================
@@ -4493,8 +4493,11 @@ Action *Driver::ConstructPhaseAction(
}
return C.MakeAction<BackendJobAction>(Input, Output);
}
+ // SYCL device compilations produce IR unless the user explicitly requested
+ // device-only assembly output, in which case emit textual SPIR-V.
if (Args.hasArg(options::OPT_emit_llvm) ||
- TargetDeviceOffloadKind == Action::OFK_SYCL) {
+ (TargetDeviceOffloadKind == Action::OFK_SYCL &&
+ !(offloadDeviceOnly() && Args.hasArg(options::OPT_S)))) {
----------------
tahonermann wrote:
TL;DR; The following records my own investigation to properly understand this
change. The change looks good and improves consistency with CUDA and HIP
compilation. There is still an inconsistency in behavior for HIP when
assembling for both host and device, but that is a distinct issue from what
this PR addresses.
I was initially surprised to see the `offloadDeviceOnly()` check here, but I
think I understand. It looks like, when performing a combined host+device
compilation with `-S`, the generated assembly contains the host assembly with
an embedded device image. That seems very reasonable and useful.
I was curious what is done for other offload languages. CUDA (`clang++ -S
t.cu`) does similarly. With `--offload-host-only`, host assembly is produced
and with `--offload-device-only`, PTX assembly is produced. Again very
reasonable and useful.
HIP compilation (`clang++ -S t.hip`) produces concatenated offload bundles
containing LLVM IR for the device followed by assembly for the host. That seems
less useful. Hip compilation is otherwise consistent with `--offload-host-only`
resulting in host assembly and `--offload-device-only` resulting in amdgpu
assembly.
https://github.com/llvm/llvm-project/pull/227844
_______________________________________________
cfe-commits mailing list
[email protected]
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits