[Mlir-commits] [mlir] [MLIR] SPIRV Target Attribute (PR #69949)

Sang Ik Lee llvmlistbot at llvm.org
Thu Oct 26 11:03:40 PDT 2023


================
@@ -166,4 +166,35 @@ def SPIRV_ResourceLimitsAttr : SPIRV_Attr<"ResourceLimits", "resource_limits"> {
   let assemblyFormat = "`<` struct(params) `>`";
 }
 
+//===----------------------------------------------------------------------===//
+// SPIRV target attribute.
+//===----------------------------------------------------------------------===//
+
+def SPIRV_TargetAttr : SPIRV_Attr<"SPIRVTarget", "target"> {
+  let description = [{
+    GPU target attribute for controlling compilation of SPIRV targets.
+  }];
+  let parameters = (ins
----------------
silee2 wrote:

Those parameters are for describing target environment: https://mlir.llvm.org/docs/Dialects/SPIR-V/#target-environment
The parameters are not used today since lowering to SPIR-V is restricted to common set of SPIR-V ops supported in all environments. 
But in the future, lowering passes can check the parameters and utilize SPIR-V extension ops or do target specific optimizations.

https://github.com/llvm/llvm-project/pull/69949


More information about the Mlir-commits mailing list