コード例 #1
0
ファイル: CPURuntimeGroupContext.cs プロジェクト: Nnelg/ILGPU
            public readonly void ApplySyncInMainThread()
            {
                // Allocate the requested amount of elements
                long sizeInBytes = Extent * Interop.SizeOf <T>();
                var  allocation  = UnmanagedMemoryViewSource.Create(sizeInBytes);

                // Publish the allocated shared memory source
                Parent.currentSharedMemorySource = allocation;
                Parent.sharedMemory.Add(allocation);
            }
コード例 #2
0
 public static ArrayView <T> Allocate <T>(long extent)
     where T : unmanaged
 {
     Trace.Assert(extent >= 0, "Invalid extent");
     return(new ArrayView <T>(
                UnmanagedMemoryViewSource.Create(
                    Interop.SizeOf <T>() * extent),
                0,
                extent));
 }