3 ms·
Unfortunately GPUs (and even CPUs' SIMD) floating point math is riddled with cross-platform determinism issues; hardware manufacturers intentionally trade that
by slimsag 3y ago
Unfortunately GPUs (and even CPUs' SIMD) floating point math is riddled with cross-platform determinism issues; hardware manufacturers intentionally trade that in order to get faster math operations in general, because although behavior of floating point is defined in IEEE 754, you get rounding errors for each operation.
Compiler optimizations (and remember, GPU drivers each use their own compiler behind the scenes to translate to their actual hardware architecture) can alter rounding errors of each operation, and parallel execution - which differs from hardware to hardware - also affects it.
Some APIs (Cuda?) let you disable all optimizations and there are ways to get cross-platform determinism, but in general it's much much slower if you want bit-for-bit equality across different hardware.
SPIR-V/Vulkan for example[0] only define an error range based in ULP for some operations - not bit-for-bit equality.
[0] https://registry.khronos.org/vulkan/specs/1.2-extensions/html/vkspec.html#spirvenv-precision-operation https://registry.khronos.org/vulkan/specs/1.2-extensions/htm...