[Mlir-commits] [mlir] [MLIR][XeGPU] Fix a bug in Layout interface: isCompatibleWith() function (PR #188607)

Charitha Saumya llvmlistbot at llvm.org
Thu Mar 26 16:54:18 PDT 2026


================
@@ -798,14 +798,16 @@ bool LayoutAttr::isCompatibleWith(const xegpu::DistributeLayoutAttr &other,
   if (!other)
     return false;
   if (getEffectiveOrderAsInt() == other.getEffectiveOrderAsInt()) {
+    // short cut when order is the same, no need to compute coords and compare
     if (level == xegpu::LayoutKind::Subgroup)
-      return (getEffectiveSgLayoutAsInt() ==
-                  other.getEffectiveSgLayoutAsInt() &&
-              getEffectiveSgDataAsInt() == other.getEffectiveSgDataAsInt());
+      if (getEffectiveSgLayoutAsInt() == other.getEffectiveSgLayoutAsInt() &&
+          getEffectiveSgDataAsInt() == other.getEffectiveSgDataAsInt())
+        return true;
     if (level == xegpu::LayoutKind::Lane)
-      return (getEffectiveLaneLayoutAsInt() ==
-                  other.getEffectiveLaneLayoutAsInt() &&
-              getEffectiveLaneDataAsInt() == other.getEffectiveLaneDataAsInt());
+      if (getEffectiveLaneLayoutAsInt() ==
+              other.getEffectiveLaneLayoutAsInt() &&
+          getEffectiveLaneDataAsInt() == other.getEffectiveLaneDataAsInt())
+        return true;
----------------
charithaintc wrote:

code looks equivalent? 

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


More information about the Mlir-commits mailing list