Comments (8)
Just chiming in to echo Martin's take here. I know this is an old topic and I've already said my 2 cents, but want to reiterate that the precision vs perf tradeoff here, even without considering platform dependent results, is no longer a good tradeoff considering how quick modern hardware does a real sqrt operation.
from handmademath.
Makes sense. To be honest I'm debating the merits of our hand-rolled SIMD code across the board. Certainly it doesn't seem worthwhile for small things like inverse square root.
I'll rework things to avoid specialized inverse square roots.
from handmademath.
Yep agreed. We should finally deal with this now with 2.0.
from handmademath.
Well to be clear, I'm suggesting we maybe just delete all our SIMD code. I'm not persuaded it's worth it. I mean maybe we could keep it for mat4 multiplies or something, but in general, I really doubt it's worth it. But SIMD is not my forte, so I'd defer to @mmozeiko on this one.
from handmademath.
It's fine to leave SIMD code if you want it. Just make sure scalar path matches SIMD float calculations. Doing SIMD on SSE & NEON will not break it, they produce same results. So SIMD by itself is not a problem.
Like for dot product that would be writing it as: return (x + z) + (y + w);
from handmademath.
Having a scalar mode is good for e.g. emscripten builds, but in general SIMD is a nice thing to keep. You don't need to SIMD everything though, and if the maintenance cost is high you can definitely simplify and have less SIMD implementation.
from handmademath.
You don't need to SIMD everything though, and if the maintenance cost is high you can definitely simplify and have less SIMD implementation.
I was looking at adding NOEN on a local branch yesterday, and was running some (very rudimentary, and not exhaustive) benchmarks. and it looks like SIMD is not worth it for Vec4 unless you care about debug performance, optimized builds at -O2
perform the same scalar vs SIMD. You do see an improvement for matrix transpose, need to add some benchmarks for other matrix ops, and Quaternions to see what else sees benefit. The same is true with both NEON and SSE, so If you wanted to remove some of the SIMD paths to simplify, its probably pretty safe to just use SIMD for matrices.
from handmademath.
I believe we should have consistent results between SIMD and non-SIMD code now. If you find any other inconsistencies, please let me know and I will reopen the issue.
from handmademath.
Related Issues (20)
- Clarify ambiguous term "Column-major" HOT 2
- User-overridable linkage HOT 2
- Ship a set of basic math functions as an easy CRT alternative HOT 2
- Support unary minus operator on vectors HOT 2
- Fully inline Handmade Math HOT 2
- CI is not working HOT 2
- Divide by zero when calling HMM_Slerp with two identity quaternions HOT 3
- Unnecessary Square Root HOT 4
- Rotate point by quaterion HOT 1
- Where's the function to inverse a matrix? HOT 2
- Request - document fundamental choices made in handmade math HOT 2
- Remove HMM_PREFIX HOT 1
- Make naming more consistent and concise HOT 1
- HMM 2.0 Design HOT 1
- Use _Generic in C? HOT 3
- Unroll our loops HOT 2
- Convert HandmadeMath to double HOT 1
- Vector to matrix multiply arguments have the wrong order HOT 1
- `HMM_LinearCombineV4M4` has incorrect name and naming of arguments HOT 2
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from handmademath.