[Mlir-commits] [mlir] [mlir][tensor][NFC] Improve documentation of pack/unpack (PR #72201)
lorenzo chelini
llvmlistbot at llvm.org
Wed Nov 15 01:04:50 PST 2023
================
@@ -1753,42 +1753,66 @@ def Tensor_PackOp : Tensor_RelayoutOp<"pack", [
AttrSizedOperandSegments]> {
let summary = "tensor pack operation";
let description = [{
- The pack operation converts an input tensor to a higher-dimensional tensor
- with a tiled and packed layout. The mandatory `inner_dims_pos` attribute
- specifies a permutation for the original dimensions, while `inner_tiles` is the
- tiling factor for each dimension. The optional attribute `outer_dims_perm`
- specifies the order for the tiled data dimension, while the attribute
- `padding_value` specifies a padding value at the boundary on non-perfectly
- divisible dimensions. Padding is optional:
- - If absent, it is UB if the tile does not perfectly divide the dimension.
- - If present, it will pad along high dimensions (high-padding) to make the
- tile complete.
+ The "pack" operation converts a source tensor of rank `n` into a result
+ tensor of rank `n + k` with a tiled and packed layout (maybe with padding)
+ and optionally transposes the original tiled loop dimensions.
+
+ `inner_dims_pos` (mandatory) specifies `k` source tensor dimensions that are
----------------
chelini wrote:
...The order of the dimensions matters: the tiled dimensions (of size `inner_tiles`) are added to the end of the result tensor in the order in which they appear in `inner_dims_pos`.... Is a bit confusing. The order in which we append the tile for the result tensor is basically `inner_tiles`, it is not the order given by `inner_dims_pos`.
I would re-write as: `inner_dims_pos` (mandatory) specifies `k` source tensor dimensions being tiled, where `0 < k <= n`. The order of the dimensions matters: `inner_dims_pos[k]` represents the source tensor dimension index tiled by the tile size at position `k` in `inner_tiles.`
https://github.com/llvm/llvm-project/pull/72201
More information about the Mlir-commits
mailing list