[all-commits] [llvm/llvm-project] 0e0b60: Implements MLIR Bytecode versioning capability

Mehdi Amini via All-commits all-commits at lists.llvm.org
Fri Mar 10 14:29:23 PST 2023


  Branch: refs/heads/main
  Home:   https://github.com/llvm/llvm-project
  Commit: 0e0b6070fd2a2a8f188ddb32aa526beda38190b7
      https://github.com/llvm/llvm-project/commit/0e0b6070fd2a2a8f188ddb32aa526beda38190b7
  Author: Matteo Franciolini <m_franciolini at apple.com>
  Date:   2023-03-10 (Fri, 10 Mar 2023)

  Changed paths:
    M mlir/docs/BytecodeFormat.md
    M mlir/docs/LangRef.md
    M mlir/include/mlir/Bytecode/BytecodeImplementation.h
    M mlir/lib/Bytecode/Encoding.h
    M mlir/lib/Bytecode/Reader/BytecodeReader.cpp
    M mlir/lib/Bytecode/Writer/BytecodeWriter.cpp
    M mlir/test/Bytecode/invalid/invalid-structure.mlir
    A mlir/test/Bytecode/versioning/versioned-attr-1.12.mlirbc
    A mlir/test/Bytecode/versioning/versioned-attr-2.0.mlirbc
    A mlir/test/Bytecode/versioning/versioned-op-1.12.mlirbc
    A mlir/test/Bytecode/versioning/versioned-op-2.0.mlirbc
    A mlir/test/Bytecode/versioning/versioned-op-2.2.mlirbc
    A mlir/test/Bytecode/versioning/versioned_attr.mlir
    A mlir/test/Bytecode/versioning/versioned_op.mlir
    M mlir/test/lib/Dialect/Test/TestDialect.cpp
    M mlir/test/lib/Dialect/Test/TestOps.td

  Log Message:
  -----------
  Implements MLIR Bytecode versioning capability

A dialect can opt-in to handle versioning through the
`BytecodeDialectInterface`. Few hooks are exposed to the dialect to allow
managing a version encoded into the bytecode file. The version is loaded
lazily and allows to retrieve the version information while parsing the input
IR, and gives an opportunity to each dialect for which a version is present
to perform IR upgrades post-parsing through the `upgradeFromVersion` method.
Custom Attribute and Type encodings can also be upgraded according to the
dialect version using readAttribute and readType methods.

There is no restriction on what kind of information a dialect is allowed to
encode to model its versioning. Currently, versioning is supported only for
bytecode formats.

Reviewed By: rriddle, mehdi_amini

Differential Revision: https://reviews.llvm.org/D143647




More information about the All-commits mailing list