Deterministic GPU sync.

Originally by comex; this is basically just merged to master.