[all-commits] [llvm/llvm-project] e04533: [mlir][Linalg] Introduce a BufferizationAliasInfo ...

Nicolas Vasilache via All-commits all-commits at lists.llvm.org
Mon Jun 21 00:05:12 PDT 2021


  Branch: refs/heads/main
  Home:   https://github.com/llvm/llvm-project
  Commit: e04533d38a5e7524593001118054efb48dea2b34
      https://github.com/llvm/llvm-project/commit/e04533d38a5e7524593001118054efb48dea2b34
  Author: Nicolas Vasilache <nicolas.vasilache at gmail.com>
  Date:   2021-06-21 (Mon, 21 Jun 2021)

  Changed paths:
    M mlir/lib/Dialect/Linalg/Transforms/ComprehensiveBufferize.cpp
    A mlir/test/Dialect/Linalg/comprehensive-func-bufferize-analysis.mlir
    M mlir/test/Dialect/Linalg/comprehensive-func-bufferize.mlir

  Log Message:
  -----------
  [mlir][Linalg] Introduce a BufferizationAliasInfo (6/n)

This revision adds a BufferizationAliasInfo which maintains and updates information about which tensors will alias once bufferized, which bufferized tensors are equivalent to others and how to handle clobbers.

Bufferization greedily tries to bufferize inplace by:

1. first trying to bufferize SubTensorInsertOp inplace, in reverse order (these are deemed the most expensives).
2. then trying to bufferize all non SubTensorOp / SubTensorInsertOp, in reverse order.
3. lastly trying to bufferize all SubTensorOp in reverse order.

Reverse order is a heuristic that seems to work nicely because structured tensor codegen very often proceeds by:

1. take a subset of a tensor
2. compute on that subset
3. insert the result subset into the full tensor and yield a new tensor.

BufferizationAliasInfo + equivalence sets + clobber analysis allows bufferizing nested
subtensor/compute/subtensor_insert sequences inplace to a certain extent.
To fully realize inplace bufferization, additional container-containee analysis will be necessary and is left for a subsequent commit.

Differential revision: https://reviews.llvm.org/D104110




More information about the All-commits mailing list