removed dup/drop bindings#1617
Conversation
orizi
left a comment
There was a problem hiding this comment.
@orizi reviewed 20 files and all commit messages, and made 2 comments.
Reviewable status: all files reviewed, 1 unresolved discussion (waiting on TomerStarkware).
src/libfuncs/const.rs line 77 at r1 (raw file):
let inner_layout = const_ty.layout(registry)?; // TODO: For struct/enum const types we could emit the constant directly into the arena slot
can't this point to some constant memory?
i'm assuming llvm has some such feature.
655aa5d to
c57e4f9
Compare
4a0b31a to
27d6b14
Compare
orizi
left a comment
There was a problem hiding this comment.
@orizi reviewed 22 files and all commit messages.
Reviewable status: all files reviewed, 1 unresolved discussion (waiting on TomerStarkware).
af42e6f to
f97c196
Compare
19dd67b to
d162d7c
Compare
TomerStarkware
left a comment
There was a problem hiding this comment.
@TomerStarkware made 1 comment.
Reviewable status: 23 of 39 files reviewed, 1 unresolved discussion (waiting on orizi).
src/libfuncs/const.rs line 77 at r1 (raw file):
Previously, orizi wrote…
can't this point to some constant memory?
i'm assuming llvm has some such feature.
Done.
orizi
left a comment
There was a problem hiding this comment.
@orizi reviewed 17 files and all commit messages, made 1 comment, and resolved 1 discussion.
Reviewable status:complete! all files reviewed, all discussions resolved (waiting on TomerStarkware).
d162d7c to
9641a97
Compare
9641a97 to
aa65112
Compare
Benchmark results Main vs HEAD.Base
Head
Base
Head
Base
Head
Base
Head
Base
Head
Base
Head
|
Benchmarking resultsBenchmark for program
|
| Command | Mean [s] | Min [s] | Max [s] | Relative |
|---|---|---|---|---|
Cairo-vm (Rust, Cairo 1) |
11.505 ± 0.096 | 11.381 | 11.687 | 6.07 ± 0.10 |
cairo-native (embedded AOT) |
1.914 ± 0.032 | 1.863 | 1.966 | 1.01 ± 0.02 |
cairo-native (embedded JIT using LLVM's ORC Engine) |
1.896 ± 0.027 | 1.861 | 1.938 | 1.00 |
Benchmark for program dict_snapshot
Open benchmarks
| Command | Mean [ms] | Min [ms] | Max [ms] | Relative |
|---|---|---|---|---|
Cairo-vm (Rust, Cairo 1) |
557.9 ± 6.0 | 552.0 | 570.2 | 1.00 |
cairo-native (embedded AOT) |
1734.7 ± 28.4 | 1677.3 | 1775.0 | 3.11 ± 0.06 |
cairo-native (embedded JIT using LLVM's ORC Engine) |
1762.7 ± 29.1 | 1715.8 | 1802.7 | 3.16 ± 0.06 |
Benchmark for program factorial_2M
Open benchmarks
| Command | Mean [s] | Min [s] | Max [s] | Relative |
|---|---|---|---|---|
Cairo-vm (Rust, Cairo 1) |
4.992 ± 0.021 | 4.964 | 5.039 | 2.25 ± 0.03 |
cairo-native (embedded AOT) |
2.226 ± 0.026 | 2.176 | 2.267 | 1.00 ± 0.02 |
cairo-native (embedded JIT using LLVM's ORC Engine) |
2.216 ± 0.025 | 2.181 | 2.266 | 1.00 |
Benchmark for program fib_2M
Open benchmarks
| Command | Mean [s] | Min [s] | Max [s] | Relative |
|---|---|---|---|---|
Cairo-vm (Rust, Cairo 1) |
4.914 ± 0.023 | 4.887 | 4.954 | 2.82 ± 0.05 |
cairo-native (embedded AOT) |
1.742 ± 0.031 | 1.706 | 1.795 | 1.00 |
cairo-native (embedded JIT using LLVM's ORC Engine) |
1.754 ± 0.026 | 1.702 | 1.794 | 1.01 ± 0.02 |
Benchmark for program linear_search
Open benchmarks
| Command | Mean [ms] | Min [ms] | Max [ms] | Relative |
|---|---|---|---|---|
Cairo-vm (Rust, Cairo 1) |
612.4 ± 12.5 | 593.4 | 635.3 | 1.00 |
cairo-native (embedded AOT) |
1757.3 ± 36.3 | 1712.2 | 1805.2 | 2.87 ± 0.08 |
cairo-native (embedded JIT using LLVM's ORC Engine) |
1784.9 ± 23.1 | 1754.9 | 1830.9 | 2.91 ± 0.07 |
Benchmark for program logistic_map
Open benchmarks
| Command | Mean [ms] | Min [ms] | Max [ms] | Relative |
|---|---|---|---|---|
Cairo-vm (Rust, Cairo 1) |
503.9 ± 13.1 | 494.0 | 539.6 | 1.00 |
cairo-native (embedded AOT) |
1864.3 ± 17.9 | 1844.9 | 1895.6 | 3.70 ± 0.10 |
cairo-native (embedded JIT using LLVM's ORC Engine) |
1987.9 ± 21.1 | 1963.2 | 2019.2 | 3.95 ± 0.11 |
orizi
left a comment
There was a problem hiding this comment.
@orizi reviewed 1 file and all commit messages.
Reviewable status:complete! all files reviewed, all discussions resolved (waiting on TomerStarkware).
Remove dup/drop overrides; rely on arena ownership
Closes #NA
Now that all heap-allocated types (
Box<T>,Nullable<T>,Array<T>, dicts, and the structs/enums containing them) live in the per-invocationarena, deep clones and recursive drops are no longer necessary. Memory is reclaimed when the arena is destroyed at invocation end, and pointer-typed
values can be shared freely between branches because no libfunc mutates through an input box pointer.
This PR removes the
DupOverridesMeta/DropOverridesMetametadata and all associated code:src/metadata/drop_overrides.rsandsrc/metadata/dup_overrides.rs(~420 lines).duplibfunc becomes a bitwise copy — return the same SSA value twice.droplibfunc becomes a no-op.array,box,enum,nullable,snapshot, andstruct(~1300 lines).array_pop/array_getno longer deep-copy popped elements; they return GEP'd pointers into the source arena slot.array_slice,array_len,circuit_eval,get_circuit_output,sha256_process_block, anddebug::printdrop their now-redundant dropinvocations on consumed inputs.
struct_boxed_deconstruct/enum_boxed_matchreturn field/payload pointers via GEP instead of unboxing and re-boxing each member.Net diff: ~+300/-2100 in
src/.Introduces Breaking Changes?
No. The runtime ABI and libfunc semantics are unchanged —
dupstill returns two values,dropstill consumes one, and consumed boxed values stillcannot be reused by the Sierra program. Only the MLIR codegen behind these libfuncs changes.
starknet-blocks.ymlworkflow to use these PRs.This change is