[all-commits] [llvm/llvm-project] b299ec: Expose callbacks for encoding of types/attributes

Mehdi Amini via All-commits all-commits at lists.llvm.org
Fri Jul 28 10:44:41 PDT 2023


  Branch: refs/heads/main
  Home:   https://github.com/llvm/llvm-project
  Commit: b299ec16661f653df66cdaf161cdc5441bc9803c
      https://github.com/llvm/llvm-project/commit/b299ec16661f653df66cdaf161cdc5441bc9803c
  Author: Mehdi Amini <joker.eph at gmail.com>
  Date:   2023-07-28 (Fri, 28 Jul 2023)

  Changed paths:
    M mlir/include/mlir/Bytecode/BytecodeImplementation.h
    M mlir/include/mlir/Bytecode/BytecodeReader.h
    A mlir/include/mlir/Bytecode/BytecodeReaderConfig.h
    M mlir/include/mlir/Bytecode/BytecodeWriter.h
    M mlir/include/mlir/IR/AsmState.h
    M mlir/lib/Bytecode/Reader/BytecodeReader.cpp
    M mlir/lib/Bytecode/Writer/BytecodeWriter.cpp
    M mlir/lib/Bytecode/Writer/IRNumbering.cpp
    A mlir/test/Bytecode/bytecode_callback.mlir
    A mlir/test/Bytecode/bytecode_callback_full_override.mlir
    A mlir/test/Bytecode/bytecode_callback_with_custom_attribute.mlir
    A mlir/test/Bytecode/bytecode_callback_with_custom_type.mlir
    M mlir/test/Bytecode/invalid/invalid_attr_type_section.mlir
    M mlir/test/lib/Dialect/Test/TestDialect.h
    M mlir/test/lib/Dialect/Test/TestDialectInterfaces.cpp
    M mlir/test/lib/Dialect/Test/TestOps.td
    M mlir/test/lib/Dialect/Test/TestTypeDefs.td
    M mlir/test/lib/IR/CMakeLists.txt
    A mlir/test/lib/IR/TestBytecodeCallbacks.cpp
    M mlir/tools/mlir-opt/mlir-opt.cpp

  Log Message:
  -----------
  Expose callbacks for encoding of types/attributes

[mlir] Expose a mechanism to provide a callback for encoding types and attributes in MLIR bytecode.

Two callbacks are exposed, respectively, to the BytecodeWriterConfig and to the ParserConfig. At bytecode parsing/printing, clients have the ability to specify a callback to be used to optionally read/write the encoding. On failure, fallback path will execute the default parsers and printers for the dialect.

Testing shows how to leverage this functionality to support back-deployment and backward-compatibility usecases when roundtripping to bytecode a client dialect with type/attributes dependencies on upstream.

Reviewed By: rriddle

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




More information about the All-commits mailing list