-
-
Notifications
You must be signed in to change notification settings - Fork 917
fix[venom]: fuzz venom pass ordering #5219
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
base: master
Are you sure you want to change the base?
Changes from all commits
e3c8523
2b6d944
7809019
06ff659
e42e9a1
038cd56
84c1a5b
26a8a63
4a8f25f
73f093c
da07d23
6da9c9f
c3159ac
4ef25da
770ee21
73616d0
64a85d4
3d4fc91
ad1f1f6
79130e8
7b90af6
a4ba5ba
63390ae
c281bcd
19cb681
fdb5b41
bb1663d
b8a6d8e
0a2db65
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,93 @@ | ||
| import glob | ||
| from pathlib import Path | ||
|
|
||
| import pytest | ||
| from hypothesis import HealthCheck, Phase, given, settings | ||
| from hypothesis import strategies as st | ||
|
|
||
| import vyper.compiler as compiler | ||
| from vyper.venom.passes import ( | ||
| CSE, | ||
| SCCP, | ||
| AffineFoldingPass, | ||
| AlgebraicOptimizationPass, | ||
| AssertCombinerPass, | ||
| AssertEliminationPass, | ||
| AssignElimination, | ||
| BranchOptimizationPass, | ||
| DeadStoreElimination, | ||
| DFTPass, | ||
| InternalReturnCopyForwardingPass, | ||
| LoadElimination, | ||
| Mem2Var, | ||
| MemMergePass, | ||
| MemoryCopyElisionPass, | ||
| OverflowEliminationPass, | ||
| PhiEliminationPass, | ||
| ReadonlyInvokeArgCopyForwardingPass, | ||
| ReduceLiteralsCodesize, | ||
| RemoveUnusedVariablesPass, | ||
| RevertToAssert, | ||
| TailMergePass, | ||
| ) | ||
|
|
||
| dir_path = Path(__file__).parent | ||
|
|
||
|
|
||
| def get_example_vy_filenames(): | ||
| return glob.glob("**/*.vy", root_dir=dir_path, recursive=True) | ||
|
|
||
|
|
||
| pass_to_disable = [ | ||
| AffineFoldingPass, | ||
| AlgebraicOptimizationPass, | ||
| AssertCombinerPass, | ||
| AssertEliminationPass, | ||
| AssignElimination, | ||
| BranchOptimizationPass, | ||
| CSE, | ||
| DeadStoreElimination, | ||
| DFTPass, | ||
| InternalReturnCopyForwardingPass, | ||
| ReduceLiteralsCodesize, | ||
| LoadElimination, | ||
| Mem2Var, | ||
| MemMergePass, | ||
| MemoryCopyElisionPass, | ||
| OverflowEliminationPass, | ||
| PhiEliminationPass, | ||
| ReadonlyInvokeArgCopyForwardingPass, | ||
| RevertToAssert, | ||
| SCCP, | ||
| TailMergePass, | ||
| RemoveUnusedVariablesPass, | ||
| ] | ||
|
|
||
| any_passes = st.lists(st.sampled_from(pass_to_disable), min_size=2, max_size=10, unique=True) | ||
|
|
||
|
|
||
| @pytest.mark.parametrize("vy_filename", get_example_vy_filenames()) | ||
| @settings( | ||
| suppress_health_check=[HealthCheck.function_scoped_fixture], | ||
| max_examples=10, | ||
| phases=[Phase.generate], | ||
| ) | ||
| @given(passes_to_disable=any_passes) | ||
| @pytest.mark.fuzzing | ||
| def test_compile_pass_fuzz(vy_filename, passes_to_disable, compiler_settings, monkeypatch): | ||
| if not compiler_settings.experimental_codegen: | ||
| pytest.skip() | ||
|
Comment on lines
+78
to
+79
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more.
In the checked fuzzing job at Useful? React with 👍 / 👎. |
||
|
|
||
| with open(dir_path / vy_filename) as f: | ||
| source_code = f.read() | ||
|
|
||
| with monkeypatch.context() as m: | ||
| run = [] | ||
|
|
||
| def temp(*args, **kwargs): | ||
| run.append(True) | ||
|
Comment on lines
+85
to
+88
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more.
When this test is invoked with experimental codegen and the default Useful? React with 👍 / 👎. |
||
|
|
||
| for pass_to_disable in passes_to_disable: | ||
| m.setattr(pass_to_disable, "run_pass", temp) | ||
|
|
||
| compiler.compile_code(source_code) | ||
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
In the regular test matrix where
--experimental-codegenis absent, this test compiles through the legacy backend, soimplementation_v_700.vystill reaches the documentedStackTooDeep: Unsupported dup depth 17failure. The compiler changes in this commit are confined to the Venom backend and cannot fix that legacy path; removing the filename-specific xfail therefore makes every non-experimental matrix job fail when this parameter is collected.Useful? React with 👍 / 👎.