4 ms·
Here is how I would have it: Instead of writing: fn do_athing(val: f32x69) -> f32x69 { } Instead you do: fn do_athing(val: fx) -> fx { } And it jus
by the__alchemist 1y ago
Here is how I would have it:
Instead of writing:
fn do_athing(val: f32x69) -> f32x69 {
}
Instead you do:
fn do_athing(val: fx) -> fx {
}
And it just works. f32, f64, as wide as your CPU supports.
- jiggawatts 1y agoThe Vector<T> type in dotnet core works precisely like this. Just yesterday I tried it for some spatial map aggregation filters and calculations, and it worked great. On my older PC it used AVX2 instructions and 256-bits at a time processing, on my newer laptop it automatically switched to AVX-512 and its speed improved 4x without a single line of code having to change! I.e.: Vector<int> has 8x "int" elements on older processors, but it has 16x elements on newer ones. You can retrieve the count with Vector<int>.Count and use that to split your data. The only issue is that swizzles and scatter/gather is unavailable for these generic types.
- the__alchemist 1y agoVery cool! I'm obviously doing the hard-coded types approach for now bc it's all I can get working!