As one data point, we've made determinism work on a large, physics- and math-heavy game. Only within a single platform, of course; but it runs on 360, PS3, Windows, OSX, and Linux. So the idea itself isn't completely out of the question. p On Mon, Jan 13, 2014 at 9:03 PM, malkia <malkia@xxxxxxxxx> wrote: > It's possible that the code generated by luajit would work the same > way on different cpus. > > But it's a real problem (outside) luajit. For example read this: > > http://www-archive.xenproject.org/files/xensummit_germany09/AMD.pdf#page=15 > (This is a problem not only for games, but for virtual machines > (moving from one host machine to another)). > > "SSE reciprocal and reciprocal-square root approximation > instructions: AMD and Intel provide different numbers of significant > bits – RCPPS, RCPSS, RSQRTPS, RSQRTSS. > > x87 instructions with infinite series implementations can return > answers whose results differ in the units in the last place (ULP). – > Trigonometric functions – ranscendental functions – Reciprocals" > > (I think luajit still uses some x87 - at least that's what vm_x86.dasc > shows but I could be wrong). > > If you happen to use external library called by luajit, or something > that changes rounding modes without your knowledge (directx used to be > such offender), then you would have differences. > > Here is a fun cpuid detection code > found here: > http://randomascii.wordpress.com/2013/07/16/floating-point-determinism/ > > // CPUID is for wimps: > __m128 input = { -997.0f }; > input = _mm_rcp_ps(input); > int platform = (input.m128_u32[0] >> 16) & 0xf; > switch (platform) > { > case 0×0: printf(“Intel.\n”); break; > case 0×7: printf(“AMD Bulldozer.\n”); break; > case 0×8: printf(“AMD K8, Bobcat, Jaguar.\n”); break; > default: printf(“Dunno\n”); break; > } > > On Mon, Jan 13, 2014 at 11:32 AM, Alex <initrd.gz@xxxxxxxxx> wrote: > >> It is not so hopeless > > > > I never said it was hopeless; I just wanted to be sure it wasn't. Also, > > thanks for the library, I'll take a peek at it. > > > > -- > > Sincerely, > > Alex Parrill > > > > -- > Dimiter "malkia" Stanev, > ICQ: 21875894 > malkia@xxxxxxx > malkia@xxxxxxxxx > >