[Mlir-commits] [mlir] [mlirbc] Address remaining missing encodings for builtin dialect. (PR #207488)
Jacques Pienaar
llvmlistbot at llvm.org
Fri Jul 3 23:18:40 PDT 2026
https://github.com/jpienaar created https://github.com/llvm/llvm-project/pull/207488
Simple ones that got missed (graph & strided layout), and add some additional tests. Also update the fixed test.
Assisted-By: Gemini
>From b3f78f941ea8c5f01c2916292c4b9210b55f4b65 Mon Sep 17 00:00:00 2001
From: Jacques Pienaar <jpienaar at google.com>
Date: Mon, 23 Feb 2026 11:33:39 +0200
Subject: [PATCH] [mlirbc] Address remaining missing encodings for builtin
dialect.
Simple ones that got missed (graph & strided layout), and add some
additional tests. Also update the fixed test.
Assisted-By: Gemini
---
.../include/mlir/IR/BuiltinDialectBytecode.td | 16 +-
mlir/test/Dialect/Builtin/Bytecode/attrs.mlir | 162 ++++++++++++++++--
.../Builtin/Bytecode/builtin_fixed.mlir | 102 ++++++++++-
.../Builtin/Bytecode/builtin_fixed_0.mlirbc | Bin 4447 -> 5470 bytes
mlir/test/Dialect/Builtin/Bytecode/types.mlir | 38 +++-
5 files changed, 298 insertions(+), 20 deletions(-)
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/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#H#Hx})dKv%JdNy-jZ!KvOn at +k*j4s0
zyV^#GGK)kxOokAuD6^P{5voZLxk}{B^FTH`B1EFXmfDN6!x1=&BgJ3j#o0)-p0&J|
z<I?I6c$2ISh~vnuM&fSf9MUo+{rckiLA8bMIP30I=c*O?1xpv^M=oEnY;o@*%idu_
zoGXO1H`*-nqFtD{uqB(HvRzC-fE_Zx`A&dWxB(VafNQ(}AJYF|K|B-whs7t6087yT
zYbh4+nG_HB4N3(34J88}#i at YLXFuRxP6xb}GXp%!>}M<21r0m6KH%55A>gk#8}Ogp
z7;vTCG{7NG2(F==wI-+c8Y`Y$k*eHPQ%h=$$~cab8JjNVD|%Hj>#Ml2L?Ve)@!N`Q
zvBjMg8FiW!TtV0Ar&zu7d-4m5+Km_24~`<=bLomz+cyt>FI3D7y?V(dOFJ8_L3^5E
zUdS5+wg~JNI4p2n$Vw7&lhJ;oE*A2b(Ii{Ql|~yN<UXUWkdRxA_8WzyX*cRJT5I&0
N(J`Z{L8g9?_zTk~Z)yMl
diff --git a/mlir/test/Dialect/Builtin/Bytecode/types.mlir b/mlir/test/Dialect/Builtin/Bytecode/types.mlir
index 91d4512998b99..e1d4a18a33c73 100644
--- a/mlir/test/Dialect/Builtin/Bytecode/types.mlir
+++ b/mlir/test/Dialect/Builtin/Bytecode/types.mlir
@@ -85,9 +85,11 @@ module @TestIndex attributes {
// CHECK-LABEL: @TestFunc
module @TestFunc attributes {
// CHECK: bytecode.func = () -> (),
- // CHECK: bytecode.func1 = (i1) -> i32
+ // CHECK: bytecode.func1 = (i1) -> i32,
+ // CHECK: bytecode.func2 = (i32) -> (f32, f64)
bytecode.func = () -> (),
- bytecode.func1 = (i1) -> (i32)
+ bytecode.func1 = (i1) -> (i32),
+ bytecode.func2 = (i32) -> (f32, f64)
} {}
//===----------------------------------------------------------------------===//
@@ -97,9 +99,13 @@ module @TestFunc attributes {
// CHECK-LABEL: @TestMemRef
module @TestMemRef attributes {
// CHECK: bytecode.test = memref<2xi8>,
- // CHECK: bytecode.test1 = memref<2xi8, 1>
+ // CHECK: bytecode.test1 = memref<2xi8, 1>,
+ // CHECK: bytecode.test2 = memref<?x?xf32>,
+ // CHECK: bytecode.test3 = memref<2x3xf32, strided<[3, 1]>>
bytecode.test = memref<2xi8>,
- bytecode.test1 = memref<2xi8, 1>
+ bytecode.test1 = memref<2xi8, 1>,
+ bytecode.test2 = memref<?x?xf32>,
+ bytecode.test3 = memref<2x3xf32, strided<[3, 1], offset: 0>>
} {}
//===----------------------------------------------------------------------===//
@@ -165,9 +171,11 @@ module @TestUnrankedTensor attributes {
// CHECK-LABEL: @TestVector
module @TestVector attributes {
// CHECK: bytecode.test = vector<8x8x128xi8>,
- // CHECK: bytecode.test1 = vector<8x[8]xf32>
+ // CHECK: bytecode.test1 = vector<8x[8]xf32>,
+ // CHECK: bytecode.test2 = vector<[4]x[4]xf16>
bytecode.test = vector<8x8x128xi8>,
- bytecode.test1 = vector<8x[8]xf32>
+ bytecode.test1 = vector<8x[8]xf32>,
+ bytecode.test2 = vector<[4]x[4]xf16>
} {}
//===----------------------------------------------------------------------===//
@@ -179,3 +187,21 @@ module @TestToken attributes {
// CHECK: bytecode.test = token
bytecode.test = token
} {}
+
+//===----------------------------------------------------------------------===//
+// IntegerType (packing variants)
+//===----------------------------------------------------------------------===//
+
+// CHECK-LABEL: @TestIntegerTypePacking
+module @TestIntegerTypePacking attributes {
+ // CHECK-DAG: bytecode.i1 = i1
+ // CHECK-DAG: bytecode.i2 = i2
+ // CHECK-DAG: bytecode.si1 = si1
+ // CHECK-DAG: bytecode.ui1 = ui1
+ // CHECK-DAG: bytecode.i4096 = i4096
+ bytecode.i1 = i1,
+ bytecode.i2 = i2,
+ bytecode.si1 = si1,
+ bytecode.ui1 = ui1,
+ bytecode.i4096 = i4096
+} {}
More information about the Mlir-commits
mailing list