#with simd, is it possible to have an array `ar` where i could index on with a vector `ar[vector]`?
1 messages · Page 1 of 1 (latest)
you’ve discovered gathering, use @shuffle for exactly this
although if you’re summing them up, why do you need to gather?
or uh, to revise my original answer, i’d vector comptime known?
ar is comptime known, vector is filled during runtime
then just do like
for (0..N) |i| out[i] = ar[vector[i]]
but then i'd be making the vector for nothing
- not really? it’ll still generate a vpshuf
- what are you actually trying to achieve?
- whats that?
- i want to 'parallel' (idk if thats correct terminology) indexing on a array. im reading characters from a line, i use those characters to index on
arwhich' values i need to sum
- x86 instruction that does gather
- you need to sum the values at the given indices? is it a constant amount of items per line?
- ah so it would still do some performance optimizations?
- the items per line differ
wouldnt it be better to just do sum += ... instead of out[i] = ... first?
i mean, yeah