[Mlir-commits] [mlir] [mlir][tosa] Add support for boolean cast/gather/scatter operations (PR #177693)

Luke Hutton llvmlistbot at llvm.org
Wed Feb 4 06:06:42 PST 2026


================
@@ -371,15 +371,23 @@ profileComplianceMap = {
         {{i32T, i32T, i32T}, SpecificationVersion::V_1_0}}},
       {{Profile::pro_fp},
        {{{fp16T, i32T, fp16T}, SpecificationVersion::V_1_0},
-        {{fp32T, i32T, fp32T}, SpecificationVersion::V_1_0}}}}},
+        {{fp32T, i32T, fp32T}, SpecificationVersion::V_1_0}}},
+      {{Profile::pro_fp, Profile::pro_int},
+       {{{boolT, i32T, boolT}, SpecificationVersion::V_1_1_DRAFT},
+        {{boolT, i64T, boolT}, SpecificationVersion::V_1_1_DRAFT}},
+       anyOf}}},
     {"tosa.scatter",
      {{{Profile::pro_int},
        {{{i8T, i32T, i8T, i8T}, SpecificationVersion::V_1_0},
         {{i16T, i32T, i16T, i16T}, SpecificationVersion::V_1_0},
         {{i32T, i32T, i32T, i32T}, SpecificationVersion::V_1_0}}},
       {{Profile::pro_fp},
        {{{fp16T, i32T, fp16T, fp16T}, SpecificationVersion::V_1_0},
-        {{fp32T, i32T, fp32T, fp32T}, SpecificationVersion::V_1_0}}}}},
+        {{fp32T, i32T, fp32T, fp32T}, SpecificationVersion::V_1_0}}},
+      {{Profile::pro_fp, Profile::pro_int},
+       {{{boolT, i32T, boolT, boolT}, SpecificationVersion::V_1_1_DRAFT},
+        {{boolT, i64T, boolT, boolT}, SpecificationVersion::V_1_1_DRAFT}},
----------------
lhutton1 wrote:

Thanks I hadn't noticed this inconsistency previously. 

It turns out this is really just redundant information. Adding these line produces a similar error compared to without:
With:
```
$ mlir-opt test.mlir --tosa-attach-target="specification_version=1.1.draft extensions=int64" --tosa-validate="strict-op-spec-alignment"
test.mlir:190:8: error: 'tosa.gather' op illegal: requires any of [pro_fp, pro_int] but not enabled in target

$ mlir-opt test.mlir --tosa-attach-target="specification_version=1.1.draft profiles=pro_int" --tosa-validate="strict-op-spec-alignment"
test.mlir:190:8: error: 'tosa.gather' op illegal: requires [int64] but not enabled in target
```
Without - the failure occurs here because we encode that the use of the int64 extension depends on pro_int or pro_fp being present in the target:
```
$ mlir-opt test.mlir --tosa-attach-target="specification_version=1.1.draft extensions=int64" --tosa-validate="strict-op-spec-alignment"
test.mlir:190:8: error: 'tosa.gather' op illegal: requires [pro_fp, pro_int] to work with but not enabled in target

$ mlir-opt test.mlir --tosa-attach-target="specification_version=1.1.draft profiles=pro_int" --tosa-validate="strict-op-spec-alignment"
test.mlir:190:8: error: 'tosa.gather' op illegal: requires [int64] but not enabled in target
```

I'll remove them from this PR, but we should look to update the script that produces this table in the specification such that these entries are not included.

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


More information about the Mlir-commits mailing list