llvmbot wrote:

<!--LLVM PR SUMMARY COMMENT-->

@llvm/pr-subscribers-clang-driver

Author: Yaxun (Sam) Liu (yxsamliu)

<details>
<summary>Changes</summary>

Currently ROCm 6.4.0 only recognize spirv64-amd-amdhsa- in bundle ID. 
spirv64-amd-amdhsa-unknown causes all HIP apps compiled for amdgcnspirv to fail.

Previously we fixed a similar issue for
amdgcn-amd-amdhsa-unknown. This patch extends that to 
spirv64-amd-amdhsa-unknown.

---
Full diff: https://github.com/llvm/llvm-project/pull/139112.diff


2 Files Affected:

- (modified) clang/lib/Driver/OffloadBundler.cpp (+5-5) 
- (modified) clang/test/Driver/clang-offload-bundler-standardize.c (+4-3) 


``````````diff
diff --git a/clang/lib/Driver/OffloadBundler.cpp 
b/clang/lib/Driver/OffloadBundler.cpp
index 859e44fb9bdb2..e7a737796925e 100644
--- a/clang/lib/Driver/OffloadBundler.cpp
+++ b/clang/lib/Driver/OffloadBundler.cpp
@@ -145,11 +145,11 @@ bool OffloadTargetInfo::operator==(const 
OffloadTargetInfo &Target) const {
 
 std::string OffloadTargetInfo::str() const {
   std::string NormalizedTriple;
-  // Unfortunately we need some special sauce for AMDGPU because all the 
runtime
-  // assumes the triple to be "amdgcn-amd-amdhsa-" (empty environment) instead
-  // of "amdgcn-amd-amdhsa-unknown". It's gonna be very tricky to patch
-  // different layers of runtime.
-  if (Triple.isAMDGPU()) {
+  // Unfortunately we need some special sauce for AMDHSA because all the 
runtime
+  // assumes the triple to be "amdgcn/spirv64-amd-amdhsa-" (empty environment)
+  // instead of "amdgcn/spirv64-amd-amdhsa-unknown". It's gonna be very tricky
+  // to patch different layers of runtime.
+  if (Triple.getOS() == Triple::OSType::AMDHSA) {
     NormalizedTriple = Triple.normalize(Triple::CanonicalForm::THREE_IDENT);
     NormalizedTriple.push_back('-');
   } else {
diff --git a/clang/test/Driver/clang-offload-bundler-standardize.c 
b/clang/test/Driver/clang-offload-bundler-standardize.c
index fd87fca4ff59d..5b831eec794d2 100644
--- a/clang/test/Driver/clang-offload-bundler-standardize.c
+++ b/clang/test/Driver/clang-offload-bundler-standardize.c
@@ -11,16 +11,17 @@
 //
 // RUN: echo 'Content of device file 1' > %t.tgt1
 // RUN: echo 'Content of device file 2' > %t.tgt2
-
+// RUN: echo 'Content of device file 3' > %t.tgt3
 //
 // Check code object compatibility for archive unbundling
 //
 // Create an object bundle
-// RUN: clang-offload-bundler -type=o 
-targets=host-%itanium_abi_triple,hip-amdgcn-amd-amdhsa--gfx906,hip-amdgcn-amd-amdhsa--gfx908
 -input=%t.o -input=%t.tgt1 -input=%t.tgt2 -output=%t.bundle
+// RUN: clang-offload-bundler -type=o 
-targets=host-%itanium_abi_triple,hip-amdgcn-amd-amdhsa--gfx906,hip-amdgcn-amd-amdhsa--gfx908,hip-spirv64-amd-amdhsa--amdgcnspirv
 -input=%t.o -input=%t.tgt1 -input=%t.tgt2 -input=%t.tgt3 -output=%t.bundle
 
-// RUN: clang-offload-bundler -unbundle -type=o 
-targets=hip-amdgcn-amd-amdhsa--gfx906,hip-amdgcn-amd-amdhsa--gfx908 
-input=%t.bundle -output=%t-hip-amdgcn-amd-amdhsa--gfx906.bc 
-output=%t-hip-amdgcn-amd-amdhsa--gfx908.bc -debug-only=CodeObjectCompatibility 
2>&1 | FileCheck %s -check-prefix=BUNDLE
+// RUN: clang-offload-bundler -unbundle -type=o 
-targets=hip-amdgcn-amd-amdhsa--gfx906,hip-amdgcn-amd-amdhsa--gfx908,hip-spirv64-amd-amdhsa--amdgcnspirv
 -input=%t.bundle -output=%t-hip-amdgcn-amd-amdhsa--gfx906.bc 
-output=%t-hip-amdgcn-amd-amdhsa--gfx908.bc 
-output=%t-hip-spirv64-amd-amdhsa--amdgcnspirv.bc 
-debug-only=CodeObjectCompatibility 2>&1 | FileCheck %s -check-prefix=BUNDLE
 // BUNDLE: Compatible: Exact match: [CodeObject: 
hip-amdgcn-amd-amdhsa--gfx906] : [Target: hip-amdgcn-amd-amdhsa--gfx906]
 // BUNDLE: Compatible: Exact match: [CodeObject: 
hip-amdgcn-amd-amdhsa--gfx908] : [Target: hip-amdgcn-amd-amdhsa--gfx908]
+// BUNDLE: Compatible: Exact match: [CodeObject: 
hip-spirv64-amd-amdhsa--amdgcnspirv] : [Target: 
hip-spirv64-amd-amdhsa--amdgcnspirv]
 
 // Some code so that we can create a binary out of this file.
 int A = 0;

``````````

</details>


https://github.com/llvm/llvm-project/pull/139112
_______________________________________________
cfe-commits mailing list
cfe-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits

Reply via email to