[Mlir-commits] [mlir] [mlir] Method to iterate over registered operations for a given dialect class. (PR #112344)

Rajveer Singh Bharadwaj llvmlistbot at llvm.org
Wed Oct 16 09:31:04 PDT 2024


================
@@ -188,7 +188,11 @@ class MLIRContextImpl {
 
   /// This is a sorted container of registered operations for a deterministic
   /// and efficient `getRegisteredOperations` implementation.
-  SmallVector<RegisteredOperationName, 0> sortedRegisteredOperations;
+  SmallVector<std::pair<StringRef, RegisteredOperationName>, 0>
----------------
Rajveer100 wrote:

Essentially, as you can notice we have pairs (D1, O1), (D2, O2)... and so on (where D=DialectName and O=OperationName).

Now, while inserting I am getting the lower bound for (Di, Oi) which is the next pair to insert so it gets fit in the right place in the segment of operations for a specific dialect, i.e, (D, O1), (D, O2), (D, Oi), here all D's are the same.

For retrieval, we do it in a similar way.

If we don't use pairwise elements we wouldn't know which segment (dialect class) of the sorted elements list the operation goes to since we only have the count of operations for each dialect class (via the string map I added), but we need at least one index, either start or end.

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


More information about the Mlir-commits mailing list