[mypyc] Do not preemptively diff & union op level dataflow sets#20897
Open
VaggelisD wants to merge 8 commits intopython:masterfrom
Open
[mypyc] Do not preemptively diff & union op level dataflow sets#20897VaggelisD wants to merge 8 commits intopython:masterfrom
VaggelisD wants to merge 8 commits intopython:masterfrom
Conversation
VaggelisD
commented
Feb 25, 2026
| @@ -559,8 +559,14 @@ def run_analysis( | |||
| ops = list(reversed(ops)) | |||
| for op in ops: | |||
| opgen, opkill = op.accept(gen_and_kill) | |||
Contributor
Author
There was a problem hiding this comment.
I think we could even cache the visitor result per op so we don't have to accept() twice, here and in L632, right? Not sure how worth it it is though, the visitor work is not that intensive.
edd4a71 to
feced01
Compare
for more information, see https://pre-commit.ci
for more information, see https://pre-commit.ci
aa2d03b to
5b6c1ac
Compare
for more information, see https://pre-commit.ci
Collaborator
|
Test failures are unrelated. I hope that I can fix the tests failing on master soon. |
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
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
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.
Mypyc is currently unable to compile SQLGlot's AST (~950 classes in a single file) as it dies with OOM even on a 64 gb machine.
Upon investigating, one chokehold seems to be the following line which generates the dataflow for each BB
Op; Given that most instructions generate emptykillandgensets, executing the union & difference preemptively ends up creating identicalcurcopies.I have verified that this fix locally unblocks compilation; Do note that mypyc still consumes 6-7 gbs of RAM so I'm still looking out for more improvements.