[Mlir-commits] [mlir] [mlir] Method to iterate over registered operations for a given dialect class. (PR #112344)
llvmlistbot at llvm.org
llvmlistbot at llvm.org
Wed Oct 16 11:21:46 PDT 2024
================
@@ -711,6 +714,21 @@ ArrayRef<RegisteredOperationName> MLIRContext::getRegisteredOperations() {
return impl->sortedRegisteredOperations;
}
+/// Return information for registered operations by dialect.
+ArrayRef<RegisteredOperationName>
+MLIRContext::getRegisteredOperationsByDialect(StringRef dialectName) {
+ auto lowerBound = std::lower_bound(
+ impl->sortedRegisteredOperations.begin(),
+ impl->sortedRegisteredOperations.end(), std::make_pair(dialectName, ""),
+ [](auto &lhs, auto &rhs) {
+ return lhs.getDialect().getNamespace().compare(
+ rhs.getDialect.getNamespace());
----------------
graphite-app[bot] wrote:
There appears to be a mismatch in the lambda function's comparison. The right-hand side of the comparison should be `rhs.first` to correctly match the pair created in the `lower_bound` call. The current `rhs.getDialect.getNamespace()` is both syntactically incorrect (missing parentheses) and doesn't align with the pair structure. Consider updating the lambda to:
```cpp
[](auto &lhs, auto &rhs) {
return lhs.getDialect().getNamespace().compare(rhs.first);
}
```
This change will ensure the comparison is performed correctly between the dialect namespaces.
*Spotted by [Graphite Reviewer](https://app.graphite.dev/graphite-reviewer/?org=llvm&ref=ai-review-comment)*<i class='graphite__hidden'><br /><br />Is this helpful? React 👍 or 👎 to let us know.</i>
https://github.com/llvm/llvm-project/pull/112344
More information about the Mlir-commits
mailing list