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]: improve liveness computation #4330

Merged
merged 26 commits into from
Nov 12, 2024

Conversation

charles-cooper
Copy link
Member

@charles-cooper charles-cooper commented Oct 25, 2024

What I did

move dfs order calculation from domtree to cfg analysis.

remove unnecessary calculation of domtree in sccp

remove redundant IRFunction.compute_reachability

change cfg_out order

refactor shared phi fixup code

How I did it

How to verify it

Commit message

feat[venom]: improve liveness computation

traversing in reverse topsort order improves stack scheduling slightly

this commit also adds a topsort method to CFGAnalysis, and speeds it up
by only checking the terminator instruction instead of iterating over
all the instructions in every basic block.

additional refactors:
- move dfs order calculation from domtree to cfg analysis.
- remove unnecessary calculation of domtree in sccp
- remove redundant IRFunction.compute_reachability
- change cfg_out order
- refactor shared phi fixup code
- remove useless `__eq__()` and `__hash__()` for IRBasicBlock

Description for the changelog

Cute Animal Picture

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

@charles-cooper charles-cooper marked this pull request as ready for review October 25, 2024 17:49
Copy link

codecov bot commented Oct 25, 2024

Codecov Report

Attention: Patch coverage is 29.78723% with 33 lines in your changes missing coverage. Please review.

Project coverage is 46.13%. Comparing base (063f190) to head (78da77c).

Files with missing lines Patch % Lines
vyper/venom/analysis/cfg.py 24.00% 19 Missing ⚠️
vyper/venom/function.py 16.66% 5 Missing ⚠️
vyper/venom/analysis/dominators.py 62.50% 3 Missing ⚠️
vyper/venom/passes/simplify_cfg.py 0.00% 2 Missing ⚠️
vyper/venom/venom_to_assembly.py 33.33% 2 Missing ⚠️
vyper/venom/analysis/liveness.py 0.00% 1 Missing ⚠️
vyper/venom/passes/sccp/sccp.py 50.00% 1 Missing ⚠️

❗ There is a different number of reports uploaded between BASE (063f190) and HEAD (78da77c). Click for more details.

HEAD has 97 uploads less than BASE
Flag BASE (063f190) HEAD (78da77c)
98 1
Additional details and impacted files
@@             Coverage Diff             @@
##           master    #4330       +/-   ##
===========================================
- Coverage   91.30%   46.13%   -45.18%     
===========================================
  Files         112      112               
  Lines       15921    15916        -5     
  Branches     2691     2684        -7     
===========================================
- Hits        14537     7343     -7194     
- Misses        949     8018     +7069     
- Partials      435      555      +120     

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

@@ -1,8 +1,7 @@
from typing import Iterator, Optional

from vyper.codegen.ir_node import IRnode
from vyper.utils import OrderedSet
from vyper.venom.basicblock import CFG_ALTERING_INSTRUCTIONS, IRBasicBlock, IRLabel, IRVariable
from vyper.venom.basicblock import IRBasicBlock, IRLabel, IRVariable

Check failure

Code scanning / CodeQL

Module-level cyclic import Error

'IRBasicBlock' may not be defined if module
vyper.venom.basicblock
is imported before module
vyper.venom.function
, as the
definition
of IRBasicBlock occurs after the cyclic
import
of vyper.venom.function.
@@ -1,8 +1,7 @@
from typing import Iterator, Optional

from vyper.codegen.ir_node import IRnode
from vyper.utils import OrderedSet
from vyper.venom.basicblock import CFG_ALTERING_INSTRUCTIONS, IRBasicBlock, IRLabel, IRVariable
from vyper.venom.basicblock import IRBasicBlock, IRLabel, IRVariable

Check failure

Code scanning / CodeQL

Module-level cyclic import Error

'IRLabel' may not be defined if module
vyper.venom.basicblock
is imported before module
vyper.venom.function
, as the
definition
of IRLabel occurs after the cyclic
import
of vyper.venom.function.
@@ -1,8 +1,7 @@
from typing import Iterator, Optional

from vyper.codegen.ir_node import IRnode
from vyper.utils import OrderedSet
from vyper.venom.basicblock import CFG_ALTERING_INSTRUCTIONS, IRBasicBlock, IRLabel, IRVariable
from vyper.venom.basicblock import IRBasicBlock, IRLabel, IRVariable

Check failure

Code scanning / CodeQL

Module-level cyclic import Error

'IRVariable' may not be defined if module
vyper.venom.basicblock
is imported before module
vyper.venom.function
, as the
definition
of IRVariable occurs after the cyclic
import
of vyper.venom.function.
@charles-cooper charles-cooper marked this pull request as draft October 26, 2024 22:26
@charles-cooper charles-cooper marked this pull request as ready for review October 27, 2024 02:25
@charles-cooper charles-cooper requested review from harkal and removed request for harkal October 27, 2024 15:19
@charles-cooper
Copy link
Member Author

hmm, this creates a regression in branch_storm.vy

@charles-cooper charles-cooper enabled auto-merge (squash) November 12, 2024 07:01
@charles-cooper charles-cooper changed the title refactor[venom]: move dfs order to CFGAnalysis feat[venom]: improve liveness computation Nov 12, 2024
@charles-cooper charles-cooper enabled auto-merge (squash) November 12, 2024 07:02
@charles-cooper charles-cooper merged commit 48cb39b into vyperlang:master Nov 12, 2024
154 of 155 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