Skip to content
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

feat[venom]: avoid last swap for commutative ops #4048

Merged
merged 19 commits into from
May 28, 2024

Conversation

harkal
Copy link
Collaborator

@harkal harkal commented May 23, 2024

What I did

Commutative op aware scheduling

How I did it

How to verify it

Commit message

This commit implements a simple "last swap" avoidance for commutative ops.
Additionally, it renames then `get_inputs()` method to `get_input_variables()`
in `IRInstruction` for clarity and consistency

Description for the changelog

Cute Animal Picture

Put a link to a cute animal picture inside the parenthesis-->

@harkal harkal marked this pull request as ready for review May 28, 2024 10:43
@harkal harkal changed the title feat[venom]: stack optimization feat[venom]: last swap avoidance for commutative ops May 28, 2024
@@ -40,7 +40,7 @@ def _process_instruction_r(self, bb: IRBasicBlock, inst: IRInstruction, offset:
self.inst_order[inst] = 0
return

for op in inst.get_inputs():
for op in list(inst.get_input_variables()):
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

iterator doesn't work?

Copy link
Member

@charles-cooper charles-cooper left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

i'd prefer to just inspect the inputs and see which one is top of stack, but this works (and it may support more stack optimizations in the future)

@charles-cooper charles-cooper changed the title feat[venom]: last swap avoidance for commutative ops feat[venom]: avoid last swap for commutative ops May 28, 2024
@charles-cooper charles-cooper merged commit d6b300d into vyperlang:master May 28, 2024
155 checks passed
@charles-cooper charles-cooper deleted the feat/stack_optimization branch May 28, 2024 16:40
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants