Skip to content

Commit

Permalink
Experimental feature for thread safety (#258)
Browse files Browse the repository at this point in the history
* checkpoint

* another checkpoint

* checkpoint again

* work in progress

* checkpoint

* terrible but it does compile now, so that is something

* decent checkpoint

* seems to compile now, just some clean up that needs to be done

* add imports

* rework random module

* checkpoint

* do not share the env between the kernel and the rest of the engines

* safepoints wip

* combine interrupts and safepoints into one thing

* simplify thread controlling

* safepoint handling

* more progress

* capture error on tasks

* fix some local issues

* fix build

* fix merge issues

* clean up

* more clean up

* fix shift reset

* checkpoint

* checkpoint

* fix tests

* setup dylibs

* depend on workspace version

* clean up the kernel

* add some more tests

* some more stuff

* tests sometimes take a while, use higher opt profile

* see if this fixes it

* fix normal build

* see what is happening

* did this work

* clean up

* set up new build stuff

* rename workflow

* fix build

* align smallvec versions

* test with different error message

* adjust tests

* typos

* try this

* separate env

* give this a shot

* try this annoying hack

* remove sync line

* in place update

* generate docs

* clean up warnings

* remove comment

* add pgo build

* upload release artifact

* set up workflows for each OS

* build

* remove prints

* try this out

* upload workflow for windows

* fix windows artifact build

* grab windows artifact

* set up nightly pgo runs

* set up nightly builds

* dont run on PR yet
  • Loading branch information
mattwparas authored Sep 3, 2024
1 parent fef98b8 commit 2004e3a
Show file tree
Hide file tree
Showing 91 changed files with 4,932 additions and 2,029 deletions.
108 changes: 108 additions & 0 deletions .github/workflows/nightly.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,108 @@
name: Nightly build

on:
workflow_dispatch: {}
schedule:
- cron: '0 0 * * *'

jobs:
check_changes:
runs-on: ubuntu-latest
name: Check latest commit
outputs:
should_run: ${{steps.should_run.outputs.should_run}}
steps:
- uses: actions/checkout@v2
- name: print latest_commit
run: echo ${{github.sha}}
- id: should_run
continue-on-error: true
name: check latest commit is less than a day
if: ${{ github.event_name == 'schedule' }}
run: test -z $(git rev-list --after="24 hours" ${{github.sha}}) && echo "::set-output name=should_run::false"

optimize:
name: PGO Build
strategy:
matrix:
os: [
{ os: ubuntu-latest, arch: x86_64-unknown-linux-gnu },
{ os: macos-latest, arch: aarch64-apple-darwin },
{ os: windows-latest, arch: x86_64-pc-windows-msvc }
]
needs: check_changes
if: ${{needs.check_changes.outputs.should_run != 'false'}}
runs-on: ${{ matrix.os.os }}
defaults:
run:
shell: bash
steps:
- name: Checkout repository
uses: actions/checkout@v2

- name: Install Rust toolchain
uses: actions-rs/toolchain@v1
with:
toolchain: stable
profile: minimal
override: true
components: llvm-tools-preview

- name: Set the STEEL_HOME environment variable
run: echo STEEL_HOME=${PWD}/.steel-sync >> $GITHUB_ENV

- name: Install cargo-pgo
run: cargo install cargo-pgo

- uses: Swatinem/rust-cache@v2
with:
shared-key: "build"

- name: Build instrumented binary
# Use `cargo pgo build -- --bin foo` if you have multiple binaries
run: cargo pgo build

- name: install steel dylib installer
env:
STEEL_HOME: ${{ env.STEEL_HOME }}
run: mkdir -p $STEEL_HOME/native && cd crates/cargo-steel-lib && cargo install --path .

- name: Install cogs
env:
STEEL_HOME: ${{ env.STEEL_HOME }}
run: |
echo $STEEL_HOME
mkdir -p .steel/cogs
cd cogs/
cargo run -- install.scm
- name: Gather PGO profiles
env:
STEEL_HOME: ${{ env.STEEL_HOME }}
run: |
./target/${{ matrix.os.arch }}/release/steel r7rs-benchmarks/scheme.scm
./target/${{ matrix.os.arch }}/release/steel r7rs-benchmarks/simplex.scm
./target/${{ matrix.os.arch }}/release/steel r7rs-benchmarks/array1.scm
./target/${{ matrix.os.arch }}/release/steel r7rs-benchmarks/triangl.scm
./target/${{ matrix.os.arch }}/release/steel benchmarks/fib/fib.scm
- name: Build optimized binary
run: cargo pgo optimize

- name: Archive pgo optimized binary
if: ${{ runner.os != 'windows' }}
uses: actions/upload-artifact@v4
with:
name: pgo-nightly-build-${{ matrix.os.arch }}
path: ${{ github.workspace }}/target/${{ matrix.os.arch }}/release/steel
retention-days: 30

- name: Archive pgo optimized binary (windows)
if: ${{ runner.os == 'windows' }}
uses: actions/upload-artifact@v2
with:
name: pgo-nightly-build-${{ matrix.os.arch }}
path: target\${{ matrix.os.arch }}\release\steel.exe
retention-days: 30


58 changes: 54 additions & 4 deletions .github/workflows/rust.yml
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,9 @@ jobs:
profile: minimal
override: true

- name: Remove sync feature from build
run: sed -i 's/"dylib-build", "sync"/"dylib-build"/' Cargo.toml

- name: Set the STEEL_HOME environment variable
run: echo STEEL_HOME=${PWD}/.steel >> $GITHUB_ENV

Expand All @@ -30,7 +33,7 @@ jobs:
shared-key: "build"

- name: Build
run: cargo build --verbose
run: cargo build --no-default-features --verbose

- name: install steel dylib installer
env:
Expand All @@ -44,26 +47,73 @@ jobs:
echo $STEEL_HOME
mkdir -p .steel/cogs
cd cogs/
cargo run -- install.scm
cargo run --no-default-features -- install.scm
- uses: actions-rs/cargo@v1
env:
STEEL_HOME: ${{ env.STEEL_HOME }}
with:
command: test
args: --all
args: --all --no-default-features

- name: install cargo-tarpaulin
run: cargo install cargo-tarpaulin

- name: run code coverage
run: cargo tarpaulin --all -o "lcov"
run: cargo tarpaulin --all --no-default-features -o "lcov" --engine llvm

- name: Coveralls GitHub Action
uses: coverallsapp/[email protected]
with:
github-token: ${{ secrets.GITHUB_TOKEN }}
path-to-lcov: ./lcov.info


sync-build:
name: Test Suite (sync)
runs-on: ubuntu-latest
steps:
- name: Checkout repository
uses: actions/checkout@v2

- name: Install Rust toolchain
uses: actions-rs/toolchain@v1
with:
toolchain: stable
profile: minimal
override: true

- name: Set the STEEL_HOME environment variable
run: echo STEEL_HOME=${PWD}/.steel-sync >> $GITHUB_ENV

- uses: Swatinem/rust-cache@v2
with:
shared-key: "build"

- name: Build
run: cargo build --verbose

- name: install steel dylib installer
env:
STEEL_HOME: ${{ env.STEEL_HOME }}
run: mkdir -p $STEEL_HOME/native && cd crates/cargo-steel-lib && cargo install --path .

- name: Install cogs
env:
STEEL_HOME: ${{ env.STEEL_HOME }}
run: |
echo $STEEL_HOME
mkdir -p .steel/cogs
cd cogs/
cargo run -- install.scm
- uses: actions-rs/cargo@v1
env:
STEEL_HOME: ${{ env.STEEL_HOME }}
with:
command: test
args: --all steel-core/sync


wasm-build:
name: Wasm32 build
Expand Down
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -7,3 +7,4 @@ docs/theme
/result
.direnv/
.steel/
.helix/
Loading

0 comments on commit 2004e3a

Please sign in to comment.