[flang-commits] [flang] [MLIR] Update convert-gpu-to-spirv pass to prepare using GPU compilat… (PR #69941)
Sang Ik Lee via flang-commits
flang-commits at lists.llvm.org
Mon Oct 30 12:08:48 PDT 2023
================
@@ -108,6 +138,25 @@ void GPUToSPIRVPass::runOnOperation() {
if (failed(applyFullConversion(gpuModule, *target, std::move(patterns))))
return signalPassFailure();
}
+
+ // For OpenCL, the gpu.func op in the original gpu.module op needs to be
----------------
silee2 wrote:
Keeping the original gpu.func causes legality check error later in the gpu compile pipeline.
If target attr is set for a gpu.module, gpu-to-llvm pass doesn't lower gpu.launch_func
Instead, it is replaced with another gpu.launch_func that has lowered argument types (llvm ptrs).
If a gpu.func remains as an input to gpu-to-llvm pass, there is an argument mismatch between the new gpu.launch_func and the gpu.func. And a error is fired.
The reason for putting a dummy func.func here is to work around that check.
For func types other than gpu.func, argument types are not checked against gpu.launch_func.
But a func.func is still need as there will be a symbol check.
https://github.com/llvm/llvm-project/pull/69941
More information about the flang-commits
mailing list