Fixed reduction optimisation bug for heterogeneous devices