[Mlir-commits] [mlir] [mlir][tosa] Add integer type conversion pass (PR #232853)
Michael Platings
llvmlistbot at llvm.org
Fri Oct 23 05:59:13 PDT 2026
================
@@ -217,6 +217,40 @@ def TosaGatherScatterHardeningPass
}];
}
+def TosaConvertIntegerTypesPass : Pass<"tosa-convert-integer-types", "ModuleOp"> {
+ let summary = "Convert selected TOSA integer types";
+ let description = [{
+ Converts integer types using `bitwidth-mappings`, a required list of
+ `<source>:<destination>` bitwidth pairs.
+ A typical use case is `bitwidth-mappings=4:8,48:64` which maps i4 and i48 to
+ i8 and i64 respectively.
+ Source bitwidths 1, 32 and 64 are not supported because some attributes
+ require these fixed widths.
+
+ Mappings apply once to the original width, preserving signedness and
+ leaving unmapped widths unchanged. Widening sign-extends signed and
+ signless constants and zero-extends unsigned constants. Narrowing truncates
+ without checking for data loss. The caller is responsible for ensuring the
+ conversion is appropriate.
+
+ Conversion covers types, function signatures and attribute payloads
+ throughout the module, including non-TOSA operations.
+ External callers and implementations must use the converted signatures.
+
+ Run after `tosa-validate`: converted IR may not conform to the TOSA
+ specification.
----------------
mplatings wrote:
Done. Added that near the top of the description,.
https://github.com/llvm/llvm-project/pull/232853
More information about the Mlir-commits
mailing list