internal static void WarpShuffleUpKernel( Index1 index, ArrayView <int> data, int shiftAmount) { data[index] = Warp.ShuffleUp(Warp.LaneIdx, shiftAmount); }
internal static void WarpShuffleUpKernel( Index1D index, ArrayView1D <int, Stride1D.Dense> data, int shiftAmount) { data[index] = Warp.ShuffleUp(Warp.LaneIdx, shiftAmount); }
public static T ExclusiveScan <T, TScanOperation>(T value) where T : unmanaged where TScanOperation : struct, IScanReduceOperation <T> { var inclusive = InclusiveScan <T, TScanOperation>(value); var exclusive = Warp.ShuffleUp(inclusive, 1); return(Warp.IsFirstLane ? default(TScanOperation).Identity : exclusive); }
public static T InclusiveScan <T, TScanOperation>(T value) where T : unmanaged where TScanOperation : struct, IScanReduceOperation <T> { TScanOperation warpScan = default; var laneIdx = Warp.LaneIdx; for (int delta = 1; delta < Warp.WarpSize; delta <<= 1) { var otherValue = Warp.ShuffleUp(value, delta); if (laneIdx >= delta) { value = warpScan.Apply(value, otherValue); } } return(value); }