-
Notifications
You must be signed in to change notification settings - Fork 14.3k
[mlir][python][wip] remove liveOperations
#92631
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Open
makslevental
wants to merge
1
commit into
llvm:main
Choose a base branch
from
makslevental:remove_live_ops
base: main
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
Open
Changes from all commits
Commits
File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -102,27 +102,16 @@ def testRoundtripBinary(): | |
def testModuleOperation(): | ||
ctx = Context() | ||
module = Module.parse(r"""module @successfulParse {}""", ctx) | ||
assert ctx._get_live_module_count() == 1 | ||
op1 = module.operation | ||
assert ctx._get_live_operation_count() == 1 | ||
live_ops = ctx._get_live_operation_objects() | ||
assert len(live_ops) == 1 | ||
assert live_ops[0] is op1 | ||
live_ops = None | ||
# CHECK: module @successfulParse | ||
print(op1) | ||
|
||
# Ensure that operations are the same on multiple calls. | ||
op2 = module.operation | ||
assert ctx._get_live_operation_count() == 1 | ||
assert op1 is op2 | ||
assert op1 == op2 | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Does is and == differ here? |
||
|
||
# Test live operation clearing. | ||
op1 = module.operation | ||
assert ctx._get_live_operation_count() == 1 | ||
num_invalidated = ctx._clear_live_operations() | ||
assert num_invalidated == 1 | ||
assert ctx._get_live_operation_count() == 0 | ||
op1 = None | ||
gc.collect() | ||
op1 = module.operation | ||
|
@@ -136,26 +125,21 @@ def testModuleOperation(): | |
op1 = None | ||
op2 = None | ||
gc.collect() | ||
print("LIVE OPERATIONS:", ctx._get_live_operation_count()) | ||
assert ctx._get_live_operation_count() == 0 | ||
assert ctx._get_live_module_count() == 0 | ||
|
||
|
||
# CHECK-LABEL: TEST: testModuleCapsule | ||
@run | ||
def testModuleCapsule(): | ||
ctx = Context() | ||
module = Module.parse(r"""module @successfulParse {}""", ctx) | ||
assert ctx._get_live_module_count() == 1 | ||
# CHECK: "mlir.ir.Module._CAPIPtr" | ||
module_capsule = module._CAPIPtr | ||
print(module_capsule) | ||
module_dup = Module._CAPICreate(module_capsule) | ||
assert module is module_dup | ||
assert module == module_dup | ||
assert module_dup.context is ctx | ||
# Gc and verify destructed. | ||
module = None | ||
module_capsule = None | ||
module_dup = None | ||
gc.collect() | ||
assert ctx._get_live_module_count() == 0 |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Nit: module (mod just doesn't save enough). Given this is binary operator, I'd even consider lhs & rhs.