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]: make dft-pass commutative aware #4358

Merged
merged 14 commits into from
Nov 20, 2024

Conversation

charles-cooper
Copy link
Member

@charles-cooper charles-cooper commented Nov 12, 2024

use the "choice" heuristic for commutative instructions

refactor/misc:
some small code cleanup in dft pass

What I did

How I did it

How to verify it

Commit message

this commit performs some code cleanup for `DFTPass`. it separates the
effects graph from the data dependency graph, and applies the heuristic
for barriers to commutative and comparator instructions as well.

Description for the changelog

Cute Animal Picture

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

use the "choice" heuristic for commutative instructions

refactor/misc:
some small code cleanup in dft pass
Copy link

codecov bot commented Nov 12, 2024

Codecov Report

Attention: Patch coverage is 21.05263% with 15 lines in your changes missing coverage. Please review.

Project coverage is 45.94%. Comparing base (c32b9b4) to head (1ebc876).

Files with missing lines Patch % Lines
vyper/venom/passes/dft.py 0.00% 9 Missing ⚠️
vyper/venom/basicblock.py 40.00% 6 Missing ⚠️

❗ There is a different number of reports uploaded between BASE (c32b9b4) and HEAD (1ebc876). Click for more details.

HEAD has 139 uploads less than BASE
Flag BASE (c32b9b4) HEAD (1ebc876)
140 1
Additional details and impacted files
@@             Coverage Diff             @@
##           master    #4358       +/-   ##
===========================================
- Coverage   91.23%   45.94%   -45.30%     
===========================================
  Files         112      112               
  Lines       16010    16015        +5     
  Branches     2697     2699        +2     
===========================================
- Hits        14607     7358     -7249     
- Misses        968     8097     +7129     
- Partials      435      560      +125     

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

@harkal
Copy link
Collaborator

harkal commented Nov 20, 2024

This seems to be regressing on CurveStableSwapNG

@charles-cooper
Copy link
Member Author

This seems to be regressing on CurveStableSwapNG

i'm seeing an improvement --
master:

$ time vnm tmp/CurveStableSwapNG-0.4.1.vy  | wc
      1       1   43225

real	0m4.694s
user	0m4.507s
sys	0m0.191s

dft-commutative:

$ time vnm tmp/CurveStableSwapNG-0.4.1.vy  | wc
      1       1   43153

real	0m4.648s
user	0m4.468s
sys	0m0.186s

@@ -434,13 +434,6 @@ def _generate_evm_for_instruction(
# the same variable, however, before a jump that is not possible
self._stack_reorder(assembly, stack, list(target_stack))

if inst.is_commutative:
Copy link
Collaborator

Choose a reason for hiding this comment

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

This creates regression for me (if I reintroduce it it will create smaller codesize on curve swap)

Copy link
Member Author

Choose a reason for hiding this comment

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

indeed

Copy link
Member Author

Choose a reason for hiding this comment

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

interestingly, i found that "always flip if is_commutative" actually performs better for curve swap than any heuristic i came up with.

@charles-cooper charles-cooper merged commit 215de1d into vyperlang:master Nov 20, 2024
156 checks passed
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.

3 participants