[all-commits] [llvm/llvm-project] f474f7: [mlir][tosa] Convert TOSA enumerations from `Strin...

Annu Singh via All-commits all-commits at lists.llvm.org
Fri Aug 29 07:13:39 PDT 2025


  Branch: refs/heads/main
  Home:   https://github.com/llvm/llvm-project
  Commit: f474f76fb285204cfcb0746776adc12dd735cf34
      https://github.com/llvm/llvm-project/commit/f474f76fb285204cfcb0746776adc12dd735cf34
  Author: Annu Singh <annu4444.as at gmail.com>
  Date:   2025-08-29 (Fri, 29 Aug 2025)

  Changed paths:
    M mlir/include/mlir/Dialect/Tosa/IR/TosaOpBase.td
    M mlir/include/mlir/Dialect/Tosa/IR/TosaOps.td
    M mlir/include/mlir/Dialect/Tosa/IR/TosaTypesBase.td
    M mlir/include/mlir/Dialect/Tosa/IR/TosaUtilOps.td
    M mlir/lib/Conversion/TosaToArith/TosaToArith.cpp
    M mlir/lib/Conversion/TosaToLinalg/TosaToLinalg.cpp
    M mlir/lib/Conversion/TosaToLinalg/TosaToLinalgNamed.cpp
    M mlir/lib/Dialect/Tosa/IR/TosaCanonicalizations.cpp
    M mlir/lib/Dialect/Tosa/Transforms/TosaValidation.cpp
    M mlir/test/Conversion/TosaToArith/tosa-to-arith-invalid.mlir
    M mlir/test/Conversion/TosaToArith/tosa-to-arith.mlir
    M mlir/test/Conversion/TosaToLinalg/tosa-to-linalg-invalid.mlir
    M mlir/test/Conversion/TosaToLinalg/tosa-to-linalg-named.mlir
    M mlir/test/Conversion/TosaToLinalg/tosa-to-linalg-resize.mlir
    M mlir/test/Conversion/TosaToLinalg/tosa-to-linalg.mlir
    M mlir/test/Dialect/Tosa/availability.mlir
    M mlir/test/Dialect/Tosa/canonicalize.mlir
    M mlir/test/Dialect/Tosa/dynamic_extension.mlir
    M mlir/test/Dialect/Tosa/error_if_check.mlir
    M mlir/test/Dialect/Tosa/invalid.mlir
    M mlir/test/Dialect/Tosa/invalid_extension.mlir
    M mlir/test/Dialect/Tosa/level_check.mlir
    M mlir/test/Dialect/Tosa/ops.mlir
    M mlir/test/Dialect/Tosa/profile_pro_fp_unsupported.mlir
    M mlir/test/Dialect/Tosa/profile_pro_int_unsupported.mlir
    M mlir/test/Dialect/Tosa/tosa-convert-integer-type-to-signless.mlir
    M mlir/test/Dialect/Tosa/tosa-infer-shapes.mlir
    M mlir/test/Dialect/Tosa/tosa-validation-valid.mlir
    M mlir/test/Dialect/Tosa/verifier.mlir
    M mlir/test/lib/Dialect/Tosa/TosaTestPasses.cpp

  Log Message:
  -----------
  [mlir][tosa] Convert TOSA enumerations from `StringBasedAttr` to `Tosa_I32EnumAttr` (#152856)

Fixes #152129 

Use `Tosa_I32EnumAttr` instead of `StringBasedAttr` to represent Tosa
enumerations.

This PR replaces `StringBasedAttr` with `Tosa_I32EnumAttr` to represent
Tosa enumerations as per the specification. The intent is to make the IR
and C++ APIs more type-safe and prevent fragile string comparisons in
passes.

Enumerations rewritten are: 

- `Tosa_ResizeTypeAttr`
- `Tosa_NanPropagationAttr`
- `Tosa_RoundingTypeAttr`

**BREAKING CHANGE**:

This commit changes attribute assembly and the C++ API surface for the
listed attributes.

Code that previously used `StringAttr` for these fields must now be
updated to use the new enum representation. In `.mlir` files, replace
string literals with the enum assembly (e.g. `mode =
#tosa.resize_type<BILINEAR>`). In C++, update call sites to either pass
the generated enum (e.g. `::mlir::tosa::RoundingType::SINGLE_ROUND`)
into builder overloads or construct the typed attribute with
`tosa::RoundingTypeAttr::get(context, /*enum*/)` and pass that.



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