コード例 #1
0
        internal static void MoveLoadsStoresAddressSpacesKernel(
            ArrayView1D <int, Stride1D.Dense> source,
            ArrayView1D <Int2, Stride1D.Dense> target)
        {
            var shared = ILGPU.SharedMemory.Allocate1D <int>(MaxLength);
            var local  = LocalMemory.Allocate1D <int>(MaxLength);
            var index  = Grid.GlobalIndex.X;
            var value1 = source[index];

            shared[index] = 42;
            local[index]  = shared[index];
            var value2 = source[index + 1];

            target[index] = new Int2(value1 + local[index], value2);
        }
コード例 #2
0
        internal static void MoveLoadsStoresAddressSpacesBarrierKernel(
            ArrayView1D <int, Stride1D.Dense> source,
            ArrayView1D <Int2, Stride1D.Dense> target)
        {
            var shared = ILGPU.SharedMemory.Allocate1D <int>(MaxLength);
            var local  = LocalMemory.Allocate1D <int>(MaxLength);
            var index  = Grid.GlobalIndex.X;
            var value1 = source[index];

            shared[index] = Group.IdxX;
            Group.Barrier();
            local[index] = shared[Group.DimX - 2];
            Group.Barrier();
            var value2 = target[index];

            target[index] = new Int2(value1 + local[index], value2.X + value2.Y);
        }