Add an optimization to move mrg_uniform to the GPU.

While there fix the inplace optimization so that it actually works with the GPU versions.