feat(testing): Add SSA interpreter for testing SSA#8115
Conversation
|
The interpreter is currently in a very incomplete yet semi-working state so I thought I'd put this up to see if anyone had any comments or suggestions. Going forward I think most of the remaining work will be:
|
There was a problem hiding this comment.
⚠️ Performance Alert ⚠️
Possible performance regression was detected for benchmark 'Execution Time'.
Benchmark result of this commit is worse than the previous benchmark result exceeding threshold 1.20.
| Benchmark suite | Current: 2872cec | Previous: 934126b | Ratio |
|---|---|---|---|
rollup-merge |
0.004 s |
0.003 s |
1.33 |
This comment was automatically generated by workflow using github-action-benchmark.
CC: @TomAFrench
…into jf/ssa-interpreter
jfecher
left a comment
There was a problem hiding this comment.
This PR should be ready for review now. Some things to note:
- ~2.3k lines of this PR are just tests in
ssa/interpreter/tests/mod.rsandssa/interpreter/tests/instructions.rs. - The interpreter currently still panics instead of returning error variants on error. We should update this later but I'm considering this ok for an MVP for testing.
- A few intrinsics are still not implemented but again I'd rather leave them out of the MVP. These are:
Intrinsic::ApplyRangeConstraintwe could just apply a range constraint but there's no documentation on any of the intrinsics so I'm not sure argument ordering, etc.Intrinsic::BlackBox(_)all black box functions are unimplementedIntrinsic::Hint(_)unsure what to do hereDerivePedersenGeneratorsthis one was just a lot of code- We should implement these in follow-ups. I'll make an issue.
- There are some necessary differences between this and SSA. Notably
assert_constantis always true. I had it failing before on non-constant ValueIds but this meant we'd fail the same SSA on different optimization levels which is undesirable.static_assertis similar but just functions exactly likeassertnow. - The interpreter can still be used for unit testing and can be easily fed inputs and outputs. Constrains in the code are still asserted, etc.
- I removed the CLI code from this PR, we can add this in a later PR so that it can be invoked via e.g.
nargo interpret-ssa. Embedding it in other commands likenargo executeisn't ideal since we'd need to pass the program arguments down tonoirc_evaluator.
There was a problem hiding this comment.
⚠️ Performance Alert ⚠️
Possible performance regression was detected for benchmark 'Test Suite Duration'.
Benchmark result of this commit is worse than the previous benchmark result exceeding threshold 1.20.
| Benchmark suite | Current: 0029fef | Previous: 4bc636a | Ratio |
|---|---|---|---|
test_report_zkpassport_noir_rsa_ |
30 s |
22 s |
1.36 |
This comment was automatically generated by workflow using github-action-benchmark.
CC: @TomAFrench
aakoshh
left a comment
There was a problem hiding this comment.
Nice, looking forward to finding ways to use this with the fuzzer as an additional pillar of oracles!
compiler/noirc_evaluator/src/ssa/interpreter/tests/instructions.rs
Outdated
Show resolved
Hide resolved
compiler/noirc_evaluator/src/ssa/interpreter/tests/instructions.rs
Outdated
Show resolved
Hide resolved
compiler/noirc_evaluator/src/ssa/interpreter/tests/instructions.rs
Outdated
Show resolved
Hide resolved
Co-authored-by: Akosh Farkash <aakoshh@gmail.com>
Co-authored-by: Akosh Farkash <aakoshh@gmail.com>
…into jf/ssa-interpreter
Automated pull of nightly from the [noir](https://github.com/noir-lang/noir) programming language, a dependency of Aztec. BEGIN_COMMIT_OVERRIDE feat: disallow emitting multiple `MemoryInit` opcodes for the same block (noir-lang/noir#8291) fix(ssa): Remove unused calls to pure functions (noir-lang/noir#8298) fix(ssa): Do not remove unused checked binary ops (noir-lang/noir#8303) fix: Return zero and insert an assertion if RHS bit size is over the limit in euclidian division (noir-lang/noir#8294) feat: remove unnecessary dynamic arrays when pushing onto slices (noir-lang/noir#8287) feat(testing): Add SSA interpreter for testing SSA (noir-lang/noir#8115) END_COMMIT_OVERRIDE Co-authored-by: AztecBot <tech@aztecprotocol.com>
Description
Problem*
Resolves #6826
Summary*
Implements an SSA interpreter purely for debugging purposes.
Additional Context
Documentation*
Check one:
PR Checklist*
cargo fmton default settings.