Skip to content

Commit e0c17c5

Browse files
committed
Added a test
1 parent d646de8 commit e0c17c5

File tree

1 file changed

+14
-0
lines changed

1 file changed

+14
-0
lines changed

mlir/test/python/ir/context_lifecycle.py

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -47,3 +47,17 @@
4747
assert '"mlir.ir.Context._CAPIPtr"' in repr(c4_capsule)
4848
c5 = mlir.ir.Context._CAPICreate(c4_capsule)
4949
assert c4 is c5
50+
c4 = None
51+
c5 = None
52+
gc.collect()
53+
54+
# Create a global threadpool and use it in two contexts
55+
tp = mlir.ir.ThreadPool()
56+
assert tp.get_max_concurrency() > 0
57+
c5 = mlir.ir.Context()
58+
c5.enable_multithreading(False)
59+
c5.set_thread_pool(tp)
60+
c6 = mlir.ir.Context()
61+
c6.enable_multithreading(False)
62+
c6.set_thread_pool(tp)
63+
assert mlir.ir.Context._get_live_count() == 2

0 commit comments

Comments
 (0)