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]: memory write merging #4341

Open
wants to merge 51 commits into
base: master
Choose a base branch
from

Conversation

HodanPlodky
Copy link
Collaborator

What I did

Reimplementation of methods from original pipeline optimizer into the venom pipeline, that handled merging of the multiple memory operations that writes into the continuous chuck of the memory into one instruction that does in batch.

How I did it

Created new pass for this purpose

How to verify it

I have written new tests

Commit message

feat[venom]: venom pipeline memory coalescing

Commit message for the final, squashed PR. (Optional, but reviewers will appreciate it! Please see our commit message style guide for what we would ideally like to see in a commit message.)

Description for the changelog

Cute Animal Picture

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

@charles-cooper
Copy link
Member

looking very nice

@HodanPlodky HodanPlodky changed the title feat[venom]: Memory write merging feat[venom]: memory write merging Nov 5, 2024
vyper/venom/passes/memmerging.py Fixed Show fixed Hide fixed
vyper/venom/passes/memmerging.py Fixed Show fixed Hide fixed
Copy link

codecov bot commented Nov 6, 2024

Codecov Report

Attention: Patch coverage is 84.83146% with 27 lines in your changes missing coverage. Please review.

Project coverage is 88.52%. Comparing base (e98e004) to head (43f7bd8).

Files with missing lines Patch % Lines
vyper/venom/passes/memmerging.py 84.57% 15 Missing and 12 partials ⚠️
Additional details and impacted files
@@            Coverage Diff             @@
##           master    #4341      +/-   ##
==========================================
- Coverage   91.31%   88.52%   -2.79%     
==========================================
  Files         113      114       +1     
  Lines       16061    16238     +177     
  Branches     2703     2742      +39     
==========================================
- Hits        14666    14375     -291     
- Misses        964     1334     +370     
- Partials      431      529      +98     

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

return a < b

def overlap(self, other: "_Interval") -> bool:
a = max(self.src_start, other.src_end)
Copy link
Collaborator

Choose a reason for hiding this comment

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

Suggested change
a = max(self.src_start, other.src_end)
a = max(self.src_start, other.src_start)

intervals.clear()

def _add_interval(
self, intervals: list[_Interval], new_inter: _Interval, ok_dst_overlap: bool = False
Copy link
Collaborator

Choose a reason for hiding this comment

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

Maybe use a better name for ok_dst_overlap? Something like allow_dst_overlap_src would be more self explanatory. I would pair that with changing the dst_overlap to dst_overlaps_src()

intervals.insert(index, new_inter)
if index > 0:
if intervals[index - 1].overlap(new_inter):
return False
Copy link
Collaborator

Choose a reason for hiding this comment

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

Shouldn't we be removing the interval we just added here? Or do the insert after the checks?

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