Skip to content
Merged
Show file tree
Hide file tree
Changes from 71 commits
Commits
Show all changes
72 commits
Select commit Hold shift + click to select a range
f641827
Revert "Revert builtin cost rework (#874)"
edg-l Oct 22, 2024
319038f
x
edg-l Oct 22, 2024
8e48a50
fix gas
edg-l Oct 22, 2024
74981dc
Merge branch 'main' into revert_revert
edg-l Oct 22, 2024
11aa07f
add paralel test
edg-l Oct 23, 2024
b566791
Merge branch 'main' into revert_revert
pefontana Oct 24, 2024
f2b7d32
Add entry point info to AotContractExecutor (#889)
edg-l Oct 28, 2024
f1356ab
Merge branch 'main' into revert_revert
edg-l Oct 28, 2024
ad818ad
Merge branch 'main' into revert_revert
edg-l Oct 28, 2024
8bb356c
upd replay
edg-l Oct 29, 2024
899a6b0
try with thread local
edg-l Oct 29, 2024
a72a146
try to fix with thread local in runtime2
edg-l Oct 30, 2024
ab48666
Merge remote-tracking branch 'origin/main' into revert_revert
edg-l Nov 4, 2024
2bb59c9
fix
edg-l Nov 4, 2024
4a07cf4
upd ref ci
edg-l Nov 4, 2024
675a285
upd replay
edg-l Nov 4, 2024
fe4d4b8
fix macos
edg-l Nov 4, 2024
1024bc6
try to fix macos
edg-l Nov 4, 2024
6d1603c
try to fix bench
edg-l Nov 4, 2024
07ac00c
fix
edg-l Nov 4, 2024
d2d8ef0
try to fix bench ci
edg-l Nov 4, 2024
939bb87
save space
edg-l Nov 4, 2024
73fa0ba
Merge branch 'main' into revert_revert
edg-l Nov 4, 2024
6b0ead1
upd rev
edg-l Nov 5, 2024
0845cb0
try to fix broken pipe
edg-l Nov 5, 2024
2a6606f
try to fix bench on ci
edg-l Nov 5, 2024
18fa33a
remove all features
edg-l Nov 5, 2024
adcec65
add cache key
edg-l Nov 5, 2024
4ed44e7
Merge branch 'main' into revert_revert
FrancoGiachetta Nov 5, 2024
40f1acc
update replay rev
FrancoGiachetta Nov 5, 2024
fce7142
fix cargo.lock
FrancoGiachetta Nov 5, 2024
9442bbf
Merge branch 'revert_revert' of github.com:lambdaclass/cairo_native i…
FrancoGiachetta Nov 5, 2024
ad6c2ce
Revert "update replay rev"
FrancoGiachetta Nov 5, 2024
e188415
fix cargo.lock
FrancoGiachetta Nov 5, 2024
44f85af
works with leaks
edg-l Nov 6, 2024
acc3a3b
fix
edg-l Nov 6, 2024
01994ed
upd replay
edg-l Nov 6, 2024
cdb84b2
fix bench
edg-l Nov 7, 2024
5a5d1b3
Reorder deps
JulianGCalderon Nov 8, 2024
49ac5dc
start porting gas to u64
edg-l Oct 29, 2024
df09128
u64 on syscalls
edg-l Oct 29, 2024
1dce819
fix
edg-l Oct 29, 2024
026f33b
Fix benches.
azteca1998 Nov 7, 2024
af8508b
fix conflict
edg-l Nov 11, 2024
1802442
clippy
edg-l Nov 11, 2024
e2b5247
fix gas refund
edg-l Nov 11, 2024
20d1c1c
fmt
edg-l Nov 11, 2024
9b2ca7b
fix
edg-l Nov 11, 2024
e5e000a
conflict
edg-l Nov 11, 2024
f1fbaf3
fix get gas
edg-l Nov 12, 2024
533e7ab
update resource bounds
edg-l Nov 12, 2024
14d4c6a
upd ci
edg-l Nov 12, 2024
cc23677
upd replay
edg-l Nov 12, 2024
461bd36
fix ci
edg-l Nov 12, 2024
7a935f9
try
edg-l Nov 12, 2024
8d213e9
fix align
edg-l Nov 12, 2024
4dbb89d
fix bench pr
edg-l Nov 12, 2024
d45811e
better fix for u256
edg-l Nov 12, 2024
fc9225c
upd replay
edg-l Nov 13, 2024
0ae22ce
upd replay
edg-l Nov 13, 2024
9798061
fix
edg-l Nov 13, 2024
e7dc42a
conflict
edg-l Nov 13, 2024
e1f87b1
remove dbg!
edg-l Nov 13, 2024
90bdd95
upd replay
edg-l Nov 13, 2024
4e890c9
fix
edg-l Nov 14, 2024
c8094ab
Revert conversion of `ResourceBounds` field type.
azteca1998 Nov 14, 2024
2f6f128
Merge branch 'main' into gas_u64
azteca1998 Nov 14, 2024
63dda0e
Update sequencer revision (for CI runs).
azteca1998 Nov 14, 2024
ae464d8
Update replay dependency.
azteca1998 Nov 14, 2024
662375a
read invoke data end pad
edg-l Nov 15, 2024
a7fdcdf
upd ci
edg-l Nov 15, 2024
dbfc56e
Merge branch 'main' into gas_u64
pefontana Nov 15, 2024
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
8 changes: 4 additions & 4 deletions .github/workflows/bench-hyperfine.yml
Original file line number Diff line number Diff line change
Expand Up @@ -215,10 +215,10 @@ jobs:
--export-markdown "${f%.*}.md" \
--export-json "${f%.*}.json" \
--warmup 3 \
-n "head $(basename $f) (JIT)" "./bin/cairo-native-run-head --run-mode=jit -s $f --opt-level 3 --available-gas 19446744073709551615" \
-n "base $(basename $f) (JIT)" "./bin/cairo-native-run-base --run-mode=jit -s $f --opt-level 3 --available-gas 19446744073709551615" \
-n "head $(basename $f) (AOT)" "CAIRO_NATIVE_RUNTIME_LIBRARY=lib/libcairo-native-runtime-head.a ./bin/cairo-native-run-head --run-mode=aot -s $f --opt-level 3 --available-gas 19446744073709551615" \
-n "base $(basename $f) (AOT)" "CAIRO_NATIVE_RUNTIME_LIBRARY=lib/libcairo-native-runtime-base.a ./bin/cairo-native-run-base --run-mode=aot -s $f --opt-level 3 --available-gas 19446744073709551615" \
-n "head $(basename $f) (JIT)" "./bin/cairo-native-run-head --run-mode=jit -s $f --opt-level 3 --available-gas 18446744073709551615" \
-n "base $(basename $f) (JIT)" "./bin/cairo-native-run-base --run-mode=jit -s $f --opt-level 3 --available-gas 18446744073709551615" \
-n "head $(basename $f) (AOT)" "CAIRO_NATIVE_RUNTIME_LIBRARY=lib/libcairo-native-runtime-head.a ./bin/cairo-native-run-head --run-mode=aot -s $f --opt-level 3 --available-gas 18446744073709551615" \
-n "base $(basename $f) (AOT)" "CAIRO_NATIVE_RUNTIME_LIBRARY=lib/libcairo-native-runtime-base.a ./bin/cairo-native-run-base --run-mode=aot -s $f --opt-level 3 --available-gas 18446744073709551615" \
>> /dev/stderr
done
- name: Print tables
Expand Down
13 changes: 6 additions & 7 deletions .github/workflows/daily.yml
Original file line number Diff line number Diff line change
Expand Up @@ -2,12 +2,12 @@ name: Daily Block Run

on:
schedule:
# At the end of every day
- cron: "0 0 * * *"
# At the end of every day
- cron: "0 0 * * *"

env:
RANGE_SIZE: 25
SEQUENCER_REV: 1b1b95cae7ae07b9bc778443ca75ee18008a6bc8
SEQUENCER_REV: 93b6da848802297626556950a0c715952aca552d

jobs:
run:
Expand Down Expand Up @@ -56,7 +56,7 @@ jobs:
# Install dependencies
- uses: ./cairo_native/.github/actions/install-linux-deps
- name: Setup rust env
uses: dtolnay/rust-toolchain@1.80.0
uses: dtolnay/rust-toolchain@1.82.0
- name: Retreive cached dependecies
uses: Swatinem/rust-cache@v2
- name: Build Cairo Native Runtime Library
Expand All @@ -65,7 +65,7 @@ jobs:
cd ../cairo_native
make runtime
echo "CAIRO_NATIVE_RUNTIME_LIBRARY=$(pwd)/libcairo_native_runtime.a" > $GITHUB_ENV

- name: Patch dependencies
run: |
# Patches native dependency to local path, to use current cairo native version
Expand All @@ -79,7 +79,7 @@ jobs:
NEW_REV="$SEQUENCER_REV"
sed -Ei "s#(\"$GIT\" *, *rev *= *\").?*(\".*)#\1$NEW_REV\2#" Cargo.toml
grep $GIT Cargo.toml

- name: Run with Native
if: ${{ matrix.runner == 'native' }}
run: |
Expand All @@ -101,7 +101,6 @@ jobs:
name: dump-${{matrix.block}}-${{matrix.runner}}
path: starknet-replay/state_dumps/${{matrix.runner}}


compare:
needs: [run]
runs-on: ubuntu-latest
Expand Down
4 changes: 2 additions & 2 deletions .github/workflows/starknet-blocks.yml
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@ jobs:
components: clippy
- uses: Swatinem/rust-cache@v2
with:
key: "ref-dc35685315f4df544d5d1cf006d3a2a25d8c2c9a"
key: "ref-3da09d1b6f3d5c089900f5521cf05b6444893e61"

- name: Check and free hdd space left
if: ${{ matrix.runner == 'native' }}
Expand Down Expand Up @@ -76,7 +76,7 @@ jobs:
uses: actions/checkout@v4
with:
repository: lambdaclass/starknet-replay
ref: dc35685315f4df544d5d1cf006d3a2a25d8c2c9a
ref: 3da09d1b6f3d5c089900f5521cf05b6444893e61
path: replay

- name: Install Starknet Replay deps
Expand Down
12 changes: 6 additions & 6 deletions benches/benches.rs
Original file line number Diff line number Diff line change
Expand Up @@ -48,23 +48,23 @@ fn criterion_benchmark(c: &mut Criterion) {
find_function_id(&logistic_map, "logistic_map::logistic_map::main").unwrap();

c.bench_function("Cached JIT factorial_2M", |b| {
b.iter(|| jit_factorial.invoke_dynamic(factorial_function_id, &[], Some(u128::MAX)));
b.iter(|| jit_factorial.invoke_dynamic(factorial_function_id, &[], Some(u64::MAX)));
});
c.bench_function("Cached JIT fib_2M", |b| {
b.iter(|| jit_fibonacci.invoke_dynamic(fibonacci_function_id, &[], Some(u128::MAX)));
b.iter(|| jit_fibonacci.invoke_dynamic(fibonacci_function_id, &[], Some(u64::MAX)));
});
c.bench_function("Cached JIT logistic_map", |b| {
b.iter(|| jit_logistic_map.invoke_dynamic(logistic_map_function_id, &[], Some(u128::MAX)));
b.iter(|| jit_logistic_map.invoke_dynamic(logistic_map_function_id, &[], Some(u64::MAX)));
});

c.bench_function("Cached AOT factorial_2M", |b| {
b.iter(|| aot_factorial.invoke_dynamic(factorial_function_id, &[], Some(u128::MAX)));
b.iter(|| aot_factorial.invoke_dynamic(factorial_function_id, &[], Some(u64::MAX)));
});
c.bench_function("Cached AOT fib_2M", |b| {
b.iter(|| aot_fibonacci.invoke_dynamic(fibonacci_function_id, &[], Some(u128::MAX)));
b.iter(|| aot_fibonacci.invoke_dynamic(fibonacci_function_id, &[], Some(u64::MAX)));
});
c.bench_function("Cached AOT logistic_map", |b| {
b.iter(|| aot_logistic_map.invoke_dynamic(logistic_map_function_id, &[], Some(u128::MAX)));
b.iter(|| aot_logistic_map.invoke_dynamic(logistic_map_function_id, &[], Some(u64::MAX)));
});
}

Expand Down
12 changes: 6 additions & 6 deletions benches/libfuncs.rs
Original file line number Diff line number Diff line change
Expand Up @@ -61,7 +61,7 @@ pub fn bench_libfuncs(c: &mut Criterion) {

// Execute the program.
let result = native_executor
.invoke_dynamic(&entry.id, &[], Some(u64::MAX as u128))
.invoke_dynamic(&entry.id, &[], Some(u64::MAX))
.unwrap();
black_box(result)
})
Expand All @@ -81,14 +81,14 @@ pub fn bench_libfuncs(c: &mut Criterion) {
// warmup
for _ in 0..5 {
native_executor
.invoke_dynamic(&entry.id, &[], Some(u64::MAX as u128))
.invoke_dynamic(&entry.id, &[], Some(u64::MAX))
.unwrap();
}

b.iter(|| {
// Execute the program.
let result = native_executor
.invoke_dynamic(&entry.id, &[], Some(u64::MAX as u128))
.invoke_dynamic(&entry.id, &[], Some(u64::MAX))
.unwrap();
black_box(result)
})
Expand All @@ -108,7 +108,7 @@ pub fn bench_libfuncs(c: &mut Criterion) {

// Execute the program.
let result = native_executor
.invoke_dynamic(&entry.id, &[], Some(u64::MAX as u128))
.invoke_dynamic(&entry.id, &[], Some(u64::MAX))
.unwrap();
black_box(result)
})
Expand All @@ -128,14 +128,14 @@ pub fn bench_libfuncs(c: &mut Criterion) {
// warmup
for _ in 0..5 {
native_executor
.invoke_dynamic(&entry.id, &[], Some(u64::MAX as u128))
.invoke_dynamic(&entry.id, &[], Some(u64::MAX))
.unwrap();
}

b.iter(|| {
// Execute the program.
let result = native_executor
.invoke_dynamic(&entry.id, &[], Some(u64::MAX as u128))
.invoke_dynamic(&entry.id, &[], Some(u64::MAX))
.unwrap();
black_box(result)
})
Expand Down
3 changes: 1 addition & 2 deletions docs/gas_builtin_accounting.md
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ and greged’s about
### Gas builtin
The gas builtin is used in Sierra in order to perform gas accounting. It is
passed as an input to all function calls and holds the current remaining
gas. It is represented in MLIR by a simple `u128`.
gas. It is represented in MLIR by a simple `u64`.

### Gas metadata
The process of calculating gas begins at the very outset of the compilation
Expand Down Expand Up @@ -236,4 +236,3 @@ constant 1.
When this compiled MLIR code is called, the initial value of all builtin
counters is set to `0` as can be seen in the
[`invoke_dynamic` function](../src/executor.rs#L240).

Loading
Loading