-
Notifications
You must be signed in to change notification settings - Fork 87
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
Simd<&T, N> #200
Comments
One thing that just occurred to me in relation to #195, #198, and #199: |
...if we get |
Or, we should not use the ops traits on the scalar type and instead use our own sealed traits that explicitly indicate which functions can monomorphize (as I have said repeatedly), and then we can allow vectors of references just fine. The ops traits do not actually mean anything whatsoever regarding intrinsics and this is an example of why using them for this is a hack that only works with number types. I think vectors of references would be useful for gather and maybe a few other things and this isn't a good reason to rule them out. |
We can only use thin pointers anyway, though. If it's a fat borrow, and any instance of |
vectors of fat pointers should totally be doable by just allocating |
what would a vector of fat pointers even do. Like are we trying to imagine that at some point you could vectorize all of rust, or what. |
One example where vectors of references would be nice: pub struct TreeNode<'a> {
data: Cell<isize>,
left: &'a TreeNode<'a>,
right: &'a TreeNode<'a>,
}
pub fn simd_binary_search<'a>(mut node: Simd<&'a TreeNode<'a>, 4>, empty_node: &'a TreeNode<'a>, key: Simd<isize, 4>) -> Mask<isize, 4> {
let mut done = Mask::from(false);
let mut found = Mask::from(false);
while !done.all() {
let data: Simd<i32, 4> = node.field_ref(field!(TreeNode::data)).gather_cells();
let gt = data.lane_gt(key);
found = data.lane_eq(key);
done = found | node.lane_ptr_eq(Simd::splat(empty_node));
let child = gt.select(node.field_ref(field!(TreeNode::left)), node.field_ref(field!(TreeNode::right)));
node = done.select(node, child);
}
found
} |
well, I would like to be able to vectorize a decent subset of rust...idk that fat pointers needs to be in that subset, but I definitely think thin pointers/references should! |
Fat pointers shouldn't really be handled via struct FatPtr<T, const N> {
ptr: Simd<*const T, N>
len: Simd<usize, N>
} for all the usual reasons to use SoA constructions. |
that breaks assumptions that |
Only if it is offered as the same type, which it should probably not be. |
Yeah i mean hardware doesn't have anything at all like a rust fat pointer as far as i know, so we don't need to represent our "simd version of fat pointers" like anything in particular because we're fudging it no matter what. |
I didn't see an issue tracking vectors of pointers/references, so I'm opening one. Feel free to edit as necessary.
The text was updated successfully, but these errors were encountered: