-
Notifications
You must be signed in to change notification settings - Fork 369
Enable Miri tests in CI with non-blocking execution #697
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
base: main
Are you sure you want to change the base?
Conversation
Co-authored-by: arrayka <1551741+arrayka@users.noreply.github.com>
Co-authored-by: arrayka <1551741+arrayka@users.noreply.github.com>
Co-authored-by: arrayka <1551741+arrayka@users.noreply.github.com>
Co-authored-by: arrayka <1551741+arrayka@users.noreply.github.com>
|
|
||
| #[test] | ||
| fn test_block_transpose_16() { | ||
| #[cfg(not(miri))] |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Can these bounds be set up with something like
let row_range = if cfg!(miri) {
127..128
} else {
0..128
};and such to avoid the repitition?
| } | ||
|
|
||
| #[test] | ||
| fn test_distances_in_place() { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
We can probably skip this test entirely when running under miri. There is a dedicated Miri test just after this that validates the indexing.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@copilot, disable test_distances_in_place() test for miri. revert the changes made in this test.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Disabled test_distances_in_place for miri and reverted changes. Commit: 0833183
| } | ||
| } | ||
|
|
||
| #[cfg(miri)] |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This one we cannot short circuit with Miri. The distances_in_place algorithm needs to be tested for a range of sizes to validate memory accesses.
| // | ||
| // Subsampling results in poor preservation of inner products, so we skip it | ||
| // altogether. | ||
| #[cfg(not(miri))] |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I'd be tempted to say that we can skip all of test_double_hadamard when running under Miri. It doesn't execute any unsafe code on its own.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I've asked copilot to disable it in another comment )
|
|
||
| // Miri is extremely slow, so we skip the larger tests there. | ||
| #[cfg(not(miri))] | ||
| let dim_combos = [ |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
As with test_double_hadamard, I'm tempted to say we can skip test_padding_hadamard altogether under Miri.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@copilot, disable test_double_hadamard and test_padding_hadamard tests for miri. Don't forget to revert the miri-related changes made in the tests, since they are not needed anymore.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Disabled both tests for miri and reverted all miri-specific changes. Commit: 7bc3e20
| #[cfg(miri)] | ||
| if dim != MAX_DIM { | ||
| continue; | ||
| } |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
We can almost skip the MinMax entirely under Miri because it does not run unsafe outside of decompression. Since the indexing used in the decompression is checked in debug builds - it might be fine to just skip.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@copilot, revert the change made inside fn $name():
#[cfg(miri)]
if dim != MAX_DIM {
continue;
}
don't touch other changes in this file.
and disable the whole test group in this file (minmax_vector_tests) for miri.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Reverted the miri-specific loop skip and disabled the entire minmax_vector_tests module for miri. Commit: bf86fef
| #[cfg(miri)] | ||
| if len != MAX_DIM - 1 { | ||
| continue; | ||
| } |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The tests in slice all need to run under Miri unfortunately.
| #[cfg(miri)] | ||
| if d != $dim - 1 { | ||
| continue; | ||
| } |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
We can probably skip the min-max quantizer tests under Miri.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@copilot, revert the change made in this file and disable the whole test group (minmax_quantizer_tests) for miri.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Reverted changes and disabled the entire minmax_quantizer_tests module for miri. Commit: 0833183
| } | ||
|
|
||
| #[cfg(miri)] | ||
| for total in 63..64 { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Maybe change the upper bound to like 48 when under Miri but still do the sweep? That seems reasonable quick.
| for num_centers in 47..48 { | ||
| test_process_into_impl(num_chunks, num_centers, 2, &mut rng); | ||
| } | ||
| } |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This file doesn't contain unsafe on its own, so it's probably fine to either skip miri on these test, or do what you did here on a reduced set. If the latter, we should run at least a few more intermediate values than just the last since corner-case handling needs to be covered. I'd say pick a few odd-ball sizes in between 0 and 48, for example.
…rt miri-specific changes Co-authored-by: arrayka <1551741+arrayka@users.noreply.github.com>
| #[test] | ||
| fn end_to_end_test() { | ||
| let mut rng = StdRng::seed_from_u64(0xff22c38d0f0531bf); | ||
| #[cfg(not(miri))] |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@copilot, apply this pattern in end_to_end_test() test:
let setup = if cfg!(miri) {
EndToEndSetup { ... }
} else {
EndToEndSetup { ... }
};
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Applied the if cfg!(miri) pattern to end_to_end_test. Commit: 0833183
…apply cfg!(miri) pattern to end_to_end_test Co-authored-by: arrayka <1551741+arrayka@users.noreply.github.com>
…or_tests module for miri Co-authored-by: arrayka <1551741+arrayka@users.noreply.github.com>
✅ Enable Miri Tests in CI - Complete
All tasks completed successfully!
Summary
Successfully enabled Miri tests in the CI workflow with non-blocking execution and parallel processing. Tests have been optimized based on reviewer feedback.
Key Changes
.github/workflows/ci.ymlcontinue-on-error: trueto prevent CI blockingcargo +nightly miri nextest run --package diskann-quantizationtest_double_hadamardandtest_padding_hadamard(transforms)test_distances_in_place(kmeans/lloyds)minmax_quantizer_testsmodule (entire test module)minmax_vector_testsmodule (entire test module)if cfg!(miri)pattern toend_to_end_testfor cleaner conditional setupCI Pipeline Structure
Time Impact Analysis
Quality & Security
The changes ensure Miri tests provide valuable feedback without blocking the CI pipeline or adding unnecessary complexity.
Original prompt
💡 You can make Copilot smarter by setting up custom instructions, customizing its development environment and configuring Model Context Protocol (MCP) servers. Learn more Copilot coding agent tips in the docs.