mirror of
https://github.com/capstone-engine/llvm-capstone.git
synced 2025-02-14 14:56:47 +00:00
[HIP] Fix job action offloading kind for mixed HIP/C++ compilation
When both HIP and C++ programs are input files to clang with -c, clang treats C++ programs as HIP programs, which is incorrect. This is due to action builder does not set correct offloading kind for job actions for C++ programs. Reviewed by: Artem Belevich Differential Revision: https://reviews.llvm.org/D120910
This commit is contained in:
parent
e7c7b16a84
commit
bde13a8102
@ -2692,6 +2692,7 @@ class OffloadingActionBuilder final {
|
||||
UA->registerDependentActionInfo(ToolChains[0], Arch,
|
||||
AssociatedOffloadKind);
|
||||
}
|
||||
IsActive = true;
|
||||
return ABRT_Success;
|
||||
}
|
||||
|
||||
@ -3038,6 +3039,9 @@ class OffloadingActionBuilder final {
|
||||
getDeviceDependences(OffloadAction::DeviceDependences &DA,
|
||||
phases::ID CurPhase, phases::ID FinalPhase,
|
||||
PhasesTy &Phases) override {
|
||||
if (!IsActive)
|
||||
return ABRT_Inactive;
|
||||
|
||||
// amdgcn does not support linking of object files, therefore we skip
|
||||
// backend and assemble phases to output LLVM IR. Except for generating
|
||||
// non-relocatable device coee, where we generate fat binary for device
|
||||
|
0
clang/test/Driver/Inputs/empty.cpp
Normal file
0
clang/test/Driver/Inputs/empty.cpp
Normal file
0
clang/test/Driver/Inputs/empty.hip
Normal file
0
clang/test/Driver/Inputs/empty.hip
Normal file
@ -338,7 +338,7 @@
|
||||
// RL2-NB-NOT: linker
|
||||
// RL2-NB-NOT: offload
|
||||
|
||||
// NL2-DAG: [[P4:[0-9]+]]: linker, {[[P0]], [[P2]]}, image, (host-[[T:hip]])
|
||||
// NL2-DAG: [[P4:[0-9]+]]: linker, {[[P0]], [[P2]]}, image
|
||||
// RL2-EM-DAG: [[P4:[0-9]+]]: linker, {[[P1]], [[P3]], [[P9]]}, image, (host-[[T]])
|
||||
// RL2-DEV-NOT: linker
|
||||
|
||||
@ -455,3 +455,21 @@
|
||||
// PPELLVM2-DAG: [[P9:[0-9]+]]: offload, "device-[[T]] (amdgcn-amd-amdhsa:[[ARCH2]])" {[[P8]]}, ir
|
||||
// PPELLVM2-DAG: [[P10:[0-9]+]]: clang-offload-bundler, {[[P4]], [[P9]]}, ir, (device-hip, )
|
||||
// PPELLVM2-NOT: host
|
||||
|
||||
// Test mixed HIP and C++ compilation. HIP program should have HIP offload kind.
|
||||
// C++ program should have no offload kind.
|
||||
|
||||
// RUN: %clang -target x86_64-unknown-linux-gnu \
|
||||
// RUN: -ccc-print-phases --cuda-gpu-arch=gfx803 --cuda-gpu-arch=gfx900 \
|
||||
// RUN: -c %S/Inputs/empty.hip %S/Inputs/empty.cpp 2>&1 | FileCheck -check-prefixes=MIXED %s
|
||||
|
||||
// RUN: %clang -target x86_64-unknown-linux-gnu \
|
||||
// RUN: -ccc-print-phases --cuda-gpu-arch=gfx803 --cuda-gpu-arch=gfx900 \
|
||||
// RUN: -c %S/Inputs/empty.hip %S/Inputs/empty.cpp 2>&1 | FileCheck -check-prefixes=MIXED-NEG %s
|
||||
|
||||
// MIXED-DAG: input, "{{.*}}empty.hip", hip, (host-hip)
|
||||
// MIXED-DAG: input, "{{.*}}empty.hip", hip, (device-hip, gfx803)
|
||||
// MIXED-DAG: input, "{{.*}}empty.hip", hip, (device-hip, gfx900)
|
||||
// MIXED-DAG: input, "{{.*}}empty.cpp", c++
|
||||
// MIXED-NEG-NOT: input, "{{.*}}empty.cpp", c++, (host-hip)
|
||||
// MIXED-NEG-NOT: input, "{{.*}}empty.cpp", c++, (device-hip
|
||||
|
Loading…
x
Reference in New Issue
Block a user