Skip to content

Don't do stack squeezing during context switches in single-threaded programs to guarantee determinism in allocations

As #4450 (closed) and #8611 (closed) show, stack squeezing in the RTS makes allocation numbers between two different runs of the same binary non-deterministic, because its effect is depending on when context switches are bound to happen.

A short-term solution might be to deactivate stack squeezing for vulnerable benchmarks with +RTS -Z +RTS -V0 like in D5460, but IMO a more elegant solution would be to only deactivate stack squeezing in threadPause calls that happen due to context switches. Would you agree?

Edited by Sebastian Graf
To upload designs, you'll need to enable LFS and have an admin enable hashed storage. More information