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

Renato Golin llvmlistbot at llvm.org
Wed Jun 5 04:52:14 PDT 2024


================
@@ -194,6 +194,162 @@ def DataLayoutSpecInterface : AttrInterface<"DataLayoutSpecInterface"> {
   }];
 }
 
+def TargetDeviceDescSpecInterface : AttrInterface<"TargetDeviceDescSpecInterface"> {
+  let cppNamespace = "::mlir";
+
+  let description = [{
+    Attribute interface describing a target device description specification.
+
+    A target device description specification is a list of device properties (key)
+    and their values for a specific device. The device is identified using "device_id"
+    (as a key and ui32 value) and "device_type" key which must have a string value.
+    Both "device_id" and "device_type" are mandatory keys. As an example, L1 cache
+    size could be a device property, and its value would be a device specific size.
+
+    A target device description specification is attached to a module as a module level
+    attribute.
----------------
rengolin wrote:

The way I was thinking this is not to replicate the system descriptor per function, but to have a single (whole) descriptor per module and then an annotation on the op (incl. function) with the identifier (ID or search query) into the module's descriptor.

```mlir
module {
  target = #dlti.system_desc { target[0] = { ... }, target[1] { ... } ... }

  ...
  func.func myFunction(...) #target = 0 {
    ...
  }
  ...
  func.func otherFunc (...) {
    linalg.generic ... #target = 1 {
      ...
    }
  }
  ...
}
```

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


More information about the Mlir-commits mailing list