Skip to content
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

single float to double float api #51

Open
jpbruyere opened this issue Aug 9, 2021 · 4 comments
Open

single float to double float api #51

jpbruyere opened this issue Aug 9, 2021 · 4 comments

Comments

@jpbruyere
Copy link
Owner

SIMD instructions target minimum 128 bits registers for floats, so for 2 dimensions vectors, the minimal alignment is 128bits, this makes use of SIMD only possible for 2*64bit float component vectors. So I'm planning to test and maybe move the vkvg api to double float instead of single float to be able to use SIMD.

@jpbruyere
Copy link
Owner Author

jpbruyere commented Aug 9, 2021

First tests with double vec2d with _m128d show no improvements with _m_add, mul, div. perfs are even worse (20% slower than vec2 (2*float) and normal arithmetic, load/store overhead for single ops on 2d vectors of doubles cant bring speedup.
SIMD usage must be considered for full algorithm with few load/store ops.

@Volatus
Copy link
Contributor

Volatus commented Dec 31, 2021

@jpbruyere Doesn't the compiler do some amount of vectorization at -O3 level? (At least I've seen this happen in C++, not sure about C).

@jpbruyere
Copy link
Owner Author

The idea here was to try to optimize atomic arithmetic operations by hands, but I was missing the load/store overheads. I guess a lot of vectorization is already done by the compilers. This subject is a hard one, this tests was my first attempt with simd ops.

@jpbruyere
Copy link
Owner Author

Most of the floating point operations will get float types promoted to double, it would maybe be wise to use double in computations where possible...

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants