コード例 #1
0
 internal static void WarpShuffleUpKernel(
     Index1 index,
     ArrayView <int> data,
     int shiftAmount)
 {
     data[index] = Warp.ShuffleUp(Warp.LaneIdx, shiftAmount);
 }
コード例 #2
0
 internal static void WarpShuffleUpKernel(
     Index1D index,
     ArrayView1D <int, Stride1D.Dense> data,
     int shiftAmount)
 {
     data[index] = Warp.ShuffleUp(Warp.LaneIdx, shiftAmount);
 }
コード例 #3
0
        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);
        }
コード例 #4
0
        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);
        }