Before the host arrays are re-uploaded after a context or device loss, make
the ACTIVE one a permutation of the drawn population again if a device write
left it behind: its surviving entries keep their order, the missing ones are
appended (repairPermutationInPlace). It is an older order than the
one lost with the GPU buffer, which the next sort replaces, but never a
corrupt one. The inactive buffer needs nothing: every flip writes it first.
Before the host arrays are re-uploaded after a context or device loss, make the ACTIVE one a permutation of the drawn population again if a device write left it behind: its surviving entries keep their order, the missing ones are appended (
repairPermutationInPlace). It is an older order than the one lost with the GPU buffer, which the next sort replaces, but never a corrupt one. The inactive buffer needs nothing: every flip writes it first.