[Mlir-commits] [mlir] [MLIR][XeGPU] Refactoring insert_strided_slice layout setup and infer rules (PR #184742)

Artem Kroviakov llvmlistbot at llvm.org
Thu Mar 5 03:11:04 PST 2026


================
@@ -864,19 +933,35 @@ DistributeLayoutAttr SliceAttr::setDimData(int64_t dim, int64_t sgData,
       parent.setDimData(adjustDims[0], sgData, instData, laneData), getDims());
 }
 
+// Derive a new layout by removing dimensions.
+// `dimGroup` specifies a group of dimensions to be removed in the derived
+// layout.
+DistributeLayoutAttr SliceAttr::dropDims(SmallVector<int64_t> dimGroup) {
+  // Map the sliced dims from parent space to collapsed space
+  SmallVector<int64_t> sliceDims = llvm::to_vector(getDims().asArrayRef());
+  SmallVector<int64_t> dimsInParentSpace =
+      mapSlicedDimsToParentSpace(dimGroup, sliceDims);
+
+  auto droppedParent = getParent().dropDims(dimsInParentSpace);
+  return SliceAttr::get(getContext(), droppedParent,
+                        DenseI64ArrayAttr::get(getContext(), sliceDims));
----------------
akroviakov wrote:

So `sliceDims` does not change after dropping parent dims?
An example of the layout transformation in the comment above would be good for understanding.

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


More information about the Mlir-commits mailing list