That seems like a gross weakness in the emulator; floating point isn't actually nondeterministic!
That seems like a gross weakness in the emulator; floating point isn't actually nondeterministic!
Now if you have 3 ULP to play with, the maker of an Intel CPU is going to design an exp instruction to best make use of the existing Intel functional units. But an Intel FPGA dev is going to design an exp instruction to best make use of Lookup Tables and 18x18 multiplies - because that's what they have on the FPGA.
So whilst you'll get the same answer for x^y on Intel CPU and Intel FPGA within 3 ULPs those rounding errors are going to be different between the two architectures. So now, if you want to compute a normal distribution on Intel FPGA vs CPU you'll get 3 ULPs in your exponent, but that'll carry forward into the rest of the equation.
So now you have a choice - do you use the built-in function for exp on the Intel CPU - which is OpenCL compliant just like the FPGA, and get unknown rounding errors in what is probably a mathematically sensitive task, or do you emulate the actual sub-operations the FPGA does? In which case your hardy RTL designer who wrote that exponent function RTL is going to have to write an implementation in C that emulates the hardware. Oh and they don't only have to do that for exp - they have to do that for 100s of mathematical functions, and it'll run dog slow on the CPU compared to using the native functions.
[1]https://en.wikipedia.org/wiki/Rounding#Table-maker's_dilemma
[2]https://www.khronos.org/registry/OpenCL/specs/opencl-2.1-env...
Yes. It's an emulator.
> ... is going to have to write an implementation in C that emulates the hardware.
Makes sense. It's an emulator.
> ... and it'll run dog slow on the CPU compared to using the native functions.
Isn't that to be expected? It's an emulator. This isn't like games where it just has to look close. If it's a dev tool for testing correctness, exactness matters.
And while yes, it's expected to be slow compared to the native functions, that's not the problem. It's slow compared to simulation.