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]: binopt #4281

Open
wants to merge 192 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from 13 commits
Commits
Show all changes
192 commits
Select commit Hold shift + click to select a range
123c07d
start binopt
HodanPlodky Oct 7, 2024
bb80541
better way of doing it
HodanPlodky Oct 8, 2024
79e3880
idea with equivalence analysis
HodanPlodky Oct 8, 2024
59dcdf5
more rules
HodanPlodky Oct 9, 2024
b543c36
all the rules from the original optimizer should be done
HodanPlodky Oct 9, 2024
f4650e3
all the rules from the original optimizer were not done so I added so…
HodanPlodky Oct 9, 2024
32ff283
lint
HodanPlodky Oct 9, 2024
ba0e245
different order
HodanPlodky Oct 9, 2024
5e74741
fixed test which no longer needed to be expected to fail
HodanPlodky Oct 10, 2024
3868042
removed _handle_offsets and fully moved it to the rest of the bin opt…
HodanPlodky Oct 10, 2024
1105344
truthy rules start
HodanPlodky Oct 10, 2024
8e4500e
adapted test for out of bounds check to take account static asserts e…
HodanPlodky Oct 10, 2024
eebed21
adapted test for out of bounds check to take account static asserts e…
HodanPlodky Oct 10, 2024
41960e8
Merge branch 'master' into feat/binopt
HodanPlodky Oct 10, 2024
d025563
Merge branch 'master' into feat/binopt
HodanPlodky Oct 10, 2024
4c5ee06
truthy continuation
HodanPlodky Oct 11, 2024
63fdfd5
truthy fix of eq
HodanPlodky Oct 13, 2024
3a6dbf9
more comparison ops opt
HodanPlodky Oct 13, 2024
a4e152b
better check of dict from charles
HodanPlodky Oct 15, 2024
ec0b5f2
Merge branch 'master' into feat/binopt
HodanPlodky Oct 15, 2024
c28dc4a
quick fix after merge
HodanPlodky Oct 15, 2024
2f1367f
more rules
HodanPlodky Oct 15, 2024
6150fc7
Merge branch 'master' into feat/binopt
HodanPlodky Oct 15, 2024
a4e996a
used commutative
HodanPlodky Oct 15, 2024
6f3a06f
better adding of additional instructions
HodanPlodky Oct 15, 2024
052f6bb
better rules handling start
HodanPlodky Oct 16, 2024
db0d608
better rules handling start
HodanPlodky Oct 16, 2024
83dec6a
more rules moved
HodanPlodky Oct 16, 2024
e52f8e8
Merge branch 'master' into feat/binopt
HodanPlodky Oct 17, 2024
9620ed1
more rules and more way to implement them
HodanPlodky Oct 17, 2024
372317c
more rules in different way
HodanPlodky Oct 17, 2024
7e69bf5
more rules in different way
HodanPlodky Oct 18, 2024
d084c1f
move some of the binopt into the sccp
HodanPlodky Oct 23, 2024
b2c8bd2
fix of the negative number rules
HodanPlodky Oct 24, 2024
db29ad5
removed the opts from algebraic ops
HodanPlodky Oct 24, 2024
9655460
lint + cleanup
HodanPlodky Oct 24, 2024
4b0ec3b
moved test for offsets from algebraic optimizer to sccp test
HodanPlodky Oct 24, 2024
8989fd9
added jnz to truthy
HodanPlodky Oct 24, 2024
9603690
uses calc on fly
HodanPlodky Oct 24, 2024
7bf4667
uses calc on fly fix
HodanPlodky Oct 24, 2024
22df052
sccp reduced recalc
HodanPlodky Oct 24, 2024
53d4122
used dfg instead of the different uses computation
HodanPlodky Oct 25, 2024
c63ab04
Merge branch 'master' into feat/binopt
HodanPlodky Oct 28, 2024
137cb1e
dfg calculation on fly and assert weird behaviour
HodanPlodky Oct 28, 2024
1e0aa69
sccp static assert fix
HodanPlodky Oct 29, 2024
b99ea0e
lint and comments
HodanPlodky Oct 29, 2024
4da9851
cleanup of the algebraic pass
HodanPlodky Oct 30, 2024
051d291
added the explanation for pass in except branch in test
HodanPlodky Oct 30, 2024
b140669
test sccp cleanup after debug
HodanPlodky Oct 30, 2024
565deee
sccp cleanup (comparison ops)
HodanPlodky Oct 30, 2024
39b5ee1
sccp cleanup (recalc)
HodanPlodky Oct 30, 2024
f0b7a86
lint
HodanPlodky Oct 30, 2024
180aa28
dfg cleanup
HodanPlodky Oct 30, 2024
fafc256
Merge branch 'master' into feat/binopt
HodanPlodky Oct 30, 2024
49b4f37
sccp binopt new rule
HodanPlodky Nov 5, 2024
905dcb8
small refactor
HodanPlodky Nov 5, 2024
223d35b
lint
HodanPlodky Nov 5, 2024
79fa212
Merge branch 'master' into feat/binopt
HodanPlodky Nov 6, 2024
3aa9bba
Merge branch 'master' into feat/binopt
HodanPlodky Nov 18, 2024
9c900e9
reachability
HodanPlodky Nov 19, 2024
8409c8f
test fixup
HodanPlodky Nov 19, 2024
ebee138
new rule
HodanPlodky Nov 20, 2024
58fdc94
fixes and cleanup of the new rule
HodanPlodky Nov 20, 2024
a1e39b8
Merge branch 'master' into feat/binopt
HodanPlodky Nov 20, 2024
a5fd090
Merge branch 'vyperlang:master' into feat/binopt
HodanPlodky Nov 21, 2024
cc37897
fixes
HodanPlodky Nov 22, 2024
07140cb
recursive traverse in algebraic opt
HodanPlodky Nov 22, 2024
15aea85
Merge branch 'master' into feat/binopt
HodanPlodky Nov 28, 2024
e8daa16
mem2var ignore nop ops
HodanPlodky Nov 29, 2024
eaa78eb
mem2var ignore nop ops
HodanPlodky Nov 29, 2024
d3e6143
loop traverse
HodanPlodky Dec 4, 2024
e6286e6
loop traversel fix and skip unimportant instruction
HodanPlodky Dec 5, 2024
706c4d9
changed how to match the intruction
HodanPlodky Dec 5, 2024
fe3ba6c
Merge branch 'master' into feat/binopt
HodanPlodky Dec 5, 2024
2aacb95
assert opt reenabled
HodanPlodky Dec 5, 2024
f3d25c5
moved local function into the methods
HodanPlodky Dec 10, 2024
4038881
early returns
HodanPlodky Dec 10, 2024
5bbd024
early assert
HodanPlodky Dec 10, 2024
8c8d0a3
Merge branch 'master' into feat/binopt
HodanPlodky Dec 10, 2024
8d9392b
more early returns to ignore more expensive places
HodanPlodky Dec 10, 2024
d044324
more early returns to ignore more expensive places
HodanPlodky Dec 10, 2024
0d2876f
lint
HodanPlodky Dec 10, 2024
c3e3593
removed unnecessery early return
HodanPlodky Dec 10, 2024
1ca086f
more refactor
HodanPlodky Dec 10, 2024
34201a5
lint
HodanPlodky Dec 11, 2024
b877185
combined the constant propagation and binopt
HodanPlodky Dec 11, 2024
461d0c0
optimization of pass runtime
HodanPlodky Dec 13, 2024
57d4bdd
Merge branch 'master' into feat/binopt
HodanPlodky Dec 18, 2024
9ad6236
test, improvment for operand equality and removed operation which do …
HodanPlodky Dec 18, 2024
e849f2c
Merge branch 'master' into feat/binopt
HodanPlodky Dec 18, 2024
fa5e043
lint
HodanPlodky Dec 18, 2024
49e2994
tests
HodanPlodky Dec 18, 2024
84bfa12
tests
HodanPlodky Dec 20, 2024
f4e2ace
Merge branch 'master' into feat/binopt
HodanPlodky Dec 23, 2024
a36de0b
Merge branch 'master' into feat/binopt
HodanPlodky Dec 28, 2024
119bd06
Merge branch 'master' into feat/binopt
HodanPlodky Dec 30, 2024
4436564
test and small improvements
HodanPlodky Dec 30, 2024
13aae41
Merge branch 'master' into feat/binopt
HodanPlodky Jan 1, 2025
e5533d8
moved the optimizations into the algebraic optimization pass
HodanPlodky Jan 1, 2025
8f1a48e
fix for the test that worked in bin opt but is expected fail in master
HodanPlodky Jan 2, 2025
6e5bb90
quick fix for better bytecode size
HodanPlodky Jan 2, 2025
0f11b81
explanatory comment
HodanPlodky Jan 2, 2025
70454bc
removed some unused code and renames
HodanPlodky Jan 2, 2025
997f6d8
order of passes
HodanPlodky Jan 3, 2025
7a69e65
moved multication like ops zero optimization into eval
HodanPlodky Jan 3, 2025
8fca0aa
moved mod and smod rule from algebraic opt to sccp eval
HodanPlodky Jan 3, 2025
9db6a32
moved exp rules from algebraic opt to sccp eval
HodanPlodky Jan 3, 2025
54d0a83
lint
HodanPlodky Jan 3, 2025
ec3762e
moved xor and sub rule to eval
HodanPlodky Jan 3, 2025
34f1284
Merge branch 'master' into feat/binopt
HodanPlodky Jan 3, 2025
2618309
merge
HodanPlodky Jan 3, 2025
b1045fa
removed unreachable
HodanPlodky Jan 5, 2025
7935856
removed unused ver
HodanPlodky Jan 5, 2025
c801100
small pass reorder
HodanPlodky Jan 5, 2025
578bf09
Update vyper/venom/passes/algebraic_optimization.py
HodanPlodky Jan 6, 2025
74b897e
comments
HodanPlodky Jan 6, 2025
f7ee285
removed unnecessery assert logic
HodanPlodky Jan 7, 2025
fde144b
lint
HodanPlodky Jan 7, 2025
f8a4dad
test fix
HodanPlodky Jan 7, 2025
42f8904
removed unnecessery while and condition
HodanPlodky Jan 8, 2025
54b6e58
renamed some wrappers
HodanPlodky Jan 8, 2025
28a75ce
lint
HodanPlodky Jan 8, 2025
3506bff
review changes and eval_arith
HodanPlodky Jan 8, 2025
50932bd
update a comment
charles-cooper Jan 8, 2025
dfe20f8
small refactor
charles-cooper Jan 8, 2025
9a14849
or rule in sccp
HodanPlodky Jan 8, 2025
35308aa
or rule in sccp
HodanPlodky Jan 8, 2025
8a0780e
refactor or op
charles-cooper Jan 8, 2025
647e838
use lit_eq in more places
charles-cooper Jan 8, 2025
2dc2d5e
priority goes to literal eval
charles-cooper Jan 8, 2025
f419df3
rewrite comparison ops
charles-cooper Jan 8, 2025
2c9bc48
refactor: more lit_eq
charles-cooper Jan 8, 2025
4985150
refactor sccp eval
charles-cooper Jan 8, 2025
f2496cd
small fixes
charles-cooper Jan 8, 2025
da1f88a
remove redundant rule (it is covered in sccp)
charles-cooper Jan 8, 2025
60f5c48
refactor: import shared lit_eq from sccp
charles-cooper Jan 8, 2025
9dc67e8
update COMPARISON_OPS to shared variable, add review comments
charles-cooper Jan 8, 2025
57d548b
remove dead code
charles-cooper Jan 8, 2025
f8b2821
minor style updates
charles-cooper Jan 8, 2025
82014f1
style rename: n_op => val
charles-cooper Jan 8, 2025
008e52c
more refactor to use lit_eq
charles-cooper Jan 8, 2025
6c940fb
review
charles-cooper Jan 8, 2025
9eeb046
types fix
HodanPlodky Jan 9, 2025
a02f6a0
fix of possible double flip
HodanPlodky Jan 9, 2025
c7ef119
reviews
HodanPlodky Jan 9, 2025
7bae487
handle offsets and reviews
HodanPlodky Jan 10, 2025
6a9b38c
passes wont return bool
HodanPlodky Jan 10, 2025
5cb53f9
Merge branch 'master' into feat/binopt
HodanPlodky Jan 10, 2025
e850d13
rename to private
HodanPlodky Jan 10, 2025
81b5dab
removed get_uses_ignore_nops
HodanPlodky Jan 10, 2025
bbe60e5
fix
HodanPlodky Jan 10, 2025
da9283a
better api for update
HodanPlodky Jan 11, 2025
fcb20e9
moved logic for last iter
HodanPlodky Jan 11, 2025
dab7a08
removed stray file
HodanPlodky Jan 11, 2025
ae8ae4a
test comments
HodanPlodky Jan 11, 2025
67d2d8c
change resolution of timeit to micros
charles-cooper Jan 11, 2025
54040ee
refactor algebraic opts
charles-cooper Jan 11, 2025
b7c703e
test refactor
HodanPlodky Jan 11, 2025
e0f652b
add some comments, update some constants
charles-cooper Jan 11, 2025
92e8570
0 divided by anything is 0
charles-cooper Jan 11, 2025
300f985
add comparison to zero test
charles-cooper Jan 11, 2025
1f4b0d5
Merge branch 'master' into feat/binopt
charles-cooper Jan 11, 2025
f54c246
test -1 - x -> ~x test
HodanPlodky Jan 11, 2025
a7fd908
removed dead code
HodanPlodky Jan 11, 2025
1097a85
small renames
charles-cooper Jan 12, 2025
43650a4
moved condition inverse factor out
HodanPlodky Jan 12, 2025
366563c
small explenatary comment
HodanPlodky Jan 13, 2025
d26ce8e
small test change
HodanPlodky Jan 13, 2025
aa6d9f9
lint
HodanPlodky Jan 13, 2025
e9d7849
Merge branch 'master' into feat/binopt
HodanPlodky Jan 13, 2025
dcedf4c
eq rule
HodanPlodky Jan 13, 2025
6d7a612
move some rules around
charles-cooper Jan 13, 2025
ca9371a
readability
charles-cooper Jan 13, 2025
18cd93e
add update_operands util
charles-cooper Jan 13, 2025
78ac094
add a comment
charles-cooper Jan 13, 2025
24d4662
minor rename, comments
charles-cooper Jan 13, 2025
dc4f34a
signess fix
HodanPlodky Jan 13, 2025
ee70d8b
signess fix
HodanPlodky Jan 13, 2025
ed2ac2d
removed unnecessary update
HodanPlodky Jan 13, 2025
7d79cfb
update dfg in place
charles-cooper Jan 13, 2025
10ac1db
optimize order of opts
charles-cooper Jan 13, 2025
43e1016
handle inst_ge_le in loop
charles-cooper Jan 13, 2025
2641f39
move things around, rename
charles-cooper Jan 13, 2025
7cc3d08
draft: refactor comparison operators
charles-cooper Jan 13, 2025
18feed6
handle regression
charles-cooper Jan 14, 2025
3572bef
test fix and lint
HodanPlodky Jan 14, 2025
74532b1
almost never tests + fix for sign
HodanPlodky Jan 14, 2025
f2a6590
test almost always
HodanPlodky Jan 14, 2025
2472328
test ge le
HodanPlodky Jan 14, 2025
16622be
test ge le improvement + signess fix
HodanPlodky Jan 14, 2025
fb20392
signess
HodanPlodky Jan 14, 2025
36c38dd
refactor wrap256, lit_eq
charles-cooper Jan 14, 2025
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
16 changes: 12 additions & 4 deletions tests/functional/builtins/codegen/test_slice.py
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,12 @@
from vyper.compiler import compile_code
from vyper.compiler.settings import OptimizationLevel, Settings
from vyper.evm.opcodes import version_check
from vyper.exceptions import ArgumentException, CompilerPanic, TypeMismatch
from vyper.exceptions import (
ArgumentException,
CompilerPanic,
StaticAssertionException,
TypeMismatch,
)

_fun_bytes32_bounds = [(0, 32), (3, 29), (27, 5), (0, 5), (5, 3), (30, 2)]

Expand Down Expand Up @@ -533,9 +538,12 @@

@pytest.mark.parametrize("bad_code", oob_fail_list)
def test_slice_buffer_oob_reverts(bad_code, get_contract, tx_failed):
c = get_contract(bad_code)
with tx_failed():
c.do_slice()
try:
c = get_contract(bad_code)
with tx_failed():
c.do_slice()
except StaticAssertionException:
Fixed Show fixed Hide fixed
pass


# tests all 3 adhoc locations: `msg.data`, `self.code`, `<address>.code`
Expand Down
4 changes: 0 additions & 4 deletions tests/functional/codegen/features/test_constructor.py
Original file line number Diff line number Diff line change
@@ -1,7 +1,4 @@
import pytest

from tests.evm_backends.base_env import _compile
from vyper.exceptions import StackTooDeep
from vyper.utils import method_id


Expand Down Expand Up @@ -169,7 +166,6 @@ def get_foo() -> uint256:
assert c.get_foo() == 39


@pytest.mark.venom_xfail(raises=StackTooDeep, reason="stack scheduler regression")
def test_nested_dynamic_array_constructor_arg_2(env, get_contract):
code = """
foo: int128
Expand Down
1 change: 1 addition & 0 deletions vyper/venom/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -49,6 +49,7 @@ def _run_passes(fn: IRFunction, optimize: OptimizationLevel) -> None:
MakeSSA(ac, fn).run_pass()
Mem2Var(ac, fn).run_pass()
MakeSSA(ac, fn).run_pass()
AlgebraicOptimizationPass(ac, fn).run_pass()
SCCP(ac, fn).run_pass()
StoreElimination(ac, fn).run_pass()
SimplifyCFGPass(ac, fn).run_pass()
Expand Down
Loading
Loading