[Mlir-commits] [mlir] [XeGPU] Add sg_map for scatter verification (PR #124300)

Artem Kroviakov llvmlistbot at llvm.org
Wed Jan 29 01:19:54 PST 2025


================
@@ -453,7 +453,16 @@ LogicalResult CreateDescOp::verify() {
   if (shape != tdescShape)
     return emitOpError("Incorrect TensorDesc shape. ")
            << "Expected is " << makeString(shape) << "\n";
-
+  if (auto sgMap = tdescTy.getSGMapAttr()) {
+    if (sgMap.getWiData()[0] > 1)
+      return emitOpError("TensorDesc cannot have wi_data[0] > 1.");
+    if (chunkSize != static_cast<int>(sgMap.getWiData()[1]))
----------------
akroviakov wrote:

`chunk_size` is a consecutive chunk of data elements per work-item. 
`wi_data` indicates the number of data elements assigned to each work-item and can only be non-1 along one of the dimensions.
As we can see from the attribute description, these concepts are equivalent. Additionally, the [documentation](https://github.com/intel/mlir-extensions/blob/main/docs/rfcs/XeGPU.md#rules-of-sg_map-setting-for-load-and-store-on-pvc-and-arc) on scattered tdesc explicitly mentions `wi_data` rules:
> For regular load with chunk_size, `wi_data[1]` must be equal to the chunk size:
> #sg_map_t = xegpu.sg_map<wi_layout = [subgroup_size, 1], wi_data = [1, chunk_size]>


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


More information about the Mlir-commits mailing list