Skip to content

Conversation

@HodanPlodky
Copy link
Collaborator

@HodanPlodky HodanPlodky commented May 15, 2025

What I did

inter bb stack analysis

How I did it

used the intra bb analysis (dft) as a base for the inter bb by propagating the information between the basic blocks

How to verify it

Commit message

this commit implements a stack order analysis which outputs the
preferred stack layout for all basic blocks. this information is then
used in the DFT pass to create better instruction ordering / stack
scheduling at basic block boundaries which results in smaller bytecode
size.

Description for the changelog

Cute Animal Picture

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

@codecov
Copy link

codecov bot commented May 19, 2025

Codecov Report

❌ Patch coverage is 96.36364% with 6 lines in your changes missing coverage. Please review.
✅ Project coverage is 93.23%. Comparing base (8bcfa6a) to head (04ef2f0).
⚠️ Report is 1 commits behind head on master.

Files with missing lines Patch % Lines
vyper/venom/analysis/stack_order.py 95.83% 5 Missing ⚠️
vyper/venom/passes/single_use_expansion.py 75.00% 0 Missing and 1 partial ⚠️
Additional details and impacted files
@@            Coverage Diff             @@
##           master    #4646      +/-   ##
==========================================
+ Coverage   93.21%   93.23%   +0.02%     
==========================================
  Files         136      137       +1     
  Lines       19299    19452     +153     
  Branches     3316     3354      +38     
==========================================
+ Hits        17989    18136     +147     
- Misses        888      893       +5     
- Partials      422      423       +1     

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

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.


while len(worklist) > 0:
bb = worklist.popleft()
stack_order = self.stack_order.handle_bbs(list(self.cfg.cfg_out(bb)))
Copy link
Member

Choose a reason for hiding this comment

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

does the liveness need to be recomputed for these bbs?

@HodanPlodky HodanPlodky marked this pull request as ready for review August 13, 2025 13:38
self.stack.append(src)
elif src in next_live:
self.stack.append(src)
if src in self.stack:
Copy link
Collaborator

Choose a reason for hiding this comment

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

Always true

@charles-cooper charles-cooper changed the title feat[venom]: stack order analysis feat[venom]: improve inter-basic block stack ordering Oct 1, 2025
@charles-cooper charles-cooper merged commit 846bedd into vyperlang:master Oct 6, 2025
163 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