[Mlir-commits] [mlir] Reimplementing target description concept using DLTI attribute (PR #92138)

Andrzej WarzyƄski llvmlistbot at llvm.org
Mon May 27 12:43:29 PDT 2024


================
@@ -90,3 +90,132 @@ module attributes { dlti.dl_spec = #dlti.dl_spec<#dlti.dl_entry<"unknown.unknown
   // expected-note at above {{enclosing op with data layout}}
   "test.op_with_data_layout"() { dlti.dl_spec = #dlti.dl_spec<#dlti.dl_entry<"unknown.unknown", 32>>} : () -> ()
 }
+
+// -----
+
+// expected-error at below {{'dlti.target_system_desc_spec' is expected to be a #dlti.target_system_desc_spec attribute}}
+"test.unknown_op"() { dlti.target_system_desc_spec = 42 } : () -> ()
+
+// -----
+
+// expected-error at below {{invalid kind of attribute specified}}
+"test.unknown_op"() { dlti.target_system_desc_spec = #dlti.target_system_desc_spec<[]> } : () -> ()
+
+// -----
+
+module attributes {
+  // expected-error at +2 {{target_device_desc_spec requires key: dlti.device_id and its value of ui32 type}}
+  dlti.target_system_desc_spec = #dlti.target_system_desc_spec<
+    #dlti.target_device_desc_spec<
+      #dlti.dl_entry<"dlti.device_type", "CPU">> 
+  >} {}
+
+// -----
+
+module attributes {
+  // expected-error at +2 {{target_device_desc_spec requires key: dlti.device_type and its value of string type}}
+  dlti.target_system_desc_spec = #dlti.target_system_desc_spec<
+    #dlti.target_device_desc_spec<
+      #dlti.dl_entry<"dlti.device_id", 0: ui32>> 
+  >} {}
+
+// -----
+
+module attributes {
+  // expected-error at +2 {{target_device_desc_spec requires key: dlti.device_id and its value of ui32 type}}
+  dlti.target_system_desc_spec = #dlti.target_system_desc_spec<
+    #dlti.target_device_desc_spec<
+      #dlti.dl_entry<"dlti.device_id", 0: i32>> 
+  >} {}
+
+// -----
+
+module attributes {
+  // expected-error at +2 {{target_device_desc_spec requires key: dlti.device_type and its value of string type}}
+  dlti.target_system_desc_spec = #dlti.target_system_desc_spec<
+    #dlti.target_device_desc_spec<
+      #dlti.dl_entry<"dlti.device_id", 0 : ui32>,
+      #dlti.dl_entry<"dlti.device_type", 0: i32>> 
+  >} {}
+
+// -----
+
+module attributes {
+  // expected-error at +2 {{repeated layout entry key: dlti.device_id}}
+  dlti.target_system_desc_spec = #dlti.target_system_desc_spec<
+    #dlti.target_device_desc_spec<
+      #dlti.dl_entry<"dlti.device_id", 0 : ui32>,
+      #dlti.dl_entry<"dlti.device_id", 1 : ui32>,
+      #dlti.dl_entry<"dlti.device_type", "CPU">,
+      #dlti.dl_entry<"dlti.L1_cache_size", 4096 : i32>>
+  >} {}
+
+// -----
+
+module attributes {
+  // expected-error at +2 {{repeated layout entry key: dlti.device_type}}
+  dlti.target_system_desc_spec = #dlti.target_system_desc_spec<
+    #dlti.target_device_desc_spec<
+      #dlti.dl_entry<"dlti.device_id", 0 : ui32>,
+      #dlti.dl_entry<"dlti.device_type", "CPU">,
+      #dlti.dl_entry<"dlti.device_type", "GPU">,
+      #dlti.dl_entry<"dlti.L1_cache_size", 4096 : i32>>
+  >} {}
+
+// -----
+
+module attributes {
+  // expected-error at +2 {{target_device_desc_spec requires value of key: dlti.L1_cache_size_in_bytes to be of ui32 type}}
+  dlti.target_system_desc_spec = #dlti.target_system_desc_spec<
+    #dlti.target_device_desc_spec<
+      #dlti.dl_entry<"dlti.device_id", 0 : ui32>,
+      #dlti.dl_entry<"dlti.device_type", "CPU">,
+      #dlti.dl_entry<"dlti.L1_cache_size_in_bytes", 4096.1 : f32>>
+  >} {}
+
+// -----
+
+module attributes {
+  // expected-error at +2 {{target_device_desc_spec requires value of key: dlti.max_vector_op_width to be of ui32 type}}
----------------
banach-space wrote:

Where is it specified that `dlti.max_vector_op_width ` has to be `ui32`?

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


More information about the Mlir-commits mailing list