Skip to content

Commit

Permalink
Merge branch 'main' into add-libfunc-profiling
Browse files Browse the repository at this point in the history
  • Loading branch information
azteca1998 committed Feb 18, 2025
2 parents c59cd54 + 17edff7 commit f711785
Show file tree
Hide file tree
Showing 98 changed files with 2,108 additions and 2,222 deletions.
4 changes: 1 addition & 3 deletions .github/ISSUE_TEMPLATE/daily_failure.md
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,4 @@ Comparing VM execution against Native produced diffs:

The transaction were not compared in order. You should rerun the whole failing block to find the error root

```
{{ env.OUTPUT }}
```
- State Diffs Comparison: {{ env.COMPARISON_RESULT }}
8 changes: 4 additions & 4 deletions .github/scripts/check-git-deps.sh
Original file line number Diff line number Diff line change
Expand Up @@ -12,16 +12,16 @@ latest_release=$(
)

current_release=$(
rg 'cairo-lang-sierra\s*=\s*(?:\{\s*git\s*=\s*"https://github.com/starkware-libs/cairo",\s*tag = "(.*?)"\s*\}|"(.*?)")' sierra2mlir/Cargo.toml -r '$1$2'
rg 'cairo-lang-sierra\s*=\s*(?:\{\s*git\s*=\s*"https://github.com/starkware-libs/cairo",\s*tag = "(.*?)"\s*\}|"(.*?)")' Cargo.toml -r '$1$2'
)

current_release_line=$(echo $current_release | cut -d':' -f1)
current_release_str=$(echo $current_release | cut -d':' -f2)

# Strip `v` prefix.
$current_release_str=$(echo $current_release_str | tr -d v)
$latest_release=$(echo $latest_release | tr -d v)
current_release_str=$(echo $current_release_str | tr -d v)
latest_release=$(echo $latest_release | tr -d v)

if [ "$current_release_str" != "$latest_release" && "v$current_release_str" != "$latest_release" ]; then
echo "::warning file=sierra2mlir/Cargo.toml,line=$current_release_line,endLine=$current_release_line,title=Outdated cairo dependency::Current release = $current_release_str, Upstream release = $latest_release"
echo "::warning file=Cargo.toml,line=$current_release_line,endLine=$current_release_line,title=Outdated cairo dependency::Current release = $current_release_str, Upstream release = $latest_release"
fi
31 changes: 11 additions & 20 deletions .github/workflows/bench-hyperfine.yml
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,7 @@ jobs:
sudo rm -rf /usr/share/dotnet/
sudo rm -rf /usr/local/lib/android
df -h
- uses: dtolnay/rust-toolchain@1.84.0
- uses: dtolnay/rust-toolchain@1.84.1
with:
components: clippy
- uses: Swatinem/rust-cache@v2
Expand Down Expand Up @@ -96,19 +96,12 @@ jobs:
runs-on: ubuntu-24.04
steps:
- name: Cache binary
uses: actions/cache@v3
uses: actions/cache@v4.2.0
id: cache-binary
with:
path: bin/cairo-native-run-${{ matrix.branch }}
key: binary-${{ github.event.pull_request[matrix.branch].sha }}

- name: Cache runtime-library
uses: actions/cache@v3
id: cache-library
with:
path: lib/libcairo-native-runtime-${{ matrix.branch }}.a
key: library-${{ github.event.pull_request[matrix.branch].sha }}

- name: check and free hdd space left
if: ${{ steps.cache-binary.outputs.cache-hit != 'true' }}
run: |
Expand All @@ -131,7 +124,7 @@ jobs:
df -h
- name: Install Rust
if: ${{ steps.cache-binary.outputs.cache-hit != 'true' || steps.cache-library.outputs.cache-hit != 'true' }}
uses: dtolnay/rust-toolchain@1.84.0
uses: dtolnay/rust-toolchain@1.84.1
- name: add llvm deb repository
if: ${{ steps.cache-binary.outputs.cache-hit != 'true' || steps.cache-library.outputs.cache-hit != 'true' }}
uses: myci-actions/add-deb-repo@11
Expand Down Expand Up @@ -159,7 +152,6 @@ jobs:
make build
mkdir lib bin
cp target/release/cairo-native-run bin/cairo-native-run-${{ matrix.branch }}
cp target/release/libcairo_native_runtime.a lib/libcairo-native-runtime-${{ matrix.branch }}.a
run-bench:
env:
Expand All @@ -185,17 +177,11 @@ jobs:
tool: hyperfine@1.16

- name: Fetch ${{ matrix.branch }} binary
uses: actions/cache/restore@v3
uses: actions/cache/restore@v4.2.0
with:
path: bin/cairo-native-run-${{ matrix.branch }}
key: binary-${{ github.event.pull_request[matrix.branch].sha }}

- name: Fetch ${{ matrix.branch }} runtime-library
uses: actions/cache/restore@v3
with:
path: lib/libcairo-native-runtime-${{ matrix.branch }}.a
key: library-${{ github.event.pull_request[matrix.branch].sha }}

- name: Run Program
run: |
make deps
Expand All @@ -208,7 +194,7 @@ jobs:
--export-json "${f%.*}.json" \
--warmup 3 \
-n "${{matrix.branch}} $(basename $f) (JIT)" "./bin/cairo-native-run-${{ matrix.branch }} --run-mode=jit -s $f --opt-level 3 --available-gas 18446744073709551615" \
-n "${{matrix.branch}} $(basename $f) (AOT)" "CAIRO_NATIVE_RUNTIME_LIBRARY=lib/libcairo-native-runtime-${{ matrix.branch }}.a ./bin/cairo-native-run-${{ matrix.branch }} --run-mode=aot -s $f --opt-level 3 --available-gas 18446744073709551615" \
-n "${{matrix.branch}} $(basename $f) (AOT)" "./bin/cairo-native-run-${{ matrix.branch }} --run-mode=aot -s $f --opt-level 3 --available-gas 18446744073709551615" \
>> /dev/stderr
done
Expand Down Expand Up @@ -238,11 +224,16 @@ jobs:
- name: Print tables
run: |
{
echo "${bold}Benchmark results Main vs HEAD.${normal}"
echo "## **Benchmark results Main vs HEAD.**"
for f in bench-results-base/*.md; do
echo "### Base"
echo
cat $f
echo
echo "### Head"
echo
cat bench-results-head/$(basename $f)
echo
done
} | tee -a comment_body.md
Expand Down
16 changes: 8 additions & 8 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ jobs:
TABLEGEN_190_PREFIX: /usr/lib/llvm-19/
steps:
- uses: actions/checkout@v4
- uses: dtolnay/rust-toolchain@1.84.0
- uses: dtolnay/rust-toolchain@1.84.1
with:
components: clippy, rustfmt
- uses: Swatinem/rust-cache@v2
Expand All @@ -41,7 +41,7 @@ jobs:
runs-on: ubuntu-24.04
steps:
- uses: actions/checkout@v4
- uses: dtolnay/rust-toolchain@1.84.0
- uses: dtolnay/rust-toolchain@1.84.1
with:
components: rustfmt
- run: cargo fmt --all -- --check
Expand Down Expand Up @@ -134,7 +134,7 @@ jobs:
sudo rm -rf /usr/local/lib/android
df -h
- name: Setup rust env
uses: dtolnay/rust-toolchain@1.84.0
uses: dtolnay/rust-toolchain@1.84.1
- name: Retreive cached dependecies
uses: Swatinem/rust-cache@v2
- name: add llvm deb repository
Expand Down Expand Up @@ -166,7 +166,7 @@ jobs:
steps:
- uses: actions/checkout@v4
- name: Rustup toolchain install
uses: dtolnay/rust-toolchain@1.84.0
uses: dtolnay/rust-toolchain@1.84.1
with:
components: clippy
- name: Rust `$PATH` workaround.
Expand Down Expand Up @@ -225,7 +225,7 @@ jobs:
sudo rm -rf /usr/local/lib/android
df -h
- name: Setup rust env
uses: dtolnay/rust-toolchain@1.84.0
uses: dtolnay/rust-toolchain@1.84.1
- name: Retreive cached dependecies
uses: Swatinem/rust-cache@v2
- name: add llvm deb repository
Expand All @@ -246,8 +246,8 @@ jobs:
scarb-version: "2.9.2"
- name: Install deps
run: make deps
- name: Build runtime and alexandria
run: make runtime-ci && make check-llvm && make needs-cairo2 && make build-alexandria
- name: Build alexandria
run: make check-llvm && make needs-cairo2 && make build-alexandria

- name: Run tests and generate coverage partition ${{ matrix.partition }}
run: cargo llvm-cov nextest --verbose --features=scarb --workspace --lcov --output-path ${{ matrix.output }} --partition count:${{ matrix.partition }}/4
Expand Down Expand Up @@ -278,7 +278,7 @@ jobs:
needs: [coverage]
steps:
- name: Setup rust env
uses: dtolnay/rust-toolchain@1.84.0
uses: dtolnay/rust-toolchain@1.84.1
- name: Retreive cached dependencies
uses: Swatinem/rust-cache@v2
- name: Install testing tools
Expand Down
50 changes: 27 additions & 23 deletions .github/workflows/daily.yml
Original file line number Diff line number Diff line change
Expand Up @@ -51,8 +51,8 @@ jobs:
- 900700
- 900800
- 900900
- 1000000
- 1001000
- 1000400
- 1000500
- 1002000
- 1003000
- 1004000
Expand Down Expand Up @@ -90,22 +90,21 @@ jobs:
path: sequencer
ref: replay

- name: Restore RPC Calls
id: restore-rpc-calls
uses: actions/cache/restore@v4.2.0
with:
path: starknet-replay/rpc_cache
key: cache-${{matrix.block}}

# Install dependencies
- uses: ./cairo_native/.github/actions/install-linux-deps
- name: Setup rust env
uses: dtolnay/rust-toolchain@1.84.0
uses: dtolnay/rust-toolchain@1.84.1
- name: Retreive cached dependecies
uses: Swatinem/rust-cache@v2
with:
workspaces: "starknet-replay -> target"
cache-directories: "cairo_native"

- name: Build Cairo Native Runtime Library
shell: bash
run: |
cd ../cairo_native
make runtime
echo "CAIRO_NATIVE_RUNTIME_LIBRARY=$(pwd)/libcairo_native_runtime.a" > $GITHUB_ENV
workspaces: starknet-replay

- name: Patch replay dependencies
run: |
Expand All @@ -130,10 +129,6 @@ jobs:
new_path='"..\/cairo_native"'
sed -i'' -r "s/^cairo-native = .*/cairo-native.path = $new_path/" Cargo.toml
# Update native submodule
git rm crates/blockifier/cairo_native
ln -s ../../../cairo_native/ crates/blockifier/cairo_native
git diff
- name: Run with Native
Expand All @@ -157,6 +152,13 @@ jobs:
name: dump-${{matrix.block}}-${{matrix.runner}}
path: starknet-replay/state_dumps/${{matrix.runner}}

- name: Save RPC Calls
uses: actions/cache/save@v4.2.0
if: ${{ always() && matrix.runner == 'vm' }}
with:
path: starknet-replay/rpc_cache
key: ${{ steps.restore-rpc-calls.outputs.cache-primary-key }}

compare:
needs: [run]
runs-on: ubuntu-latest
Expand Down Expand Up @@ -188,19 +190,21 @@ jobs:
run: |
./scripts/cmp_state_dumps.sh | tee output
- name: Upload Compare Results
id: upload_compare_results
uses: actions/upload-artifact@v4
if: ${{ always() }}
with:
name: output-result
path: output

- name: Prepare env vars
if: ${{ always() }}
run: |
# Save workflow url
REPO_URL="${{ github.server_url }}/${{ github.repository }}"
echo "WORKFLOW_URL=$REPO_URL/actions/runs/${{ github.run_id }}" | tee -a $GITHUB_ENV
# Save output
{
echo 'OUTPUT<<EOF'
cat output
echo EOF
} >> "$GITHUB_ENV"
echo "COMPARISON_RESULT=$REPO_URL/actions/runs/${{ github.run_id }}/artifacts/${{ steps.upload_compare_results.outputs.artifact-id }}" | tee -a $GITHUB_ENV
- name: Create Issue
if: ${{ failure() }}
Expand Down
4 changes: 1 addition & 3 deletions .github/workflows/publish.yml
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@ jobs:
sudo rm -rf /usr/share/dotnet/
sudo rm -rf /usr/local/lib/android
- name: Setup rust env
uses: dtolnay/rust-toolchain@1.84.0
uses: dtolnay/rust-toolchain@1.84.1
- name: Retreive cached dependecies
uses: Swatinem/rust-cache@v2
- name: add llvm deb repository
Expand All @@ -37,7 +37,5 @@ jobs:
keys-asc: https://apt.llvm.org/llvm-snapshot.gpg.key
- name: Install LLVM
run: sudo apt-get install llvm-19 llvm-19-dev llvm-19-runtime clang-19 clang-tools-19 lld-19 libpolly-19-dev libmlir-19-dev mlir-19-tools
- name: publish the runtime
run: cargo publish --token ${CRATES_TOKEN} --all-features -p cairo-native-runtime
- name: publish the crate
run: cargo publish --token ${CRATES_TOKEN} --all-features -p cairo-native
Loading

0 comments on commit f711785

Please sign in to comment.