Skip to content

Commit b2eb2b2

Browse files
authored
[NFC][clang-linker-wrapper] Move Arch definition out of the loop. (#20954)
Add a TODO comment with plan for further alignment with the upstream code. The idea is replace SPIR-V AOT sub-targets with --arch option to separate JIT and AOT modes.
1 parent ae37621 commit b2eb2b2

File tree

1 file changed

+6
-3
lines changed

1 file changed

+6
-3
lines changed

clang/tools/clang-linker-wrapper/ClangLinkerWrapper.cpp

Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -2256,6 +2256,12 @@ linkAndWrapDeviceFiles(ArrayRef<SmallVector<OffloadFile>> LinkerInputFiles,
22562256

22572257
auto &SplitModules = *SplitModulesOrErr;
22582258
const llvm::Triple Triple(LinkerArgs.getLastArgValue(OPT_triple_EQ));
2259+
StringRef Arch = LinkerArgs.getLastArgValue(OPT_arch_EQ);
2260+
if (Arch.empty())
2261+
Arch = "native";
2262+
// TODO: Take into account Arch values considered as JIT: "native",
2263+
// "spir64", "spir", "spirv32" and "spirv64" for SPIR targets.
2264+
// For now we only consider NoSubArch target as JIT.
22592265
bool IsJIT = Triple.isSPIROrSPIRV() &&
22602266
Triple.getSubArch() == llvm::Triple::NoSubArch;
22612267
if ((Triple.isNVPTX() || Triple.isAMDGCN()) &&
@@ -2273,9 +2279,6 @@ linkAndWrapDeviceFiles(ArrayRef<SmallVector<OffloadFile>> LinkerInputFiles,
22732279
}
22742280
for (size_t I = 0, E = SplitModules.size(); I != E; ++I) {
22752281
SmallVector<StringRef> Files = {SplitModules[I].ModuleFilePath};
2276-
StringRef Arch = LinkerArgs.getLastArgValue(OPT_arch_EQ);
2277-
if (Arch.empty())
2278-
Arch = "native";
22792282
SmallVector<std::pair<StringRef, StringRef>, 4> BundlerInputFiles;
22802283
auto ClangOutputOrErr =
22812284
linkDevice(Files, LinkerArgs, true /* IsSYCLKind */,

0 commit comments

Comments
 (0)