Skip to content

Commit 13cd43a

Browse files
authored
[Clang][OpenMP] Do not use feature option during packaging (#111702)
Clang-offload-packager allows packaging of images based on an arbitrary list of key-value pairs where only triple-key is mandatory. Using target features as a key during packaging is not correct, as clang does not allow packaging multiple images in one binary which only differ in a target feature. TargetID features (xnack and sramecc) anyways are handled using arch-key and not as target features.
1 parent 18d655f commit 13cd43a

File tree

2 files changed

+2
-9
lines changed

2 files changed

+2
-9
lines changed

clang/lib/Driver/ToolChains/Clang.cpp

Lines changed: 1 addition & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -9107,13 +9107,6 @@ void OffloadPackager::ConstructJob(Compilation &C, const JobAction &JA,
91079107
llvm::copy_if(Features, std::back_inserter(FeatureArgs),
91089108
[](StringRef Arg) { return !Arg.starts_with("-target"); });
91099109

9110-
if (TC->getTriple().isAMDGPU()) {
9111-
for (StringRef Feature : llvm::split(Arch.split(':').second, ':')) {
9112-
FeatureArgs.emplace_back(
9113-
Args.MakeArgString(Feature.take_back() + Feature.drop_back()));
9114-
}
9115-
}
9116-
91179110
// TODO: We need to pass in the full target-id and handle it properly in the
91189111
// linker wrapper.
91199112
SmallVector<std::string> Parts{
@@ -9123,7 +9116,7 @@ void OffloadPackager::ConstructJob(Compilation &C, const JobAction &JA,
91239116
"kind=" + Kind.str(),
91249117
};
91259118

9126-
if (TC->getDriver().isUsingOffloadLTO() || TC->getTriple().isAMDGPU())
9119+
if (TC->getDriver().isUsingOffloadLTO())
91279120
for (StringRef Feature : FeatureArgs)
91289121
Parts.emplace_back("feature=" + Feature.str());
91299122

clang/test/Driver/amdgpu-openmp-toolchain.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -64,7 +64,7 @@
6464
// RUN: %clang -### -target x86_64-pc-linux-gnu -fopenmp --offload-arch=gfx90a:sramecc-:xnack+ \
6565
// RUN: -nogpulib %s 2>&1 | FileCheck %s --check-prefix=CHECK-TARGET-ID
6666
// CHECK-TARGET-ID: "-cc1" "-triple" "amdgcn-amd-amdhsa" {{.*}} "-target-cpu" "gfx90a" "-target-feature" "-sramecc" "-target-feature" "+xnack"
67-
// CHECK-TARGET-ID: clang-offload-packager{{.*}}arch=gfx90a:sramecc-:xnack+,kind=openmp,feature=-sramecc,feature=+xnack
67+
// CHECK-TARGET-ID: clang-offload-packager{{.*}}arch=gfx90a:sramecc-:xnack+,kind=openmp
6868

6969
// RUN: not %clang -### -target x86_64-pc-linux-gnu -fopenmp --offload-arch=gfx90a,gfx90a:xnack+ \
7070
// RUN: -nogpulib %s 2>&1 | FileCheck %s --check-prefix=CHECK-TARGET-ID-ERROR

0 commit comments

Comments
 (0)