CodeQL / Analyze (actions) (push) Canceled after 0s
CodeQL / Analyze (python) (push) Canceled after 0s
pre-commit / pre-commit (push) Canceled after 0s
Multi-Arch CI / setup (push) Canceled after 0s
Publish build_manylinux_x86_64 images / publish_build_manylinux_x86_64 (push) Canceled after 0s
Setup (Multi-Arch) / setup (push) Canceled after 0s
Multi-Arch CI / Linux::${{ fromJSON(needs.setup.outputs.linux_build_config || '{}').build_variant_label || 'skip' }} (push) Canceled after 0s
Publish TheRock Docker image / build-and-push-image (push) Canceled after 0s
Publish no_rocm_image_ubi10 image / publish_no_rocm_image_ubi10 (push) Canceled after 0s
Multi-Arch CI / Windows::${{ fromJSON(needs.setup.outputs.windows_build_config || '{}').build_variant_label || 'skip' }} (push) Canceled after 0s
Publish TheRock Docker image / build-and-push-image (push) Canceled after 0s
Multi-Arch CI / Manifest Diff (push) Canceled after 0s
TheRock Manifest Diff Report / Generate Manifest Diff Report (push) Canceled after 0s
Multi-Arch CI / CI Summary (push) Canceled after 0s
Publish no_rocm_image_ubuntu24_04 images / publish_no_rocm_image_ubuntu24_04 (push) Canceled after 0s
Publish no_rocm_image_ubuntu24_04_ocl_rt images / publish_no_rocm_image_ubuntu24_04_ocl_rt (push) Canceled after 0s
Publish TheRock Docker image / build-and-push-image (push) Canceled after 0s
Publish TheRock Docker image / build-and-push-image (push) Canceled after 0s
Publish no_rocm_image_ubuntu24_04 images / publish_no_rocm_image_ubuntu24_04_rocgdb (push) Canceled after 0s
Publish no_rocm_image_ubuntu24_04_rocgdb images / publish_no_rocm_image_ubuntu24_04_rocgdb (push) Canceled after 0s
Publish no_rocm_image_ubuntu24_04 images / publish_no_rocm_image_ubuntu24_04_ocl_rt (push) Canceled after 0s
Publish TheRock Docker image / build-and-push-image (push) Canceled after 0s
Unit Tests / Unit Tests :: ubuntu-24.04 (push) Canceled after 0s
Unit Tests / Unit Tests :: windows-2022 (push) Canceled after 0s
Publish no_rocm_image_ubuntu24_04 images / publish_no_rocm_image_ubuntu24_04_media (push) Canceled after 0s
Unit Tests / Unit Tests Summary (push) Canceled after 0s
Publish no_rocm_image_ubuntu24_04 images / publish_no_rocm_image_ubuntu24_04_openmpi (push) Canceled after 0s
47 lines
1.9 KiB
Python
47 lines
1.9 KiB
Python
# RUN: %PYTHON %s
|
|
# It is sufficient that this doesn't assert.
|
|
|
|
from mlir.ir import *
|
|
|
|
|
|
def createDetachedModule():
|
|
module = Module.create()
|
|
with InsertionPoint(module.body):
|
|
# TODO: Python bindings are currently unaware that modules are also
|
|
# operations, so having a module erased won't trigger the cascading
|
|
# removal of live operations (#93337). Use a non-module operation
|
|
# instead.
|
|
nested = Operation.create("test.some_operation", regions=1)
|
|
|
|
# When the operation is detached from parent, it is considered to be
|
|
# owned by Python. It will therefore be erased when the Python object
|
|
# is destroyed.
|
|
nested.detach_from_parent()
|
|
|
|
# However, we create and maintain references to operations within
|
|
# `nested`. These references keep the corresponding operations in the
|
|
# "live" list even if they have been erased in C++, making them
|
|
# "zombie". If the C++ allocator reuses one of the address previously
|
|
# used for a now-"zombie" operation, this used to result in an
|
|
# assertion "cannot create detached operation that already exists" from
|
|
# the bindings code. Erasing the detached operation should result in
|
|
# removing all nested operations from the live list.
|
|
#
|
|
# Note that the assertion is not guaranteed since it depends on the
|
|
# behavior of the allocator on the C++ side, so this test mail fail
|
|
# intermittently.
|
|
with InsertionPoint(nested.regions[0].blocks.append()):
|
|
a = [Operation.create("test.some_other_operation") for i in range(100)]
|
|
return a
|
|
|
|
|
|
def createManyDetachedModules():
|
|
with Context() as ctx, Location.unknown():
|
|
ctx.allow_unregistered_dialects = True
|
|
for j in range(100):
|
|
a = createDetachedModule()
|
|
|
|
|
|
if __name__ == "__main__":
|
|
createManyDetachedModules()
|