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

Run tests with miri #897

Closed
swfsql opened this issue Dec 5, 2023 · 1 comment
Closed

Run tests with miri #897

swfsql opened this issue Dec 5, 2023 · 1 comment

Comments

@swfsql
Copy link
Contributor

swfsql commented Dec 5, 2023

It's possible to use miri to run some tests (cpu ones - so no cuda feature - and the ones that don't interact with python - so no numpy feature). Miri can be particularly useful to detect possible Undefined Behavior cases and memory leaks, although it can also have false positives (and false negatives - this depends on the tests coverage).

Setup

The miri readme mentions using cargo nextest so tests are able to run in parallel, and for memory leaks to be detected.

# install miri
rustup +nightly component add miri

# install cargo nextest (Linux x86_64)
curl -LsSf https://get.nexte.st/latest/linux | tar zxf - -C ${CARGO_HOME:-~/.cargo}/bin
# cargo clean (run once when `cargo miri` is not used)
cargo clean

# run all tests (note: very slow and should take hours, assuming there are no errors)
MIRIFLAGS='-Zmiri-strict-provenance -Zmiri-symbolic-alignment-check -Zmiri-retag-fields -Zmiri-disable-isolation -Zmiri-tree-borrows' \
cargo miri nextest run --test-threads 1 --no-default-features --features std,fast-alloc,cpu,nightly,safetensors

Note that miri is very slow and takes an hour to run eg. the longest transformer test. So an accompanying issue (#898) would be to reduce the test sizes to their minimum.

@swfsql swfsql mentioned this issue Dec 5, 2023
12 tasks
@swfsql
Copy link
Contributor Author

swfsql commented Mar 1, 2024

Closing as I think the tests that got run on the linked pr indicated a robust behavior.
But feel free to ping or re-open in case anyone has an interest!

@swfsql swfsql closed this as completed Mar 1, 2024
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 a pull request may close this issue.

1 participant