[Mlir-commits] [mlir] [mlir][spirv] Add support for SPV_ARM_graph extension - part 1 (PR #151934)
Davide Grohmann
llvmlistbot at llvm.org
Fri Aug 8 01:01:26 PDT 2025
================
@@ -31,6 +31,18 @@ static bool isNestedInFunctionOpInterface(Operation *op) {
return isNestedInFunctionOpInterface(op->getParentOp());
}
+/// Returns true if the given op is a GraphARM op or nested in a
+/// GraphARM op without a module-like op in the middle.
+static bool isNestedInGraphARMOpInterface(Operation *op) {
+ if (!op)
+ return false;
+ if (op->hasTrait<OpTrait::SymbolTable>())
----------------
davidegrohmann wrote:
This code check if the given op has a parent of type `GraphARMOp` since several op should be contained inside the defined graph scope.
Yes I think so that module-like must have a SymbolTable. The code in that file claims so as well:
```
/// Returns true if the given op is an module-like op that maintains a symbol
/// table.
static bool isDirectInModuleLikeOp(Operation *op) {
return op && op->hasTrait<OpTrait::SymbolTable>();
}
```
Also my implementation is inspired by this one:
```
/// Returns true if the given op is a function-like op or nested in a
/// function-like op without a module-like op in the middle.
static bool isNestedInFunctionOpInterface(Operation *op) {
if (!op)
return false;
if (op->hasTrait<OpTrait::SymbolTable>())
return false;
if (isa<FunctionOpInterface>(op))
return true;
return isNestedInFunctionOpInterface(op->getParentOp());
}
```
https://github.com/llvm/llvm-project/pull/151934
More information about the Mlir-commits
mailing list