Skip to content

Conversation

@FrancoGiachetta
Copy link
Contributor

@FrancoGiachetta FrancoGiachetta commented Nov 13, 2025

Fix sierra emu eval_trim and add int range to trace dump

Closes #NA

This PR fixes bounded_int_trim libfuncs in sierra-emu. The issue was that the implementation was not taking into account that it could receive BoundedInts as inputs.
This PR also implements dumping IntRanges with the trace dump.

Introduces Breaking Changes?

No.

These PRs should be merged after this one right away, in that order.

Checklist

  • Linked to Github Issue.
  • Unit tests added.
  • Integration tests added.
  • This change requires new documentation.
    • Documentation has been added/updated.

@codecov-commenter
Copy link

codecov-commenter commented Nov 13, 2025

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 81.47%. Comparing base (b31ad2b) to head (623c80c).

Additional details and impacted files
@@           Coverage Diff           @@
##             main    #1459   +/-   ##
=======================================
  Coverage   81.47%   81.47%           
=======================================
  Files         105      105           
  Lines       25759    25759           
=======================================
  Hits        20987    20987           
  Misses       4772     4772           

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.

@github-actions
Copy link

github-actions bot commented Nov 13, 2025

Benchmark results Main vs HEAD.

Base

Command Mean [s] Min [s] Max [s] Relative
base dict_insert.cairo (JIT) 1.972 ± 0.026 1.929 2.016 1.05 ± 0.02
base dict_insert.cairo (AOT) 1.880 ± 0.017 1.848 1.908 1.00

Head

Command Mean [s] Min [s] Max [s] Relative
head dict_insert.cairo (JIT) 2.021 ± 0.028 1.968 2.069 1.01 ± 0.02
head dict_insert.cairo (AOT) 1.995 ± 0.038 1.953 2.059 1.00

Base

Command Mean [s] Min [s] Max [s] Relative
base dict_snapshot.cairo (JIT) 1.658 ± 0.012 1.644 1.686 1.07 ± 0.01
base dict_snapshot.cairo (AOT) 1.553 ± 0.013 1.537 1.571 1.00

Head

Command Mean [s] Min [s] Max [s] Relative
head dict_snapshot.cairo (JIT) 1.765 ± 0.026 1.735 1.808 1.03 ± 0.03
head dict_snapshot.cairo (AOT) 1.712 ± 0.037 1.669 1.789 1.00

Base

Command Mean [s] Min [s] Max [s] Relative
base factorial_2M.cairo (JIT) 2.034 ± 0.022 1.994 2.069 1.02 ± 0.01
base factorial_2M.cairo (AOT) 2.001 ± 0.017 1.970 2.020 1.00

Head

Command Mean [s] Min [s] Max [s] Relative
head factorial_2M.cairo (JIT) 2.212 ± 0.062 2.125 2.302 1.02 ± 0.03
head factorial_2M.cairo (AOT) 2.178 ± 0.023 2.135 2.225 1.00

Base

Command Mean [s] Min [s] Max [s] Relative
base fib_2M.cairo (JIT) 1.570 ± 0.010 1.558 1.590 1.03 ± 0.01
base fib_2M.cairo (AOT) 1.526 ± 0.011 1.508 1.547 1.00

Head

Command Mean [s] Min [s] Max [s] Relative
head fib_2M.cairo (JIT) 1.758 ± 0.022 1.718 1.786 1.05 ± 0.03
head fib_2M.cairo (AOT) 1.668 ± 0.036 1.610 1.717 1.00

Base

Command Mean [s] Min [s] Max [s] Relative
base heavy_circuit.cairo (JIT) 13.084 ± 0.061 13.007 13.208 1.04 ± 0.01
base heavy_circuit.cairo (AOT) 12.598 ± 0.093 12.432 12.759 1.00

Head

Command Mean [s] Min [s] Max [s] Relative
head heavy_circuit.cairo (JIT) 13.585 ± 0.202 13.281 13.934 1.01 ± 0.03
head heavy_circuit.cairo (AOT) 13.504 ± 0.389 12.863 14.115 1.00

Base

Command Mean [s] Min [s] Max [s] Relative
base linear_search.cairo (JIT) 1.744 ± 0.017 1.722 1.783 1.09 ± 0.01
base linear_search.cairo (AOT) 1.601 ± 0.013 1.585 1.616 1.00

Head

Command Mean [s] Min [s] Max [s] Relative
head linear_search.cairo (JIT) 1.975 ± 0.062 1.871 2.090 1.13 ± 0.05
head linear_search.cairo (AOT) 1.755 ± 0.065 1.654 1.822 1.00

Base

Command Mean [s] Min [s] Max [s] Relative
base logistic_map.cairo (JIT) 1.877 ± 0.014 1.855 1.898 1.11 ± 0.01
base logistic_map.cairo (AOT) 1.684 ± 0.015 1.661 1.709 1.00

Head

Command Mean [s] Min [s] Max [s] Relative
head logistic_map.cairo (JIT) 2.038 ± 0.043 1.955 2.110 1.08 ± 0.05
head logistic_map.cairo (AOT) 1.883 ± 0.082 1.756 2.009 1.00

@github-actions
Copy link

github-actions bot commented Nov 13, 2025

Benchmarking results

Benchmark for program dict_insert

Open benchmarks
Command Mean [s] Min [s] Max [s] Relative
Cairo-vm (Rust, Cairo 1) 10.788 ± 0.019 10.763 10.814 6.33 ± 0.05
cairo-native (embedded AOT) 1.705 ± 0.012 1.683 1.721 1.00
cairo-native (embedded JIT using LLVM's ORC Engine) 1.768 ± 0.008 1.753 1.780 1.04 ± 0.01

Benchmark for program dict_snapshot

Open benchmarks
Command Mean [ms] Min [ms] Max [ms] Relative
Cairo-vm (Rust, Cairo 1) 506.2 ± 5.4 500.6 519.0 1.00
cairo-native (embedded AOT) 1400.5 ± 11.2 1384.1 1420.7 2.77 ± 0.04
cairo-native (embedded JIT using LLVM's ORC Engine) 1496.0 ± 11.6 1478.4 1511.0 2.96 ± 0.04

Benchmark for program factorial_2M

Open benchmarks
Command Mean [s] Min [s] Max [s] Relative
Cairo-vm (Rust, Cairo 1) 4.793 ± 0.005 4.786 4.801 2.71 ± 0.02
cairo-native (embedded AOT) 1.770 ± 0.010 1.756 1.782 1.00
cairo-native (embedded JIT using LLVM's ORC Engine) 1.814 ± 0.012 1.798 1.836 1.02 ± 0.01

Benchmark for program fib_2M

Open benchmarks
Command Mean [s] Min [s] Max [s] Relative
Cairo-vm (Rust, Cairo 1) 4.705 ± 0.019 4.690 4.754 3.41 ± 0.04
cairo-native (embedded AOT) 1.380 ± 0.015 1.361 1.412 1.00
cairo-native (embedded JIT using LLVM's ORC Engine) 1.416 ± 0.019 1.398 1.462 1.03 ± 0.02

Benchmark for program heavy_circuit

Open benchmarks
Command Mean [s] Min [s] Max [s] Relative
Cairo-vm (Rust, Cairo 1) 10.383 ± 0.113 10.213 10.589 1.17 ± 0.02
cairo-native (embedded AOT) 8.877 ± 0.072 8.777 8.987 1.00
cairo-native (embedded JIT using LLVM's ORC Engine) 9.267 ± 0.065 9.198 9.420 1.04 ± 0.01

Benchmark for program linear_search

Open benchmarks
Command Mean [ms] Min [ms] Max [ms] Relative
Cairo-vm (Rust, Cairo 1) 537.6 ± 5.1 530.9 548.1 1.00
cairo-native (embedded AOT) 1448.5 ± 16.8 1425.7 1489.6 2.69 ± 0.04
cairo-native (embedded JIT using LLVM's ORC Engine) 1560.5 ± 14.1 1538.7 1588.5 2.90 ± 0.04

Benchmark for program logistic_map

Open benchmarks
Command Mean [ms] Min [ms] Max [ms] Relative
Cairo-vm (Rust, Cairo 1) 461.4 ± 2.8 456.0 466.1 1.00
cairo-native (embedded AOT) 1551.8 ± 16.6 1533.1 1588.3 3.36 ± 0.04
cairo-native (embedded JIT using LLVM's ORC Engine) 1732.5 ± 8.3 1715.6 1741.9 3.76 ± 0.03

CoreTypeConcrete::IntRange(info) => {
let type_info = registry.get_type(&info.ty).unwrap();

match type_info {
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Don´t we need in this match to handle the case of a BoundedInt?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It was not the aim of this PR honestly, and it seems not to be necessary for now.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

We could at least add a todo for it, so that we remember to implement it later.

Copy link
Contributor

@JulianGCalderon JulianGCalderon left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM

@gabrielbosio gabrielbosio added this pull request to the merge queue Dec 5, 2025
Merged via the queue into main with commit 69e1fbb Dec 5, 2025
30 checks passed
@gabrielbosio gabrielbosio deleted the fix-sierra-emu-and-int-rage-dump branch December 5, 2025 20:04
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

6 participants