[all-commits] [llvm/llvm-project] 45aaa6: [mlir][tensor] Fix one-shot bufferization of tenso...

Ingo Müller via All-commits all-commits at lists.llvm.org
Fri May 26 02:40:03 PDT 2023


  Branch: refs/heads/main
  Home:   https://github.com/llvm/llvm-project
  Commit: 45aaa67fceadaeb3bf76bab21d36c1f337d97491
      https://github.com/llvm/llvm-project/commit/45aaa67fceadaeb3bf76bab21d36c1f337d97491
  Author: Ingo Müller <ingomueller at google.com>
  Date:   2023-05-26 (Fri, 26 May 2023)

  Changed paths:
    M mlir/lib/Dialect/Tensor/Transforms/BufferizableOpInterfaceImpl.cpp
    M mlir/test/Dialect/Tensor/one-shot-bufferize.mlir

  Log Message:
  -----------
  [mlir][tensor] Fix one-shot bufferization of tensor.reshape.

I believe that the previous implementation did not work on any input. It
called getMemRefType with `layout = {}`, presumably with the intention
to create a MemrefType with identity layout. However, the implementation
of that function returns a MemrefType with *unknown* layout if it is
provided with a default-constructed layout attribute. This patch uses
getMemRefTypeWithStaticIdentityLayout instead, with has identical
behavior except for the case of a default-constructed layout, which it
passes on as-is to the MemrefType.

This problem did not surface in the test because tensor.reshape was not
tested with -one-shot-bufferize. This patch introduces a test copied
from the tests for -tesnor-bufferize adapted in as follows: since the
test is run with "bufferize-function-boundaries", a tensor that is
passed into the function is bufferized into a memref with unknown
layout, which wouldn't be a valid intput for memref.reshape, so the
tests now uses a tensor constructed with arith.constant inside of the
function.

Reviewed By: springerm

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




More information about the All-commits mailing list