[Date Prev][Date Next][Thread Prev][Thread Next]
[Date Index]
[Thread Index]
- Subject: Re: [BUG] lua 5.2 luai_hashnum bug with threads
- From: Rob Kendrick <rjek@...>
- Date: Tue, 22 Apr 2014 09:27:29 +0100
On Tue, Apr 22, 2014 at 11:51:26AM +0400, Andrei wrote:
> Hi everyone,
>
> New bug for Lua 5.2:
>
> 'luai_hashnum' FAILS to generate a DETERMINISTIC hash value for identical keys when executed non-concurrently on separate threads.
>
> It is the fault of different precision controls being set on different threads, one of which is automatically set to 24 bits when using DirectX without the D3DCREATE_FPU_PRESERVE flag. (But not strictly limited to DX, anyone wanting to increase floating point performance with the sacrifice of precision).
>
> Another scenario is where the LuaVM is created and setup before DirectX (or anyone) resets the precision control and the resulting LuaVM appears empty (because of hash misses)
>
> Here is the code to demonstrate - http://pastebin.com/xzDiTFj1
I don't see how this is a bug in Lua. Lua, being written in ANSI C, has
no regard for threads or DirectX, and it is reasonable for it to expect
that the mathematical model does not change under it.
B.