[Mlir-commits] [mlir] [MLIR][XeGPU] Distribute vector.step & vector.shape_cast op from wg to sg (PR #155443)

Adam Siemieniuk llvmlistbot at llvm.org
Fri Sep 5 03:24:23 PDT 2025


================
@@ -563,9 +545,11 @@ struct WgToSgElementwiseOp : public ConversionPattern {
       // Copy all attributes, but update "layout_result_0" to drop
       // sgLayout/sgData
       for (auto attr : op->getAttrs()) {
-        if (auto layout = dyn_cast<xegpu::LayoutAttr>(attr.getValue())) {
-          if (auto newLayout = layout.dropSgLayoutAndData())
-            state.addAttribute(attr.getName(), newLayout);
+        if (auto layout =
+                dyn_cast<xegpu::DistributeLayoutAttr>(attr.getValue())) {
+          if (!layout.getLaneLayoutAsInt().empty() ||
+              !layout.getLaneDataAsInt().empty())
+            state.addAttribute(attr.getName(), layout.dropSgLayoutAndData());
----------------
adam-smnk wrote:

Out of curiosity (and as I already forgot), is `dropSgLayoutAndData` not callable without any lane data?
It'd be cleaner to always call it without need for these extra checks.

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


More information about the Mlir-commits mailing list