[Mlir-commits] [mlir] [mlir][affine]introduce AffineSymbol trait and use it for using gpu.threadid op in the inner loops. (PR #118478)

Uday Bondhugula llvmlistbot at llvm.org
Thu Jan 16 07:14:50 PST 2025


================
@@ -443,9 +444,15 @@ bool mlir::affine::isValidSymbol(Value value, Region *region) {
   if (matchPattern(defOp, m_Constant(&operandCst)))
     return true;
 
-  // Affine apply operation is ok if all of its operands are ok.
-  if (auto applyOp = dyn_cast<AffineApplyOp>(defOp))
-    return applyOp.isValidSymbol(region);
+  // `Pure` operation that its operands are the valid symbolic identifiers.
+  if (isPure(defOp)) {
+    bool operandVaildSymbol =
+        llvm::all_of(defOp->getOperands(), [&](Value operand) {
+          return affine::isValidSymbol(operand, region);
+        });
+    if (operandVaildSymbol)
----------------
bondhugula wrote:

Nit: 
```
if (llvm::all_of(...)
 ...
```
Your comment above already makes it clear - no need of the separate variable.

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


More information about the Mlir-commits mailing list