[all-commits] [llvm/llvm-project] 2b5134: [mlir] Fix bytecode reading of resource sections

Jeff Niu via All-commits all-commits at lists.llvm.org
Fri Sep 29 18:40:15 PDT 2023


  Branch: refs/heads/main
  Home:   https://github.com/llvm/llvm-project
  Commit: 2b5134f1b7f4d2ded14f138c84939d2037326c51
      https://github.com/llvm/llvm-project/commit/2b5134f1b7f4d2ded14f138c84939d2037326c51
  Author: Mogball <jeff at modular.com>
  Date:   2023-09-29 (Fri, 29 Sep 2023)

  Changed paths:
    M mlir/lib/Bytecode/Reader/BytecodeReader.cpp
    M mlir/unittests/Bytecode/BytecodeTest.cpp

  Log Message:
  -----------
  [mlir] Fix bytecode reading of resource sections

This partially reverts #66380. The assertion that the underlying buffer
of an EncodingReader is aligned to any required alignments for resource
sections. Resources know their own alignment and pad their buffers
accordingly, but the bytecode reader doesn't know that ahead of time.
Consequently, it cannot give the resource EncodingReader a base buffer
aligned to the maximum required alignment.

A simple example from the test fails without this:

```mlir
module @TestDialectResources attributes {
  bytecode.test = dense_resource<resource> : tensor<4xi32>
} {}
{-#
  dialect_resources: {
    builtin: {
      resource: "0x2000000001000000020000000300000004000000",
      resource_2: "0x2000000001000000020000000300000004000000"
    }
  }
```




More information about the All-commits mailing list