[Mlir-commits] [mlir] [mlirbc] Add AffineMap serialization support (PR #191970)

Matthias Springer llvmlistbot at llvm.org
Wed Jun 3 03:52:23 PDT 2026


================
@@ -88,6 +90,302 @@ static void writePotentiallySplatString(DialectBytecodeWriter &writer,
     writer.writeOwnedString(str);
 }
 
+//===----------------------------------------------------------------------===//
+// AffineExpr / AffineMap bytecode helpers
+//===----------------------------------------------------------------------===//
+
+// AffineExpr kind encoding:
+// Extra kinds may be appended here but the existing ones and their ordering
+// should not be changed.
+enum class AffineExprBytecodeKind : uint64_t {
+  DimId = 0,
+  SymbolId = 1,
+  Constant = 2,
+  Add = 3,
+  Mul = 4,
+  Mod = 5,
+  FloorDiv = 6,
+  CeilDiv = 7
+};
+
+// AffineMap kind encoding. These are packed into the low 2 bits of the header
+// varint and fixed.
+enum class AffineMapBytecodeKind : unsigned {
----------------
matthias-springer wrote:

Why special-case these in the bytecode? We also don't special-case them in the in-memory representation.

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


More information about the Mlir-commits mailing list