Subzero: fix non-deterministic stack layout and code-gen
Using std::unordered_set to hold unmaterialized variables meant that
when materializeAll was called, the order of variables would differ
between runs of the same executable on the same target.
Instead, we now use a map of Variable* to a monotonically increasing
counter, allowing us to not only guarantee order-consistency across
runs, but also means we can submit variables in the order they are
declared, which may be preferable by the JIT backend.
Note that this also affects LLVM; however, LLVM likely already performs
stack variable reordering, so the effects are minimized. Nonetheless,
this change likely also fixes determinism when using LLVM.
Bug: angleproject:4482
Bug: b/172365901
Change-Id: I5698085ab96663b3c9a2fae4f01b1c1b3aac8b4b
Reviewed-on: https://swiftshader-review.googlesource.com/c/SwiftShader/+/49949
Presubmit-Ready: Antonio Maiorano <amaiorano@google.com>
Tested-by:
Antonio Maiorano <amaiorano@google.com>
Kokoro-Result: kokoro <noreply+kokoro@google.com>
Reviewed-by:
Nicolas Capens <nicolascapens@google.com>
Showing
Please
register
or
sign in
to comment