Hacker News new | ask | show | jobs
GCC 12 is 119x slower than AVX-512 SIMD on this task (ashvardanian.com)
3 points by prtg 966 days ago
1 comments

"this task" is complex mathematical calculation ("Jensen Shannon divergence") and a large fraction of speedup is from replacing exact methods with approximate ones.. full 32-bit floats become 16-bit ones, exact logarithm is replaced by approximation of one, division is replacing with reciprocal + multiply...

It's an interesting question: can computer do that same thing automatically? Can we somehow tell the compiler: "this variable's interesting range is 1-100 and I only need 10LSBs of precision.. feel free to optimize under those assumption"?