[clang-tools-extra] [MLIR] SPIRV Target Attribute (PR #69949)
Lei Zhang via cfe-commits
cfe-commits at lists.llvm.org
Sat Oct 28 17:30:18 PDT 2023
================
@@ -188,4 +188,46 @@ def GpuROCDLAttachTarget: Pass<"rocdl-attach-target", ""> {
];
}
+def GpuSPIRVAttachTarget: Pass<"spirv-attach-target", ""> {
+ let summary = "Attaches an SPIRV target attribute to a GPU Module.";
+ let description = [{
+ This pass searches for all GPU Modules in the immediate regions and attaches
+ an SPIRV target if the module matches the name specified by the `module` argument.
+
+ Example:
+ ```
+ // File: in1.mlir:
+ gpu.module @nvvm_module_1 {...}
+ gpu.module @spirv_module_1 {...}
+ // mlir-opt --spirv-attach-target="module=spirv.* ver=v1.0 caps=Kernel" in1.mlir
----------------
antiagainst wrote:
Given the following file
```
Please don't call the symbolize* functions twice everywhere--those functions are expensive. We can save the result in a locla variable and use it later.
```
With `mlir-opt ...`, it will generate:
```
gpu.module @nvvm_module_1 {...}
gpu.module @spirv_module_1 [#spirv.target<vce = #spirv.vce<v1.0, [Kernel], []>, resource_limits = <>>] {...}
```
https://github.com/llvm/llvm-project/pull/69949
More information about the cfe-commits
mailing list