public static CommandQueueSafeHandle CreateCommandQueue(ContextSafeHandle context, ClDeviceID device, CommandQueueProperties properties) { ErrorCode errorCode; CommandQueueSafeHandle result = clCreateCommandQueue(context, device, properties, out errorCode); ErrorHandler.ThrowOnFailure(errorCode); return(result); }
internal static void Flush(CommandQueueSafeHandle commandQueue) { if (commandQueue == null) { throw new ArgumentNullException("commandQueue"); } ErrorHandler.ThrowOnFailure(clFlush(commandQueue)); }
private static extern ErrorCode clEnqueueNDRangeKernel( CommandQueueSafeHandle commandQueue, KernelSafeHandle kernel, uint workDim, [In, MarshalAs(UnmanagedType.LPArray)] IntPtr[] globalWorkOffset, [In, MarshalAs(UnmanagedType.LPArray)] IntPtr[] globalWorkSize, [In, MarshalAs(UnmanagedType.LPArray)] IntPtr[] localWorkSize, uint numEventsInWaitList, [In, MarshalAs(UnmanagedType.CustomMarshaler, MarshalTypeRef = typeof(SafeHandleArrayMarshaler))] EventSafeHandle[] eventWaitList, out EventSafeHandle @event);
public CommandQueue CreateCommandQueue(Device device, CommandQueueProperties properties) { if (device == null) { throw new ArgumentNullException("device"); } CommandQueueSafeHandle handle = UnsafeNativeMethods.CreateCommandQueue(this.Handle, device.ID, properties); return(new CommandQueue(handle, this, device)); }
private static extern ErrorCode clEnqueueNativeKernel( CommandQueueSafeHandle commandQueue, NativeKernelFunction userFunction, IntPtr args, IntPtr cbArgs, uint numMemObjects, [In, MarshalAs(UnmanagedType.CustomMarshaler, MarshalTypeRef = typeof(SafeHandleArrayMarshaler))] MemObjectSafeHandle[] memList, [In, MarshalAs(UnmanagedType.LPArray)] IntPtr[] argsMemLoc, uint numEventsInWaitList, [In, MarshalAs(UnmanagedType.CustomMarshaler, MarshalTypeRef = typeof(SafeHandleArrayMarshaler))] EventSafeHandle[] eventWaitList, out EventSafeHandle @event);
internal static EventSafeHandle EnqueueMarkerWithWaitList(CommandQueueSafeHandle commandQueue, EventSafeHandle[] eventWaitList) { if (commandQueue == null) { throw new ArgumentNullException("commandQueue"); } EventSafeHandle result; ErrorHandler.ThrowOnFailure(clEnqueueMarkerWithWaitList(commandQueue, GetNumItems(eventWaitList), GetItems(eventWaitList), out result)); return(result); }
public static EventSafeHandle EnqueueTask( CommandQueueSafeHandle commandQueue, KernelSafeHandle kernel, EventSafeHandle[] eventWaitList) { if (commandQueue == null) { throw new ArgumentNullException("commandQueue"); } if (kernel == null) { throw new ArgumentNullException("kernel"); } EventSafeHandle result; ErrorHandler.ThrowOnFailure(clEnqueueTask(commandQueue, kernel, GetNumItems(eventWaitList), GetItems(eventWaitList), out result)); return(result); }
internal CommandQueue(CommandQueueSafeHandle handle, Context context, Device device) { if (handle == null) { throw new ArgumentNullException(nameof(handle)); } if (context == null) { throw new ArgumentNullException(nameof(context)); } if (device == null) { throw new ArgumentNullException(nameof(device)); } _handle = handle; _context = context; _device = device; }
public static EventSafeHandle EnqueueNDRangeKernel( CommandQueueSafeHandle commandQueue, KernelSafeHandle kernel, IntPtr[] globalWorkOffset, IntPtr[] globalWorkSize, IntPtr[] localWorkSize, EventSafeHandle[] eventWaitList) { if (commandQueue == null) { throw new ArgumentNullException("commandQueue"); } if (kernel == null) { throw new ArgumentNullException("kernel"); } if (globalWorkSize == null) { throw new ArgumentNullException("globalWorkSize"); } if (localWorkSize == null) { throw new ArgumentNullException("localWorkSize"); } uint workDim = (uint)globalWorkSize.Length; if (globalWorkOffset != null && globalWorkOffset.Length != workDim) { throw new ArgumentException(); } if (localWorkSize != null && localWorkSize.Length != workDim) { throw new ArgumentException(); } EventSafeHandle result; ErrorHandler.ThrowOnFailure(clEnqueueNDRangeKernel(commandQueue, kernel, (uint)workDim, globalWorkOffset, globalWorkSize, localWorkSize, GetNumItems(eventWaitList), GetItems(eventWaitList), out result)); return(result); }
public static T GetCommandQueueInfo <T>(CommandQueueSafeHandle commandQueue, CommandQueueParameterInfo <T> parameter) { int?fixedSize = parameter.ParameterInfo.FixedSize; #if DEBUG bool verifyFixedSize = true; #else bool verifyFixedSize = false; #endif UIntPtr requiredSize; if (fixedSize.HasValue && !verifyFixedSize) { requiredSize = (UIntPtr)fixedSize; } else { ErrorHandler.ThrowOnFailure(clGetCommandQueueInfo(commandQueue, parameter.ParameterInfo.Name, UIntPtr.Zero, IntPtr.Zero, out requiredSize)); } if (verifyFixedSize && fixedSize.HasValue) { if (requiredSize.ToUInt64() != (ulong)fixedSize.Value) { throw new ArgumentException("The parameter definition includes a fixed size that does not match the required size according to the runtime."); } } IntPtr memory = IntPtr.Zero; try { memory = Marshal.AllocHGlobal((int)requiredSize.ToUInt32()); UIntPtr actualSize; ErrorHandler.ThrowOnFailure(clGetCommandQueueInfo(commandQueue, parameter.ParameterInfo.Name, requiredSize, memory, out actualSize)); return(parameter.ParameterInfo.Deserialize(actualSize, memory)); } finally { Marshal.FreeHGlobal(memory); } }
private static extern ErrorCode clEnqueueTask( CommandQueueSafeHandle commandQueue, KernelSafeHandle kernel, uint numEventsInWaitList, [In, MarshalAs(UnmanagedType.CustomMarshaler, MarshalTypeRef = typeof(SafeHandleArrayMarshaler))] EventSafeHandle[] eventWaitList, out EventSafeHandle @event);
private static extern ErrorCode clFlush(CommandQueueSafeHandle commandQueue);
private static extern ErrorCode clGetCommandQueueInfo( CommandQueueSafeHandle commandQueue, int paramName, UIntPtr paramValueSize, IntPtr paramValue, out UIntPtr paramValueSizeRet);
private static extern ErrorCode clRetainCommandQueue(CommandQueueSafeHandle commandQueue);