bit-hack / tack

Tack - The vector wrapper
0 stars 0 forks source link

Add support for multiple implementations #16

Open bit-hack opened 8 years ago

bit-hack commented 8 years ago

We should think about how to support multiple implementations of our vector classes. One thought would be to make changes similar to the following:

float4.h - compiler feature detection with pass threw to below
float4_sse.h - sse specialized implementation
float4_cpu.h - scalar fpu implementation as fallback
float4_neon.h - neon specialized implementation

Its quite nice that we can also reuse our test suite to test all of these specializations and ensure they are equivalent, by just changing the platform and compiler flags.

bit-hack commented 8 years ago

Should we be making the abstraction between implementations at a different level? Intrinsic level?

kbenzie commented 8 years ago

I was thinking about having intrinsic_traits which would have architecture specific specialisations, this would allow the float4 type to contain only the logic and keep the details of the intrinsics elsewhere.

Selecting the intrinsic_traits would depend on #ifdef's and a using intrinsic_traits = x86_intrinsic_tratis on each path.

How does that sound?

bit-hack commented 8 years ago

If I understand correctly then this would be an interesting approach. This would however be limited by however well two vector instruction sets map to each other. It seems like it would be worth trying out this approach and seeing how it fairs. Perhaps we/I should knock up a WIP branch and try to add some very basic Neon stuff and see how it looks?