[Mlir-commits] [mlir] [MLIR][XeGPU] Remove the transpose attribte from Gather/Scatter ops and Cleanup the documents (PR #145389)
Chao Chen
llvmlistbot at llvm.org
Wed Jun 25 10:19:51 PDT 2025
================
@@ -213,6 +213,37 @@ static LayoutInfo getDefaultSIMTLayoutInfo(VectorType vectorTy) {
LaneData({1, packingFactor}));
}
+/// Helper to get the default layout for a vector type.
+static LayoutInfo getDefaultSIMTLayoutInfo(xegpu::TensorDescType tdescTy) {
+ // Expecting a 1D or 2D vector.
+ assert((tdescTy.getRank() == 1 || tdescTy.getRank() == 2) &&
+ "Expected 1D or 2D TensorDesc.");
+ // Expecting int or float element type.
+ assert(tdescTy.getElementType().isIntOrFloat() &&
+ "Expected int or float element type.");
+ // If the rank is 1, then return default layout for 1D vector.
+ if (tdescTy.getRank() == 1)
+ return getDefaultSIMTLayoutInfo(1);
+ // Packing factor is determined by the element type bitwidth.
+ unsigned bitwidth = tdescTy.getElementType().getIntOrFloatBitWidth();
+
+ if (tdescTy.isScattered()) {
+ int packingFactor =
+ bitwidth < xegpu::targetinfo::packedSizeInBitsForGatherScatter
+ ? xegpu::targetinfo::packedSizeInBitsForGatherScatter / bitwidth
+ : 1;
+ return LayoutInfo(LaneLayout({xegpu::targetinfo::subgroupSize, 1}),
+ LaneData({1, packingFactor}));
+ }
----------------
chencha3 wrote:
The semantic of scattered tensor_desc explicitly defines the layout it can handle. When its user requests a different layout, it will create a conflict. I think this how the conflict is detected, and then handled. please correct me if I am wrong.
https://github.com/llvm/llvm-project/pull/145389
More information about the Mlir-commits
mailing list