packed_simd icon indicating copy to clipboard operation
packed_simd copied to clipboard

Scatter/gather for non-pointer types?

Open rileylyman opened this issue 6 years ago • 1 comments

I'm new to this crate, so I don't know if I just haven't looked hard enough, but it seems like there is no scatter/gather or strided loads/stores for the generic Simd<[T,n]> trait. Is it possible to do strided or gather/scatter memory operations for packed vectors that don't contain pointers? If not, are there any plans on adding this? For example, something like

let arr = [1, 2, 3, 4, 5, 6, 7, 8];
let vec1 = f64x4::load_stride(arr[..], 2); // [1,3,5,7]
let vec2 = f64x4::load_gather(arr[..], [0,3,5,6,7]); // [1,4,6,7,8]

rileylyman avatar Apr 21 '19 21:04 rileylyman

It's possible, but there is no one working on that.

The way one would currently implement both operations is by just creating a suitable vector of pointers, and then doing the load on that. Currently, this approach does not work for all vector types, because the library currently only implements 512-bit wide vectors, and a u8x64::load_gather method would require a 4096-bit wide vector on 64-bit machines.

So full generic support for this might need adding more pointer vector types first.

gnzlbg avatar Apr 24 '19 15:04 gnzlbg