r332121 - [HIP] Let clang-offload-bundler support HIP
Yaxun Liu via cfe-commits
cfe-commits at lists.llvm.org
Fri May 11 12:02:18 PDT 2018
Author: yaxunl
Date: Fri May 11 12:02:18 2018
New Revision: 332121
URL: http://llvm.org/viewvc/llvm-project?rev=332121&view=rev
Log:
[HIP] Let clang-offload-bundler support HIP
When bundle/unbundle intermediate files for HIP, there may be multiple
sub archs, therefore BoundArch needs to be included in the target
and output file names for clang-offload-bundler.
Differential Revision: https://reviews.llvm.org/D46473
Modified:
cfe/trunk/lib/Driver/Driver.cpp
cfe/trunk/lib/Driver/ToolChains/Clang.cpp
cfe/trunk/tools/clang-offload-bundler/ClangOffloadBundler.cpp
Modified: cfe/trunk/lib/Driver/Driver.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/Driver/Driver.cpp?rev=332121&r1=332120&r2=332121&view=diff
==============================================================================
--- cfe/trunk/lib/Driver/Driver.cpp (original)
+++ cfe/trunk/lib/Driver/Driver.cpp Fri May 11 12:02:18 2018
@@ -3736,9 +3736,12 @@ InputInfo Driver::BuildJobsForActionNoCa
UI.DependentToolChain->getTriple().normalize(),
/*CreatePrefixForHost=*/true);
auto CurI = InputInfo(
- UA, GetNamedOutputPath(C, *UA, BaseInput, UI.DependentBoundArch,
- /*AtTopLevel=*/false, MultipleArchs,
- OffloadingPrefix),
+ UA,
+ GetNamedOutputPath(C, *UA, BaseInput, UI.DependentBoundArch,
+ /*AtTopLevel=*/false,
+ MultipleArchs ||
+ UI.DependentOffloadKind == Action::OFK_HIP,
+ OffloadingPrefix),
BaseInput);
// Save the unbundling result.
UnbundlingResults.push_back(CurI);
Modified: cfe/trunk/lib/Driver/ToolChains/Clang.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/Driver/ToolChains/Clang.cpp?rev=332121&r1=332120&r2=332121&view=diff
==============================================================================
--- cfe/trunk/lib/Driver/ToolChains/Clang.cpp (original)
+++ cfe/trunk/lib/Driver/ToolChains/Clang.cpp Fri May 11 12:02:18 2018
@@ -5542,6 +5542,10 @@ void OffloadBundler::ConstructJob(Compil
Triples += Action::GetOffloadKindName(CurKind);
Triples += '-';
Triples += CurTC->getTriple().normalize();
+ if (CurKind == Action::OFK_HIP && CurDep->getOffloadingArch()) {
+ Triples += '-';
+ Triples += CurDep->getOffloadingArch();
+ }
}
CmdArgs.push_back(TCArgs.MakeArgString(Triples));
@@ -5611,6 +5615,11 @@ void OffloadBundler::ConstructJobMultipl
Triples += Action::GetOffloadKindName(Dep.DependentOffloadKind);
Triples += '-';
Triples += Dep.DependentToolChain->getTriple().normalize();
+ if (Dep.DependentOffloadKind == Action::OFK_HIP &&
+ !Dep.DependentBoundArch.empty()) {
+ Triples += '-';
+ Triples += Dep.DependentBoundArch;
+ }
}
CmdArgs.push_back(TCArgs.MakeArgString(Triples));
Modified: cfe/trunk/tools/clang-offload-bundler/ClangOffloadBundler.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/tools/clang-offload-bundler/ClangOffloadBundler.cpp?rev=332121&r1=332120&r2=332121&view=diff
==============================================================================
--- cfe/trunk/tools/clang-offload-bundler/ClangOffloadBundler.cpp (original)
+++ cfe/trunk/tools/clang-offload-bundler/ClangOffloadBundler.cpp Fri May 11 12:02:18 2018
@@ -969,11 +969,11 @@ int main(int argc, const char **argv) {
getOffloadKindAndTriple(Target, Kind, Triple);
bool KindIsValid = !Kind.empty();
- KindIsValid = KindIsValid &&
- StringSwitch<bool>(Kind)
- .Case("host", true)
- .Case("openmp", true)
- .Default(false);
+ KindIsValid = KindIsValid && StringSwitch<bool>(Kind)
+ .Case("host", true)
+ .Case("openmp", true)
+ .Case("hip", true)
+ .Default(false);
bool TripleIsValid = !Triple.empty();
llvm::Triple T(Triple);
More information about the cfe-commits
mailing list