[Mlir-commits] [mlir] [mlirbc] Address remaining missing encodings for builtin dialect. (PR #207488)
llvmlistbot at llvm.org
llvmlistbot at llvm.org
Fri Jul 3 23:19:13 PDT 2026
llvmorg-github-actions[bot] wrote:
<!--LLVM PR SUMMARY COMMENT-->
@llvm/pr-subscribers-mlir-core
Author: Jacques Pienaar (jpienaar)
<details>
<summary>Changes</summary>
Simple ones that got missed (graph & strided layout), and add some additional tests. Also update the fixed test.
Assisted-By: Gemini
---
Patch is 22.83 KiB, truncated to 20.00 KiB below, full version: https://github.com/llvm/llvm-project/pull/207488.diff
5 Files Affected:
- (modified) mlir/include/mlir/IR/BuiltinDialectBytecode.td (+15-1)
- (modified) mlir/test/Dialect/Builtin/Bytecode/attrs.mlir (+151-11)
- (modified) mlir/test/Dialect/Builtin/Bytecode/builtin_fixed.mlir (+100-2)
- (modified) mlir/test/Dialect/Builtin/Bytecode/builtin_fixed_0.mlirbc ()
- (modified) mlir/test/Dialect/Builtin/Bytecode/types.mlir (+32-6)
``````````diff
diff --git a/mlir/include/mlir/IR/BuiltinDialectBytecode.td b/mlir/include/mlir/IR/BuiltinDialectBytecode.td
index f087e5cb23081..d098793989dc4 100644
--- a/mlir/include/mlir/IR/BuiltinDialectBytecode.td
+++ b/mlir/include/mlir/IR/BuiltinDialectBytecode.td
@@ -242,6 +242,13 @@ def IntegerSetAttr : EnableIntegerSetPrintingJuly2026<(attr
let cBuilder = "IntegerSetAttr::get(IntegerSet::get(numDims, numSymbols, constraints, eqFlags))";
}
+class EnableStridedPrintingJuly2026<dag d> : DialectAttribute<d>;
+
+def StridedLayoutAttr : EnableStridedPrintingJuly2026<(attr
+ SignedVarInt:$offset,
+ Array<SignedVarIntList>:$strides
+)>;
+
// Types
// -----
@@ -264,6 +271,11 @@ def FunctionType : DialectType<(type
Array<Type>:$results
)>;
+def GraphType : DialectType<(type
+ Array<Type>:$inputs,
+ Array<Type>:$results
+)>;
+
def BFloat16Type : DialectType<(type)>;
def Float16Type : DialectType<(type)>;
@@ -417,6 +429,7 @@ def BuiltinDialectAttributes : DialectAttributes<"Builtin"> {
FileLineColRange,
AffineMapAttr,
IntegerSetAttr,
+ StridedLayoutAttr,
];
}
@@ -455,7 +468,8 @@ def BuiltinDialectTypes : DialectTypes<"Builtin"> {
Float6E2M3FNType,
Float6E3M2FNType,
Float8E8M0FNUType,
- TokenType
+ TokenType,
+ GraphType
];
}
diff --git a/mlir/test/Dialect/Builtin/Bytecode/attrs.mlir b/mlir/test/Dialect/Builtin/Bytecode/attrs.mlir
index 3364a8e9fce8e..7dedfbdff10a7 100644
--- a/mlir/test/Dialect/Builtin/Bytecode/attrs.mlir
+++ b/mlir/test/Dialect/Builtin/Bytecode/attrs.mlir
@@ -29,13 +29,55 @@ module @TestDenseArray attributes {
//===----------------------------------------------------------------------===//
// CHECK-LABEL: @TestDenseTypedElements
-// CHECK: bytecode.test1 = dense<true> : tensor<256xi1>
-// CHECK: bytecode.test2 = dense<[10, 32, -1]> : tensor<3xi8>
-// CHECK: bytecode.test3 = dense<[1.{{.*}}e+01, 3.2{{.*}}e+01, 1.809{{.*}}e+03]> : tensor<3xf64>
+// CHECK-DAG: bytecode.test1 = dense<true> : tensor<256xi1>
+// CHECK-DAG: bytecode.test2 = dense<[10, 32, -1]> : tensor<3xi8>
+// CHECK-DAG: bytecode.test3 = dense<[1.{{.*}}e+01, 3.2{{.*}}e+01, 1.809{{.*}}e+03]> : tensor<3xf64>
+// CHECK-DAG: bytecode.i16 = dense<[100, -200]> : tensor<2xi16>
+// CHECK-DAG: bytecode.i64 = dense<1000000> : tensor<4xi64>
+// CHECK-DAG: bytecode.f16 = dense<[1.500000e+00, 2.500000e+00]> : tensor<2xf16>
+// CHECK-DAG: bytecode.bf16 = dense<[-5.000000e-01, 5.000000e-01]> : tensor<2xbf16>
+// CHECK-DAG: bytecode.complex_val = dense<(1.000000e+00,2.000000e+00)> : tensor<1xcomplex<f32>>
module @TestDenseTypedElements attributes {
bytecode.test1 = dense<true> : tensor<256xi1>,
bytecode.test2 = dense<[10, 32, 255]> : tensor<3xi8>,
- bytecode.test3 = dense<[10.0, 32.0, 1809.0]> : tensor<3xf64>
+ bytecode.test3 = dense<[10.0, 32.0, 1809.0]> : tensor<3xf64>,
+ bytecode.i16 = dense<[100, -200]> : tensor<2xi16>,
+ bytecode.i64 = dense<1000000> : tensor<4xi64>,
+ bytecode.f16 = dense<[1.5, 2.5]> : tensor<2xf16>,
+ bytecode.bf16 = dense<[-0.5, 0.5]> : tensor<2xbf16>,
+ bytecode.complex_val = dense<(1.0, 2.0)> : tensor<1xcomplex<f32>>
+} {}
+
+// DenseI1 (single, 8-element, varied sizes)
+
+// CHECK-LABEL: @TestDenseI1SingleElement
+module @TestDenseI1SingleElement attributes {
+ // CHECK-DAG: bytecode.false_1 = dense<false> : tensor<1xi1>
+ // CHECK-DAG: bytecode.true_1 = dense<true> : tensor<1xi1>
+ bytecode.false_1 = dense<false> : tensor<1xi1>,
+ bytecode.true_1 = dense<true> : tensor<1xi1>
+} {}
+
+// CHECK-LABEL: @TestDenseI1EightElements
+module @TestDenseI1EightElements attributes {
+ // CHECK-DAG: bytecode.mixed_8 = dense<[true, false, true, false, true, false, true, false]> : tensor<8xi1>
+ // CHECK-DAG: bytecode.all_true_8 = dense<true> : tensor<8xi1>
+ // CHECK-DAG: bytecode.all_false_8 = dense<false> : tensor<8xi1>
+ bytecode.mixed_8 = dense<[true, false, true, false, true, false, true, false]> : tensor<8xi1>,
+ bytecode.all_true_8 = dense<true> : tensor<8xi1>,
+ bytecode.all_false_8 = dense<false> : tensor<8xi1>
+} {}
+
+// CHECK-LABEL: @TestDenseI1VariedSizes
+module @TestDenseI1VariedSizes attributes {
+ // CHECK-DAG: bytecode.i1_2 = dense<[true, false]> : tensor<2xi1>
+ // CHECK-DAG: bytecode.i1_7 = dense<[true, false, true, false, true, false, true]> : tensor<7xi1>
+ // CHECK-DAG: bytecode.i1_9 = dense<[true, false, true, false, true, false, true, false, true]> : tensor<9xi1>
+ // CHECK-DAG: bytecode.i1_16 = dense<[true, false, true, false, true, false, true, false, true, false, true, false, true, false, true, false]> : tensor<16xi1>
+ bytecode.i1_2 = dense<[true, false]> : tensor<2xi1>,
+ bytecode.i1_7 = dense<[true, false, true, false, true, false, true]> : tensor<7xi1>,
+ bytecode.i1_9 = dense<[true, false, true, false, true, false, true, false, true]> : tensor<9xi1>,
+ bytecode.i1_16 = dense<[true, false, true, false, true, false, true, false, true, false, true, false, true, false, true, false]> : tensor<16xi1>
} {}
//===----------------------------------------------------------------------===//
@@ -58,10 +100,16 @@ module @TestFloat attributes {
// CHECK: bytecode.float1 = 0.10000{{.*}} : f80
// CHECK: bytecode.float2 = 0.10000{{.*}} : f128
// CHECK: bytecode.float3 = -5.000000e-01 : bf16
+ // CHECK: bytecode.inf = 0x7FF0000000000000 : f64
+ // CHECK: bytecode.nan = 0x7FF8000000000000 : f64
+ // CHECK: bytecode.ninf = 0xFFF0000000000000 : f64
bytecode.float = 10.0 : f64,
bytecode.float1 = 0.1 : f80,
bytecode.float2 = 0.1 : f128,
- bytecode.float3 = -0.5 : bf16
+ bytecode.float3 = -0.5 : bf16,
+ bytecode.inf = 0x7FF0000000000000 : f64,
+ bytecode.nan = 0x7FF8000000000000 : f64,
+ bytecode.ninf = 0xFFF0000000000000 : f64
} {}
//===----------------------------------------------------------------------===//
@@ -74,10 +122,18 @@ module @TestInt attributes {
// CHECK: bytecode.int1 = -1 : i8
// CHECK: bytecode.int2 = 800 : ui64
// CHECK: bytecode.int3 = 90000000000000000300000000000000000001 : i128
+ // CHECK: bytecode.int4 = true
+ // CHECK: bytecode.int5 = 42 : i32
+ // CHECK: bytecode.int6 = -100 : si32
+ // CHECK: bytecode.int7 = 7 : index
bytecode.int = false,
bytecode.int1 = -1 : i8,
bytecode.int2 = 800 : ui64,
- bytecode.int3 = 90000000000000000300000000000000000001 : i128
+ bytecode.int3 = 90000000000000000300000000000000000001 : i128,
+ bytecode.int4 = true,
+ bytecode.int5 = 42 : i32,
+ bytecode.int6 = -100 : si32,
+ bytecode.int7 = 7 : index
} {}
//===----------------------------------------------------------------------===//
@@ -87,7 +143,9 @@ module @TestInt attributes {
// CHECK-LABEL: @TestSparseElements
module @TestSparseElements attributes {
// CHECK-LITERAL: bytecode.sparse = sparse<[[0, 0], [1, 2]], [1, 5]> : tensor<3x4xi32>
- bytecode.sparse = sparse<[[0, 0], [1, 2]], [1, 5]> : tensor<3x4xi32>
+ // CHECK-LITERAL: bytecode.sparse_1d = sparse<[1, 3], [10.0, 20.0]> : tensor<5xf32>
+ bytecode.sparse = sparse<[[0, 0], [1, 2]], [1, 5]> : tensor<3x4xi32>,
+ bytecode.sparse_1d = sparse<[1, 3], [10.0, 20.0]> : tensor<5xf32>
} {}
@@ -99,8 +157,10 @@ module @TestSparseElements attributes {
module @TestString attributes {
// CHECK: bytecode.string = "hello"
// CHECK: bytecode.string2 = "hello" : i32
+ // CHECK: bytecode.string3 = ""
bytecode.string = "hello",
- bytecode.string2 = "hello" : i32
+ bytecode.string2 = "hello" : i32,
+ bytecode.string3 = ""
} {}
//===----------------------------------------------------------------------===//
@@ -146,7 +206,9 @@ module @TestDistinct attributes {
// CHECK-LABEL: @TestLocCallSite
module @TestLocCallSite attributes {
// CHECK: bytecode.loc = loc(callsite("foo" at "mysource.cc":10:8))
- bytecode.loc = loc(callsite("foo" at "mysource.cc":10:8))
+ // CHECK: bytecode.loc2 = loc(callsite("a":1:1 at callsite("b":2:2 at "c":3:3)))
+ bytecode.loc = loc(callsite("foo" at "mysource.cc":10:8)),
+ bytecode.loc2 = loc(callsite("a":1:1 at callsite("b":2:2 at "c":3:3)))
} {}
//===----------------------------------------------------------------------===//
@@ -156,7 +218,15 @@ module @TestLocCallSite attributes {
// CHECK-LABEL: @TestLocFileLineCol
module @TestLocFileLineCol attributes {
// CHECK: bytecode.loc = loc("mysource.cc":10:8)
- bytecode.loc = loc("mysource.cc":10:8)
+ // CHECK: bytecode.loc2 = loc("source.cc":10:8 to 12:4)
+ // CHECK: bytecode.loc3 = loc("source.cc":10:8 to :12)
+ // CHECK: bytecode.loc4 = loc("file.cc":0:0)
+ // CHECK: bytecode.loc5 = loc("file.cc":42:0)
+ bytecode.loc = loc("mysource.cc":10:8),
+ bytecode.loc2 = loc("source.cc":10:8 to 12:4),
+ bytecode.loc3 = loc("source.cc":10:8 to :12),
+ bytecode.loc4 = loc("file.cc":0:0),
+ bytecode.loc5 = loc("file.cc":42:0)
} {}
//===----------------------------------------------------------------------===//
@@ -221,9 +291,11 @@ module @TestAffineMap attributes {
// Identity maps.
// CHECK: bytecode.identity_1d = affine_map<(d0) -> (d0)>
// CHECK: bytecode.identity_3d = affine_map<(d0, d1, d2) -> (d0, d1, d2)>
+ // CHECK: bytecode.identity_large = affine_map<(d0, d1, d2, d3, d4, d5, d6, d7, d8, d9, d10, d11, d12, d13, d14, d15) -> (d0, d1, d2, d3, d4, d5, d6, d7, d8, d9, d10, d11, d12, d13, d14, d15)>
// Multi-result maps.
// CHECK: bytecode.multi_mix = affine_map<(d0, d1) -> (d0 + d1, d0 * 2, d1 mod 5)>
+ // CHECK: bytecode.multi_mix_deep = affine_map<(d0, d1)[s0] -> (((d0 + d1) floordiv 4 + s0) ceildiv 2 + (d0 mod 3 + d1 * 5) floordiv 7)>
// CHECK: bytecode.multi_sym = affine_map<(d0, d1)[s0] -> (d0 floordiv s0, d1 ceildiv s0, d0 + d1 + s0)>
// Permutation maps.
@@ -247,7 +319,9 @@ module @TestAffineMap attributes {
bytecode.empty_map = affine_map<() -> ()>,
bytecode.identity_1d = affine_map<(d0) -> (d0)>,
bytecode.identity_3d = affine_map<(d0, d1, d2) -> (d0, d1, d2)>,
+ bytecode.identity_large = affine_map<(d0, d1, d2, d3, d4, d5, d6, d7, d8, d9, d10, d11, d12, d13, d14, d15) -> (d0, d1, d2, d3, d4, d5, d6, d7, d8, d9, d10, d11, d12, d13, d14, d15)>,
bytecode.multi_mix = affine_map<(d0, d1) -> (d0 + d1, d0 * 2, d1 mod 5)>,
+ bytecode.multi_mix_deep = affine_map<(d0, d1)[s0] -> (((d0 + d1) floordiv 4 + s0) ceildiv 2 + (d0 mod 3 + d1 * 5) floordiv 7)>,
bytecode.multi_sym = affine_map<(d0, d1)[s0] -> (d0 floordiv s0, d1 ceildiv s0, d0 + d1 + s0)>,
bytecode.perm_2d = affine_map<(d0, d1) -> (d1, d0)>,
bytecode.perm_3d = affine_map<(d0, d1, d2) -> (d2, d0, d1)>,
@@ -265,9 +339,75 @@ module @TestIntegerSetAttr attributes {
// CHECK-DAG: bytecode.ineq = affine_set<(d0) : (d0 >= 0)>
// CHECK-DAG: bytecode.multi = affine_set<(d0, d1)[s0] : (d0 >= 0, -d0 + s0 >= 0, d1 >= 0)>
// CHECK-DAG: bytecode.eq_ineq = affine_set<(d0, d1) : (d0 == 0, d1 >= 0)>
+ // CHECK-DAG: bytecode.neg_const = affine_set<(d0) : (d0 + 42 == 0)>
+ // CHECK-DAG: bytecode.multi_sym = affine_set<(d0)[s0, s1] : (d0 + s0 >= 0, d0 + s1 >= 0)>
+ // CHECK-DAG: bytecode.complex = affine_set<(d0, d1)[s0] : (d0 * 2 + d1 == 0, d0 - s0 >= 0, d1 mod 3 >= 0)>
bytecode.eq = affine_set<(d0) : (d0 == 0)>,
bytecode.ineq = affine_set<(d0) : (d0 >= 0)>,
bytecode.multi = affine_set<(d0, d1)[s0] : (d0 >= 0, -d0 + s0 >= 0, d1 >= 0)>,
- bytecode.eq_ineq = affine_set<(d0, d1) : (d0 == 0, d1 >= 0)>
+ bytecode.eq_ineq = affine_set<(d0, d1) : (d0 == 0, d1 >= 0)>,
+ bytecode.neg_const = affine_set<(d0) : (d0 + 42 == 0)>,
+ bytecode.multi_sym = affine_set<(d0)[s0, s1] : (d0 + s0 >= 0, d0 + s1 >= 0)>,
+ bytecode.complex = affine_set<(d0, d1)[s0] : (d0 * 2 + d1 == 0, d0 - s0 >= 0, d1 mod 3 >= 0)>
+} {}
+
+//===----------------------------------------------------------------------===//
+// DictionaryAttr
+//===----------------------------------------------------------------------===//
+
+// CHECK-LABEL: @TestDictionaryAttr
+module @TestDictionaryAttr attributes {
+ // CHECK-DAG: bytecode.empty_dict = {}
+ // CHECK-DAG: bytecode.nested_dict = {inner = {a = 1 : i32}}
+ bytecode.empty_dict = {},
+ bytecode.nested_dict = {inner = {a = 1 : i32}}
+} {}
+
+//===----------------------------------------------------------------------===//
+// UnitAttr
+//===----------------------------------------------------------------------===//
+
+// CHECK-LABEL: @TestUnitAttr
+module @TestUnitAttr attributes {
+ // CHECK-DAG: bytecode.unit
+ bytecode.unit
+} {}
+
+//===----------------------------------------------------------------------===//
+// EmptyContainers
+//===----------------------------------------------------------------------===//
+
+// CHECK-LABEL: @TestEmptyContainers
+module @TestEmptyContainers attributes {
+ // CHECK-DAG: bytecode.empty_arr = []
+ // CHECK-DAG: bytecode.empty_dict = {}
+ // CHECK-DAG: bytecode.empty_str = ""
+ // CHECK-DAG: bytecode.empty_tuple = tuple<>
+ // CHECK-DAG: bytecode.empty_func = () -> ()
+ // CHECK-DAG: bytecode.empty_map = affine_map<() -> ()>
+ // CHECK-DAG: bytecode.empty_dense_arr = array<i32>
+ // CHECK-DAG: bytecode.empty_tensor = dense<> : tensor<0xi32>
+ bytecode.empty_arr = [],
+ bytecode.empty_dict = {},
+ bytecode.empty_str = "",
+ bytecode.empty_tuple = tuple<>,
+ bytecode.empty_func = () -> (),
+ bytecode.empty_map = affine_map<() -> ()>,
+ bytecode.empty_dense_arr = array<i32>,
+ bytecode.empty_tensor = dense<> : tensor<0xi32>
+} {}
+
+//===----------------------------------------------------------------------===//
+// StridedLayoutAttr
+//===----------------------------------------------------------------------===//
+
+// CHECK-LABEL: @TestStridedLayoutAttr
+module @TestStridedLayoutAttr attributes {
+ // CHECK-DAG: bytecode.static_strides = strided<[3, 1]>
+ // CHECK-DAG: bytecode.with_offset = strided<[3, 1], offset: 5>
+ // CHECK-DAG: bytecode.dynamic = strided<[?, 1], offset: ?>
+ bytecode.static_strides = strided<[3, 1]>,
+ bytecode.with_offset = strided<[3, 1], offset: 5>,
+ bytecode.dynamic = strided<[?, 1], offset: ?>
} {}
diff --git a/mlir/test/Dialect/Builtin/Bytecode/builtin_fixed.mlir b/mlir/test/Dialect/Builtin/Bytecode/builtin_fixed.mlir
index 31061a6fa8653..d427035435277 100644
--- a/mlir/test/Dialect/Builtin/Bytecode/builtin_fixed.mlir
+++ b/mlir/test/Dialect/Builtin/Bytecode/builtin_fixed.mlir
@@ -127,12 +127,36 @@ module @TestFloatAttr attributes {
// CHECK-DAG: bytecode.f64 = 1.000000e+01 : f64
// CHECK-DAG: bytecode.f80 = 0.1{{.*}} : f80
// CHECK-DAG: bytecode.f128 = 0.1{{.*}} : f128
+ // CHECK-DAG: bytecode.tf32 = 1.000000e+00 : tf32
+ // CHECK-DAG: bytecode.f8E5M2 = 1.000000e+00 : f8E5M2
+ // CHECK-DAG: bytecode.f8E4M3 = 1.000000e+00 : f8E4M3
+ // CHECK-DAG: bytecode.f8E4M3FN = 1.000000e+00 : f8E4M3FN
+ // CHECK-DAG: bytecode.f8E5M2FNUZ = 1.000000e+00 : f8E5M2FNUZ
+ // CHECK-DAG: bytecode.f8E4M3FNUZ = 1.000000e+00 : f8E4M3FNUZ
+ // CHECK-DAG: bytecode.f8E4M3B11FNUZ = 1.000000e+00 : f8E4M3B11FNUZ
+ // CHECK-DAG: bytecode.f8E3M4 = 1.000000e+00 : f8E3M4
+ // CHECK-DAG: bytecode.f4E2M1FN = 1.000000e+00 : f4E2M1FN
+ // CHECK-DAG: bytecode.f6E2M3FN = 1.000000e+00 : f6E2M3FN
+ // CHECK-DAG: bytecode.f6E3M2FN = 1.000000e+00 : f6E3M2FN
+ // CHECK-DAG: bytecode.f8E8M0FNU = 1.000000e+00 : f8E8M0FNU
bytecode.bf16 = -0.5 : bf16,
bytecode.f16 = 1.5 : f16,
bytecode.f32 = 3.14 : f32,
bytecode.f64 = 10.0 : f64,
bytecode.f80 = 0.1 : f80,
- bytecode.f128 = 0.1 : f128
+ bytecode.f128 = 0.1 : f128,
+ bytecode.tf32 = 1.0 : tf32,
+ bytecode.f8E5M2 = 1.0 : f8E5M2,
+ bytecode.f8E4M3 = 1.0 : f8E4M3,
+ bytecode.f8E4M3FN = 1.0 : f8E4M3FN,
+ bytecode.f8E5M2FNUZ = 1.0 : f8E5M2FNUZ,
+ bytecode.f8E4M3FNUZ = 1.0 : f8E4M3FNUZ,
+ bytecode.f8E4M3B11FNUZ = 1.0 : f8E4M3B11FNUZ,
+ bytecode.f8E3M4 = 1.0 : f8E3M4,
+ bytecode.f4E2M1FN = 1.0 : f4E2M1FN,
+ bytecode.f6E2M3FN = 1.0 : f6E2M3FN,
+ bytecode.f6E3M2FN = 1.0 : f6E3M2FN,
+ bytecode.f8E8M0FNU = 1.0 : f8E8M0FNU
} {} loc(unknown)
//===----------------------------------------------------------------------===//
@@ -260,12 +284,36 @@ module @TestAllFloatTypes attributes {
// CHECK-DAG: bytecode.f64 = f64
// CHECK-DAG: bytecode.f80 = f80
// CHECK-DAG: bytecode.f128 = f128
+ // CHECK-DAG: bytecode.tf32 = tf32
+ // CHECK-DAG: bytecode.f8E5M2 = f8E5M2
+ // CHECK-DAG: bytecode.f8E4M3 = f8E4M3
+ // CHECK-DAG: bytecode.f8E4M3FN = f8E4M3FN
+ // CHECK-DAG: bytecode.f8E5M2FNUZ = f8E5M2FNUZ
+ // CHECK-DAG: bytecode.f8E4M3FNUZ = f8E4M3FNUZ
+ // CHECK-DAG: bytecode.f8E4M3B11FNUZ = f8E4M3B11FNUZ
+ // CHECK-DAG: bytecode.f8E3M4 = f8E3M4
+ // CHECK-DAG: bytecode.f4E2M1FN = f4E2M1FN
+ // CHECK-DAG: bytecode.f6E2M3FN = f6E2M3FN
+ // CHECK-DAG: bytecode.f6E3M2FN = f6E3M2FN
+ // CHECK-DAG: bytecode.f8E8M0FNU = f8E8M0FNU
bytecode.bf16 = bf16,
bytecode.f16 = f16,
bytecode.f32 = f32,
bytecode.f64 = f64,
bytecode.f80 = f80,
- bytecode.f128 = f128
+ bytecode.f128 = f128,
+ bytecode.tf32 = tf32,
+ bytecode.f8E5M2 = f8E5M2,
+ bytecode.f8E4M3 = f8E4M3,
+ bytecode.f8E4M3FN = f8E4M3FN,
+ bytecode.f8E5M2FNUZ = f8E5M2FNUZ,
+ bytecode.f8E4M3FNUZ = f8E4M3FNUZ,
+ bytecode.f8E4M3B11FNUZ = f8E4M3B11FNUZ,
+ bytecode.f8E3M4 = f8E3M4,
+ bytecode.f4E2M1FN = f4E2M1FN,
+ bytecode.f6E2M3FN = f6E2M3FN,
+ bytecode.f6E3M2FN = f6E3M2FN,
+ bytecode.f8E8M0FNU = f8E8M0FNU
} {} loc(unknown)
//===----------------------------------------------------------------------===//
@@ -396,6 +444,42 @@ module @TestTupleType attributes {
bytecode.mixed_tuple = tuple<i32, f64, index>
} {} loc(unknown)
+//===----------------------------------------------------------------------===//
+// AffineMapAttr
+//===----------------------------------------------------------------------===//
+
+// CHECK-LABEL: @TestAffineMapAttr
+module @TestAffineMapAttr attributes {
+ // CHECK-DAG: bytecode.identity = affine_map<(d0) -> (d0)>
+ // CHECK-DAG: bytecode.multi_dim = affine_map<(d0, d1) -> (d0 + d1)>
+ // CHECK-DAG: bytecode.with_symbol = affine_map<(d0)[s0] -> (d0 + s0)>
+ // CHECK-DAG: bytecode.complex = affine_map<(d0, d1) -> (d0 floordiv 4, d1 mod 8)>
+ // CHECK-DAG: bytecode.empty = affine_map<() -> ()>
+ // CHECK-DAG: bytecode.constant = affine_map<() -> (42)>
+ bytecode.identity = affine_map<(d0) -> (d0)>,
+ bytecode.multi_dim = affine_map<(d0, d1) -> (d0 + d1)>,
+ bytecode.with_symbol = affine_map<(d0)[s0] -> (d0 + s0)>,
+ bytecode.complex = affine_map<(d0, d1) -> (d0 floordiv 4, d1 mod 8)>,
+ bytecode.empty = affine_map<() -> ()>,
+ bytecode.constant = affine_map<() -> (42)>
+} {} loc(unknown)
+
+//===----------------------------------------------------------------------===//
+// IntegerSetAttr
+//===----------------------------------------------------------------------===//
+
+// CHECK-LABEL: @TestIntegerSetAttr
+module @TestIntegerSetAttr attributes {
+ // CHECK-DAG: bytecode.eq = affine_set<(d0) : (d0 == 0)>
+ // CHECK-DAG: bytecode.ineq = affine_set<(d0) : (d0 >= 0)>
+ // CHECK-DAG: bytecode.multi = affine_set<(d0, d1)[s0] : (d0 >= 0, -d0 + s0 >= 0, d1 >= 0)>
+ // CHECK-DAG: bytecode.eq_ineq = affine_set<(d0, d1) : (d0 == 0, d1 >= 0)>
+ bytecode.eq = affine_set<(d0) : (d0 == 0)>,
+ bytecode.ineq = affine_set<(d0) : (d0 >= 0)>,
+ bytecode.multi = affine_set<(d0, d1)[s0] : (d0 >= 0, -d0 + s0 >= 0, d1 >= 0)>,
+ bytecode.eq_ineq = affine_set<(d0, d1) : (d0 == 0, d1 >= 0)>
+} {} loc(unknown)
+
//===----------------------------------------------------------------------===//
// DenseResourceElementsAttr
//===----------------------------------------------------------------------===//
@@ -416,6 +500,20 @@ module @TestDenseStringElementsAttr attributes {
bytecode.dense_str = dense<["foo", "bar", "baz"]> : tensor<3x!bytecode.string>
} {} loc(unknown)
+//===----------------------------------------------------------------------===//
+// StridedLayoutAttr
+//===----------------------------------------------------------------------===//
+
+// CHECK-LABEL: @TestStridedLayoutAttr
+module @TestStridedLayoutAttr attributes {
+ // CHECK-DAG: bytecode.static_strides = strided<[3, 1]>
+ // CHECK-DAG: bytecode.with_offset = strided<[3, 1], offset: 5>
+ // CHECK-DAG: bytecode.dynamic = strided<[?, 1], offset: ?>
+ bytecode.static_strides = strided<[3, 1]>,
+ bytecode.with_offset = strided<[3, 1], offset: 5>,
+ bytecode.dynamic = strided<[?, 1], offset: ?>
+} {} loc(unknown)
+
} loc(unknown)
{-#
diff --git a/mlir/test/Dialect/Builtin/Bytecode/builtin_fixed_0.mlirbc b/mlir/test/Dialect/Builtin/Bytecode/bu...
[truncated]
``````````
</details>
https://github.com/llvm/llvm-project/pull/207488
More information about the Mlir-commits
mailing list