[Mlir-commits] [mlir] [MLIR][XeGPU] Enhance XeGPU lane layout to support "wrap-around" distribution (PR #186958)
Artem Kroviakov
llvmlistbot at llvm.org
Thu Mar 19 08:11:11 PDT 2026
================
@@ -270,6 +270,54 @@ def DistributeLayoutAttr: AttrInterface<"DistributeLayoutAttr"> {
"FailureOr<SmallVector<SmallVector<Value>>>",
"computeDistributedCoords",
(ins "OpBuilder &": $builder, "Location":$loc, "Value":$linearId, "ArrayRef<int64_t>":$shape)>,
+ InterfaceMethod<[{Statically computes multidimensional coordinates for all dist units
+ assigned to a compute unit identified by `linearId`. This is the
+ compile-time counterpart of `computeDistributedCoords`: it performs
+ the same delinearization and round-robin enumeration but operates
+ entirely on static integer values. Returns a list of coordinate
+ vectors, one per dist unit.}],
+ /*retTy=*/"SmallVector<SmallVector<int64_t>>",
+ /*methodName=*/"computeStaticDistributedCoords",
+ /*args=*/(ins "int64_t":$linearId, "ArrayRef<int64_t>":$shape)>,
+ InterfaceMethod<[{Computes the per-compute-unit shape by dividing each dimension of
+ `shape` by the corresponding layout factor (sg_layout or
+ lane_layout). For wrap-around dimensions where the division is uneven,
+ the tensor tile is broadcasted to all subgroups/lanes.}],
+ /*retTy=*/"FailureOr<SmallVector<int64_t>>",
+ /*methodName=*/"computeDistributedShape",
----------------
akroviakov wrote:
It would be good to mention how the "distributed shape" is different from "distribution unit" in the description for clarity.
Perhaps something like `A distributed shape is composed of distribution units that equally divide it` to quickly clarify the difference.
https://github.com/llvm/llvm-project/pull/186958
More information about the Mlir-commits
mailing list