History log of /llvm-project/mlir/lib/Dialect/Tensor/IR/TensorTilingInterfaceImpl.cpp (Results 1 – 25 of 54)
Revision (<<< Hide revision tags) (Show revision tags >>>) Date Author Comments
Revision tags: llvmorg-21-init, llvmorg-19.1.7, llvmorg-19.1.6
# 33927744 12-Dec-2024 Nirvedh <nirvedh@gmail.com>

[mlir][tensor] fix typo in pad tiling comment


# 85c91afb 12-Dec-2024 Nirvedh <nirvedh@gmail.com>

[mlir][tensor] fix typo in pad tiling comment


# 77400103 12-Dec-2024 Nirvedh Meshram <96096277+nirvedhmeshram@users.noreply.github.com>

NfC fix comment in #119039 (#119727)

Missed commiting clang-fomrat in
[#19903](https://github.com/llvm/llvm-project/pull/119039)


# 3f136f7d 12-Dec-2024 Nirvedh Meshram <96096277+nirvedhmeshram@users.noreply.github.com>

[Tensor] Simplify tenor.pad tiling length calculations. (#119039)

The current calculations calculate ending location of the new length and
then subtract the new offset from that location. It is poss

[Tensor] Simplify tenor.pad tiling length calculations. (#119039)

The current calculations calculate ending location of the new length and
then subtract the new offset from that location. It is possible to
directly calculate new length. Along with requiring less operations
(which can matter in dynamic case) this also has the advantage that the
values are upper bounded by length rather than source size which is more
friendly for range analysis. I believe the change is already being
tested by
`test/Dialect/Linalg/subtensor-of-padtensor.mlir` and
`test/Dialect/Linalg/tile-and-fuse-tensors.mlir`

---------

Signed-off-by: Nirvedh <nirvedh@gmail.com>

show more ...


Revision tags: llvmorg-19.1.5, llvmorg-19.1.4
# 8cc616bc 13-Nov-2024 Max191 <44243577+Max191@users.noreply.github.com>

[mlir] Clamp UnPackOp tiling sizes from operand tile (#112429)

The `getIterationDomainTileFromOperandTile` implementation for
tensor.unpack did not clamp sizes when the unpack op had extract_slice

[mlir] Clamp UnPackOp tiling sizes from operand tile (#112429)

The `getIterationDomainTileFromOperandTile` implementation for
tensor.unpack did not clamp sizes when the unpack op had extract_slice
semantics. This PR fixes the bug.

The PR also makes a minor change to `tileAndFuseConsumerOfSlice`. When
replacing DPS inits, the iteration domain is needed, and it is computed
from the tiled version of the operation after the initial tiling
transformation. This can result in some extra indexing computation, so
the PR changes it to use the original full sized cloned consumer op.

---------

Signed-off-by: Max Dawkins <max.dawkins@gmail.com>

show more ...


Revision tags: llvmorg-19.1.3
# f1595ecf 25-Oct-2024 Max191 <44243577+Max191@users.noreply.github.com>

[mlir] Fix bug in UnPackOp tiling implementation causing infinite loop (#113571)

This fixes a bug in the tiling implementation of tensor.unpack that was
causing an infinite loop when certain unpack

[mlir] Fix bug in UnPackOp tiling implementation causing infinite loop (#113571)

This fixes a bug in the tiling implementation of tensor.unpack that was
causing an infinite loop when certain unpack ops get tiled and fused as
a producer. The tiled implementation of tensor.unpack sometimes needs to
create an additional tensor.extract_slice on the result of the tiled
unpack op, but this slice was getting added to the `generatedSlices` of
the tiling result. The `generatedSlices` are used to find the next
producers to fuse, so it caused an infinite loop of fusing the same
unpack op after it was already in the loop. This fixes the bug by adding
the slice of the source instead of the result.

Signed-off-by: Max Dawkins <max.dawkins@gmail.com>

show more ...


Revision tags: llvmorg-19.1.2, llvmorg-19.1.1, llvmorg-19.1.0
# d5f0969c 12-Sep-2024 MaheshRavishankar <1663364+MaheshRavishankar@users.noreply.github.com>

[mlir][TilingInterface] Avoid looking at operands for getting slices to continue tile + fuse. (#107882)

Current implementation of `scf::tileConsumerAndFuseProducerUsingSCF`
looks at operands of til

[mlir][TilingInterface] Avoid looking at operands for getting slices to continue tile + fuse. (#107882)

Current implementation of `scf::tileConsumerAndFuseProducerUsingSCF`
looks at operands of tiled/tiled+fused operations to see if they are
produced by `extract_slice` operations to populate the worklist used to
continue fusion. This implicit assumption does not always work. Instead
make the implementations of `getTiledImplementation` return the slices
to use to continue fusion.

This is a breaking change

- To continue to get the same behavior of
`scf::tileConsumerAndFuseProducerUsingSCF`, change all out-of-tree
implementation of `TilingInterface::getTiledImplementation` to return
the slices to continue fusion on. All in-tree implementations have been
adapted to this.
- This change touches parts that required a simplification to the
`ControlFn` in `scf::SCFTileAndFuseOptions`. It now returns a
`std::optional<scf::SCFTileAndFuseOptions::ControlFnResult>` object that
should be `std::nullopt` if fusion is not to be performed.

Signed-off-by: MaheshRavishankar <mahesh.revishankar@gmail.com>

show more ...


# c8763f04 04-Sep-2024 Yun-Fly <yunfei.song@intel.com>

[mlir][tensor] Fix consumer fusion for `tensor.pack` without explicit `outer_dims_perm` attribute (#106687)


Revision tags: llvmorg-19.1.0-rc4
# 91e57c6f 23-Aug-2024 Quinn Dawkins <quinn.dawkins@gmail.com>

[mlir][tensor] Add TilingInterface support for fusing tensor.pad (#105892)

This adds implementations for the two TilingInterface methods required
for fusion to `tensor.pad`: `getIterationDomainTile

[mlir][tensor] Add TilingInterface support for fusing tensor.pad (#105892)

This adds implementations for the two TilingInterface methods required
for fusion to `tensor.pad`: `getIterationDomainTileFromResultTile` and
`generateResultTileValue`, allowing fusion of pad with a tiled consumer.

show more ...


# f06563a5 23-Aug-2024 Yun-Fly <yunfei.song@intel.com>

[mlir][tensor] Add consumer fusion for `tensor.pack` op. (#103715)

Add missing `getIterationDomainTileFromOperandTile` and `getTiledImplementationFromOperandTile` to `tensor.pack` and enable fusing

[mlir][tensor] Add consumer fusion for `tensor.pack` op. (#103715)

Add missing `getIterationDomainTileFromOperandTile` and `getTiledImplementationFromOperandTile` to `tensor.pack` and enable fusing it as a consumer. NOTE that, it only expects perfect tiling scenario without padding semantic currently.

show more ...


Revision tags: llvmorg-19.1.0-rc3, llvmorg-19.1.0-rc2
# 5262865a 04-Aug-2024 Kazu Hirata <kazu@google.com>

[mlir] Construct SmallVector with ArrayRef (NFC) (#101896)


Revision tags: llvmorg-19.1.0-rc1, llvmorg-20-init, llvmorg-18.1.8, llvmorg-18.1.7
# 2b2ce50f 01-Jun-2024 Abhishek Varma <abhvarma@amd.com>

[MLIR][SCF] Add an API to fuse consumer to a producer within scf loop (#88712)

This commit adds an API (`tileAndFuseConsumerOfSlice`) to fuse consumer to a producer within
scf.for/scf.forall loop.

[MLIR][SCF] Add an API to fuse consumer to a producer within scf loop (#88712)

This commit adds an API (`tileAndFuseConsumerOfSlice`) to fuse consumer to a producer within
scf.for/scf.forall loop.

To support this two new methods are added to the `TilingInterface`
- `getIterationDomainTileFromOperandTile`
- `getTiledImplementationFromOperandTile`.

Consumer operations that implement this method can be used to be fused with tiled producer operands in a manner similar to (but essentially the inverse of) the fusion of an untiled producer with a tiled consumer.

Note that this only does one `tiled producer` -> `consumer` fusion. This could be called repeatedly for fusing multiple consumers. The current implementation also is conservative in when this kicks in (like single use of the value returned by the inter-tile loops that surround the tiled producer, etc.) These can be relaxed over time.

Signed-off-by: Abhishek Varma <abhvarma@amd.com>

---------

Signed-off-by: Abhishek Varma <abhvarma@amd.com>
Signed-off-by: Abhishek Varma <avarma094@gmail.com>
Co-authored-by: cxy <chenxunyu1993@gmail.com>

show more ...


Revision tags: llvmorg-18.1.6, llvmorg-18.1.5
# f220c359 23-Apr-2024 Oleksandr "Alex" Zinenko <zinenko@google.com>

Revert "[mlir][linalg] Enable fuse consumer" (#89722)

Reverts llvm/llvm-project#85528. This was committed without tests,
despite reviewers requesting tests to be added. The post-commit
discussion

Revert "[mlir][linalg] Enable fuse consumer" (#89722)

Reverts llvm/llvm-project#85528. This was committed without tests,
despite reviewers requesting tests to be added. The post-commit
discussion leans towards revert, which would be consistent with the
policy.

show more ...


# 2a47ee07 22-Apr-2024 donald chen <62002319+cxy-1993@users.noreply.github.com>

[MLIR][Linalg] Enable fuse consumer (#85528)

This patch adds support for consumer fusion to the tiling interface, and
implements fuse consumers on FuseIntoContainingOp.

- Add interface method 'g

[MLIR][Linalg] Enable fuse consumer (#85528)

This patch adds support for consumer fusion to the tiling interface, and
implements fuse consumers on FuseIntoContainingOp.

- Add interface method 'getIterDomainTilePositionFromOperandPosition' to
tiling interface which get iteration domain position from operand
position.
- Add interface method 'getTiledImplementationFromOperandPosition' to
tiling interface which generate tiled implementation according to
operand position.
- Implemented the above two methods and supported consumer fusion for
FuseIntoContainingOp.

Signed-off-by: Donald Chen

show more ...


Revision tags: llvmorg-18.1.4
# 40dd3aa9 16-Apr-2024 Matthias Springer <me@m-sp.org>

[mlir][Interfaces] `Variable` abstraction for `ValueBoundsOpInterface` (#87980)

This commit generalizes and cleans up the `ValueBoundsConstraintSet`
API. The API used to provide function overloads

[mlir][Interfaces] `Variable` abstraction for `ValueBoundsOpInterface` (#87980)

This commit generalizes and cleans up the `ValueBoundsConstraintSet`
API. The API used to provide function overloads for comparing/computing
bounds of:
- index-typed SSA value
- dimension of shaped value
- affine map + operands

This commit removes all overloads. There is now a single entry point for
each `compare` variant and each `computeBound` variant. These functions
now take a `Variable`, which is internally represented as an affine map
and map operands.

This commit also adds support for computing bounds for an affine map +
operands. There was previously no public API for that.

show more ...


Revision tags: llvmorg-18.1.3, llvmorg-18.1.2, llvmorg-18.1.1, llvmorg-18.1.0, llvmorg-18.1.0-rc4, llvmorg-18.1.0-rc3, llvmorg-18.1.0-rc2, llvmorg-18.1.0-rc1, llvmorg-19-init, llvmorg-17.0.6, llvmorg-17.0.5, llvmorg-17.0.4, llvmorg-17.0.3, llvmorg-17.0.2, llvmorg-17.0.1, llvmorg-17.0.0, llvmorg-17.0.0-rc4, llvmorg-17.0.0-rc3
# 8b68cec9 14-Aug-2023 Hanhan Wang <hanchung@google.com>

[mlir][tensor] Add producer fusion for tensor.pack op.

We are able to fuse the pack op only if inner tiles are not tiled or
they are fully used. Otherwise, it could generate a sequence of
non-trivia

[mlir][tensor] Add producer fusion for tensor.pack op.

We are able to fuse the pack op only if inner tiles are not tiled or
they are fully used. Otherwise, it could generate a sequence of
non-trivial ops.

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

show more ...


Revision tags: llvmorg-17.0.0-rc2, llvmorg-17.0.0-rc1, llvmorg-18-init
# 6596b0dd 22-Jun-2023 Matthias Springer <me@m-sp.org>

[mlir][tensor] Clean up tensor::DimOp usage

* Remove duplicate functions. `tensor::getMixedSize` and `tensor::getMixedSizes` should be used.
* Use `tensor::getMixedSize` instead of `createOrFold<ten

[mlir][tensor] Clean up tensor::DimOp usage

* Remove duplicate functions. `tensor::getMixedSize` and `tensor::getMixedSizes` should be used.
* Use `tensor::getMixedSize` instead of `createOrFold<tensor::DimOp>`. This is more efficient. `createOrFold` will create an op an immediately try to fold it. In case of a static dimension size, an attribute can be used directly.

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

show more ...


# 3e12cf2a 21-Jun-2023 Matthias Springer <me@m-sp.org>

[mlir][tensor][NFC] TilingInterface: Use Attribute instead of Value

Minor cleanup to take full advantage of OpFoldResult.

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


Revision tags: llvmorg-16.0.6, llvmorg-16.0.5, llvmorg-16.0.4, llvmorg-16.0.3
# b0674405 28-Apr-2023 Mahesh Ravishankar <ravishankarm@google.com>

[mlir][Tensor] Dont drop attributes during tiling.

Reviewed By: hanchung

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


# 4c48f016 20-Apr-2023 Matthias Springer <springerm@google.com>

[mlir][Affine][NFC] Wrap dialect in "affine" namespace

This cleanup aligns the affine dialect with all the other dialects.

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


Revision tags: llvmorg-16.0.2
# 7e5b10b9 12-Apr-2023 Nicolas Vasilache <nicolas.vasilache@gmail.com>

[mlir][Linalg] Add support for tiling tensor.pad to scf.forall

Also, properly propagate the nofold attribute.

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


# eabb6ccd 11-Apr-2023 Matthias Springer <springerm@google.com>

[mlir][linalg] Replace `getUpperBoundForIndex` implementation

Use `reifyValueBound` instead, which is more general not hard-coded to a specific list supported ops.

Also add a `closedUB` parameter t

[mlir][linalg] Replace `getUpperBoundForIndex` implementation

Use `reifyValueBound` instead, which is more general not hard-coded to a specific list supported ops.

Also add a `closedUB` parameter to the ValueBoundsOpInterface API.

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

show more ...


Revision tags: llvmorg-16.0.1
# 411b1d8f 20-Mar-2023 Mahesh Ravishankar <ravishankarm@google.com>

[mlir][Tensor] Make `TilingInterface` implementation only return handle to the created `pad` operation.

Pad tiling implementation only needs to return the tiled pad
operation. The rest of the genera

[mlir][Tensor] Make `TilingInterface` implementation only return handle to the created `pad` operation.

Pad tiling implementation only needs to return the tiled pad
operation. The rest of the generated code is related to handling
boundary conditions.

Reviewed By: hanchung

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

show more ...


Revision tags: llvmorg-16.0.0, llvmorg-16.0.0-rc4
# 809e3d8c 02-Mar-2023 Mahesh Ravishankar <ravishankarm@google.com>

[mlir][TilingInterface] Modify `TilingInterface` methods to better return the state of the transformed IR.

Currently the `getTiledImplementation` and `generateResultTileValue`
return just `SmallVect

[mlir][TilingInterface] Modify `TilingInterface` methods to better return the state of the transformed IR.

Currently the `getTiledImplementation` and `generateResultTileValue`
return just `SmallVector<Operation *>` and `FailureOr<Value>`.

- For `getTiledImplementation` returning empty implies tiling wasnt
done. There is also an implicit assumption that the tiled operation
results correspond to the tiled values of the result of the original
operation. This cannot handle cases where the tiled implementation
might use multiple operations to compute the tiled value for the
results of the untiled operation. Sometimes, the tiled operation
might not directly give the tiled values, and might require casts,
etc to get a replacement.
- For `generateResultTileValue`, it is assumed that the op defining
the returned `Value` is the operation that represents the tiled
computation. Again presence of casts, etc violate this.

Instead make these methods return
```
struct TilingResult {
SmallVector<Operation *> tiledOps;
SmallVector<Value> tiledValues;
};
```

The `tiledOps` represent the operations generated that are relevant
for subsequent transformations. The `tiledValues` represent the tiled
values for the results of the original operation. This better
transmits the state of the transformed IR.

As a consequence the following methods also return `FailureOr<TilingResult>`
- `tensor::replaceExtractSliceWithTiledProducer`
- `tensor::bubbleUpPadSlice`

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

show more ...


# 7707ed97 15-Mar-2023 Jie Fu <jiefu@tencent.com>

[mlir] Fix two build warnings (NFC)

/data/llvm-project/mlir/lib/Dialect/Tensor/Utils/Utils.cpp:62:11: error: comparison of integers of different signs: 'int64_t' (aka 'long') and 'size_t' (aka 'unsi

[mlir] Fix two build warnings (NFC)

/data/llvm-project/mlir/lib/Dialect/Tensor/Utils/Utils.cpp:62:11: error: comparison of integers of different signs: 'int64_t' (aka 'long') and 'size_t' (aka 'unsigned long') [-Werror,-Wsign-compare]
if (dim >= shape.size())
~~~ ^ ~~~~~~~~~~~~
1 error generated.

/data/llvm-project/mlir/lib/Dialect/Tensor/IR/TensorTilingInterfaceImpl.cpp:484:8: error: unused variable 'appendIndex' [-Werror,-Wunused-variable]
auto appendIndex = [&](Value val, SmallVector<Value> &dynIndices,
^
1 error generated.

show more ...


123