Repository navigation
Add SIMD algebraic intrinsics - #164952
calebzulawski wants to merge 14 commits into
Conversation
|
Some changes occurred to the CTFE / Miri interpreter cc @rust-lang/miri Some changes occurred to the CTFE machinery Some changes occurred to the platform-builtins intrinsics. Make sure the cc @antoyo, @GuillaumeGomez, @bjorn3, @programmerjake Some changes occurred to the intrinsics. Make sure the CTFE / Miri interpreter |
|
r? @davidtwco rustbot has assigned @davidtwco. Use Why was this reviewer chosen?The reviewer was selected based on:
|
e92596e to
9d8b178
Compare
|
cc @rust-lang/miri |
|
cc @bjorn3 |
3125bca to
6796d73
Compare
| }; | ||
|
|
||
| let mut res = init; | ||
| for i in M::nondet_index_iterator(self, op_len) { |
There was a problem hiding this comment.
maybe add a comment noting that this doesn't fully randomize the reduce order, since it only randomizes the order of the inputs then does an ordered reduce -- that will never give you an evaluation order like (a + b) + (c + d).
There was a problem hiding this comment.
an example implementation that does cover all possible evaluation orders: https://play.rust-lang.org/?version=stable&mode=debug&edition=2024&gist=c2f778ccd6b16d881b5afac8200ffaf7
pub fn random_reduce<T>(mut inputs: Vec<T>, mut reduce: impl FnMut(T, T) -> T) -> Option<T> {
while inputs.len() >= 2 {
let lhs_index = rand::random_range(0..inputs.len());
let lhs = inputs.swap_remove(lhs_index);
let rhs_index = rand::random_range(0..inputs.len());
let rhs = inputs.swap_remove(rhs_index);
inputs.push(reduce(lhs, rhs));
}
inputs.pop()
}There was a problem hiding this comment.
I'm curious if this is actually necessary, miri's float nondeterminism doesn't generate every possible distribution of nondeterminism
There was a problem hiding this comment.
maybe not, but in the case of catastrophic cancellation, you can get wildly different results for the different evaluation orders so imo it would be useful for miri to be able to give you those.
This comment has been minimized.
This comment has been minimized.
4db7858 to
3067057
Compare
This comment has been minimized.
This comment has been minimized.
…educe order, and add non-determinism miri test for SIMD
… regular operations
Co-authored-by: Ralf Jung <post@ralfj.de>
3067057 to
95f5629
Compare
|
This PR was rebased onto a different main commit. Here's a range-diff highlighting what actually changed. Rebasing is a normal part of keeping PRs up to date, so no action is needed—this note is just to help reviewers. |
|
I think #164924 introduced a minor break to cg_gcc vector frem, I repaired that here |
6790b70 to
d617bff
Compare
View all comments
Added algebraic intrinsics for SIMD. First half of rust-lang/portable-simd#539