[Mlir-commits] [mlir] [MLIR] Update convert-gpu-to-spirv pass to prepare using GPU compilat… (PR #69941)
Sang Ik Lee
llvmlistbot at llvm.org
Fri Oct 27 18:14:05 PDT 2023
================
@@ -76,22 +76,24 @@ void GPUToSPIRVPass::runOnOperation() {
// This works fine for Vulkan shader that has a dedicated runner.
// But OpenCL kernel needs SPIRV module placed inside original GPU module as
// OpenCL uses GPU compilation pipeline.
- auto targetEnv = getTargetEnvFromGPUModuleOp(moduleOp);
+ const mlir::spirv::TargetEnv& targetEnv = getTargetEnvFromGPUModuleOp(moduleOp);
FailureOr<spirv::MemoryModel> memoryModel =
spirv::getMemoryModel(targetEnv);
if (failed(memoryModel))
return signalPassFailure();
- (memoryModel == spirv::MemoryModel::OpenCL)
- ? builder.setInsertionPoint(moduleOp.getBody(),
- moduleOp.getBody()->begin())
- : builder.setInsertionPoint(moduleOp.getOperation());
+ if (memoryModel == spirv::MemoryModel::OpenCL) {
+ builder.setInsertionPoint(moduleOp.getBody(),
+ moduleOp.getBody()->begin());
+ } else {
+ builder.setInsertionPoint(moduleOp.getOperation());
+ }
gpuModules.push_back(builder.clone(*moduleOp.getOperation()));
});
// Run conversion for each module independently as they can have different
// TargetEnv attributes.
for (Operation *gpuModule : gpuModules) {
- auto targetAttr = spirv::lookupTargetEnvOrDefault(gpuModule);
+ mlir::spirv::TargetEnvAttr targetAttr = spirv::lookupTargetEnvOrDefault(gpuModule);
----------------
silee2 wrote:
Removed mlir::
https://github.com/llvm/llvm-project/pull/69941
More information about the Mlir-commits
mailing list