forked from OSchip/llvm-project
[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 llvm-svn: 332121
This commit is contained in:
parent
5103e48bad
commit
609f752929
|
@ -3736,9 +3736,12 @@ InputInfo Driver::BuildJobsForActionNoCache(
|
|||
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);
|
||||
|
|
|
@ -5542,6 +5542,10 @@ void OffloadBundler::ConstructJob(Compilation &C, const JobAction &JA,
|
|||
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::ConstructJobMultipleOutputs(
|
|||
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));
|
||||
|
|
|
@ -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);
|
||||
|
|
Loading…
Reference in New Issue