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

tune code size / gas for bytes copy routines #2738

Closed
wants to merge 11 commits into from

Conversation

charles-cooper
Copy link
Member

@charles-cooper charles-cooper commented Mar 31, 2022

What I did

fix #2656, also unroll copy_bytes when the number of words is small (<8).

should refactor a little because a couple code paths look suspiciously similar. also consider exposing the constants UNROLL_WORD_COPY_TUNING and ROLL_ARRAY_TUNING as optimizer options.

How I did it

How to verify it

check IR following contract -- foo has loops, bar has unrolled, baz has loops

w: uint256[15]
@external
def foo(x: uint256[15]) -> uint256[15]:
    y: uint256[15] = x
    z: uint256[15] = y
    self.w = z
    return z

w2: uint256[5]
@external
def bar(x: uint256[5]) -> uint256[5]:
    y: uint256[5] = x
    z: uint256[5] = y
    self.w2 = z
    return z

@external
def baz(x: int128[7]) -> int128[7]:
    return x

Commit message

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

image

@codecov-commenter
Copy link

codecov-commenter commented Mar 31, 2022

Codecov Report

Merging #2738 (591ba5c) into master (6fdeb84) will decrease coverage by 18.29%.
The diff coverage is 60.39%.

@@             Coverage Diff             @@
##           master    #2738       +/-   ##
===========================================
- Coverage   86.66%   68.37%   -18.30%     
===========================================
  Files          93       93               
  Lines        9886     9910       +24     
  Branches     2420     2423        +3     
===========================================
- Hits         8568     6776     -1792     
- Misses        831     2458     +1627     
- Partials      487      676      +189     
Impacted Files Coverage Δ
vyper/codegen/ir_node.py 90.60% <ø> (-1.88%) ⬇️
vyper/codegen/stmt.py 67.46% <0.00%> (-21.43%) ⬇️
vyper/codegen/core.py 67.04% <61.00%> (-17.05%) ⬇️
vyper/ast/natspec.py 12.34% <0.00%> (-86.42%) ⬇️
vyper/ir/s_expressions.py 5.88% <0.00%> (-85.30%) ⬇️
vyper/cli/utils.py 16.66% <0.00%> (-71.43%) ⬇️
vyper/codegen/function_definitions/utils.py 28.57% <0.00%> (-71.43%) ⬇️
vyper/cli/vyper_json.py 9.38% <0.00%> (-70.40%) ⬇️
vyper/compiler/output.py 29.37% <0.00%> (-64.41%) ⬇️
vyper/compiler/utils.py 36.00% <0.00%> (-56.00%) ⬇️
... and 51 more

Continue to review full report at Codecov.

Legend - Click here to learn more
Δ = absolute <relative> (impact), ø = not affected, ? = missing data
Powered by Codecov. Last update 6fdeb84...591ba5c. Read the comment docs.

@charles-cooper
Copy link
Member Author

superseded by #3483

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.

codesize regression with large calldata arrays which need to be clamped
2 participants