================
@@ -714,10 +714,14 @@ static Error runAOTCompileIntelGPU(StringRef InputFile,
StringRef OutputFile,
CmdArgs.push_back("-output_no_suffix");
CmdArgs.push_back("-spirv_input");
- StringRef Arch(Args.getLastArgValue(OPT_arch_EQ));
- assert(!Arch.empty() && "Arch must be specified for AOT compilation");
+ // Compile for the --device list, e.g. "xe-mtl-u,xe-mtl-h" for an IGCA
+ // target, or else for the Intel GPU in --arch.
+ std::string Devices = llvm::join(Args.getAllArgValues(OPT_device_EQ), ",");
+ if (Devices.empty())
+ Devices = Args.getLastArgValue(OPT_arch_EQ);
+ assert(!Devices.empty() && "a device must be specified for AOT compilation");
CmdArgs.push_back("-device");
- CmdArgs.push_back(Arch);
+ CmdArgs.push_back(Devices);
----------------
srividya-sundaram wrote:
To add: instead of `--device`, we could pass only the GPUs in
`clang-sycl-linker`'s existing `--arch` option,
example: `--arch=xe-mtl-h,xe-mtl-u` instead of `--arch=igca_30r
--device=xe-mtl-h --device=xe-mtl-u`, and let `clang-sycl-linker` look up their
`IGCA` target.
But clang links CUDA once per GPU, so its `-arch` is always one name, while
here one link covers several GPUs with a single `ocloc` call.
`clang-linker-wrapper` passes `--arch` on as `-march`
([ClangLinkerWrapper.cpp](https://github.com/llvm/llvm-project/blob/a3fe58fec3c3aab1a17fc317354945b8492a28e3/clang/tools/clang-linker-wrapper/ClangLinkerWrapper.cpp#L530-L532)),
so `-march` would become a list for SYCL only, and `clang-sycl-linker` would
still need `igca_30r` back to label the device image
([ClangSYCLLinker.cpp](https://github.com/llvm/llvm-project/blob/a3fe58fec3c3aab1a17fc317354945b8492a28e3/clang/tools/clang-sycl-linker/ClangSYCLLinker.cpp#L1056-L1057)).
A separate `--device` list keeps `--arch` a single name, as for other targets.
https://github.com/llvm/llvm-project/pull/239010
_______________________________________________
cfe-commits mailing list
[email protected]
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits