================
@@ -5154,6 +5158,8 @@ void Clang::ConstructJob(Compilation &C, const JobAction
&JA,
rewriteKind = RK_Fragile;
} else if (JA.getType() == types::TY_CIR) {
CmdArgs.push_back("-emit-cir");
+ } else if (JA.getType() == types::TY_Image && IsAMDSPIRVForHIPDevice) {
----------------
mgcarrasco wrote:
This is required for `--offload-new-driver -save-temps --offload-device-only
--offload-arch=amdgcnspirv -use-spirv-backend`. As a reference, these are the
phases if we were using `--offload-arch=gfx1030` instead:
```
+- 0: input, "foo.c", hip, (device-hip, gfx1030)
+- 1: preprocessor, {0}, hip-cpp-output, (device-hip, gfx1030)
+- 2: compiler, {1}, ir, (device-hip, gfx1030)
+- 3: backend, {2}, assembler, (device-hip, gfx1030)
+- 4: assembler, {3}, object, (device-hip, gfx1030)
+- 5: linker, {4}, image, (device-hip, gfx1030)
+- 6: offload, "device-hip (amdgcn-amd-amdhsa:gfx1030)" {5}, image
+- 7: linker, {6}, hip-fatbin, (device-hip)
8: offload, "device-hip (amdgcn-amd-amdhsa)" {7}, none
```
For SPIR-V and the BE, we can't have steps `4: assembler`and `5: linker` due to
the external dependencies constraints.
Thus, the `BackendJobAction` must use `-emit-obj` to emit binary SPV directly
and skip assembling and linking. This `BackendJobAction` is created
[here](https://github.com/llvm/llvm-project/pull/167543/files#diff-f8c64e36dfe3828a6f816c4550e78bb0305769ace1be53207e86ac9a3280ac9eR5324).
If `BackendJobAction` doesn't use `types::TY_Image`, then the driver does not
create the following phases (`7: linker` and `8: offload`). This is because the
`ShouldBundleHIP` expects `types::TY_Image`
[here](https://github.com/llvm/llvm-project/blob/21fedcbf89a27521c1c4822c51232605e2c3a33f/clang/lib/Driver/Driver.cpp#L5061).
`ShouldBundleHIP` is not changed by this PR, that is how it currently works.
https://github.com/llvm/llvm-project/pull/167543
_______________________________________________
cfe-commits mailing list
[email protected]
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits