[Mlir-commits] [mlir] [MLIR] Add continuous tiling to TileUsingForOp (PR #82792)

llvmlistbot at llvm.org llvmlistbot at llvm.org
Tue Apr 2 06:05:55 PDT 2024


muneebkhan85 wrote:

> > > High level comment, why cant this just be an after tile and fuse peeling transformation. What is happening here seems to be peeling applied repeatedly.
> > 
> > 
> > An issue here is that the static tile size is created using AffineMin at the time of creating the loop nests. This makes the issue more complicated than just having to create new tail-loops and clone regions from the original loop into it.
> 
> Sorry for the delay. I am still not convinced this is the easiest way to doing this. Looking at the description, you are trying to split full tiles and partial tiles (and then applying that recursively). As easier approach to me is to do something like this
> 
> ```
> %result = <linalg_op>(%operand1, %operand2, ...)
> ```
> 
> you can first split into two
> 
> ```
> %operand0_slice = tensor.extract_slice %operand0
> %operand1_slice = tensor.extract_slice %operand1
> ....
> %result_slice = <linalg_op>(%operand0_slice, %operand1_slice,...)
> ...
> %operand0_remaining = tensor.extract_slice %operand0
> %operand1_remaining = tensor.extract_slice %operand1
> ....
> %result_remaining = <linalg_op>(%operand0_remaining, %operand1_remaining)
> ....
> %result = tensor.insert_slice %result_slice into ....
> %result1 = tensor.insert_slice %result_remaining  into ...
> ```
> 
> Now you can tile the individual ops. This does not need any changes to the Tiling implementation itself, and is also modular. You can take the second linalg op and apply the same procedure repeatedly to get all the different loops. That would be upto the caller to do (or wrapped in a helper function), but the core logic is just this one step.

@MaheshRavishankar Thank you for the comments. After some deliberation we have decided to take another route for this without requiring any changes to the tiling logic. Please see the discussions here

https://github.com/llvm/llvm-project/pull/82792#issuecomment-2011851728

together with the example posted here

https://github.com/llvm/llvm-project/pull/82792#issuecomment-2015240405

The idea is to create an op `continuous_tile_sizes` that -- when provided a linalg op, dimension to tile and tile size -- would return as result 1) a list of `tile sizes`, and 2) a list of `split points` in a pattern similar to `multitile_sizes` except that each of these lists would contain more than one element. Then, using a multi-way split, we could use the existing tiling op to achieve  continuous tiling.



https://github.com/llvm/llvm-project/pull/82792


More information about the Mlir-commits mailing list