[Mlir-commits] [mlir] [mlir][SPIRV] Add `spirv.vce` when create `spirv.module` in GPUToSPIRV (PR #147267)
Jaeho Kim
llvmlistbot at llvm.org
Mon Jul 7 02:55:43 PDT 2025
https://github.com/oojahooo created https://github.com/llvm/llvm-project/pull/147267
In GPUToSPIRV conversion, we can pass the `spirv.vce` triple obtained from `spirv.target_env` when creating a `spirv.module` in `GPUModuleConversion::matchAndRewrite` because `spirv.target_env` must derived by executing `lookupTargetEnvOrDefault`
>From 63960e79e16bc96aadd1e00a28f4387631728154 Mon Sep 17 00:00:00 2001
From: oojahooo <oojahooo at gmail.com>
Date: Mon, 7 Jul 2025 18:52:50 +0900
Subject: [PATCH] [mlir][SPIRV] Add `spirv.vce` when create `spirv.module` in
GPUToSPIRV
In GPUToSPIRV conversion, pass the `spirv.vce` triple obtained from
`spirv.target_env` when creating a `spirv.module` in
`GPUModuleConversion::matchAndRewrite`
---
mlir/lib/Conversion/GPUToSPIRV/GPUToSPIRV.cpp | 4 ++--
1 file changed, 2 insertions(+), 2 deletions(-)
diff --git a/mlir/lib/Conversion/GPUToSPIRV/GPUToSPIRV.cpp b/mlir/lib/Conversion/GPUToSPIRV/GPUToSPIRV.cpp
index b99ed261ecfa3..9c9afef8c226f 100644
--- a/mlir/lib/Conversion/GPUToSPIRV/GPUToSPIRV.cpp
+++ b/mlir/lib/Conversion/GPUToSPIRV/GPUToSPIRV.cpp
@@ -368,8 +368,8 @@ LogicalResult GPUModuleConversion::matchAndRewrite(
// Add a keyword to the module name to avoid symbolic conflict.
std::string spvModuleName = (kSPIRVModule + moduleOp.getName()).str();
auto spvModule = rewriter.create<spirv::ModuleOp>(
- moduleOp.getLoc(), addressingModel, *memoryModel, std::nullopt,
- StringRef(spvModuleName));
+ moduleOp.getLoc(), addressingModel, *memoryModel,
+ targetEnv.getAttr().getTripleAttr(), StringRef(spvModuleName));
// Move the region from the module op into the SPIR-V module.
Region &spvModuleRegion = spvModule.getRegion();
More information about the Mlir-commits
mailing list