4 ms·
Handling NaNs (Not a Number, usually referring to operations that trigger non arithmetic numbers, such as 0/0) was not optimally handled by Wasmer LLVM compiler
by syrusakbary 5y ago
Handling NaNs (Not a Number, usually referring to operations that trigger non arithmetic numbers, such as 0/0) was not optimally handled by Wasmer LLVM compiler.
We had a custom NaN "canonicalizer" that was always canonicalizing NaNs (that means: making sure the NaN bits were always the same in any chipset) regardless of use case and need. We took a look on how other runtimes were doing it more optimally and realized we could use LLVM intrinsic calls for math operations so LLVM would handle it directly.
If you are curious about the tech details, here's the PR!
https://github.com/wasmerio/wasmer/pull/2161 https://github.com/wasmerio/wasmer/pull/2161
- tgb 5y ago> NaNs (Not a Number, usually referring to positive/negative Infinite values in floats and integers) Huh? This sounds totally incorrect to me.
- syrusakbary 5y agoSorry about that! I was trying to explain it so people with little understanding could see how NaNs are handled/generated in a Wasm context (for example: 0/0 will trigger a NaN), but it's true that Infinite and NaNs are not the same. I'll correct my comment :)
- mattgreenrocks 5y agoMakes sense. NaNs are super weird: quiet/signaling variants, as well as they're technically a set of values, WRT to which bits indicate them.