Skip to content
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

Refactor common operations into a block trait #518

Merged
merged 6 commits into from
Apr 22, 2024
Merged

Conversation

edg-l
Copy link
Member

@edg-l edg-l commented Apr 17, 2024

We have a lot of repeated places in codegen where we use complicated or repetitive operations, this refactors some common complexity so we can avoid mistakes.

For now I only use the methods in a few places like the array libfuncs, but it could be used in all libfuncs, It's just quite some more work to do replacing those.

Operations that are in BlockExt that can be replaced

  • llvm.alloca
  • arith.constant
  • llvm.extract_value
  • llvm.insert_value
  • llvm.alloca
  • llvm.load
  • llvm.store
  • llvm.memcpy

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 Apr 17, 2024

Codecov Report

Attention: Patch coverage is 98.41772% with 5 lines in your changes are missing coverage. Please review.

Project coverage is 89.54%. Comparing base (9663d29) to head (517ec9f).

Files Patch % Lines
src/libfuncs/array.rs 96.24% 5 Missing ⚠️
Additional details and impacted files
@@            Coverage Diff             @@
##             main     #518      +/-   ##
==========================================
- Coverage   89.68%   89.54%   -0.15%     
==========================================
  Files         107      108       +1     
  Lines       34759    34322     -437     
==========================================
- Hits        31175    30733     -442     
- Misses       3584     3589       +5     

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

Copy link

github-actions bot commented Apr 17, 2024

Benchmarking results

Benchmark for program factorial_2M

Open benchmarks
Command Mean [s] Min [s] Max [s] Relative
Cairo-vm (Rust, Cairo 1) 13.495 ± 0.062 13.404 13.635 31.03 ± 0.17
cairo-native (embedded AOT) 1.568 ± 0.015 1.542 1.592 3.60 ± 0.04
cairo-native (embedded JIT using LLVM's ORC Engine) 1.545 ± 0.017 1.529 1.578 3.55 ± 0.04
cairo-native (standalone AOT) 0.636 ± 0.002 0.634 0.639 1.46 ± 0.01
cairo-native (standalone AOT with -march=native) 0.435 ± 0.001 0.434 0.438 1.00

Benchmark for program fib_2M

Open benchmarks
Command Mean [s] Min [s] Max [s] Relative
Cairo-vm (Rust, Cairo 1) 12.981 ± 0.053 12.937 13.113 1597.14 ± 18.68
cairo-native (embedded AOT) 1.108 ± 0.019 1.084 1.135 136.36 ± 2.79
cairo-native (embedded JIT using LLVM's ORC Engine) 1.108 ± 0.013 1.086 1.127 136.28 ± 2.17
cairo-native (standalone AOT) 0.008 ± 0.000 0.008 0.009 1.02 ± 0.02
cairo-native (standalone AOT with -march=native) 0.008 ± 0.000 0.008 0.008 1.00

Benchmark for program logistic_map

Open benchmarks
Command Mean [s] Min [s] Max [s] Relative
Cairo-vm (Rust, Cairo 1) 1.894 ± 0.025 1.861 1.931 27.93 ± 0.37
cairo-native (embedded AOT) 1.186 ± 0.008 1.177 1.198 17.48 ± 0.12
cairo-native (embedded JIT using LLVM's ORC Engine) 1.433 ± 0.017 1.417 1.465 21.13 ± 0.25
cairo-native (standalone AOT) 0.112 ± 0.000 0.111 0.112 1.64 ± 0.00
cairo-native (standalone AOT with -march=native) 0.068 ± 0.000 0.068 0.068 1.00

@edg-l edg-l added this pull request to the merge queue Apr 18, 2024
@github-merge-queue github-merge-queue bot removed this pull request from the merge queue due to failed status checks Apr 18, 2024
@edg-l edg-l added this pull request to the merge queue Apr 18, 2024
@github-merge-queue github-merge-queue bot removed this pull request from the merge queue due to failed status checks Apr 18, 2024
@edg-l edg-l added this pull request to the merge queue Apr 18, 2024
@github-merge-queue github-merge-queue bot removed this pull request from the merge queue due to failed status checks Apr 18, 2024
@edg-l edg-l added this pull request to the merge queue Apr 19, 2024
@github-merge-queue github-merge-queue bot removed this pull request from the merge queue due to failed status checks Apr 19, 2024
@elielnfinic
Copy link

Can I take this?

@igaray igaray added this pull request to the merge queue Apr 22, 2024
Merged via the queue into main with commit ca6549a Apr 22, 2024
9 checks passed
@igaray igaray deleted the refactor_simpler branch April 22, 2024 19:23
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.

5 participants