[Mlir-commits] [mlir] [MLIR][Python] Make the TypeID allocator globally defined in `PassManager.add` (PR #162594)
llvmlistbot at llvm.org
llvmlistbot at llvm.org
Wed Oct 8 23:13:45 PDT 2025
================
@@ -52,6 +52,23 @@ class PyPassManager {
MlirPassManager passManager;
};
+class PyTypeIDAllocator {
+public:
+ PyTypeIDAllocator() : allocator(mlirTypeIDAllocatorCreate()) {}
+ ~PyTypeIDAllocator() {
+ if (!allocator.ptr)
+ mlirTypeIDAllocatorDestroy(allocator);
+ }
+
+ MlirTypeIDAllocator get() { return allocator; }
+ MlirTypeID allocate() { return mlirTypeIDAllocatorAllocateTypeID(allocator); }
+
+private:
+ MlirTypeIDAllocator allocator;
+};
+
+PyTypeIDAllocator globalTypeIDAllocator;
----------------
PragmaTwice wrote:
Done in https://github.com/llvm/llvm-project/pull/162594/commits/3b3c3f6b4f85eda3f8b1f0fb0659202a83ce8204.
https://github.com/llvm/llvm-project/pull/162594
More information about the Mlir-commits
mailing list