[Mlir-commits] [mlir] [MLIR][XeGPU] Extend SGMapAttr and Add ConvertLayoutOp (PR #132425)
Adam Siemieniuk
llvmlistbot at llvm.org
Thu Apr 3 04:59:54 PDT 2025
================
@@ -105,6 +105,28 @@ isArgShapesValid(TensorDescType tdescTy, VectorType valueTy,
<< " for tensor descriptor " << tdescTy;
}
+static bool isEvenDistributed(llvm::ArrayRef<int64_t> shape,
+ xegpu::LayoutAttr attr) {
+ assert(attr && "Layout attribute is missing.");
+ llvm::SmallVector<int32_t> defaults(shape.size(), 1);
+ llvm::ArrayRef<int32_t> layout, data;
+ if (auto sg_layout = attr.getSgLayout()) {
+ layout = sg_layout.asArrayRef();
+ auto sg_data = attr.getSgData();
+ data = sg_data ? sg_data.asArrayRef() : defaults;
+ } else {
+ layout = attr.getLaneLayout().asArrayRef();
+ auto lane_data = attr.getLaneData();
+ data = lane_data ? lane_data.asArrayRef() : defaults;
+ }
+ for (auto [s, d, l] : llvm::zip_equal(shape, data, layout)) {
----------------
adam-smnk wrote:
I would suggest a bit more expressive variable names.
https://github.com/llvm/llvm-project/pull/132425
More information about the Mlir-commits
mailing list