[Mlir-commits] [mlir] [MLIR] Update convert-gpu-to-spirv pass to prepare using GPU compilat… (PR #69941)
Lei Zhang
llvmlistbot at llvm.org
Fri Oct 27 16:11:13 PDT 2023
================
@@ -54,22 +55,67 @@ void GPUToSPIRVPass::runOnOperation() {
SmallVector<Operation *, 1> gpuModules;
OpBuilder builder(context);
+
+ auto getTargetEnvFromGPUModuleOp = [*this](gpu::GPUModuleOp moduleOp) {
+ Operation *gpuModule = moduleOp.getOperation();
+ auto targetAttr = spirv::lookupTargetEnvOrDefault(gpuModule);
+ std::unique_ptr<ConversionTarget> target =
+ SPIRVConversionTarget::get(targetAttr);
+
+ SPIRVConversionOptions options;
+ options.use64bitIndex = this->use64bitIndex;
+ SPIRVTypeConverter typeConverter(targetAttr, options);
+ const spirv::TargetEnv &targetEnv = typeConverter.getTargetEnv();
----------------
antiagainst wrote:
You can create a `spirv::TargetEnv` directly from a `spirv::TargetEnvAttr`; don't need to go through the type converter.
https://github.com/llvm/llvm-project/pull/69941
More information about the Mlir-commits
mailing list