8000 [dynamo] refactor codegen to minimize NULL codegen'ing · pytorch/pytorch@21516db · GitHub
[go: up one dir, main page]

Skip to content

Commit 21516db

Browse files
committed
[dynamo] refactor codegen to minimize NULL codegen'ing
ghstack-source-id: b03e902 Pull Request resolved: #153510
1 parent 4db3fc0 commit 21516db

File tree

3 files changed

+281
-205
lines changed

3 files changed

+281
-205
lines changed

torch/_dynamo/codegen.py

Lines changed: 0 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -507,22 +507,6 @@ def rot_n(self, n):
507507
create_instruction("UNPACK_SEQUENCE", arg=n),
508508
]
509509

510-
def pop_null(self):
511-
# POP_TOP doesn't work for null, so we pop nulls by pushing in a
512-
# nop function, calling it (which consumes the null), and popping the result.
513-
assert sys.version_info >= (3, 11)
514-
return [
515-
self.create_load_const_unchecked(lambda: None),
516-
# 3.13 swapped NULL and callable
517-
*(
518-
(create_instruction("SWAP", arg=2),)
519-
if sys.version_info >= (3, 13)
520-
else ()
521-
),
522-
*create_call_function(0, False),
523-
create_instruction("POP_TOP"),
524-
]
525-
526510
def pop_top(self):
527511
self.append_output(create_instruction("POP_TOP"))
528512

0 commit comments

Comments
 (0)
0