[all-commits] [llvm/llvm-project] bdeee9: DLTI: Simplifying getDevicePropertyValue API by re...

Niranjan Hasabnis via All-commits all-commits at lists.llvm.org
Thu Jun 27 01:24:26 PDT 2024


  Branch: refs/heads/main
  Home:   https://github.com/llvm/llvm-project
  Commit: bdeee9b105b7f1e75adcbfbd43f884d4ddb1a612
      https://github.com/llvm/llvm-project/commit/bdeee9b105b7f1e75adcbfbd43f884d4ddb1a612
  Author: Niranjan Hasabnis <niranjan.hasabnis at intel.com>
  Date:   2024-06-27 (Thu, 27 Jun 2024)

  Changed paths:
    M mlir/include/mlir/Interfaces/DataLayoutInterfaces.h
    M mlir/include/mlir/Interfaces/DataLayoutInterfaces.td
    M mlir/lib/Dialect/DLTI/DLTI.cpp
    M mlir/lib/Interfaces/DataLayoutInterfaces.cpp
    M mlir/test/Dialect/DLTI/invalid.mlir
    M mlir/test/Dialect/DLTI/roundtrip.mlir
    M mlir/test/Dialect/DLTI/valid.mlir
    M mlir/unittests/Interfaces/DataLayoutInterfacesTest.cpp

  Log Message:
  -----------
  DLTI: Simplifying getDevicePropertyValue API by returning Attribute type value (#96706)

**Rationale**

- With the current flexibility of supporting any type of value, we will
need to offer type-specific APIs to fetch a value (e.g.,
`getDevicePropertyValueAsInt` for integer type,
`getDevicePropertyValueAsFloat` for float type, etc.) A single type of
value will eliminate this need.
- Current flexibility can also lead to typing errors when a user fetches
the value of a property using an API that is not consistent with the
type of the value.

**What is the change**

For following system description,


```
 module attributes {
   dlti.target_system_spec = #dlti.target_system_spec<
     "CPU": #dlti.target_device_spec<
      #dlti.dl_entry<"max_vector_op_width", 64.0 : f32>>,
     "GPU": #dlti.target_device_spec<
      #dlti.dl_entry<"max_vector_op_width", 128 : ui32>>
   >} {}
```

a user no longer needs to use `getDevicePropertyValueAsInt` for
retrieving GPU's `max_vector_op_width` and
`getDevicePropertyValueAsFloat` for retrieving CPU's
`max_vector_op_width`. Instead it can be done with a uniform API of
`getDevicePropertyValue`.



To unsubscribe from these emails, change your notification settings at https://github.com/llvm/llvm-project/settings/notifications


More information about the All-commits mailing list