Documentation ¶
Overview ¶
Package cl22 provides a wrapper API to OpenCL 2.2.
If you require a different API level, refer to the opencl-go project (https://opencl-go.github.com) to see which versions are available.
To build and work with this library, you need an OpenCL SDK installed on your system. Refer to the documentation on opencl-go (https://opencl-go.github.com) on how to do this.
The API requires knowledge of the OpenCL API. While the wrapper hides some low-level C-API details, there is still heavy use of `unsafe.Pointer` and the potential for memory access-violations if used wrong.
This library wraps/represents constants, types, and functions as closely to the original API as possible - while applying Go idioms. It also provides convenience functions where practical. For example: PlatformInfoString().
The library uses a Go-idiomatic naming pattern that avoids name clashes: For example, "cl_device_local_mem_type" and "CL_DEVICE_LOCAL_MEM_TYPE" would both resolve to "DeviceLocalMemType". For the type of the constant, choose a suffix that matches the parameter where it is used. For example, "cl_platform_info" is expressed as "PlatformInfoName" as it identifies the name of the parameter in PlatformInfo().
References:
See also: https://registry.khronos.org/OpenCL/sdk/2.2/docs/man/html/
The API documentation is, in part, based on the official asciidoctor source files from https://github.com/KhronosGroup/OpenCL-Docs, licensed under the Creative Commons Attribution 4.0 International License; see https://creativecommons.org/licenses/by/4.0/ .
Index ¶
- Constants
- func BuildProgram(program Program, devices []DeviceID, options string, callback func()) error
- func CommandQueueInfo(commandQueue CommandQueue, paramName CommandQueueInfoName, paramSize uintptr, ...) (uintptr, error)
- func CompileProgram(program Program, devices []DeviceID, options string, headers []IncludeHeader, ...) error
- func ContextInfo(context Context, paramName ContextInfoName, paramSize uintptr, ...) (uintptr, error)
- func ContextInfoString(context Context, paramName ContextInfoName) (string, error)
- func DeviceAndHostTimer(id DeviceID) (device uint64, host uint64, err error)
- func DeviceInfo(id DeviceID, paramName DeviceInfoName, paramSize uintptr, ...) (uintptr, error)
- func DeviceInfoString(id DeviceID, paramName DeviceInfoName) (string, error)
- func EnqueueBarrierWithWaitList(commandQueue CommandQueue, waitList []Event, event *Event) error
- func EnqueueCopyBuffer(commandQueue CommandQueue, src, dst MemObject, ...) error
- func EnqueueCopyBufferRect(commandQueue CommandQueue, src, dst MemObject, ...) error
- func EnqueueCopyBufferToImage(commandQueue CommandQueue, srcBuffer, dstImage MemObject, srcOffset uintptr, ...) error
- func EnqueueCopyImage(commandQueue CommandQueue, srcImage, dstImage MemObject, ...) error
- func EnqueueCopyImageToBuffer(commandQueue CommandQueue, srcImage, dstBuffer MemObject, ...) error
- func EnqueueFillBuffer(commandQueue CommandQueue, mem MemObject, pattern unsafe.Pointer, ...) error
- func EnqueueFillImage(commandQueue CommandQueue, image MemObject, fillColor unsafe.Pointer, ...) error
- func EnqueueMapBuffer(commandQueue CommandQueue, buffer MemObject, blocking bool, flags MapFlags, ...) (unsafe.Pointer, error)
- func EnqueueMarkerWithWaitList(commandQueue CommandQueue, waitList []Event, event *Event) error
- func EnqueueMigrateMemObjects(commandQueue CommandQueue, memObjects []MemObject, ...) error
- func EnqueueNDRangeKernel(commandQueue CommandQueue, kernel Kernel, workDimensions []WorkDimension, ...) error
- func EnqueueNativeKernel(commandQueue CommandQueue, callback func([]unsafe.Pointer), ...) error
- func EnqueueReadBuffer(commandQueue CommandQueue, mem MemObject, blockingRead bool, ...) error
- func EnqueueReadBufferRect(commandQueue CommandQueue, mem MemObject, blockingRead bool, ...) error
- func EnqueueReadImage(commandQueue CommandQueue, image MemObject, blocking bool, ...) error
- func EnqueueSvmFree(commandQueue CommandQueue, ptrs []unsafe.Pointer, ...) error
- func EnqueueSvmMap(commandQueue CommandQueue, blocking bool, flags MemFlags, ...) error
- func EnqueueSvmMemFill(commandQueue CommandQueue, svmPtr, pattern unsafe.Pointer, ...) error
- func EnqueueSvmMemcpy(commandQueue CommandQueue, blocking bool, dstPtr unsafe.Pointer, ...) error
- func EnqueueSvmMigrateMem(commandQueue CommandQueue, svmPtrs []unsafe.Pointer, sizes []int, ...) error
- func EnqueueSvmUnmap(commandQueue CommandQueue, svmPtr unsafe.Pointer, waitList []Event, ...) error
- func EnqueueTask(commandQueue CommandQueue, kernel Kernel, waitList []Event, event *Event) errordeprecated
- func EnqueueUnmapMemObject(commandQueue CommandQueue, mem MemObject, mappedPtr unsafe.Pointer, ...) error
- func EnqueueWriteBuffer(commandQueue CommandQueue, mem MemObject, blockingRead bool, ...) error
- func EnqueueWriteBufferRect(commandQueue CommandQueue, mem MemObject, blockingRead bool, ...) error
- func EnqueueWriteImage(commandQueue CommandQueue, image MemObject, blocking bool, ...) error
- func EventInfo(event Event, paramName EventInfoName, paramSize uintptr, ...) (uintptr, error)
- func EventProfilingInfo(event Event, paramName EventProfilingInfoName, paramSize uintptr, ...) (uintptr, error)
- func ExtensionFunctionAddressForPlatform(id PlatformID, functionName string) unsafe.Pointer
- func Finish(commandQueue CommandQueue) error
- func Flush(commandQueue CommandQueue) error
- func HostTimer(id DeviceID) (uint64, error)
- func ImageInfo(image MemObject, paramName ImageInfoName, paramSize uintptr, ...) (uintptr, error)
- func KernelArgInfo(kernel Kernel, index uint32, paramName KernelArgInfoName, paramSize uintptr, ...) (uintptr, error)
- func KernelArgInfoString(kernel Kernel, index uint32, paramName KernelArgInfoName) (string, error)
- func KernelInfo(kernel Kernel, paramName KernelInfoName, paramSize uintptr, ...) (uintptr, error)
- func KernelInfoString(kernel Kernel, paramName KernelInfoName) (string, error)
- func KernelSubGroupInfo(kernel Kernel, device DeviceID, paramName KernelSubGroupInfoName, ...) (uintptr, error)
- func KernelWorkGroupInfo(kernel Kernel, device DeviceID, paramName KernelWorkGroupInfoName, ...) (uintptr, error)
- func MemObjectInfo(mem MemObject, paramName MemObjectInfoName, paramSize uintptr, ...) (uintptr, error)
- func PipeInfo(pipe MemObject, paramName PipeInfoName, paramSize uintptr, ...) (uintptr, error)
- func PlatformInfo(id PlatformID, paramName PlatformInfoName, paramSize uintptr, ...) (uintptr, error)
- func PlatformInfoString(id PlatformID, paramName PlatformInfoName) (string, error)
- func ProgramBuildInfo(program Program, device DeviceID, paramName ProgramBuildInfoName, ...) (uintptr, error)
- func ProgramBuildInfoString(program Program, device DeviceID, paramName ProgramBuildInfoName) (string, error)
- func ProgramInfo(program Program, paramName ProgramInfoName, paramSize uintptr, ...) (uintptr, error)
- func ProgramInfoString(program Program, paramName ProgramInfoName) (string, error)
- func ReleaseCommandQueue(commandQueue CommandQueue) error
- func ReleaseContext(context Context) error
- func ReleaseDevice(id DeviceID) error
- func ReleaseEvent(event Event) error
- func ReleaseKernel(kernel Kernel) error
- func ReleaseMemObject(mem MemObject) error
- func ReleaseProgram(program Program) error
- func ReleaseSampler(sampler Sampler) error
- func RetainCommandQueue(commandQueue CommandQueue) error
- func RetainContext(context Context) error
- func RetainDevice(id DeviceID) error
- func RetainEvent(event Event) error
- func RetainKernel(kernel Kernel) error
- func RetainMemObject(mem MemObject) error
- func RetainProgram(program Program) error
- func RetainSampler(sampler Sampler) error
- func SamplerInfo(sampler Sampler, paramName ContextInfoName, paramSize uintptr, ...) (uintptr, error)
- func SetDefaultDeviceCommandQueue(context Context, deviceID DeviceID, commandQueue CommandQueue) error
- func SetEventCallback(event Event, callbackType EventCommandExecutionStatus, callback func(error)) error
- func SetKernelArg(kernel Kernel, index uint32, size uintptr, value unsafe.Pointer) error
- func SetKernelArgSvmPointer(kernel Kernel, index uint32, value unsafe.Pointer) error
- func SetKernelExecInfo(kernel Kernel, paramName KernelExecInfoName, paramSize uintptr, ...) error
- func SetMemObjectDestructorCallback(mem MemObject, callback func()) error
- func SetProgramReleaseCallback(program Program, callback func()) error
- func SetProgramSpecializationConstant(program Program, id uint32, size uintptr, value unsafe.Pointer) error
- func SetUserEventStatus(event Event, executionStatus int) error
- func SvmAlloc(context Context, flags SvmMemFlags, size int, alignment uint32) (unsafe.Pointer, error)
- func SvmFree(context Context, ptr unsafe.Pointer)
- func UnloadPlatformCompiler(id PlatformID) error
- func WaitForEvents(events []Event) error
- type Bool
- type BufferCreateType
- type BufferRegion
- type BuildStatus
- type ChannelOrder
- type ChannelType
- type CommandQueue
- type CommandQueueInfoName
- type CommandQueuePropertiesFlags
- type CommandQueueProperty
- type Context
- type ContextErrorCallback
- type ContextErrorHandler
- type ContextErrorHandlerFunc
- type ContextInfoName
- type ContextProperty
- type DeviceAffinityDomainFlags
- type DeviceExecCapabilitiesFlags
- type DeviceFpConfigFlags
- type DeviceID
- type DeviceInfoName
- type DeviceLocalMemTypeEnum
- type DeviceMemCacheTypeEnum
- type DevicePartitionProperty
- type DeviceSvmCapabilitiesFlags
- type DeviceTerminateCapabilityKhrFlags
- type DeviceTypeFlags
- type Event
- type EventCommandExecutionStatus
- type EventCommandType
- type EventInfoName
- type EventProfilingInfoName
- type ExtensionTerminateContextKhr
- type ImageDesc
- type ImageFormat
- type ImageInfoName
- type IncludeHeader
- type Kernel
- type KernelArgAccessQualifier
- type KernelArgAddressQualifier
- type KernelArgInfoName
- type KernelArgTypeQualifier
- type KernelExecInfoName
- type KernelInfoName
- type KernelSubGroupInfoName
- type KernelWorkGroupInfoName
- type MapFlags
- type MappedImage
- type MemFlags
- type MemMigrationFlags
- type MemObject
- func CreateBuffer(context Context, flags MemFlags, size int, hostPtr unsafe.Pointer) (MemObject, error)
- func CreateImage(context Context, flags MemFlags, format ImageFormat, desc ImageDesc, ...) (MemObject, error)
- func CreatePipe(context Context, flags MemFlags, packetSize, maxPackets uint32, ...) (MemObject, error)
- func CreateSubBuffer(buffer MemObject, flags MemFlags, createType BufferCreateType, ...) (MemObject, error)
- type MemObjectInfoName
- type MemObjectType
- type PipeInfoName
- type PipeProperty
- type PlatformID
- type PlatformInfoName
- type Program
- func CreateProgramWithBinary(context Context, devices []DeviceID, binaries [][]byte) (Program, []error, error)
- func CreateProgramWithBuiltInKernels(context Context, devices []DeviceID, kernelNames string) (Program, error)
- func CreateProgramWithIl(context Context, il []byte) (Program, error)
- func CreateProgramWithSource(context Context, sources []string) (Program, error)
- func LinkProgram(context Context, devices []DeviceID, options string, programs []Program, ...) (Program, error)
- type ProgramBinaryType
- type ProgramBuildInfoName
- type ProgramInfoName
- type Sampler
- type SamplerAddressingMode
- type SamplerFilterMode
- type SamplerInfoName
- type SamplerProperty
- type StatusError
- type SvmMemFlags
- type WorkDimension
- type WrapperError
Constants ¶
const ( // KhrTerminateContextExtensionName is the official name of the extension // handled by ExtensionTerminateContextKhr. KhrTerminateContextExtensionName = "cl_khr_terminate_context" // ErrContextTerminatedKhr is returned for all operations within a context after the context has been terminated. // // Extension: KhrTerminateContextExtensionName ErrContextTerminatedKhr StatusError = C.CL_CONTEXT_TERMINATED_KHR // DeviceTerminateCapabilityKhrInfo represents the capability about a device to which degree it supports // termination of their contexts. // // Info value type: DeviceTerminateCapabilityKhrFlags // Extension: KhrTerminateContextExtensionName DeviceTerminateCapabilityKhrInfo DeviceInfoName = C.CL_DEVICE_TERMINATE_CAPABILITY_KHR // ContextTerminateKhrProperty represents a context property that requests to enable context termination. // // Use WithTermination() for convenience. // // Property value type: Bool // Extension: KhrTerminateContextExtensionName ContextTerminateKhrProperty uintptr = C.CL_CONTEXT_TERMINATE_KHR )
const ( // QueuePropertiesProperty is a bitfield. // // Use WithQueuePropertyFlags() for convenience. // // Property value type: CommandQueuePropertiesFlags QueuePropertiesProperty uint64 = C.CL_QUEUE_PROPERTIES // QueueSizeProperty specifies the size of the device queue in bytes. // This can only be specified if QueueOnDevice is set in QueuePropertiesProperty. // This must be a value less than or equal DeviceQueueOnDeviceMaxSizeInfo. // // For best performance, this should be less than or equal DeviceQueueOnDevicePreferredSizeInfo. // // If QueueSizeProperty is not specified, the device queue is created with DeviceQueueOnDevicePreferredSizeInfo as // the size of the queue. // // Use WithQueueSize() for convenience. // // Property value type: uint32 // Since: 2.0 QueueSizeProperty uint64 = C.CL_QUEUE_SIZE )
const ( // ContextPlatformProperty specifies the platform to use. // // Use OnPlatform() for convenience. // // Property value type: PlatformID ContextPlatformProperty uintptr = C.CL_CONTEXT_PLATFORM // ContextInteropUserSyncProperty specifies whether the user is responsible for synchronization between OpenCL and // other APIs. Please refer to the specific sections in the OpenCL Extension Specification that describe sharing // with other APIs for restrictions on using this flag. // // Use WithInteropUserSync() for convenience. // // Property value type: Bool // Since: 1.2 ContextInteropUserSyncProperty uintptr = C.CL_CONTEXT_INTEROP_USER_SYNC )
const ( // DevicePartitionEquallyProperty requests to split the aggregate device into as many smaller aggregate devices as // can be created, each containing N compute units. The value N is passed as the value accompanying this property. // If N does not divide evenly into DeviceMaxComputeUnitsInfo, then the remaining compute units are not used. // // Use PartitionedEqually() for convenience. // // Property value type: uint32 // Since: 1.2 DevicePartitionEquallyProperty uintptr = C.CL_DEVICE_PARTITION_EQUALLY // DevicePartitionByCountsProperty is followed by a list of compute unit counts terminated with 0 or // DevicePartitionByCountsListEndProperty. For each non-zero count M in the list, a sub-device is created with M compute // units in it. // // The number of non-zero count entries in the list may not exceed DevicePartitionMaxSubDevicesInfo. // // The total number of compute units specified may not exceed DeviceMaxComputeUnitsInfo. // // Use PartitionedByCounts() for convenience. // // Property value type: uint32 // Since: 1.2 DevicePartitionByCountsProperty uintptr = C.CL_DEVICE_PARTITION_BY_COUNTS // DevicePartitionByCountsListEndProperty terminates the property value list started by DevicePartitionByCountsProperty. // // Since: 1.2 DevicePartitionByCountsListEndProperty uintptr = C.CL_DEVICE_PARTITION_BY_COUNTS_LIST_END // DevicePartitionByAffinityDomainProperty splits the device into smaller aggregate devices containing one or more // compute units that all share part of a cache hierarchy. The value accompanying this property may be drawn // from the constants of DeviceAffinityDomainFlags. // // Use PartitionedByAffinityDomain() for convenience. // // Property value type: DeviceAffinityDomainFlags // Since: 1.2 DevicePartitionByAffinityDomainProperty uintptr = C.CL_DEVICE_PARTITION_BY_AFFINITY_DOMAIN )
const ( MemReadWriteFlag = C.CL_MEM_READ_WRITE MemWriteOnlyFlag = C.CL_MEM_WRITE_ONLY MemReadOnlyFlag = C.CL_MEM_READ_ONLY MemUseHostPtrFlag = C.CL_MEM_USE_HOST_PTR MemAllocHostPtrFlag = C.CL_MEM_ALLOC_HOST_PTR MemCopyHostPtrFlag = C.CL_MEM_COPY_HOST_PTR MemHostWriteOnlyFlag = C.CL_MEM_HOST_WRITE_ONLY MemHostReadOnlyFlag = C.CL_MEM_HOST_READ_ONLY MemHostNoAccessFlag = C.CL_MEM_HOST_NO_ACCESS MemSvmFineGrainBufferFlag = C.CL_MEM_SVM_FINE_GRAIN_BUFFER MemSvmAtomicsFlag = C.CL_MEM_SVM_ATOMICS MemKernelReadAndWriteFlag = C.CL_MEM_KERNEL_READ_AND_WRITE )
These constants identify possible properties of a MemObject.
const ( // SamplerNormalizedCoordsProperty specifies whether the image coordinates are normalized or not. // // Use WithNormalizedCoords() for convenience. // // Property value type: Bool SamplerNormalizedCoordsProperty uint64 = C.CL_SAMPLER_NORMALIZED_COORDS // SamplerAddressingModeProperty specifies how out-of-range image coordinates are handled when reading from // an image. // // Use WithAddressingMode() for convenience. // // Property value type: SamplerAddressingMode SamplerAddressingModeProperty uint64 = C.CL_SAMPLER_ADDRESSING_MODE // SamplerFilterModeProperty specifies the type of filter that is applied when reading an image. // // Use WithFilterMode() for convenience. // // Property value type: SamplerFilterMode SamplerFilterModeProperty uint64 = C.CL_SAMPLER_FILTER_MODE )
const BufferRegionByteSize = unsafe.Sizeof(C.cl_buffer_region{})
BufferRegionByteSize is the size, in bytes, of the BufferRegion structure.
const ImageDescByteSize = unsafe.Sizeof(C.cl_image_desc{})
ImageDescByteSize is the size, in bytes, of the ImageDesc structure.
const ImageFormatByteSize = unsafe.Sizeof(C.cl_image_format{})
ImageFormatByteSize is the size, in bytes, of the ImageFormat structure.
Variables ¶
This section is empty.
Functions ¶
func BuildProgram ¶
BuildProgram builds (compiles and links) a program executable from the program source or binary.
The notification routine is a callback function that an application can register and which will be called when the program executable has been built (successfully or unsuccessfully). If callback is not nil, BuildProgram() does not need to wait for the build to complete and can return immediately once the build operation can begin. Any state changes of the program object that result from calling BuildProgram() (e.g. build status or log) will be observable from this callback function. The build operation can begin if the context, program whose sources are being compiled and linked, list of devices and build options specified are all valid and appropriate host and device resources needed to perform the build are available. If callback is nil, BuildProgram() does not return until the build has completed. This callback function may be called asynchronously by the OpenCL implementation. It is the applications responsibility to ensure that the callback function is thread-safe.
See also: https://registry.khronos.org/OpenCL/sdk/2.2/docs/man/html/clBuildProgram.html
func CommandQueueInfo ¶
func CommandQueueInfo(commandQueue CommandQueue, paramName CommandQueueInfoName, paramSize uintptr, paramValue unsafe.Pointer) (uintptr, error)
CommandQueueInfo queries information about a command-queue.
The provided size need to specify the size of the available space pointed to the provided value in bytes.
The returned number is the required size, in bytes, for the queried information. Call the function with a zero size and nil value to request the required size. This helps in determining the necessary space for dynamic information, such as arrays.
Raw strings are with a terminating NUL character. For convenience, use CommandQueueInfoString().
See also: https://registry.khronos.org/OpenCL/sdk/2.2/docs/man/html/clGetCommandQueueInfo.html
func CompileProgram ¶
func CompileProgram(program Program, devices []DeviceID, options string, headers []IncludeHeader, callback func()) error
CompileProgram compiles a program's source for all the devices or a specific device(s) in the OpenCL context associated with a program.
Since: 1.2 See also: https://registry.khronos.org/OpenCL/sdk/2.2/docs/man/html/clCompileProgram.html
func ContextInfo ¶
func ContextInfo(context Context, paramName ContextInfoName, paramSize uintptr, paramValue unsafe.Pointer) (uintptr, error)
ContextInfo queries information about a context.
The provided size need to specify the size of the available space pointed to the provided value in bytes.
The returned number is the required size, in bytes, for the queried information. Call the function with a zero size and nil value to request the required size. This helps in determining the necessary space for dynamic information, such as arrays.
Raw strings are with a terminating NUL character. For convenience, use ContextInfoString().
See also: https://registry.khronos.org/OpenCL/sdk/2.2/docs/man/html/clGetContextInfo.html
func ContextInfoString ¶
func ContextInfoString(context Context, paramName ContextInfoName) (string, error)
ContextInfoString is a convenience method for ContextInfo() to query information values that are string-based.
This function does not verify the queried information is indeed of type string. It assumes the information is a NUL terminated raw string and will extract the bytes as characters before that.
func DeviceAndHostTimer ¶
DeviceAndHostTimer returns a reasonably synchronized pair of timestamps from the device timer and the host timer as seen by device.
The resolution of the device timer may be queried via DeviceInfo() and the flag DeviceProfilingTimerResolutionInfo. The resolution of the host timer may be queried via PlatformInfo() and the flag PlatformHostTimerResolutionInfo.
Since: 2.1 See also: https://registry.khronos.org/OpenCL/sdk/2.2/docs/man/html/clGetDeviceAndHostTimer.html
func DeviceInfo ¶
func DeviceInfo(id DeviceID, paramName DeviceInfoName, paramSize uintptr, paramValue unsafe.Pointer) (uintptr, error)
DeviceInfo queries specific information about a device.
The provided size need to specify the size of the available space pointed to the provided value in bytes.
The returned number is the required size, in bytes, for the queried information. Call the function with a zero size and nil value to request the required size. This helps in determining the necessary space for dynamic information, such as arrays.
Raw strings are with a terminating NUL character. For convenience, use DeviceInfoString().
See also: https://registry.khronos.org/OpenCL/sdk/2.2/docs/man/html/clGetDeviceInfo.html
func DeviceInfoString ¶
func DeviceInfoString(id DeviceID, paramName DeviceInfoName) (string, error)
DeviceInfoString is a convenience method for DeviceInfo() to query information values that are string-based.
This function does not verify the queried information is indeed of type string. It assumes the information is a NUL terminated raw string and will extract the bytes as characters before that.
func EnqueueBarrierWithWaitList ¶
func EnqueueBarrierWithWaitList(commandQueue CommandQueue, waitList []Event, event *Event) error
EnqueueBarrierWithWaitList is a synchronization point that enqueues a barrier operation.
The barrier command either waits for a list of events to complete, or if the list is empty it waits for all commands previously enqueued in commandQueue to complete before it completes. This command blocks command execution, that is, any following commands enqueued after it do not execute until it completes.
Since: 1.2 See also: https://registry.khronos.org/OpenCL/sdk/2.2/docs/man/html/clEnqueueBarrierWithWaitList.html
func EnqueueCopyBuffer ¶
func EnqueueCopyBuffer(commandQueue CommandQueue, src, dst MemObject, srcOffset, dstOffset, size uintptr, waitList []Event, event *Event) error
EnqueueCopyBuffer enqueues a command to copy from one buffer object to another.
See also: https://registry.khronos.org/OpenCL/sdk/2.2/docs/man/html/clEnqueueCopyBuffer.html
func EnqueueCopyBufferRect ¶
func EnqueueCopyBufferRect(commandQueue CommandQueue, src, dst MemObject, srcOrigin, dstOrigin, region [3]uintptr, srcRowPitch, srcSlicePitch, dstRowPitch, dstSlicePitch uintptr, waitList []Event, event *Event) error
EnqueueCopyBufferRect enqueues a command to copy a 2D or 3D rectangular region from a buffer object to another buffer object.
See also: https://registry.khronos.org/OpenCL/sdk/2.2/docs/man/html/clEnqueueCopyBufferRect.html
func EnqueueCopyBufferToImage ¶
func EnqueueCopyBufferToImage(commandQueue CommandQueue, srcBuffer, dstImage MemObject, srcOffset uintptr, srcOrigin, region [3]uintptr, waitList []Event, event *Event) error
EnqueueCopyBufferToImage enqueues a command to copy a buffer object to an image object.
See also: https://registry.khronos.org/OpenCL/sdk/2.2/docs/man/html/clEnqueueCopyBufferToImage.html
func EnqueueCopyImage ¶
func EnqueueCopyImage(commandQueue CommandQueue, srcImage, dstImage MemObject, srcOrigin, dstOrigin, region [3]uintptr, waitList []Event, event *Event) error
EnqueueCopyImage enqueues a command to copy image objects.
See also: https://registry.khronos.org/OpenCL/sdk/2.2/docs/man/html/clEnqueueCopyImage.html
func EnqueueCopyImageToBuffer ¶
func EnqueueCopyImageToBuffer(commandQueue CommandQueue, srcImage, dstBuffer MemObject, srcOrigin, region [3]uintptr, dstOffset uintptr, waitList []Event, event *Event) error
EnqueueCopyImageToBuffer enqueues a command to copy an image object to a buffer object.
See also: https://registry.khronos.org/OpenCL/sdk/2.2/docs/man/html/clEnqueueCopyImageToBuffer.html
func EnqueueFillBuffer ¶
func EnqueueFillBuffer(commandQueue CommandQueue, mem MemObject, pattern unsafe.Pointer, patternSize, offset, size uintptr, waitList []Event, event *Event) error
EnqueueFillBuffer enqueues a command to fill a buffer object with a pattern of a given pattern size.
Since: 1.2 See also: https://registry.khronos.org/OpenCL/sdk/2.2/docs/man/html/clEnqueueFillBuffer.html
func EnqueueFillImage ¶
func EnqueueFillImage(commandQueue CommandQueue, image MemObject, fillColor unsafe.Pointer, origin, region [3]uintptr, waitList []Event, event *Event) error
EnqueueFillImage enqueues a command to fill an image object with a specified color.
The fill color is a single floating point value if the channel order is ChannelOrderDepth. Otherwise, the fill color is a four-component RGBA floating-point color value if the image channel data type is not an unnormalized signed or unsigned integer type, is a four-component signed integer value if the image channel data type is an unnormalized signed integer type and is a four-component unsigned integer value if the image channel data type is an unnormalized unsigned integer type. The fill color will be converted to the appropriate image channel format and order associated with image.
See also: https://registry.khronos.org/OpenCL/sdk/2.2/docs/man/html/clEnqueueFillImage.html
func EnqueueMapBuffer ¶
func EnqueueMapBuffer(commandQueue CommandQueue, buffer MemObject, blocking bool, flags MapFlags, offset, size uintptr, waitList []Event, event *Event) (unsafe.Pointer, error)
EnqueueMapBuffer enqueues a command to map a region of a buffer object into the host address space and returns a pointer to this mapped region.
See also: https://registry.khronos.org/OpenCL/sdk/2.2/docs/man/html/clEnqueueMapBuffer.html
func EnqueueMarkerWithWaitList ¶
func EnqueueMarkerWithWaitList(commandQueue CommandQueue, waitList []Event, event *Event) error
EnqueueMarkerWithWaitList enqueues a marker command which waits for either a list of events to complete, or all previously enqueued commands to complete.
Since: 1.2 See also: https://registry.khronos.org/OpenCL/sdk/2.2/docs/man/html/clEnqueueMarkerWithWaitList.html
func EnqueueMigrateMemObjects ¶
func EnqueueMigrateMemObjects(commandQueue CommandQueue, memObjects []MemObject, migrationFlags MemMigrationFlags, waitList []Event, event *Event) error
EnqueueMigrateMemObjects enqueues a command to indicate which device a set of memory objects should be associated with.
Typically, memory objects are implicitly migrated to a device for which enqueued commands, using the memory object, are targeted. EnqueueMigrateMemObjects() allows this migration to be explicitly performed ahead of the dependent commands. This allows a user to preemptively change the association of a memory object, through regular command queue scheduling, in order to prepare for another upcoming command. This also permits an application to overlap the placement of memory objects with other unrelated operations before these memory objects are needed potentially hiding transfer latencies.
Since: 1.2 See also: https://registry.khronos.org/OpenCL/sdk/2.2/docs/man/html/clEnqueueMigrateMemObjects.html
func EnqueueNDRangeKernel ¶
func EnqueueNDRangeKernel(commandQueue CommandQueue, kernel Kernel, workDimensions []WorkDimension, waitList []Event, event *Event) error
EnqueueNDRangeKernel enqueues a command to execute a kernel on a device.
See also: https://registry.khronos.org/OpenCL/sdk/2.2/docs/man/html/clEnqueueNDRangeKernel.html
func EnqueueNativeKernel ¶
func EnqueueNativeKernel(commandQueue CommandQueue, callback func([]unsafe.Pointer), memObjects []MemObject, waitList []Event, event *Event) error
EnqueueNativeKernel enqueues a command to execute a native Go function not compiled using the OpenCL compiler.
The provided callback function will receive pointers to global memory that represents the provided MemObject entries.
See also: https://registry.khronos.org/OpenCL/sdk/2.2/docs/man/html/clEnqueueNativeKernel.html
func EnqueueReadBuffer ¶
func EnqueueReadBuffer(commandQueue CommandQueue, mem MemObject, blockingRead bool, offset, size uintptr, data unsafe.Pointer, waitList []Event, event *Event) error
EnqueueReadBuffer enqueues a command to read from a buffer object to host memory.
See also: https://registry.khronos.org/OpenCL/sdk/2.2/docs/man/html/clEnqueueReadBuffer.html
func EnqueueReadBufferRect ¶
func EnqueueReadBufferRect(commandQueue CommandQueue, mem MemObject, blockingRead bool, bufferOrigin, hostOrigin, region [3]uintptr, bufferRowPitch, bufferSlicePitch, hostRowPitch, hostSlicePitch uintptr, data unsafe.Pointer, waitList []Event, event *Event) error
EnqueueReadBufferRect enqueues a command to read from a 2D or 3D rectangular region of a buffer object to host memory.
Since: 1.1 See also: https://registry.khronos.org/OpenCL/sdk/2.2/docs/man/html/clEnqueueReadBufferRect.html
func EnqueueReadImage ¶
func EnqueueReadImage(commandQueue CommandQueue, image MemObject, blocking bool, origin, region [3]uintptr, rowPitch, slicePitch uintptr, ptr unsafe.Pointer, waitList []Event, event *Event) error
EnqueueReadImage enqueues a command to read from an image or image array object to host memory.
See also: https://registry.khronos.org/OpenCL/sdk/2.2/docs/man/html/clEnqueueReadImage.html
func EnqueueSvmFree ¶
func EnqueueSvmFree(commandQueue CommandQueue, ptrs []unsafe.Pointer, callback func(CommandQueue, []unsafe.Pointer), waitList []Event, event *Event) error
EnqueueSvmFree enqueues a command to free shared virtual memory allocated using SvmAlloc() or a shared system memory pointer.
Since: 2.0 See also: https://registry.khronos.org/OpenCL/sdk/2.2/docs/man/html/clEnqueueSvmFree.html
func EnqueueSvmMap ¶
func EnqueueSvmMap(commandQueue CommandQueue, blocking bool, flags MemFlags, svmPtr unsafe.Pointer, size int, waitList []Event, event *Event) error
EnqueueSvmMap enqueues a command that will allow the host to update a region of an SVM buffer.
Since: 2.0 See also: https://registry.khronos.org/OpenCL/sdk/2.2/docs/man/html/clEnqueueSVMMap.html
func EnqueueSvmMemFill ¶
func EnqueueSvmMemFill(commandQueue CommandQueue, svmPtr, pattern unsafe.Pointer, patternSize, size int, waitList []Event, event *Event) error
EnqueueSvmMemFill enqueues a command to fill a region in memory with a pattern of a given pattern size.
The pattern must be a scalar or vector integer or floating-point data type supported by OpenCL.
Since: 2.0 See also: https://registry.khronos.org/OpenCL/sdk/2.2/docs/man/html/clEnqueueSVMMemFill.html
func EnqueueSvmMemcpy ¶
func EnqueueSvmMemcpy(commandQueue CommandQueue, blocking bool, dstPtr unsafe.Pointer, srcPtr unsafe.Pointer, size int, waitList []Event, event *Event) error
EnqueueSvmMemcpy enqueues a command to do a memcpy operation.
Since: 2.0 See also: https://registry.khronos.org/OpenCL/sdk/2.2/docs/man/html/clEnqueueSVMMemcpy.html
func EnqueueSvmMigrateMem ¶
func EnqueueSvmMigrateMem(commandQueue CommandQueue, svmPtrs []unsafe.Pointer, sizes []int, flags MemMigrationFlags, waitList []Event, event *Event) error
EnqueueSvmMigrateMem enqueues a command to indicate which device a set of ranges of SVM allocations should be associated with.
Since: 2.1 See also: https://registry.khronos.org/OpenCL/sdk/2.2/docs/man/html/clEnqueueSVMMigrateMem.html
func EnqueueSvmUnmap ¶
func EnqueueSvmUnmap(commandQueue CommandQueue, svmPtr unsafe.Pointer, waitList []Event, event *Event) error
EnqueueSvmUnmap enqueues a command to indicate that the host has completed updating the region given by an SVM pointer and which was specified in a previous call to EnqueueSvmMap().
Since: 2.0 See also: https://registry.khronos.org/OpenCL/sdk/2.2/docs/man/html/clEnqueueSVMUnmap.html
func EnqueueTask
deprecated
func EnqueueTask(commandQueue CommandQueue, kernel Kernel, waitList []Event, event *Event) error
EnqueueTask enqueues a command to execute a kernel, using a single work-item, on a device.
EnqueueTask() is equivalent to calling EnqueueNDRangeKernel() with one WorkDimension that has GlobalOffset = 0, GlobalSize = 1, and LocalSize = 1.
Deprecated: 1.2; Use EnqueueNDRangeKernel() instead. See also: https://registry.khronos.org/OpenCL/sdk/2.2/docs/man/html/clEnqueueTask.html
func EnqueueUnmapMemObject ¶
func EnqueueUnmapMemObject(commandQueue CommandQueue, mem MemObject, mappedPtr unsafe.Pointer, waitList []Event, event *Event) error
EnqueueUnmapMemObject enqueues a command to unmap a previously mapped region of a memory object.
Reads or writes from the host using the pointer returned by the mapping functions are considered to be complete.
See also: https://registry.khronos.org/OpenCL/sdk/2.2/docs/man/html/clEnqueueUnmapMemObject.html
func EnqueueWriteBuffer ¶
func EnqueueWriteBuffer(commandQueue CommandQueue, mem MemObject, blockingRead bool, offset, size uintptr, data unsafe.Pointer, waitList []Event, event *Event) error
EnqueueWriteBuffer enqueues a command to write to a buffer object from host memory.
See also: https://registry.khronos.org/OpenCL/sdk/2.2/docs/man/html/clEnqueueWriteBuffer.html
func EnqueueWriteBufferRect ¶
func EnqueueWriteBufferRect(commandQueue CommandQueue, mem MemObject, blockingRead bool, bufferOrigin, hostOrigin, region [3]uintptr, bufferRowPitch, bufferSlicePitch, hostRowPitch, hostSlicePitch uintptr, data unsafe.Pointer, waitList []Event, event *Event) error
EnqueueWriteBufferRect enqueues a command to write to a 2D or 3D rectangular region of a buffer object from host memory.
Since: 1.1 See also: https://registry.khronos.org/OpenCL/sdk/2.2/docs/man/html/clEnqueueWriteBufferRect.html
func EnqueueWriteImage ¶
func EnqueueWriteImage(commandQueue CommandQueue, image MemObject, blocking bool, origin, region [3]uintptr, rowPitch, slicePitch uintptr, ptr unsafe.Pointer, waitList []Event, event *Event) error
EnqueueWriteImage enqueues a command to write to an image or image array object from host memory.
See also: https://registry.khronos.org/OpenCL/sdk/2.2/docs/man/html/clEnqueueWriteImage.html
func EventInfo ¶
func EventInfo(event Event, paramName EventInfoName, paramSize uintptr, paramValue unsafe.Pointer) (uintptr, error)
EventInfo queries information about an event.
The provided size need to specify the size of the available space pointed to the provided value in bytes.
The returned number is the required size, in bytes, for the queried information. Call the function with a zero size and nil value to request the required size. This helps in determining the necessary space for dynamic information, such as arrays.
Raw strings are with a terminating NUL character.
See also: https://registry.khronos.org/OpenCL/sdk/2.2/docs/man/html/clGetEventInfo.html
func EventProfilingInfo ¶
func EventProfilingInfo(event Event, paramName EventProfilingInfoName, paramSize uintptr, paramValue unsafe.Pointer) (uintptr, error)
EventProfilingInfo returns profiling information for the command associated with event if profiling is enabled.
The provided size need to specify the size of the available space pointed to the provided value in bytes.
The returned number is the required size, in bytes, for the queried information. Call the function with a zero size and nil value to request the required size. This helps in determining the necessary space for dynamic information, such as arrays.
Raw strings are with a terminating NUL character.
See also: https://registry.khronos.org/OpenCL/sdk/2.2/docs/man/html/clGetEventProfilingInfo.html
func ExtensionFunctionAddressForPlatform ¶
func ExtensionFunctionAddressForPlatform(id PlatformID, functionName string) unsafe.Pointer
ExtensionFunctionAddressForPlatform returns the address of the extension function named by functionName for a given platform.
The pointer returned should be cast to a C-function pointer type matching the extension function's definition defined in the appropriate extension specification and header file.
A return value of nil indicates that the specified function does not exist for the implementation or platform is not a valid platform. A non-nil return value for ExtensionFunctionAddressForPlatform() does not guarantee that an extension function is actually supported by the platform. The application must also make a corresponding query using PlatformInfo(platform, PlatformExtensionsInfo, ...) or DeviceInfo(device, DeviceExtensionsInfo, ...) to determine if an extension is supported by the OpenCL implementation.
func Finish ¶
func Finish(commandQueue CommandQueue) error
Finish blocks until all previously queued OpenCL commands in a command-queue are issued to the associated device and have completed.
All previously queued OpenCL commands in commandQueue are issued to the associated device, and the function blocks until all previously queued commands have completed. Finish() does not return until all previously queued commands in commandQueue have been processed and completed. Finish() is also a synchronization point.
See also: https://registry.khronos.org/OpenCL/sdk/2.2/docs/man/html/clFinish.html
func Flush ¶
func Flush(commandQueue CommandQueue) error
Flush issues all previously queued OpenCL commands in a command-queue to the device associated with the command-queue.
All previously queued OpenCL commands in commandQueue are issued to the device associated with commandQueue. Flush() only guarantees that all queued commands to commandQueue will eventually be submitted to the appropriate device. There is no guarantee that they will be complete after Flush() returns.
See also: https://registry.khronos.org/OpenCL/sdk/2.2/docs/man/html/clFlush.html
func HostTimer ¶
HostTimer returns the current value of the host clock as seen by device. This value is in the same timebase as the host timestamp returned from DeviceAndHostTimer().
Since: 2.1 See also: https://registry.khronos.org/OpenCL/sdk/2.2/docs/man/html/clGetHostTimer.html
func ImageInfo ¶
func ImageInfo(image MemObject, paramName ImageInfoName, paramSize uintptr, paramValue unsafe.Pointer) (uintptr, error)
ImageInfo returns information specific to an image object.
The provided size need to specify the size of the available space pointed to the provided value in bytes.
The returned number is the required size, in bytes, for the queried information. Call the function with a zero size and nil value to request the required size. This helps in determining the necessary space for dynamic information, such as arrays.
Raw strings are with a terminating NUL character.
See also: https://registry.khronos.org/OpenCL/sdk/2.2/docs/man/html/clGetImageInfo.html
func KernelArgInfo ¶
func KernelArgInfo(kernel Kernel, index uint32, paramName KernelArgInfoName, paramSize uintptr, paramValue unsafe.Pointer) (uintptr, error)
KernelArgInfo returns information about the arguments of a kernel.
The provided size need to specify the size of the available space pointed to the provided value in bytes.
The returned number is the required size, in bytes, for the queried information. Call the function with a zero size and nil value to request the required size. This helps in determining the necessary space for dynamic information, such as arrays.
Raw strings are with a terminating NUL character.For convenience, use KernelArgInfoString().
See also: https://registry.khronos.org/OpenCL/sdk/2.2/docs/man/html/clGetKernelArgInfo.html
func KernelArgInfoString ¶
func KernelArgInfoString(kernel Kernel, index uint32, paramName KernelArgInfoName) (string, error)
KernelArgInfoString is a convenience method for KernelArgInfo() to query information values that are string-based.
This function does not verify the queried information is indeed of type string. It assumes the information is a NUL terminated raw string and will extract the bytes as characters before that.
func KernelInfo ¶
func KernelInfo(kernel Kernel, paramName KernelInfoName, paramSize uintptr, paramValue unsafe.Pointer) (uintptr, error)
KernelInfo returns information about the kernel object.
The provided size need to specify the size of the available space pointed to the provided value in bytes.
The returned number is the required size, in bytes, for the queried information. Call the function with a zero size and nil value to request the required size. This helps in determining the necessary space for dynamic information, such as arrays.
Raw strings are with a terminating NUL character. For convenience, use KernelInfoString().
See also: https://registry.khronos.org/OpenCL/sdk/2.2/docs/man/html/clGetKernelInfo.html
func KernelInfoString ¶
func KernelInfoString(kernel Kernel, paramName KernelInfoName) (string, error)
KernelInfoString is a convenience method for KernelInfo() to query information values that are string-based.
This function does not verify the queried information is indeed of type string. It assumes the information is a NUL terminated raw string and will extract the bytes as characters before that.
func KernelSubGroupInfo ¶
func KernelSubGroupInfo(kernel Kernel, device DeviceID, paramName KernelSubGroupInfoName, inputSize uintptr, inputValue unsafe.Pointer, paramSize uintptr, paramValue unsafe.Pointer) (uintptr, error)
KernelSubGroupInfo returns information about the kernel object.
The provided size need to specify the size of the available space pointed to the provided value in bytes.
The returned number is the required size, in bytes, for the queried information. Call the function with a zero size and nil value to request the required size. This helps in determining the necessary space for dynamic information, such as arrays.
Raw strings are with a terminating NUL character.
Since: 2.1 See also: https://registry.khronos.org/OpenCL/sdk/2.2/docs/man/html/clGetKernelSubGroupInfo.html
func KernelWorkGroupInfo ¶
func KernelWorkGroupInfo(kernel Kernel, device DeviceID, paramName KernelWorkGroupInfoName, paramSize uintptr, paramValue unsafe.Pointer) (uintptr, error)
KernelWorkGroupInfo returns information about the kernel object that may be specific to a device.
The provided size need to specify the size of the available space pointed to the provided value in bytes.
The returned number is the required size, in bytes, for the queried information. Call the function with a zero size and nil value to request the required size. This helps in determining the necessary space for dynamic information, such as arrays.
Raw strings are with a terminating NUL character.
See also: https://registry.khronos.org/OpenCL/sdk/2.2/docs/man/html/clGetKernelWorkGroupInfo.html
func MemObjectInfo ¶
func MemObjectInfo(mem MemObject, paramName MemObjectInfoName, paramSize uintptr, paramValue unsafe.Pointer) (uintptr, error)
MemObjectInfo queries information about a memory object.
The provided size need to specify the size of the available space pointed to the provided value in bytes.
The returned number is the required size, in bytes, for the queried information. Call the function with a zero size and nil value to request the required size. This helps in determining the necessary space for dynamic information, such as arrays.
Raw strings are with a terminating NUL character.
See also: https://registry.khronos.org/OpenCL/sdk/2.2/docs/man/html/clGetMemObjectInfo.html
func PipeInfo ¶
func PipeInfo(pipe MemObject, paramName PipeInfoName, paramSize uintptr, paramValue unsafe.Pointer) (uintptr, error)
PipeInfo queries information specific to a pipe object.
The provided size need to specify the size of the available space pointed to the provided value in bytes.
The returned number is the required size, in bytes, for the queried information. Call the function with a zero size and nil value to request the required size. This helps in determining the necessary space for dynamic information, such as arrays.
Raw strings are with a terminating NUL character.
Since: 2.0 See also: https://registry.khronos.org/OpenCL/sdk/2.2/docs/man/html/clGetPipeInfo.html
func PlatformInfo ¶
func PlatformInfo(id PlatformID, paramName PlatformInfoName, paramSize uintptr, paramValue unsafe.Pointer) (uintptr, error)
PlatformInfo queries information about an OpenCL platform.
The provided size need to specify the size of the available space pointed to the provided value in bytes.
The returned number is the required size, in bytes, for the queried information. Call the function with a zero size and nil value to request the required size. This helps in determining the necessary space for dynamic information, such as arrays.
Raw strings are with a terminating NUL character. For convenience, use PlatformInfoString().
See also: https://registry.khronos.org/OpenCL/sdk/2.2/docs/man/html/clGetPlatformInfo.html
func PlatformInfoString ¶
func PlatformInfoString(id PlatformID, paramName PlatformInfoName) (string, error)
PlatformInfoString is a convenience method for PlatformInfo() to query information values that are string-based.
This function does not verify the queried information is indeed of type string. It assumes the information is a NUL terminated raw string and will extract the bytes as characters before that.
func ProgramBuildInfo ¶
func ProgramBuildInfo(program Program, device DeviceID, paramName ProgramBuildInfoName, paramSize uintptr, paramValue unsafe.Pointer) (uintptr, error)
ProgramBuildInfo returns build information for each device in the program object.
The provided size need to specify the size of the available space pointed to the provided value in bytes.
The returned number is the required size, in bytes, for the queried information. Call the function with a zero size and nil value to request the required size. This helps in determining the necessary space for dynamic information, such as arrays.
Raw strings are with a terminating NUL character. For convenience, use ProgramBuildInfoString().
See also: https://registry.khronos.org/OpenCL/sdk/2.2/docs/man/html/clGetProgramBuildInfo.html
func ProgramBuildInfoString ¶
func ProgramBuildInfoString(program Program, device DeviceID, paramName ProgramBuildInfoName) (string, error)
ProgramBuildInfoString is a convenience method for ProgramBuildInfo() to query information values that are string-based.
This function does not verify the queried information is indeed of type string. It assumes the information is a NUL terminated raw string and will extract the bytes as characters before that.
func ProgramInfo ¶
func ProgramInfo(program Program, paramName ProgramInfoName, paramSize uintptr, paramValue unsafe.Pointer) (uintptr, error)
ProgramInfo returns information of the program object.
The provided size need to specify the size of the available space pointed to the provided value in bytes.
The returned number is the required size, in bytes, for the queried information. Call the function with a zero size and nil value to request the required size. This helps in determining the necessary space for dynamic information, such as arrays.
Raw strings are with a terminating NUL character. For convenience, use ProgramInfoString().
See also: https://registry.khronos.org/OpenCL/sdk/2.2/docs/man/html/clGetProgramInfo.html
func ProgramInfoString ¶
func ProgramInfoString(program Program, paramName ProgramInfoName) (string, error)
ProgramInfoString is a convenience method for ProgramInfo() to query information values that are string-based.
This function does not verify the queried information is indeed of type string. It assumes the information is a NUL terminated raw string and will extract the bytes as characters before that.
func ReleaseCommandQueue ¶
func ReleaseCommandQueue(commandQueue CommandQueue) error
ReleaseCommandQueue decrements the commandQueue reference count.
After the commandQueue reference count becomes zero and all commands queued to commandQueue have finished (eg. kernel-instances, memory object updates etc.), the command-queue is deleted.
ReleaseCommandQueue() performs an implicit flush to issue any previously queued OpenCL commands in commandQueue.
See also: https://registry.khronos.org/OpenCL/sdk/2.2/docs/man/html/clReleaseCommandQueue.html
func ReleaseContext ¶
ReleaseContext decrements the context reference count.
After the reference count becomes zero and all the objects attached to context (such as memory objects, command-queues) are released, the context is deleted.
See also: https://registry.khronos.org/OpenCL/sdk/2.2/docs/man/html/clReleaseContext.html
func ReleaseDevice ¶
ReleaseDevice decrements the device reference count if device is a valid sub-device created by a call to CreateSubDevices(). If id refers to a root level device, meaning a DeviceID returned by DeviceIDs(), the device reference count remains unchanged.
Since: 1.2 See also: https://registry.khronos.org/OpenCL/sdk/2.2/docs/man/html/clReleaseDevice.html
func ReleaseEvent ¶
ReleaseEvent decrements the event reference count.
See also: https://registry.khronos.org/OpenCL/sdk/2.2/docs/man/html/clReleaseEvent.html
func ReleaseKernel ¶
ReleaseKernel decrements the kernel reference count.
The kernel object is deleted once the number of instances that are retained to kernel become zero and the kernel object is no longer needed by any enqueued commands that use kernel.
See also: https://registry.khronos.org/OpenCL/sdk/2.2/docs/man/html/clReleaseKernel.html
func ReleaseMemObject ¶
ReleaseMemObject decrements the memory object reference count.
After the reference count becomes zero and commands queued for execution on a command-queue(s) that use mem have finished, the memory object is deleted. If mem is a buffer object, mem cannot be deleted until all sub-buffer objects associated with mem are deleted.
See also: https://registry.khronos.org/OpenCL/sdk/2.2/docs/man/html/clReleaseMemObject.html
func ReleaseProgram ¶
ReleaseProgram decrements the program reference count.
The program object is deleted after all kernel objects associated with program have been deleted and the program reference count becomes zero.
See also: https://registry.khronos.org/OpenCL/sdk/2.2/docs/man/html/clReleaseProgram.html
func ReleaseSampler ¶
ReleaseSampler decrements the sampler reference count.
The sampler object is deleted after the reference count becomes zero and commands queued for execution on a command-queue(s) that use sampler have finished.
See also: https://registry.khronos.org/OpenCL/sdk/2.2/docs/man/html/clReleaseSampler.html
func RetainCommandQueue ¶
func RetainCommandQueue(commandQueue CommandQueue) error
RetainCommandQueue increments the commandQueue reference count.
CreateCommandQueueWithProperties() and CreateCommandQueue() perform an implicit retain. This is very helpful for 3rd party libraries, which typically get a command-queue passed to them by the application. However, it is possible that the application may delete the command-queue without informing the library. Allowing functions to attach to (i.e. retain) and release a command-queue solves the problem of a command-queue being used by a library no longer being valid.
See also: https://registry.khronos.org/OpenCL/sdk/2.2/docs/man/html/clRetainCommandQueue.html
func RetainContext ¶
RetainContext increments the context reference count.
CreateContext() and CreateContextFromType() perform an implicit retain. This is very helpful for 3rd party libraries, which typically get a context passed to them by the application. However, it is possible that the application may delete the context without informing the library. Allowing functions to attach to (i.e. retain) and release a context solves the problem of a context being used by a library no longer being valid.
See also: https://registry.khronos.org/OpenCL/sdk/2.2/docs/man/html/clRetainContext.html
func RetainDevice ¶
RetainDevice increments the device reference count if device is a valid sub-device created by a call to CreateSubDevices(). If id refers to a root level device, meaning a DeviceID returned by DeviceIDs(), the device reference count remains unchanged.
Since: 1.2 See also: https://registry.khronos.org/OpenCL/sdk/2.2/docs/man/html/clRetainDevice.html
func RetainEvent ¶
RetainEvent increments the event reference count. The OpenCL commands that return an event perform an implicit retain.
See also: https://registry.khronos.org/OpenCL/sdk/2.2/docs/man/html/clRetainEvent.html
func RetainKernel ¶
RetainKernel increments the kernel reference count.
See also: https://registry.khronos.org/OpenCL/sdk/2.2/docs/man/html/clRetainKernel.html
func RetainMemObject ¶
RetainMemObject increments the memory object reference count.
Function that create a memory object perform an implicit retain.
See also: https://registry.khronos.org/OpenCL/sdk/2.2/docs/man/html/clRetainMemObject.html
func RetainProgram ¶
RetainProgram increments the program reference count.
See also: https://registry.khronos.org/OpenCL/sdk/2.2/docs/man/html/clRetainProgram.html
func RetainSampler ¶
RetainSampler increments the sampler reference count.
CreateSamplerWithProperties() and CreateSampler() perform an implicit retain.
See also: https://registry.khronos.org/OpenCL/sdk/2.2/docs/man/html/clRetainSampler.html
func SamplerInfo ¶
func SamplerInfo(sampler Sampler, paramName ContextInfoName, paramSize uintptr, paramValue unsafe.Pointer) (uintptr, error)
SamplerInfo queries information about a sampler.
The provided size need to specify the size of the available space pointed to the provided value in bytes.
The returned number is the required size, in bytes, for the queried information. Call the function with a zero size and nil value to request the required size. This helps in determining the necessary space for dynamic information, such as arrays.
Raw strings are with a terminating NUL character.
See also: https://registry.khronos.org/OpenCL/sdk/2.2/docs/man/html/clGetSamplerInfo.html
func SetDefaultDeviceCommandQueue ¶
func SetDefaultDeviceCommandQueue(context Context, deviceID DeviceID, commandQueue CommandQueue) error
SetDefaultDeviceCommandQueue replaces the default command-queue on the device.
This function may be used to replace a default device command-queue created with CreateCommandQueueWithProperties() and the QueueOnDeviceDefault flag.
Since: 2.1 See also: https://registry.khronos.org/OpenCL/sdk/2.2/docs/man/html/clSetDefaultDeviceCommandQueue.html
func SetEventCallback ¶
func SetEventCallback(event Event, callbackType EventCommandExecutionStatus, callback func(error)) error
SetEventCallback registers a user callback function for a specific command execution status.
The command execution callback values for which a callback can be registered are: EventCommandSubmittedStatus, EventCommandRunningStatus, or EventCommandCompleteStatus.
The provided callback will receive an error in case execution failed, or nil if the requested execution status has been reached.
See also: https://registry.khronos.org/OpenCL/sdk/2.2/docs/man/html/clSetEventCallback.html
func SetKernelArg ¶
SetKernelArg sets the argument value for a specific argument of a kernel.
See also: https://registry.khronos.org/OpenCL/sdk/2.2/docs/man/html/clSetKernelArg.html
func SetKernelArgSvmPointer ¶
SetKernelArgSvmPointer sets an SVM pointer as the argument value for a specific argument of a kernel.
Since: 2.0 See also: https://registry.khronos.org/OpenCL/sdk/2.2/docs/man/html/clSetKernelArgSVMPointer.html
func SetKernelExecInfo ¶
func SetKernelExecInfo(kernel Kernel, paramName KernelExecInfoName, paramSize uintptr, paramValue unsafe.Pointer) error
SetKernelExecInfo passes additional information other than argument values to a kernel.
Since: 2.0 See also: https://registry.khronos.org/OpenCL/sdk/2.2/docs/man/html/clSetKernelExecInfo.html
func SetMemObjectDestructorCallback ¶
SetMemObjectDestructorCallback registers a destructor callback function with a memory object.
Each call to SetMemObjectDestructorCallback() registers the specified callback function on a destructor callback stack associated with mem. The registered callback functions are called in the reverse order in which they were registered.
See also: https://registry.khronos.org/OpenCL/sdk/2.2/docs/man/html/clSetMemObjectDestructorCallback.html
func SetProgramReleaseCallback ¶
SetProgramReleaseCallback registers a destructor callback function with a program object.
Each call to SetProgramReleaseCallback() registers the specified callback function on a callback stack associated with program. The registered callback functions are called in the reverse order in which they were registered. The registered callback functions are called after destructors (if any) for program scope global variables (if any) are called and before the program object is deleted. This provides a mechanism for an application to be notified when destructors for program scope global variables are complete.
SetProgramReleaseCallback() may unconditionally return an error if no devices in the context associated with program support destructors for program scope global variables. Support for constructors and destructors for program scope global variables is required only for OpenCL 2.2 devices.
Since: 2.2 See also: https://registry.khronos.org/OpenCL/sdk/2.2/docs/man/html/clSetProgramReleaseCallback.html
func SetProgramSpecializationConstant ¶
func SetProgramSpecializationConstant(program Program, id uint32, size uintptr, value unsafe.Pointer) error
SetProgramSpecializationConstant sets a constant for a program created from intermediate language.
The specialization value will be used by subsequent calls to BuildProgram() until another call to SetProgramSpecializationConstant() changes it.
Since: 2.2 See also: https://registry.khronos.org/OpenCL/sdk/2.2/docs/man/html/clSetProgramSpecializationConstant.html
func SetUserEventStatus ¶
SetUserEventStatus sets the execution status of a user event object.
If there are enqueued commands with user events in the eventWaitList argument of Enqueue* commands, the user must ensure that the status of these user events being waited on are set using SetUserEventStatus() before any OpenCL APIs that release OpenCL objects except for event objects are called; otherwise the behavior is undefined.
The provided executionStatus can either be EventCommandCompleteStatus or a negative value to indicate an error.
See also: https://registry.khronos.org/OpenCL/sdk/2.2/docs/man/html/clSetUserEventStatus.html
func SvmAlloc ¶
func SvmAlloc(context Context, flags SvmMemFlags, size int, alignment uint32) (unsafe.Pointer, error)
SvmAlloc allocates a shared virtual memory (SVM) buffer that can be shared by the host and all devices in an OpenCL context that support shared virtual memory.
For flags, potential values are MemReadWriteFlag, MemWriteOnlyFlag, MemReadOnlyFlag, MemSvmAtomicsFlag, MemSvmFineGrainBufferFlag.
Since: 2.0 See also: https://registry.khronos.org/OpenCL/sdk/2.2/docs/man/html/clSVMAlloc.html
func SvmFree ¶
SvmFree frees a shared virtual memory buffer allocated using SvmAlloc().
SvmFree does not wait for previously enqueued commands that may be using ptr to finish before freeing the memory. It is the responsibility of the application to make sure that enqueued commands that use ptr have finished before freeing the memory.
Since: 2.0 See also: https://registry.khronos.org/OpenCL/sdk/2.2/docs/man/html/clSVMFree.html
func UnloadPlatformCompiler ¶
func UnloadPlatformCompiler(id PlatformID) error
UnloadPlatformCompiler allows the implementation to release the resources allocated by the OpenCL compiler for a platform.
This function allows the implementation to release the resources allocated by the OpenCL compiler for platform. This is a hint from the application and does not guarantee that the compiler will not be used in the future or that the compiler will actually be unloaded by the implementation. Calls to BuildProgram(), CompileProgram(), or LinkProgram() after UnloadPlatformCompiler() will reload the compiler, if necessary, to build the appropriate program executable.
Since: 1.2 See also: https://registry.khronos.org/OpenCL/sdk/2.2/docs/man/html/clUnloadPlatformCompiler.html
func WaitForEvents ¶
WaitForEvents waits on the host thread for commands identified by event objects to complete.
See also: https://registry.khronos.org/OpenCL/sdk/2.2/docs/man/html/clWaitForEvents.html
Types ¶
type Bool ¶
Bool represents a boolean value in the OpenCL API. It is not guaranteed to be the same size as the bool in kernels.
type BufferCreateType ¶
type BufferCreateType C.cl_buffer_create_type
BufferCreateType determines the kind of sub-buffer object.
const ( // BufferCreateTypeRegion describes a buffer object that represents a specific region in buffer. // // Creation data type: BufferRegion // Since: 1.1 BufferCreateTypeRegion BufferCreateType = C.CL_BUFFER_CREATE_TYPE_REGION )
type BuildStatus ¶
type BuildStatus C.cl_build_status
BuildStatus describes the build, compile, or link status of a program.
const ( // BuildNoneStatus is the build status returned if no BuildProgram(), CompileProgram(), or LinkProgram() has been // performed on the specified program object for device. BuildNoneStatus BuildStatus = C.CL_BUILD_NONE // BuildSuccessStatus is the build status returned if BuildProgram(), CompileProgram(), or LinkProgram() - // whichever was performed last on the specified program object for device - was successful. BuildSuccessStatus BuildStatus = C.CL_BUILD_SUCCESS // BuildErrorStatus is the build status returned if BuildProgram(), CompileProgram(), or LinkProgram() - // whichever was performed last on the specified program object for device - generated an error. BuildErrorStatus BuildStatus = C.CL_BUILD_ERROR // BuildInProgressStatus is the build status returned if BuildProgram(), CompileProgram(), or LinkProgram() - // whichever was performed last on the specified program object for device - has not finished. BuildInProgressStatus BuildStatus = C.CL_BUILD_IN_PROGRESS )
type ChannelOrder ¶
type ChannelOrder C.cl_channel_order
ChannelOrder describes the sequence and nature of the color channels of an image.
const ( ChannelOrderR ChannelOrder = C.CL_R ChannelOrderA ChannelOrder = C.CL_A ChannelOrderRg ChannelOrder = C.CL_RG ChannelOrderRa ChannelOrder = C.CL_RA ChannelOrderRgb ChannelOrder = C.CL_RGB ChannelOrderRgba ChannelOrder = C.CL_RGBA ChannelOrderBgra ChannelOrder = C.CL_BGRA ChannelOrderArgb ChannelOrder = C.CL_ARGB ChannelOrderIntensity ChannelOrder = C.CL_INTENSITY ChannelOrderLuminance ChannelOrder = C.CL_LUMINANCE ChannelOrderRx ChannelOrder = C.CL_Rx ChannelOrderRgx ChannelOrder = C.CL_RGx ChannelOrderRgbx ChannelOrder = C.CL_RGBx ChannelOrderDepth ChannelOrder = C.CL_DEPTH ChannelOrderStencil ChannelOrder = C.CL_DEPTH_STENCIL ChannelOrderSrgb ChannelOrder = C.CL_sRGB ChannelOrderSrgbx ChannelOrder = C.CL_sRGBx ChannelOrderSrgba ChannelOrder = C.CL_sRGBA ChannelOrderSbgra ChannelOrder = C.CL_sBGRA ChannelOrderAbgr ChannelOrder = C.CL_ABGR )
Constants for possible ChannelOrder values.
type ChannelType ¶
type ChannelType C.cl_channel_type
ChannelType describes the resolution and value range of color channels.
const ( ChannelTypeSnormInt8 ChannelType = C.CL_SNORM_INT8 ChannelTypeSnormInt16 ChannelType = C.CL_SNORM_INT16 ChannelTypeUnormInt8 ChannelType = C.CL_UNORM_INT8 ChannelTypeUnormInt16 ChannelType = C.CL_UNORM_INT16 ChannelTypeUnormShort565 ChannelType = C.CL_UNORM_SHORT_565 ChannelTypeUnormShort555 ChannelType = C.CL_UNORM_SHORT_555 ChannelTypeUnormInt101010 ChannelType = C.CL_UNORM_INT_101010 ChannelTypeSignedInt8 ChannelType = C.CL_SIGNED_INT8 ChannelTypeSignedInt16 ChannelType = C.CL_SIGNED_INT16 ChannelTypeSignedInt32 ChannelType = C.CL_SIGNED_INT32 ChannelTypeUnsignedInt8 ChannelType = C.CL_UNSIGNED_INT8 ChannelTypeUnsignedInt16 ChannelType = C.CL_UNSIGNED_INT16 ChannelTypeUnsignedInt32 ChannelType = C.CL_UNSIGNED_INT32 ChannelTypeHalfFloat ChannelType = C.CL_HALF_FLOAT ChannelTypeFloat ChannelType = C.CL_FLOAT ChannelTypeUnormInt24 ChannelType = C.CL_UNORM_INT24 ChannelTypeUnormInt1010102 ChannelType = C.CL_UNORM_INT_101010_2 )
Constants for possible ChannelType values.
type CommandQueue ¶
type CommandQueue uintptr
CommandQueue describes a sequence of events for OpenCL operations. Create a new command-queue with CreateCommandQueueWithProperties().
func CreateCommandQueue
deprecated
func CreateCommandQueue(context Context, deviceID DeviceID, properties CommandQueuePropertiesFlags) (CommandQueue, error)
CreateCommandQueue creates a command-queue on a specific device.
Deprecated: 1.2; Use CreateCommandQueueWithProperties() instead. See also: https://registry.khronos.org/OpenCL/sdk/2.2/docs/man/html/clCreateCommandQueue.html
func CreateCommandQueueWithProperties ¶
func CreateCommandQueueWithProperties(context Context, deviceID DeviceID, properties ...CommandQueueProperty) (CommandQueue, error)
CreateCommandQueueWithProperties create a host or device command-queue on a specific device.
If QueuePropertiesProperty is not specified in the properties, an in-order host command-queue is created for the specified device.
See also: https://registry.khronos.org/OpenCL/sdk/2.2/docs/man/html/clCreateCommandQueueWithProperties.html
func (CommandQueue) String ¶
func (cq CommandQueue) String() string
String provides a readable presentation of the command-queue identifier. It is based on the numerical value of the underlying pointer.
type CommandQueueInfoName ¶
type CommandQueueInfoName C.cl_command_queue_info
CommandQueueInfoName identifies properties of a command-queue, which can be queried with CommandQueueInfo().
const ( // QueueContextInfo returns the context specified when the command-queue is created. // // Returned type: Context QueueContextInfo CommandQueueInfoName = C.CL_QUEUE_CONTEXT // QueueDeviceInfo returns the device specified when the command-queue is created // // Returned type: DeviceID QueueDeviceInfo CommandQueueInfoName = C.CL_QUEUE_DEVICE // QueueReferenceCountInfo returns the command-queue reference count. // // Note: The reference count returned should be considered immediately stale. It is unsuitable for // general use in applications. This feature is provided for identifying memory leaks. // // Returned type: uint32 QueueReferenceCountInfo CommandQueueInfoName = C.CL_QUEUE_REFERENCE_COUNT // QueuePropertiesInfo returns the currently specified properties for the command-queue. // These properties are specified by the value associated with the QueuePropertiesProperty passed in properties // argument in CreateCommandQueueWithProperties(), or the value of the properties argument in CreateCommandQueue(). // // Returned type: uint64 QueuePropertiesInfo CommandQueueInfoName = C.CL_QUEUE_PROPERTIES // QueueSizeInfo returns the size of the device command-queue. To be considered valid for this query, // the command-queue must be a device command-queue. // // Returned type: uint32 // Since: 2.0 QueueSizeInfo CommandQueueInfoName = C.CL_QUEUE_SIZE // QueueDeviceDefaultInfo returns the current default command-queue for the underlying device. // // Returned type: CommandQueue // Since: 2.1 QueueDeviceDefaultInfo CommandQueueInfoName = C.CL_QUEUE_DEVICE_DEFAULT )
type CommandQueuePropertiesFlags ¶
type CommandQueuePropertiesFlags C.cl_command_queue_properties
CommandQueuePropertiesFlags is used to determine DeviceQueueOnDevicePropertiesInfo and DeviceQueueOnHostPropertiesInfo with DeviceInfo(), as well as QueuePropertiesProperty for CreateCommandQueueWithProperties() and CreateCommandQueue().
const ( // QueueOutOfOrderExecModeEnable determines whether the commands queued in the command-queue are executed // in-order or out-of-order. If set, the commands in the command-queue are executed out-of-order. // Otherwise, commands are executed in-order. QueueOutOfOrderExecModeEnable CommandQueuePropertiesFlags = C.CL_QUEUE_OUT_OF_ORDER_EXEC_MODE_ENABLE // QueueProfilingEnable enables or disables profiling of commands in the command-queue. If set, // the profiling of commands is enabled. Otherwise, profiling of commands is disabled. QueueProfilingEnable CommandQueuePropertiesFlags = C.CL_QUEUE_PROFILING_ENABLE // QueueOnDevice indicates that this is a device queue. If QueueOnDevice is set, QueueOutOfOrderExecModeEnable // must also be set. Only out-of-order device queues are supported. // // Since: 2.0 QueueOnDevice CommandQueuePropertiesFlags = C.CL_QUEUE_ON_DEVICE // QueueOnDeviceDefault indicates that this is the default device queue. // This can only be used with QueueOnDevice. // // Since: 2.0 QueueOnDeviceDefault CommandQueuePropertiesFlags = C.CL_QUEUE_ON_DEVICE_DEFAULT )
type CommandQueueProperty ¶
type CommandQueueProperty []uint64
CommandQueueProperty is one entry of properties which are taken into account when creating command-queue objects.
func WithQueuePropertyFlags ¶
func WithQueuePropertyFlags(flags CommandQueuePropertiesFlags) CommandQueueProperty
WithQueuePropertyFlags is a convenience function to create a valid QueuePropertiesProperty. Use it in combination with CreateCommandQueueWithProperties().
func WithQueueSize ¶
func WithQueueSize(bytes uint32) CommandQueueProperty
WithQueueSize is a convenience function to create a valid QueueSizeProperty. Use it in combination with CreateCommandQueueWithProperties().
type Context ¶
type Context uintptr
A Context is used by the OpenCL runtime for managing objects such as command-queues, memory, program and kernel objects, and for executing kernels on one or more devices specified in the context.
func CreateContext ¶
func CreateContext(deviceIds []DeviceID, callback *ContextErrorCallback, properties ...ContextProperty) (Context, error)
CreateContext creates an OpenCL context for the specified devices.
The callback is an optional receiver for any errors that happen during creation or execution of the context. It is possible that one registered callback is re-used for multiple context objects. Synchronization and separation between the contexts is left to the user. It is possible to call ContextErrorCallback.Release() while any context the callback is registered with is still active.
See also: https://registry.khronos.org/OpenCL/sdk/2.2/docs/man/html/clCreateContext.html
func CreateContextFromType ¶
func CreateContextFromType(deviceType DeviceTypeFlags, callback *ContextErrorCallback, properties ...ContextProperty) (Context, error)
CreateContextFromType creates an OpenCL context for devices that match the given device type. The context does not reference any sub-devices that may have been created from these devices.
The callback is an optional receiver for any errors that happen during creation or execution of the context. It is possible that one registered callback is re-used for multiple context objects. Synchronization and separation between the contexts is left to the user. It is possible to call ContextErrorCallback.Release() while any context the callback is registered with is still active.
See also: https://registry.khronos.org/OpenCL/sdk/2.2/docs/man/html/clCreateContextFromType.html
type ContextErrorCallback ¶
type ContextErrorCallback struct {
// contains filtered or unexported fields
}
ContextErrorCallback is a registered callback that can be used to receive error messages from contexts. Create and register a new callback with NewContextErrorCallback(). The callback is a globally registered resource that must be released with Release() when it is no longer needed.
func NewContextErrorCallback ¶
func NewContextErrorCallback(handler ContextErrorHandler) (*ContextErrorCallback, error)
NewContextErrorCallback creates and registers a new callback.
As this is a globally registered resource, registration may fail if memory is exhausted.
The provided handler can be called from other threads from within the OpenCL runtime.
func (*ContextErrorCallback) Release ¶
func (cb *ContextErrorCallback) Release()
Release removes the registered callback from the system. When this function returns, the assigned handler will no longer be called.
In case you release the error callback before the associated context is destroyed, there is a slight chance for a later, newly created error callback to be called for that older context. This can happen if the allocated low-level memory block that holds the Go handle receives the same pointer as the previous callback had.
type ContextErrorHandler ¶
type ContextErrorHandler interface { // Handle receives the information on the event. The private information is an opaque detail, specific // to the event, which may help during further analysis. Handle(errorInfo string, privateInfo []byte) }
ContextErrorHandler is informed about an error that occurred within the processing of a context.
type ContextErrorHandlerFunc ¶
ContextErrorHandlerFunc is a convenience type for ContextErrorHandler. This function type implements the interface and forwards the call to itself.
func (ContextErrorHandlerFunc) Handle ¶
func (handler ContextErrorHandlerFunc) Handle(errorInfo string, privateInfo []byte)
Handle calls the function itself.
type ContextInfoName ¶
type ContextInfoName C.cl_context_info
ContextInfoName identifies properties of a context, which can be queried with ContextInfo().
const ( // ContextReferenceCountInfo returns the context reference count. // // Note: The reference count returned should be considered immediately stale. It is unsuitable for // general use in applications. This feature is provided for identifying memory leaks. // // Returned type: uint32 ContextReferenceCountInfo ContextInfoName = C.CL_CONTEXT_REFERENCE_COUNT // ContextDevicesInfo returns the list of devices and sub-devices in context. // // Returned type: []DeviceID ContextDevicesInfo ContextInfoName = C.CL_CONTEXT_DEVICES // ContextNumDevicesInfo returns the number of devices in context. // // Returned type: uint32 // Since: 1.1 ContextNumDevicesInfo ContextInfoName = C.CL_CONTEXT_NUM_DEVICES // ContextPropertiesInfo returns the properties argument specified in CreateContext() or CreateContextFromType(). // // The returned list is the concatenated list of all the properties provided at creation. // This list also includes the terminating zero value. // // Returned type: []uintptr ContextPropertiesInfo ContextInfoName = C.CL_CONTEXT_PROPERTIES )
type ContextProperty ¶
type ContextProperty []uintptr
ContextProperty is one entry of properties which are taken into account when creating context objects.
func OnPlatform ¶
func OnPlatform(id PlatformID) ContextProperty
OnPlatform is a convenience function to create a valid ContextPlatformProperty. Use it in combination with CreateContext() or CreateContextFromType().
func WithInteropUserSync ¶
func WithInteropUserSync(value bool) ContextProperty
WithInteropUserSync is a convenience function to create a valid ContextInteropUserSyncProperty. Use it in combination with CreateContext() or CreateContextFromType().
func WithTermination ¶
func WithTermination(enabled bool) ContextProperty
WithTermination is a convenience function to create a valid ContextTerminateKhrProperty. Use it in combination with CreateContext() or CreateContextFromType().
Extension: KhrTerminateContextExtensionName
type DeviceAffinityDomainFlags ¶
type DeviceAffinityDomainFlags C.cl_device_affinity_domain
DeviceAffinityDomainFlags describe how sub-devices are partitioned according to their cache hierarchy.
const ( // DeviceAffinityDomainNuma splits the device into sub-devices comprised of compute units that share a NUMA node. // // Since: 1.2 DeviceAffinityDomainNuma DeviceAffinityDomainFlags = C.CL_DEVICE_AFFINITY_DOMAIN_NUMA // DeviceAffinityDomainL4Cache splits the device into sub-devices comprised of compute units that share a // level 4 data cache. // // Since: 1.2 DeviceAffinityDomainL4Cache DeviceAffinityDomainFlags = C.CL_DEVICE_AFFINITY_DOMAIN_L4_CACHE // DeviceAffinityDomainL3Cache splits the device into sub-devices comprised of compute units that share a // level 3 data cache. // // Since: 1.2 DeviceAffinityDomainL3Cache DeviceAffinityDomainFlags = C.CL_DEVICE_AFFINITY_DOMAIN_L3_CACHE // DeviceAffinityDomainL2Cache splits the device into sub-devices comprised of compute units that share a // level 2 data cache. // // Since: 1.2 DeviceAffinityDomainL2Cache DeviceAffinityDomainFlags = C.CL_DEVICE_AFFINITY_DOMAIN_L2_CACHE // DeviceAffinityDomainL1Cache splits the device into sub-devices comprised of compute units that share a // level 1 data cache. // // Since: 1.2 DeviceAffinityDomainL1Cache DeviceAffinityDomainFlags = C.CL_DEVICE_AFFINITY_DOMAIN_L1_CACHE // DeviceAffinityDomainNextPartitionable splits the device along the next partitionable affinity domain. // The implementation shall find the first level along which the device or sub-device may be further subdivided // in the order NUMA, L4, L3, L2, L1, and partition the device into sub-devices comprised of compute units that // share memory subsystems at this level. // // Determine what happened by calling DeviceInfo() with DevicePartitionTypeInfo on the sub-devices. // // Since: 1.2 DeviceAffinityDomainNextPartitionable DeviceAffinityDomainFlags = C.CL_DEVICE_AFFINITY_DOMAIN_NEXT_PARTITIONABLE )
type DeviceExecCapabilitiesFlags ¶
type DeviceExecCapabilitiesFlags C.cl_device_exec_capabilities
DeviceExecCapabilitiesFlags are used to determine the DeviceExecutionCapabilitiesInfo with DeviceInfo().
const ( // ExecKernel identifies that the OpenCL device can execute OpenCL kernels. ExecKernel DeviceExecCapabilitiesFlags = C.CL_EXEC_KERNEL // ExecNativeKernel identifies that the OpenCL device can execute native kernels. ExecNativeKernel DeviceExecCapabilitiesFlags = C.CL_EXEC_NATIVE_KERNEL )
type DeviceFpConfigFlags ¶
type DeviceFpConfigFlags C.cl_device_fp_config
DeviceFpConfigFlags are used to determine the DeviceSingleFpConfigInfo and DeviceDoubleFpConfigInfo with DeviceInfo().
const ( // FpDenorm identifies denorms are supported. FpDenorm DeviceFpConfigFlags = C.CL_FP_DENORM // FpInfNan identifies INF and quiet NaNs are supported. FpInfNan DeviceFpConfigFlags = C.CL_FP_INF_NAN // FpRoundToNearest identifies round to nearest even rounding mode supported. FpRoundToNearest DeviceFpConfigFlags = C.CL_FP_ROUND_TO_NEAREST // FpRoundToZero identifies round to zero rounding mode supported. FpRoundToZero DeviceFpConfigFlags = C.CL_FP_ROUND_TO_ZERO // FpRoundToInf identifies round to positive and negative infinity rounding modes supported. FpRoundToInf DeviceFpConfigFlags = C.CL_FP_ROUND_TO_INF // FpFma identifies IEEE754-2008 fused multiply-add is supported. FpFma DeviceFpConfigFlags = C.CL_FP_FMA // FpSoftFloat identifies basic floating-point operations (such as addition, subtraction, multiplication) // are implemented in software. // // Since: 1.1 FpSoftFloat DeviceFpConfigFlags = C.CL_FP_SOFT_FLOAT // FpCorrectlyRoundedDivideSqrt identifies divide and sqrt are correctly rounded as defined by the IEEE754 // specification. // // Since: 1.2 FpCorrectlyRoundedDivideSqrt DeviceFpConfigFlags = C.CL_FP_CORRECTLY_ROUNDED_DIVIDE_SQRT )
type DeviceID ¶
type DeviceID uintptr
DeviceID references an OpenCL device of the system.
func CreateSubDevices ¶
func CreateSubDevices(id DeviceID, properties ...DevicePartitionProperty) ([]DeviceID, error)
CreateSubDevices creates an array of sub-devices that each reference a non-intersecting set of compute units within the device identified by id, according to the partition scheme given by properties. Only one of the available partitioning schemes can be specified in properties.
The output sub-devices may be used in every way that the root (or parent) device can be used, including creating contexts, building programs, further calls to CreateSubDevices(), and creating command-queues. When a command-queue is created against a sub-device, the commands enqueued on the queue are executed only on the sub-device.
Since: 1.2 See also: https://registry.khronos.org/OpenCL/sdk/2.2/docs/man/html/clCreateSubDevices.html
func DeviceIDs ¶
func DeviceIDs(platformID PlatformID, deviceType DeviceTypeFlags) ([]DeviceID, error)
DeviceIDs queries devices available on a platform.
The deviceType is a bitfield that identifies the type of OpenCL device. The deviceType can be used to query specific OpenCL devices or all OpenCL devices available.
See also: https://registry.khronos.org/OpenCL/sdk/2.2/docs/man/html/clGetDeviceIDs.html
type DeviceInfoName ¶
type DeviceInfoName C.cl_device_info
DeviceInfoName identifies properties of a device, which can be queried with DeviceInfo().
const ( // DeviceAddressBitsInfo specify the default compute device address space size of the global address space specified // as an unsigned integer value in bits. Currently supported values are 32 or 64 bits. // // Returned type: uint32 DeviceAddressBitsInfo DeviceInfoName = C.CL_DEVICE_ADDRESS_BITS // DeviceAvailableInfo is true if the device is available and false otherwise. A device is considered to be // available if the device can be expected to successfully execute commands enqueued to the device. // // Returned type: Bool DeviceAvailableInfo DeviceInfoName = C.CL_DEVICE_AVAILABLE // DeviceBuiltInKernelsInfo represents a semicolon separated list of built-in kernels supported by the device. // An empty string is returned if no built-in kernels are supported by the device. // // Returned type: string // Since: 1.2 DeviceBuiltInKernelsInfo DeviceInfoName = C.CL_DEVICE_BUILT_IN_KERNELS // DeviceCompilerAvailableInfo is False if the implementation does not have a compiler available to compile the // program source. It is True if the compiler is available. // // This can be False for the embedded platform profile only. // // Returned type: Bool DeviceCompilerAvailableInfo DeviceInfoName = C.CL_DEVICE_COMPILER_AVAILABLE // DeviceDoubleFpConfigInfo describes double precision floating-point capability of the OpenCL device. // This is a bit-field. // // Returned type: DeviceFpConfigFlags // Since: 1.2 DeviceDoubleFpConfigInfo DeviceInfoName = C.CL_DEVICE_DOUBLE_FP_CONFIG // DeviceEndianLittleInfo is True if the OpenCL device is a little endian device and False otherwise. // // Returned type: Bool DeviceEndianLittleInfo DeviceInfoName = C.CL_DEVICE_ENDIAN_LITTLE // DeviceErrorCorrectionSupportInfo is True if the device implements error correction for all accesses to compute // device memory (global and constant). Is False if the device does not implement such error correction. // // Returned type: Bool DeviceErrorCorrectionSupportInfo DeviceInfoName = C.CL_DEVICE_ERROR_CORRECTION_SUPPORT // DeviceExecutionCapabilitiesInfo describes the execution capabilities of the device. This is a bit-field. // // The mandated minimum capability is ExecKernel. // // Returned type: DeviceExecCapabilitiesFlags DeviceExecutionCapabilitiesInfo DeviceInfoName = C.CL_DEVICE_EXECUTION_CAPABILITIES // DeviceExtensionsInfo returns a space separated list of extension names (the extension names themselves do not // contain any spaces) supported by the device. The list of extension names may include Khronos approved // extension names and vendor specified extension names. // // Returned type: string DeviceExtensionsInfo DeviceInfoName = C.CL_DEVICE_EXTENSIONS // DeviceGlobalMemCacheSizeInfo returns the size of global memory cache in bytes. // // Returned type: uint64 DeviceGlobalMemCacheSizeInfo DeviceInfoName = C.CL_DEVICE_GLOBAL_MEM_CACHE_SIZE // DeviceGlobalMemCacheTypeInfo represents the type of global memory cache supported. // // Returned type: DeviceMemCacheTypeEnum DeviceGlobalMemCacheTypeInfo DeviceInfoName = C.CL_DEVICE_GLOBAL_MEM_CACHE_TYPE // DeviceGlobalMemCachelineSizeInfo is the size of global memory cache line in bytes. // // Returned type: uint32 DeviceGlobalMemCachelineSizeInfo DeviceInfoName = C.CL_DEVICE_GLOBAL_MEM_CACHELINE_SIZE // DeviceGlobalMemSizeInfo is the size of global device memory in bytes. // // Returned type: uint64 DeviceGlobalMemSizeInfo DeviceInfoName = C.CL_DEVICE_GLOBAL_MEM_SIZE // DeviceHostUnifiedMemoryInfo is True if the device and the host have a unified memory subsystem and is // False otherwise. // // Returned type: Bool // Deprecated: 1.2 DeviceHostUnifiedMemoryInfo DeviceInfoName = C.CL_DEVICE_HOST_UNIFIED_MEMORY // DeviceGlobalVariablePreferredTotalSizeInfo is the maximum preferred total size, in bytes, of all program variables // in the global address space. This is a performance hint. An implementation may place such variables in storage // with optimized device access. This query returns the capacity of such storage. The minimum value is 0. // // Returned type: uintptr // Since: 2.0 DeviceGlobalVariablePreferredTotalSizeInfo DeviceInfoName = C.CL_DEVICE_GLOBAL_VARIABLE_PREFERRED_TOTAL_SIZE // DeviceIlVersionInfo represents the intermediate languages that can be supported by CreateProgramWithIl for this // device. Returns a space-separated list of IL version strings of the form // <IL_Prefix>_<Major_Version>.<Minor_Version>. // // For an OpenCL 2.1 or 2.2 device, SPIR-V is a required IL prefix. // // If the device does not support intermediate language programs, the value must be "" (an empty string). // // Returned type: string // Since: 2.1 // Extension: cl_khr_il_program DeviceIlVersionInfo DeviceInfoName = C.CL_DEVICE_IL_VERSION // DeviceImage2dMaxHeightInfo is the maximum height of 2D image in pixels. // The minimum value is 16384 if DeviceImageSupportInfo is True, the value is 0 otherwise. // // Returned type: uintptr DeviceImage2dMaxHeightInfo DeviceInfoName = C.CL_DEVICE_IMAGE2D_MAX_HEIGHT // DeviceImage2dMaxWidthInfo is the maximum width of 2D image or 1D image not created from a buffer object in pixels. // The minimum value is 16384 if DeviceImageSupportInfo is True, the value is 0 otherwise. // // Returned type: uintptr DeviceImage2dMaxWidthInfo DeviceInfoName = C.CL_DEVICE_IMAGE2D_MAX_WIDTH // DeviceImage3dMaxDepthInfo is the maximum depth of 3D image in pixels. // The minimum value is 2048 if DeviceImageSupportInfo is True, the value is 0 otherwise. // // Returned type: uintptr DeviceImage3dMaxDepthInfo DeviceInfoName = C.CL_DEVICE_IMAGE3D_MAX_DEPTH // DeviceImage3dMaxHeightInfo is the maximum height of 3D image in pixels. // The minimum value is 2048 if DeviceImageSupportInfo is True, the value is 0 otherwise. // // Returned type: uintptr DeviceImage3dMaxHeightInfo DeviceInfoName = C.CL_DEVICE_IMAGE3D_MAX_HEIGHT // DeviceImage3dMaxWidthInfo is the maximum width of 3D image in pixels. // The minimum value is 2048 if DeviceImageSupportInfo is True, the value is 0 otherwise. // // Returned type: uintptr DeviceImage3dMaxWidthInfo DeviceInfoName = C.CL_DEVICE_IMAGE3D_MAX_WIDTH // DeviceImageBaseAddressAlignmentInfo specifies the minimum alignment in pixels of the host_ptr specified to // CreateBuffer() or CreateBufferWithProperties() when a 2D image is created from a buffer which was created // using MemUseHostPtr. The value returned must be a power of 2. // // This value must be 0 for devices that do not support 2D images created from a buffer. // // Returned type: uint32 // Since: 2.0 DeviceImageBaseAddressAlignmentInfo DeviceInfoName = C.CL_DEVICE_IMAGE_BASE_ADDRESS_ALIGNMENT // DeviceImageMaxArraySizeInfo is the maximum number of images in a 1D or 2D image array. // The minimum value is 2048 if DeviceImageSupportInfo is True, the value is 0 otherwise. // // Returned type: uintptr // Since: 1.2 DeviceImageMaxArraySizeInfo DeviceInfoName = C.CL_DEVICE_IMAGE_MAX_ARRAY_SIZE // DeviceImageMaxBufferSizeInfo is the maximum number of pixels for a 1D image created from a buffer object. // The minimum value is 65536 if DeviceImageSupportInfo is True, the value is 0 otherwise. // // Returned type: uintptr // Since: 1.2 DeviceImageMaxBufferSizeInfo DeviceInfoName = C.CL_DEVICE_IMAGE_MAX_BUFFER_SIZE // DeviceImagePitchAlignmentInfo is the row pitch alignment size in pixels for 2D images created from a buffer. // The value returned must be a power of 2. // This value must be 0 for devices that do not support 2D images created from a buffer. // // Returned type: uint32 // Since: 2.0 DeviceImagePitchAlignmentInfo DeviceInfoName = C.CL_DEVICE_IMAGE_PITCH_ALIGNMENT // DeviceImageSupportInfo is True if images are supported by the OpenCL device and False otherwise. // // Returned type: Bool DeviceImageSupportInfo DeviceInfoName = C.CL_DEVICE_IMAGE_SUPPORT // DeviceLinkerAvailableInfo is False if the implementation does not have a linker available. // It is True if the linker is available. // // This can be False for the embedded platform profile only. // This must be True if DeviceCompilerAvailableInfo is True. // // Returned type: Bool // Since: 1.2 DeviceLinkerAvailableInfo DeviceInfoName = C.CL_DEVICE_LINKER_AVAILABLE // DeviceLocalMemSizeInfo is the size of local memory region in bytes. The minimum value is 32 KB for devices // that are not of type DeviceTypeCustom. // // Returned type: uint64 DeviceLocalMemSizeInfo DeviceInfoName = C.CL_DEVICE_LOCAL_MEM_SIZE // DeviceLocalMemTypeInfo is the type of local memory supported. // This can be set to DeviceLocalMemTypeLocal implying dedicated local memory storage such as SRAM, or // DeviceLocalMemTypeGlobal. // // For custom devices, DeviceLocalMemTypeNone can also be returned indicating no local memory support. // // Returned type: DeviceLocalMemTypeEnum DeviceLocalMemTypeInfo DeviceInfoName = C.CL_DEVICE_LOCAL_MEM_TYPE // DeviceMaxClockFrequencyInfo is the clock frequency of the device in MHz. The meaning of this value is // implementation-defined. For devices with multiple clock domains, the clock frequency for any of the clock // domains may be returned. For devices that dynamically change frequency for power or thermal reasons, the // returned clock frequency may be any valid frequency. // // Note: This definition is missing before version 2.2. // // Returned type: uint32 // Deprecated: by 2.2 DeviceMaxClockFrequencyInfo DeviceInfoName = C.CL_DEVICE_MAX_CLOCK_FREQUENCY // DeviceMaxComputeUnitsInfo refers to the number of parallel compute units on the OpenCL device. // A work-group executes on a single compute unit. The minimum value is 1. // // Returned type: uint32 DeviceMaxComputeUnitsInfo DeviceInfoName = C.CL_DEVICE_MAX_COMPUTE_UNITS // DeviceMaxConstantArgsInfo is the maximum number of arguments declared with the __constant qualifier in a kernel. // The minimum value is 8 for devices that are not of type DeviceTypeCustom. // // Returned type: uint32 DeviceMaxConstantArgsInfo DeviceInfoName = C.CL_DEVICE_MAX_CONSTANT_ARGS // DeviceMaxConstantBufferSizeInfo is the maximum size in bytes of a constant buffer allocation. The minimum value // is 64 KB for devices that are not of type DeviceTypeCustom. // // Returned type: uint64 DeviceMaxConstantBufferSizeInfo DeviceInfoName = C.CL_DEVICE_MAX_CONSTANT_BUFFER_SIZE // DeviceMaxGlobalVariableSizeInfo is the maximum number of bytes of storage that may be allocated for any single // variable in program scope or inside a function in an OpenCL kernel language declared in the global address space. // // The minimum value is 64 KB if the device supports program scope global variables, and must be 0 for devices // that do not support program scope global variables. // // Returned type: uintptr // Since: 2.0 DeviceMaxGlobalVariableSizeInfo DeviceInfoName = C.CL_DEVICE_MAX_GLOBAL_VARIABLE_SIZE // DeviceMaxMemAllocSizeInfo is the maximum size of memory object allocation in bytes. The minimum value is // max(min(1024 * 1024 * 1024, 1/4th of DeviceGlobalMemSizeInfo), 32 * 1024 * 1024) // for devices that are not of type DeviceTypeCustom. // // Returned type: uint64 DeviceMaxMemAllocSizeInfo DeviceInfoName = C.CL_DEVICE_MAX_MEM_ALLOC_SIZE // DeviceMaxNumSubGroupsInfo is the maximum number of subgroups in a work-group that a device is capable of executing // on a single compute unit, for any given kernel-instance running on the device. // // The minimum value is 1 if the device supports subgroups, and must be 0 for devices that do not support subgroups. // // Returned type: uint32 // Since: 2.1 DeviceMaxNumSubGroupsInfo DeviceInfoName = C.CL_DEVICE_MAX_NUM_SUB_GROUPS // DeviceMaxOnDeviceEventsInfo is the maximum number of events in use by a device queue. These refer to events // returned by the enqueue_ built-in functions to a device queue or user events returned by the create_user_event // built-in function that have not been released. // // The minimum value is 1024 for devices supporting on-device queues, and must be 0 for devices that do not // support on-device queues. // // Returned type: uint32 // Since: 2.0 DeviceMaxOnDeviceEventsInfo DeviceInfoName = C.CL_DEVICE_MAX_ON_DEVICE_EVENTS // DeviceMaxOnDeviceQueuesInfo is the maximum number of device queues that can be created for this device in a // single context. // // The minimum value is 1 for devices supporting on-device queues, and must be 0 for devices that do not // support on-device queues. // // Returned type: uint32 // Since: 2.0 DeviceMaxOnDeviceQueuesInfo DeviceInfoName = C.CL_DEVICE_MAX_ON_DEVICE_QUEUES // DeviceMaxParameterSizeInfo is the maximum size in bytes of all arguments that can be passed to a kernel. // // The minimum value is 1024 for devices that are not of type DeviceTypeCustom. For this minimum value, // only a maximum of 128 arguments can be passed to a kernel // // Returned type: uintptr DeviceMaxParameterSizeInfo DeviceInfoName = C.CL_DEVICE_MAX_PARAMETER_SIZE // DeviceMaxPipeArgsInfo is the maximum number of pipe objects that can be passed as arguments to a kernel. // The minimum value is 16 for devices supporting pipes, and must be 0 for devices that do not support pipes. // // Returned type: uint32 // Since: 2.0 DeviceMaxPipeArgsInfo DeviceInfoName = C.CL_DEVICE_MAX_PIPE_ARGS // DeviceMaxReadImageArgsInfo is the maximum number of image objects arguments of a kernel declared with the read_only // qualifier. The minimum value is 128 if DeviceImageSupportInfo is True, the value is 0 otherwise. // // Returned type: uint32 DeviceMaxReadImageArgsInfo DeviceInfoName = C.CL_DEVICE_MAX_READ_IMAGE_ARGS // DeviceMaxReadWriteImageArgsInfo is the maximum number of image objects arguments of a kernel declared with the // write_only or read_write qualifier. // // The minimum value is 64 if the device supports read-write images arguments, and must be 0 for devices that // do not support read-write images. // // Returned type: uint32 // Since: 2.0 DeviceMaxReadWriteImageArgsInfo DeviceInfoName = C.CL_DEVICE_MAX_READ_WRITE_IMAGE_ARGS // DeviceMaxSamplersInfo is the maximum number of samplers that can be used in a kernel. // The minimum value is 16 if DeviceImageSupportInfo is True, the value is 0 otherwise. // // Returned type: uint32 DeviceMaxSamplersInfo DeviceInfoName = C.CL_DEVICE_MAX_SAMPLERS // DeviceMaxWorkGroupSizeInfo is the maximum number of work-items in a work-group that a device is capable of // executing on a single compute unit, for any given kernel-instance running on the device. // The minimum value is 1. The returned value is an upper limit and will not necessarily maximize performance. // This maximum may be larger than supported by a specific kernel. // // Returned type: uintptr DeviceMaxWorkGroupSizeInfo DeviceInfoName = C.CL_DEVICE_MAX_WORK_GROUP_SIZE // DeviceMaxWorkItemDimensionsInfo is the maximum dimensions that specify the global and local work-item IDs used by // the data parallel execution model. The minimum value is 3 for devices that are not of type DeviceTypeCustom. // // Return type: uint32 DeviceMaxWorkItemDimensionsInfo DeviceInfoName = C.CL_DEVICE_MAX_WORK_ITEM_DIMENSIONS // DeviceMaxWorkItemSizesInfo is the maximum number of work-items that can be specified in each dimension of the // work-group to EnqueueNDRangeKernel(). // Returns N uintptr entries, where N is the value returned by the query for DeviceMaxWorkItemDimensionsInfo. // The minimum value is (1, 1, 1) for devices that are not of type DeviceTypeCustom. // // Returned type: []uintptr DeviceMaxWorkItemSizesInfo DeviceInfoName = C.CL_DEVICE_MAX_WORK_ITEM_SIZES // DeviceMaxWriteImageArgsInfo is the maximum number of image objects arguments of a kernel declared with the // write_only qualifier. The minimum value is 64 if DeviceImageSupportInfo is True, the value is 0 otherwise. // // Returned type: uint32 DeviceMaxWriteImageArgsInfo DeviceInfoName = C.CL_DEVICE_MAX_WRITE_IMAGE_ARGS // DeviceMemBaseAddrAlignInfo is the alignment requirement (in bits) for sub-buffer offsets. The minimum value is // the size (in bits) of the largest OpenCL built-in data type supported by the device // (long16 in FULL profile, long16 or int16 in EMBEDDED profile) for devices that are not of type DeviceTypeCustom. // // Returned type: uint32 DeviceMemBaseAddrAlignInfo DeviceInfoName = C.CL_DEVICE_MEM_BASE_ADDR_ALIGN // DeviceNameInfo refers to a human-readable string that identifies the device. // // Returned type: string DeviceNameInfo DeviceInfoName = C.CL_DEVICE_NAME // DeviceNativeVectorWidthCharInfo returns the native ISA vector width. // The vector width is defined as the number of scalar elements that can be stored in the vector. // // Returned type: uint32 // Since: 1.1 DeviceNativeVectorWidthCharInfo DeviceInfoName = C.CL_DEVICE_NATIVE_VECTOR_WIDTH_CHAR // DeviceNativeVectorWidthDoubleInfo returns the native ISA vector width. // The vector width is defined as the number of scalar elements that can be stored in the vector. // // If double precision is not supported, this value must be 0. // // Returned type: uint32 // Since: 1.1 DeviceNativeVectorWidthDoubleInfo DeviceInfoName = C.CL_DEVICE_NATIVE_VECTOR_WIDTH_DOUBLE // DeviceNativeVectorWidthFloatInfo returns the native ISA vector width. // The vector width is defined as the number of scalar elements that can be stored in the vector. // // Returned type: uint32 // Since: 1.1 DeviceNativeVectorWidthFloatInfo DeviceInfoName = C.CL_DEVICE_NATIVE_VECTOR_WIDTH_FLOAT // DeviceNativeVectorWidthHalfInfo returns the native ISA vector width. // The vector width is defined as the number of scalar elements that can be stored in the vector. // // If the cl_khr_fp16 extension is not supported, this value must be 0. // // Returned type: uint32 // Since: 1.1 // Extension: cl_khr_fp16 DeviceNativeVectorWidthHalfInfo DeviceInfoName = C.CL_DEVICE_NATIVE_VECTOR_WIDTH_HALF // DeviceNativeVectorWidthIntInfo returns the native ISA vector width. // The vector width is defined as the number of scalar elements that can be stored in the vector. // // Returned type: uint32 // Since: 1.1 DeviceNativeVectorWidthIntInfo DeviceInfoName = C.CL_DEVICE_NATIVE_VECTOR_WIDTH_INT // DeviceNativeVectorWidthLongInfo returns the native ISA vector width. // The vector width is defined as the number of scalar elements that can be stored in the vector. // // Returned type: uint32 // Since: 1.1 DeviceNativeVectorWidthLongInfo DeviceInfoName = C.CL_DEVICE_NATIVE_VECTOR_WIDTH_LONG // DeviceNativeVectorWidthShortInfo returns the native ISA vector width. // The vector width is defined as the number of scalar elements that can be stored in the vector. // // Returned type: uint32 // Since: 1.1 DeviceNativeVectorWidthShortInfo DeviceInfoName = C.CL_DEVICE_NATIVE_VECTOR_WIDTH_SHORT // DeviceOpenClCVersionInfo returns the highest fully backwards compatible OpenCL C version supported by the // compiler for the device. For devices supporting compilation from OpenCL C source, this will return // a version string with the following format: // // OpenCL<space>C<space><major_version.minor_version><space><vendor-specific information> // // Returned type: string // Since: 1.1 DeviceOpenClCVersionInfo DeviceInfoName = C.CL_DEVICE_OPENCL_C_VERSION // DeviceParentDeviceInfo returns the DeviceID of the parent device to which this sub-device belongs. // If device is a root-level device, a zero value is returned. // // Returned type: DeviceID // Since: 1.2 DeviceParentDeviceInfo DeviceInfoName = C.CL_DEVICE_PARENT_DEVICE // DevicePartitionAffinityDomainInfo returns the list of supported affinity domains for partitioning the device // using DevicePartitionByAffinityDomainProperty. This is a bit-field. // If the device does not support any affinity domains, a value of 0 will be returned. // // Returned type: DeviceAffinityDomainFlags // Since: 1.2 DevicePartitionAffinityDomainInfo DeviceInfoName = C.CL_DEVICE_PARTITION_AFFINITY_DOMAIN // DevicePartitionMaxSubDevicesInfo returns the maximum number of sub-devices that can be created when // a device is partitioned. // The value returned cannot exceed DeviceMaxComputeUnitsInfo. // // Returned type: uint32 // Since: 1.2 DevicePartitionMaxSubDevicesInfo DeviceInfoName = C.CL_DEVICE_PARTITION_MAX_SUB_DEVICES // DevicePartitionPropertiesInfo returns the list of partition types supported by device. // This is an array of uintptr values drawn from the list of DevicePartitionEquallyProperty, DevicePartitionByCountsProperty, // and DevicePartitionByAffinityDomainProperty. // If the device cannot be partitioned (i.e. there is no partitioning scheme supported by the device that will // return at least two subdevices), a value of 0 will be returned. // // Returned type: []uintptr // Since: 1.2 DevicePartitionPropertiesInfo DeviceInfoName = C.CL_DEVICE_PARTITION_PROPERTIES // DevicePartitionTypeInfo returns the properties argument specified in CreateSubDevices() if device is a sub-device. // In the case where the properties argument to CreateSubDevices() is DevicePartitionByAffinityDomainProperty, // DeviceAffinityDomainNextPartitionable, the affinity domain used to perform the partition will be returned. // This can be one of the following values: // // DeviceAffinityDomainNuma // DeviceAffinityDomainL4Cache // DeviceAffinityDomainL3Cache // DeviceAffinityDomainL2Cache // DeviceAffinityDomainL1Cache // // Otherwise the implementation may either return a parameter size of 0 i.e. there is no partition type // associated with device or can return a property value of 0 (where 0 is used to terminate the // partition property list) in the memory that the result value points to. // // Returned type: []uintptr // Since: 1.2 DevicePartitionTypeInfo DeviceInfoName = C.CL_DEVICE_PARTITION_TYPE // DevicePipeMaxActiveReservationsInfo is the maximum number of reservations that can be active for a pipe per // work-item in a kernel. A work-group reservation is counted as one reservation per work-item. // The minimum value is 1 for devices supporting pipes, and must be 0 for devices that do not support pipes. // // Returned type: uint32 // Since: 2.0 DevicePipeMaxActiveReservationsInfo DeviceInfoName = C.CL_DEVICE_PIPE_MAX_ACTIVE_RESERVATIONS // DevicePipeMaxPacketSizeInfo is the maximum size of pipe packet in bytes. // The minimum value is 1024 bytes if the device supports pipes, and must be 0 for devices that do not // support pipes. // // Returned type: uint32 // Since: 2.0 DevicePipeMaxPacketSizeInfo DeviceInfoName = C.CL_DEVICE_PIPE_MAX_PACKET_SIZE // DevicePlatformInfo returns the platform associated with this device. // // Returned type: PlatformID DevicePlatformInfo DeviceInfoName = C.CL_DEVICE_PLATFORM // DevicePreferredGlobalAtomicAlignmentInfo returns the value representing the preferred alignment in bytes for // OpenCL 2.0 atomic types to global memory. This query can return 0 which indicates that the preferred // alignment is aligned to the natural size of the type. // // Returned type: uint32 // Since: 2.0 DevicePreferredGlobalAtomicAlignmentInfo DeviceInfoName = C.CL_DEVICE_PREFERRED_GLOBAL_ATOMIC_ALIGNMENT // DevicePreferredInteropUserSyncInfo is True if the devices preference is for the user to be responsible for // synchronization, when sharing memory objects between OpenCL and other APIs such as DirectX, // False if the device / implementation has a performant path for performing synchronization of memory object // shared between OpenCL and other APIs such as DirectX. // // Returned type: Bool // Since: 1.2 DevicePreferredInteropUserSyncInfo DeviceInfoName = C.CL_DEVICE_PREFERRED_INTEROP_USER_SYNC // DevicePreferredLocalAtomicAlignmentInfo returns the value representing the preferred alignment in bytes for // OpenCL 2.0 atomic types to local memory. This query can return 0 which indicates that the preferred // alignment is aligned to the natural size of the type. // // Returned type: uint32 // Since: 2.0 DevicePreferredLocalAtomicAlignmentInfo DeviceInfoName = C.CL_DEVICE_PREFERRED_LOCAL_ATOMIC_ALIGNMENT // DevicePreferredPlatformAtomicAlignmentInfo returns the value representing the preferred alignment in bytes for // OpenCL 2.0 fine-grained SVM atomic types. This query can return 0 which indicates that the preferred // alignment is aligned to the natural size of the type. // // Returned type: uint32 // Since: 2.0 DevicePreferredPlatformAtomicAlignmentInfo DeviceInfoName = C.CL_DEVICE_PREFERRED_PLATFORM_ATOMIC_ALIGNMENT // DevicePreferredVectorWidthCharInfo is the preferred native vector width size for built-in scalar types that // can be put into vectors. The vector width is defined as the number of scalar elements that can be stored // in the vector. // // Returned type: uint32 DevicePreferredVectorWidthCharInfo DeviceInfoName = C.CL_DEVICE_PREFERRED_VECTOR_WIDTH_CHAR // DevicePreferredVectorWidthDoubleInfo is the preferred native vector width size for built-in scalar types that // can be put into vectors. The vector width is defined as the number of scalar elements that can be stored // in the vector. // If double precision is not supported, this value must be 0. // // Returned type: uint32 DevicePreferredVectorWidthDoubleInfo DeviceInfoName = C.CL_DEVICE_PREFERRED_VECTOR_WIDTH_DOUBLE // DevicePreferredVectorWidthFloatInfo is the preferred native vector width size for built-in scalar types that // can be put into vectors. The vector width is defined as the number of scalar elements that can be stored // in the vector. // // Returned type: uint32 DevicePreferredVectorWidthFloatInfo DeviceInfoName = C.CL_DEVICE_PREFERRED_VECTOR_WIDTH_FLOAT // DevicePreferredVectorWidthHalfInfo is the preferred native vector width size for built-in scalar types that // can be put into vectors. The vector width is defined as the number of scalar elements that can be stored // in the vector. // If the cl_khr_fp16 extension is not supported, this value must be 0. // // Returned type: uint32 // Since: 1.1 // Extension: cl_khr_fp16 DevicePreferredVectorWidthHalfInfo DeviceInfoName = C.CL_DEVICE_PREFERRED_VECTOR_WIDTH_HALF // DevicePreferredVectorWidthIntInfo is the preferred native vector width size for built-in scalar types that // can be put into vectors. The vector width is defined as the number of scalar elements that can be stored // in the vector. // // Returned type: uint32 DevicePreferredVectorWidthIntInfo DeviceInfoName = C.CL_DEVICE_PREFERRED_VECTOR_WIDTH_INT // DevicePreferredVectorWidthLongInfo is the preferred native vector width size for built-in scalar types that // can be put into vectors. The vector width is defined as the number of scalar elements that can be stored // in the vector. // // Returned type: uint32 DevicePreferredVectorWidthLongInfo DeviceInfoName = C.CL_DEVICE_PREFERRED_VECTOR_WIDTH_LONG // DevicePreferredVectorWidthShortInfo is the preferred native vector width size for built-in scalar types that // can be put into vectors. The vector width is defined as the number of scalar elements that can be stored // in the vector. // // Returned type: uint32 DevicePreferredVectorWidthShortInfo DeviceInfoName = C.CL_DEVICE_PREFERRED_VECTOR_WIDTH_SHORT // DevicePrintfBufferSizeInfo is the maximum size in bytes of the internal buffer that holds the output of printf // calls from a kernel. The minimum value for the FULL profile is 1 MB. // // Returned type: uintptr // Since: 1.2 DevicePrintfBufferSizeInfo DeviceInfoName = C.CL_DEVICE_PRINTF_BUFFER_SIZE // DeviceProfileInfo is the OpenCL profile string. Returns the profile name supported by the device. // The profile name returned can be one of the following strings: // // "FULL_PROFILE" - if the device supports the OpenCL specification (functionality defined as part of the core // specification and does not require any extensions to be supported). // // "EMBEDDED_PROFILE" - if the device supports the OpenCL embedded profile. // // Returned type: string DeviceProfileInfo DeviceInfoName = C.CL_DEVICE_PROFILE // DeviceProfilingTimerResolutionInfo describes the resolution of device timer. This is measured in nanoseconds. // // Returned type: uintptr DeviceProfilingTimerResolutionInfo DeviceInfoName = C.CL_DEVICE_PROFILING_TIMER_RESOLUTION // DeviceQueueOnDeviceMaxSizeInfo is the maximum size of the device queue in bytes. // The minimum value is 256 KB for the full profile and 64 KB for the embedded profile for devices supporting // on-device queues, and must be 0 for devices that do not support on-device queues. // // Returned type: uint32 // Since: 2.0 DeviceQueueOnDeviceMaxSizeInfo DeviceInfoName = C.CL_DEVICE_QUEUE_ON_DEVICE_MAX_SIZE // DeviceQueueOnDevicePreferredSizeInfo is the preferred size of the device queue, in bytes. Applications should // use this size for the device queue to ensure good performance. // The minimum value is 16 KB for devices supporting on-device queues, and must be 0 for devices that // do not support on-device queues. // // Returned type: uint32 // Since: 2.0 DeviceQueueOnDevicePreferredSizeInfo DeviceInfoName = C.CL_DEVICE_QUEUE_ON_DEVICE_PREFERRED_SIZE // DeviceQueueOnDevicePropertiesInfo describes the on device command-queue properties supported by the device. // This is a bit-field. // // Returned type: CommandQueuePropertiesFlags // Since: 2.0 DeviceQueueOnDevicePropertiesInfo DeviceInfoName = C.CL_DEVICE_QUEUE_ON_DEVICE_PROPERTIES // DeviceQueueOnHostPropertiesInfo describes the on host command-queue properties supported by the device. // This is a bit-field // // Returned type: CommandQueuePropertiesFlags // Since: 2.0 DeviceQueueOnHostPropertiesInfo DeviceInfoName = C.CL_DEVICE_QUEUE_ON_HOST_PROPERTIES // DeviceQueuePropertiesInfo describes the command-queue properties supported by the device. This is a bit-field // that describes one or more of the following values: QueueOutOfOrderExecModeEnable, QueueProfilingEnable. // // Returned type: CommandQueuePropertiesFlags // Deprecated: 1.2; Use DeviceQueueOnHostPropertiesInfo instead. DeviceQueuePropertiesInfo DeviceInfoName = C.CL_DEVICE_QUEUE_PROPERTIES // DeviceReferenceCountInfo returns the device reference count. If the device is a root-level device, // a reference count of one is returned. // // Note: The reference count returned should be considered immediately stale. It is unsuitable for general // use in applications. This feature is provided for identifying memory leaks. // // Returned type: uint32 // Since: 1.2 DeviceReferenceCountInfo DeviceInfoName = C.CL_DEVICE_REFERENCE_COUNT // DeviceSingleFpConfigInfo describes single precision floating-point capability of the device. This is a bit-field. // // Returned type: DeviceFpConfigFlags DeviceSingleFpConfigInfo DeviceInfoName = C.CL_DEVICE_SINGLE_FP_CONFIG // DeviceSubGroupIndependentForwardProgressInfo is True if this device supports independent forward progress of // subgroups, False otherwise. // This value must be True for devices that support the cl_khr_subgroups extension, and must return False for // devices that do not support subgroups. // // Returned type: Bool // Since: 2.1 // Extension: cl_khr_subgroups DeviceSubGroupIndependentForwardProgressInfo DeviceInfoName = C.CL_DEVICE_SUB_GROUP_INDEPENDENT_FORWARD_PROGRESS // DeviceSvmCapabilitiesInfo describes the various shared virtual memory (SVM) memory allocation types the // device supports. This is a bit-field. // // Returned type: DeviceSvmCapabilitiesFlags // Since: 2.0 DeviceSvmCapabilitiesInfo DeviceInfoName = C.CL_DEVICE_SVM_CAPABILITIES // DeviceTypeInfo is the type or types of the OpenCL device. // // Returned type: DeviceTypeFlags DeviceTypeInfo DeviceInfoName = C.CL_DEVICE_TYPE // DeviceVendorInfo refers to a human-readable string that identifies the vendor of the device. // // Returned type: string DeviceVendorInfo DeviceInfoName = C.CL_DEVICE_VENDOR // DeviceVendorIDInfo is a unique device vendor identifier. // // Returned type: uint32 DeviceVendorIDInfo DeviceInfoName = C.CL_DEVICE_VENDOR_ID // DeviceVersionInfo is an OpenCL version string. Returns the OpenCL version supported by the device. // This version string has the following format: // // OpenCL<space><major_version.minor_version><space><vendor-specific information> // // Returned type: string DeviceVersionInfo DeviceInfoName = C.CL_DEVICE_VERSION // DriverVersionInfo specifies the OpenCL software driver version string. Follows a vendor-specific format. // // Returned type: string DriverVersionInfo DeviceInfoName = C.CL_DRIVER_VERSION )
type DeviceLocalMemTypeEnum ¶
type DeviceLocalMemTypeEnum C.cl_device_local_mem_type
DeviceLocalMemTypeEnum is used to determine the DeviceLocalMemTypeInfo with DeviceInfo().
const ( DeviceLocalMemTypeNone DeviceLocalMemTypeEnum = C.CL_NONE DeviceLocalMemTypeLocal DeviceLocalMemTypeEnum = C.CL_LOCAL DeviceLocalMemTypeGlobal DeviceLocalMemTypeEnum = C.CL_GLOBAL )
These are the possible values for DeviceLocalMemTypeEnum. They are slightly reworded compared to the original OpenCL API to avoid potential name/type clashes in the future.
type DeviceMemCacheTypeEnum ¶
type DeviceMemCacheTypeEnum C.cl_device_mem_cache_type
DeviceMemCacheTypeEnum is used to determine the DeviceGlobalMemCacheTypeInfo with DeviceInfo().
const ( DeviceMemCacheNone DeviceMemCacheTypeEnum = C.CL_NONE DeviceMemCacheReadOnly DeviceMemCacheTypeEnum = C.CL_READ_ONLY_CACHE DeviceMemCacheReadWrite DeviceMemCacheTypeEnum = C.CL_READ_WRITE_CACHE )
These are the possible values for DeviceMemCacheTypeEnum. They are slightly reworded compared to the original OpenCL API to avoid potential name/type clashes in the future.
type DevicePartitionProperty ¶
type DevicePartitionProperty []uintptr
DevicePartitionProperty is one entry of properties which are taken into account when creating sub-devices with CreateSubDevices().
func PartitionedByAffinityDomain ¶
func PartitionedByAffinityDomain(domain DeviceAffinityDomainFlags) DevicePartitionProperty
PartitionedByAffinityDomain is a convenience function to create a valid DevicePartitionByAffinityDomainProperty. Use it in combination with CreateSubDevices().
func PartitionedByCounts ¶
func PartitionedByCounts(units []uint32) DevicePartitionProperty
PartitionedByCounts is a convenience function to create a valid DevicePartitionByCountsProperty. Use it in combination with CreateSubDevices().
func PartitionedEqually ¶
func PartitionedEqually(units uint32) DevicePartitionProperty
PartitionedEqually is a convenience function to create a valid DevicePartitionEquallyProperty. Use it in combination with CreateSubDevices().
type DeviceSvmCapabilitiesFlags ¶
type DeviceSvmCapabilitiesFlags C.cl_device_svm_capabilities
DeviceSvmCapabilitiesFlags is used to determine DeviceSvmCapabilitiesInfo with DeviceInfo().
const ( // DeviceSvmCoarseGrainBuffer identifies support for coarse-grain buffer sharing using SvmAlloc(). // Memory consistency is guaranteed at synchronization points and the host must use calls to EnqueueMapBuffer() // and EnqueueUnmapMemObject(). // // Since: 2.0 DeviceSvmCoarseGrainBuffer DeviceSvmCapabilitiesFlags = C.CL_DEVICE_SVM_COARSE_GRAIN_BUFFER // DeviceSvmFineGrainBuffer identifies support for fine-grain buffer sharing using SvmAlloc(). // Memory consistency is guaranteed at synchronization points without need for EnqueueMapBuffer() and // EnqueueUnmapMemObject(). // // Since: 2.0 DeviceSvmFineGrainBuffer DeviceSvmCapabilitiesFlags = C.CL_DEVICE_SVM_FINE_GRAIN_BUFFER // DeviceSvmFineGrainSystem identifies support for sharing the host’s entire virtual memory including memory // allocated using malloc. Memory consistency is guaranteed at synchronization points. // // Since: 2.0 DeviceSvmFineGrainSystem DeviceSvmCapabilitiesFlags = C.CL_DEVICE_SVM_FINE_GRAIN_SYSTEM // DeviceSvmAtomics identifies support for the OpenCL 2.0 atomic operations that provide memory consistency // across the host and all OpenCL devices supporting fine-grain SVM allocations. // // Since: 2.0 DeviceSvmAtomics DeviceSvmCapabilitiesFlags = C.CL_DEVICE_SVM_ATOMICS )
type DeviceTerminateCapabilityKhrFlags ¶
type DeviceTerminateCapabilityKhrFlags C.cl_bitfield
DeviceTerminateCapabilityKhrFlags describe the termination capability of the OpenCL device.
Extension: KhrTerminateContextExtensionName
const ( // DeviceTerminateCapabilityKhrContext indicates that context termination is supported. // // Note: The constant is an assumption. Refer to https://github.com/KhronosGroup/OpenCL-Docs/issues/813 for details. // // Extension: KhrTerminateContextExtensionName DeviceTerminateCapabilityKhrContext DeviceTerminateCapabilityKhrFlags = 1 << 0 )
type DeviceTypeFlags ¶
type DeviceTypeFlags C.cl_device_type
DeviceTypeFlags is a bitfield that identifies the type of OpenCL device. It can be used for DeviceIDs() to filter for the requested devices.
const ( // DeviceTypeCPU is an OpenCL device similar to a traditional CPU (Central Processing Unit). // The host processor that executes OpenCL host code may also be considered a CPU OpenCL device. DeviceTypeCPU DeviceTypeFlags = C.CL_DEVICE_TYPE_CPU // DeviceTypeDefault is the default OpenCL device in the platform. // The default OpenCL device must not be a DeviceTypeCustom device. DeviceTypeDefault DeviceTypeFlags = C.CL_DEVICE_TYPE_DEFAULT // DeviceTypeGpu is an OpenCL device similar to a GPU (Graphics Processing Unit). // Many systems include a dedicated processor for graphics or rendering that may be considered a GPU OpenCL device. DeviceTypeGpu DeviceTypeFlags = C.CL_DEVICE_TYPE_GPU // DeviceTypeAccelerator are dedicated devices that may accelerate OpenCL programs, such as FPGAs // (Field Programmable Gate Arrays), DSPs (Digital Signal Processors), or AI (Artificial Intelligence) processors. DeviceTypeAccelerator DeviceTypeFlags = C.CL_DEVICE_TYPE_ACCELERATOR // DeviceTypeCustom are specialized devices that implement some OpenCL runtime APIs but do not support // all required OpenCL functionality. // // Since: 1.2 DeviceTypeCustom DeviceTypeFlags = C.CL_DEVICE_TYPE_CUSTOM // DeviceTypeAll identifies all OpenCL devices available in the platform, except for DeviceTypeCustom devices. DeviceTypeAll DeviceTypeFlags = C.CL_DEVICE_TYPE_ALL )
type Event ¶
type Event uintptr
Event objects are used as synchronization points between different commands within a context. Enqueue* functions offer the option to return a new event object, and a manually controlled event object can be created with CreateUserEvent().
func CreateUserEvent ¶
CreateUserEvent creates a user event object. User events allow applications to enqueue commands that wait on a user event to finish before the command is executed by the device.
See also: https://registry.khronos.org/OpenCL/sdk/2.2/docs/man/html/clCreateUserEvent.html
type EventCommandExecutionStatus ¶
EventCommandExecutionStatus describes the execution status of an event. Negative values are error status values.
const ( // EventCommandQueuedStatus means the command has been enqueued in the command-queue. EventCommandQueuedStatus EventCommandExecutionStatus = C.CL_QUEUED // EventCommandSubmittedStatus means the enqueued command has been submitted by the host to the device associated // with the command-queue. EventCommandSubmittedStatus EventCommandExecutionStatus = C.CL_SUBMITTED // EventCommandRunningStatus means the device is currently executing this command. EventCommandRunningStatus EventCommandExecutionStatus = C.CL_RUNNING // EventCommandCompleteStatus means that the command has completed. EventCommandCompleteStatus EventCommandExecutionStatus = C.CL_COMPLETE )
type EventCommandType ¶
EventCommandType identifies the associated command with an event.
const ( // CommandNdRangeKernel events are created by EnqueueNDRangeKernel(). CommandNdRangeKernel EventCommandType = C.CL_COMMAND_NDRANGE_KERNEL // CommandTask events are created by EnqueueTask(). CommandTask EventCommandType = C.CL_COMMAND_TASK // CommandNativeKernel events are created by EnqueueNativeKernel(). CommandNativeKernel EventCommandType = C.CL_COMMAND_NATIVE_KERNEL // CommandReadBuffer events are created by EnqueueReadBuffer(). CommandReadBuffer EventCommandType = C.CL_COMMAND_READ_BUFFER // CommandWriteBuffer events are created by EnqueueWriteBuffer(). CommandWriteBuffer EventCommandType = C.CL_COMMAND_WRITE_BUFFER // CommandCopyBuffer events are created by EnqueueCopyBuffer(). CommandCopyBuffer EventCommandType = C.CL_COMMAND_COPY_BUFFER // CommandReadImage events are created by EnqueueReadImage(). CommandReadImage EventCommandType = C.CL_COMMAND_READ_IMAGE // CommandWriteImage events are created by EnqueueWriteImage(). CommandWriteImage EventCommandType = C.CL_COMMAND_WRITE_IMAGE // CommandCopyImage events are created by EnqueueCopyImage(). CommandCopyImage EventCommandType = C.CL_COMMAND_COPY_IMAGE // CommandCopyImageToBuffer events are created by EnqueueCopyImageToBuffer(). CommandCopyImageToBuffer EventCommandType = C.CL_COMMAND_COPY_IMAGE_TO_BUFFER // CommandCopyBufferToImage events are created by EnqueueCopyBufferToImage(). CommandCopyBufferToImage EventCommandType = C.CL_COMMAND_COPY_BUFFER_TO_IMAGE // CommandMapBuffer events are created by EnqueueMapBuffer(). CommandMapBuffer EventCommandType = C.CL_COMMAND_MAP_BUFFER // CommandMapImage events are created by EnqueueMapImage(). CommandMapImage EventCommandType = C.CL_COMMAND_MAP_IMAGE // CommandUnmapMemObject events are created by EnqueueUnmapMemObject(). CommandUnmapMemObject EventCommandType = C.CL_COMMAND_UNMAP_MEM_OBJECT // CommandMarker events are created by EnqueueMarker() and EnqueueMarkerWithWaitList(). CommandMarker EventCommandType = C.CL_COMMAND_MARKER // CommandReadBufferRect events are created by EnqueueReadBufferRect(). // // Since: 1.1 CommandReadBufferRect EventCommandType = C.CL_COMMAND_READ_BUFFER_RECT // CommandWriteBufferRect events are created by EnqueueWriteBufferRect(). // // Since: 1.1 CommandWriteBufferRect EventCommandType = C.CL_COMMAND_WRITE_BUFFER_RECT // CommandCopyBufferRect events are created by EnqueueCopyBufferRect(). // // Since: 1.1 CommandCopyBufferRect EventCommandType = C.CL_COMMAND_COPY_BUFFER_RECT // CommandUser events are created by CreateUserEvent(). // // Since: 1.1 CommandUser EventCommandType = C.CL_COMMAND_USER // CommandBarrier events are created by EnqueueBarrier() and EnqueueBarrierWithWaitList(). // // Since: 1.2 CommandBarrier EventCommandType = C.CL_COMMAND_BARRIER // CommandMigrateMemObjects events are created by EnqueueMigrateMemObjects(). // // Since: 1.2 CommandMigrateMemObjects EventCommandType = C.CL_COMMAND_MIGRATE_MEM_OBJECTS // CommandFillBuffer events are created by EnqueueFillBuffer(). // // Since: 1.2 CommandFillBuffer EventCommandType = C.CL_COMMAND_FILL_BUFFER // CommandFillImage events are created by EnqueueFillImage(). // // Since: 1.2 CommandFillImage EventCommandType = C.CL_COMMAND_FILL_IMAGE // CommandSvmFree events are created by EnqueueSvmFree(). // // Since: 2.0 CommandSvmFree EventCommandType = C.CL_COMMAND_SVM_FREE // CommandSvmMemcpy events are created by EnqueueSvmMemcpy(). // // Since: 2.0 CommandSvmMemcpy EventCommandType = C.CL_COMMAND_SVM_MEMCPY // CommandSvmMemFill events are created by EnqueueSvmMemFill(). // // Since: 2.0 CommandSvmMemFill EventCommandType = C.CL_COMMAND_SVM_MEMFILL // CommandSvmMap events are created by EnqueueSvmMap(). // // Since: 2.0 CommandSvmMap EventCommandType = C.CL_COMMAND_SVM_MAP // CommandSvmUnmap events are created by EnqueueSvmUnmap(). // // Since: 2.0 CommandSvmUnmap EventCommandType = C.CL_COMMAND_SVM_UNMAP )
type EventInfoName ¶
type EventInfoName C.cl_event_info
EventInfoName identifies properties of an event, which can be queried with EventInfo().
const ( // EventCommandQueueInfo returns the command-queue associated with event. For user event objects, // a zero value is returned. // // Returned type: CommandQueue EventCommandQueueInfo EventInfoName = C.CL_EVENT_COMMAND_QUEUE // EventContextInfo returns the context associated with event. // // Returned type: Context EventContextInfo EventInfoName = C.CL_EVENT_CONTEXT // EventCommandTypeInfo return the command type associated with the event. // // Returned type: EventCommandType EventCommandTypeInfo EventInfoName = C.CL_EVENT_COMMAND_TYPE // EventReferenceCountInfo returns the event reference count. // // Note: The reference count returned should be considered immediately stale. It is unsuitable for // general use in applications. This feature is provided for identifying memory leaks. // // Returned type: uint32 EventReferenceCountInfo EventInfoName = C.CL_EVENT_REFERENCE_COUNT // EventCommandExecutionStatusInfo returns the execution status of the command identified by event. // // Error codes are identified by a negative integer value: The command was abnormally terminated - this may be // caused by a bad memory access for example. These error codes come from the same set of error codes that are // returned from the platform or runtime API calls as status codes. // // Returned type: EventCommandExecutionStatus EventCommandExecutionStatusInfo EventInfoName = C.CL_EVENT_COMMAND_EXECUTION_STATUS )
type EventProfilingInfoName ¶
type EventProfilingInfoName C.cl_profiling_info
EventProfilingInfoName identifies profiling properties of an event, which can be queried with EventProfilingInfo().
const ( // ProfilingCommandQueuedInfo describes the current device time counter in nanoseconds when the command identified // by the event is enqueued in a command-queue by the host. // // Returned type: uint64 ProfilingCommandQueuedInfo EventProfilingInfoName = C.CL_PROFILING_COMMAND_QUEUED // ProfilingCommandSubmitInfo describes the current device time counter in nanoseconds when the command identified // by the event that has been enqueued is submitted by the host to the device associated with the command-queue. // // Returned type: uint64 ProfilingCommandSubmitInfo EventProfilingInfoName = C.CL_PROFILING_COMMAND_SUBMIT // ProfilingCommandStartInfo describes the current device time counter in nanoseconds when the command identified // by the event starts execution on the device. // // Returned type: uint64 ProfilingCommandStartInfo EventProfilingInfoName = C.CL_PROFILING_COMMAND_START // ProfilingCommandEndInfo describes the current device time counter in nanoseconds when the command identified // by the event has finished execution on the device. // // Returned type: uint64 ProfilingCommandEndInfo EventProfilingInfoName = C.CL_PROFILING_COMMAND_END // ProfilingCommandCompleteInfo describes the current device time counter in nanoseconds when the command identified // by the event and any child commands enqueued by this command on the device have finished execution. // // Returned type: uint64 // Since: 2.0 ProfilingCommandCompleteInfo EventProfilingInfoName = C.CL_PROFILING_COMMAND_COMPLETE )
type ExtensionTerminateContextKhr ¶
type ExtensionTerminateContextKhr struct {
// contains filtered or unexported fields
}
ExtensionTerminateContextKhr represents the functionality provided by the "cl_khr_terminate_context" extension. Load the extension with LoadExtensionTerminateContextKhr().
See also: https://registry.khronos.org/OpenCL/sdk/2.2/docs/man/html/cl_khr_terminate_context.html Extension: KhrTerminateContextExtensionName
func LoadExtensionTerminateContextKhr ¶
func LoadExtensionTerminateContextKhr(id PlatformID) (*ExtensionTerminateContextKhr, error)
LoadExtensionTerminateContextKhr loads the required functions for the extension and returns an instance to ExtensionTerminateContextKhr if possible.
Extension: KhrTerminateContextExtensionName
func (*ExtensionTerminateContextKhr) TerminateContext ¶
func (ext *ExtensionTerminateContextKhr) TerminateContext(context Context) error
TerminateContext terminates all pending work associated with the context and renders all data owned by the context invalid. It is the responsibility of the application to release all objects associated with the context being terminated.
See also: https://registry.khronos.org/OpenCL/sdk/2.2/docs/man/html/clTerminateContextKHR.html Extension: KhrTerminateContextExtensionName
type ImageDesc ¶
type ImageDesc struct { ImageType MemObjectType Width uintptr Height uintptr Depth uintptr ArraySize uintptr RowPitch uintptr SlicePitch uintptr NumMipLevels uint32 NumSamples uint32 MemObject MemObject }
ImageDesc describes the dimensions of the image.
type ImageFormat ¶
type ImageFormat struct { ChannelOrder ChannelOrder ChannelType ChannelType }
ImageFormat describes how the bytes of the byte buffer shall be interpreted as pixel values.
func SupportedImageFormats ¶
func SupportedImageFormats(context Context, flags MemFlags, imageType MemObjectType) ([]ImageFormat, error)
SupportedImageFormats returns the list of image formats supported by an OpenCL implementation.
See also: https://registry.khronos.org/OpenCL/sdk/2.2/docs/man/html/clGetSupportedImageFormats.html
type ImageInfoName ¶
type ImageInfoName C.cl_image_info
ImageInfoName identifies properties of an image object, which can be queried with ImageInfo().
const ( // ImageFormatInfo return the image format descriptor specified when the image was created. // // Returned type: ImageFormat ImageFormatInfo ImageInfoName = C.CL_IMAGE_FORMAT // ImageElementSizeInfo returns the size of each element of the image memory object given by image in bytes. // // Returned type: uintptr ImageElementSizeInfo ImageInfoName = C.CL_IMAGE_ELEMENT_SIZE // ImageRowPitchInfo returns the row pitch in bytes of a row of elements of the image object given by image. // // Returned type: uintptr ImageRowPitchInfo ImageInfoName = C.CL_IMAGE_ROW_PITCH // ImageSlicePitchInfo returns the slice pitch in bytes of a 2D slice for the 3D image object or size of each // image in a 1D or 2D image array given by image. // // Returned type: uintptr ImageSlicePitchInfo ImageInfoName = C.CL_IMAGE_SLICE_PITCH // ImageWidthInfo returns the width of the image in pixels. // // Returned type: uintptr ImageWidthInfo ImageInfoName = C.CL_IMAGE_WIDTH // ImageHeightInfo returns the height of the image in pixels. // For a 1D image, 1D image buffer and 1D image array object, height is 0. // // Returned type: uintptr ImageHeightInfo ImageInfoName = C.CL_IMAGE_HEIGHT // ImageDepthInfo returns the depth of the image in pixels. // For a 1D image, 1D image buffer, 2D image or 1D and 2D image array object, depth is 0. // // Returned type: uintptr ImageDepthInfo ImageInfoName = C.CL_IMAGE_DEPTH // ImageArraySizeInfo returns the number of images in the image array. // If image is not an image array, 0 is returned. // // Returend type: uintptr // Since: 1.2 ImageArraySizeInfo ImageInfoName = C.CL_IMAGE_ARRAY_SIZE // ImageBufferInfo returns the buffer object associated with image. // // Returned type: MemObject // Since: 1.2 // Deprecated: 2.0 ImageBufferInfo ImageInfoName = C.CL_IMAGE_BUFFER // ImageNumMipLevelsInfo returns the MIP level count associated with the image. // // Returned type: uint32 // Since: 1.2 ImageNumMipLevelsInfo ImageInfoName = C.CL_IMAGE_NUM_MIP_LEVELS // ImageNumSamplesInfo returns the sample count associated with the image. // // Returned type: uint32 // Since: 1.2 ImageNumSamplesInfo ImageInfoName = C.CL_IMAGE_NUM_SAMPLES )
type IncludeHeader ¶
IncludeHeader is a named program to be used with CompileProgram().
type Kernel ¶
type Kernel uintptr
Kernel object references a particular __kernel function and its arguments for execution.
func CloneKernel ¶
CloneKernel makes a shallow copy of the kernel object.
Cloning is used to make a shallow copy of the kernel object, its arguments and any information passed to the kernel object using SetKernelExecInfo(). If the kernel object was ready to be enqueued before copying it, the clone of the kernel object is ready to enqueue.
The returned kernel object is an exact copy of the source kernel, with one caveat: the reference count on the returned kernel object is set as if it had been returned by CreateKernel(). The reference count of the source kernel will not be changed.
The resulting kernel will be in the same state as if CreateKernel() is called to create the resultant kernel with the same arguments as those used to create the source kernel, the latest call to SetKernelArg() or SetKernelArgSVMPointer() for each argument index applied to kernel and the last call to SetKernelExecInfo() for each value of the param name parameter are applied to the new kernel object.
All arguments of the new kernel object must be intact, and it may be correctly used in the same situations as kernel except those that assume a pre-existing reference count. Setting arguments on the new kernel object will not affect the source kernel except insofar as the argument points to a shared underlying entity and in that situation behavior is as if two kernel objects had been created and the same argument applied to each. Only the data stored in the kernel object is copied; data referenced by the kernels arguments are not copied. For example, if a buffer or pointer argument is set on a kernel object, the pointer is copied but the underlying memory allocation is not.
Since: 2.1 See also: https://registry.khronos.org/OpenCL/sdk/2.2/docs/man/html/clCloneKernel.html
func CreateKernel ¶
CreateKernel creates a kernel object.
See also: https://registry.khronos.org/OpenCL/sdk/2.2/docs/man/html/clCreateKernel.html
func CreateKernelsInProgram ¶
CreateKernelsInProgram creates kernel objects for all kernel functions in a program object.
Kernel objects are not created for any __kernel functions in program that do not have the same function definition across all devices for which a program executable has been successfully built.
Kernel objects can only be created once you have a program object with a valid program source or binary loaded into the program object and the program executable has been successfully built for one or more devices associated with program. No changes to the program executable are allowed while there are kernel objects associated with a program object. This means that calls to BuildProgram() and CompileProgram() return ErrInvalidOperation if there are kernel objects attached to a program object.
The OpenCL context associated with program will be the context associated with kernel. The list of devices associated with program are the devices associated with kernel. Devices associated with a program object for which a valid program executable has been built can be used to execute kernels declared in the program object.
See also: https://registry.khronos.org/OpenCL/sdk/2.2/docs/man/html/clCreateKernelsInProgram.html
type KernelArgAccessQualifier ¶
type KernelArgAccessQualifier C.cl_kernel_arg_access_qualifier
KernelArgAccessQualifier describes the access qualifier for a kernel argument.
const ( KernelArgAccessReadOnly KernelArgAccessQualifier = C.CL_KERNEL_ARG_ACCESS_READ_ONLY KernelArgAccessWriteOnly KernelArgAccessQualifier = C.CL_KERNEL_ARG_ACCESS_WRITE_ONLY KernelArgAccessReadWrite KernelArgAccessQualifier = C.CL_KERNEL_ARG_ACCESS_READ_WRITE KernelArgAccessNone KernelArgAccessQualifier = C.CL_KERNEL_ARG_ACCESS_NONE )
List of possible KernelArgAccessQualifier values.
type KernelArgAddressQualifier ¶
type KernelArgAddressQualifier C.cl_kernel_arg_address_qualifier
KernelArgAddressQualifier describes the address qualifier for a kernel argument.
const ( KernelArgAddressGlobal KernelArgAddressQualifier = C.CL_KERNEL_ARG_ADDRESS_GLOBAL KernelArgAddressLocal KernelArgAddressQualifier = C.CL_KERNEL_ARG_ADDRESS_LOCAL KernelArgAddressConstant KernelArgAddressQualifier = C.CL_KERNEL_ARG_ADDRESS_CONSTANT KernelArgAddressPrivate KernelArgAddressQualifier = C.CL_KERNEL_ARG_ADDRESS_PRIVATE )
List of possible KernelArgAddressQualifier values.
type KernelArgInfoName ¶
type KernelArgInfoName C.cl_kernel_arg_info
KernelArgInfoName identifies properties of a kernel argument, which can be queried with KernelArgInfo().
const ( // KernelArgAddressQualifierInfo returns the address qualifier specified for the argument. // // Returned type: KernelArgAddressQualifier // Since: 1.2 KernelArgAddressQualifierInfo KernelArgInfoName = C.CL_KERNEL_ARG_ADDRESS_QUALIFIER // KernelArgAccessQualifierInfo returns the access qualifier specified for the argument. // // Returned type: KernelArgAccessQualifier // Since: 1.2 KernelArgAccessQualifierInfo KernelArgInfoName = C.CL_KERNEL_ARG_ACCESS_QUALIFIER // KernelArgTypeNameInfo returns the type name specified for the argument. // The type name returned will be the argument type name as it was declared with any whitespace removed. // If argument type name is an unsigned scalar type (i.e. unsigned char, unsigned short, unsigned int, // unsigned long), uchar, ushort, uint and ulong will be returned. // The argument type name returned does not include any type qualifiers. // // Returned type: string // Since: 1.2 KernelArgTypeNameInfo KernelArgInfoName = C.CL_KERNEL_ARG_TYPE_NAME // KernelArgTypeQualifierInfo returns a bitfield describing one or more type qualifiers specified for the argument. // // Returned type: KernelArgTypeQualifier // Since: 1.2 KernelArgTypeQualifierInfo KernelArgInfoName = C.CL_KERNEL_ARG_TYPE_QUALIFIER // KernelArgNameInfo returns the name specified for the argument. // // Returned type: string // Since: 1.2 KernelArgNameInfo KernelArgInfoName = C.CL_KERNEL_ARG_NAME )
type KernelArgTypeQualifier ¶
type KernelArgTypeQualifier C.cl_kernel_arg_type_qualifier
KernelArgTypeQualifier describes the type for a kernel argument.
const ( KernelArgTypeNone KernelArgTypeQualifier = C.CL_KERNEL_ARG_TYPE_NONE KernelArgTypeConst KernelArgTypeQualifier = C.CL_KERNEL_ARG_TYPE_CONST KernelArgTypeRestrict KernelArgTypeQualifier = C.CL_KERNEL_ARG_TYPE_RESTRICT KernelArgTypeVolatile KernelArgTypeQualifier = C.CL_KERNEL_ARG_TYPE_VOLATILE KernelArgTypePipe KernelArgTypeQualifier = C.CL_KERNEL_ARG_TYPE_PIPE )
List of possible KernelArgTypeQualifier values.
type KernelExecInfoName ¶
type KernelExecInfoName C.cl_kernel_exec_info
KernelExecInfoName describes an extra parameter beyond arguments for a kernel.
const ( // KernelExecInfoSvmPtrs defines the SVM pointers that must reference locations contained entirely within buffers // that are passed to kernel as arguments, or that are passed through the execution information. // // Non-argument SVM buffers must be specified by passing pointers to those buffers via SetKernelExecInfo() // for coarse-grain and fine-grain buffer SVM allocations but not for fine-grain system SVM allocations. // // Required type: []unsafe.Pointer // Since: 2.0 KernelExecInfoSvmPtrs KernelExecInfoName = C.CL_KERNEL_EXEC_INFO_SVM_PTRS // KernelExecInfoSvmFineGrainSystem indicates whether the kernel uses pointers that are fine-grain system SVM // allocations. These fine-grain system SVM pointers may be passed as arguments or defined in SVM buffers that // are passed as arguments to kernel. // // Required type: Bool // Since: 2.0 KernelExecInfoSvmFineGrainSystem KernelExecInfoName = C.CL_KERNEL_EXEC_INFO_SVM_FINE_GRAIN_SYSTEM )
type KernelInfoName ¶
type KernelInfoName C.cl_kernel_info
KernelInfoName identifies properties of a kernel, which can be queried with KernelInfo().
const ( // KernelFunctionNameInfo returns the kernel function name. // // Returned type: string KernelFunctionNameInfo KernelInfoName = C.CL_KERNEL_FUNCTION_NAME // KernelNumArgsInfo returns the number of arguments to kernel. // // Returned type: uint32 KernelNumArgsInfo KernelInfoName = C.CL_KERNEL_NUM_ARGS // KernelReferenceCountInfo returns the kernel reference count. // // Note: The reference count returned should be considered immediately stale. It is unsuitable for general // use in applications. This feature is provided for identifying memory leaks. // // Returned type: uint32 KernelReferenceCountInfo KernelInfoName = C.CL_KERNEL_REFERENCE_COUNT // KernelContextInfo returns the context associated with kernel. // // Returned type: Context KernelContextInfo KernelInfoName = C.CL_KERNEL_CONTEXT // KernelProgramInfo returns the program object associated with kernel. // // Returned type: Program KernelProgramInfo KernelInfoName = C.CL_KERNEL_PROGRAM // KernelAttributesInfo returns any attributes specified using the __attribute__ OpenCL C qualifier // (or using an OpenCL C++ qualifier syntax [[]] ) with the kernel function declaration in the program source. // // Returned type: string // Since: 1.2 KernelAttributesInfo KernelInfoName = C.CL_KERNEL_ATTRIBUTES )
type KernelSubGroupInfoName ¶
type KernelSubGroupInfoName C.cl_kernel_sub_group_info
KernelSubGroupInfoName identifies properties of a kernel, which can be queried with KernelSubGroupInfo().
const ( // KernelMaxSubGroupSizeForNDRangeInfo returns the maximum sub-group size for this kernel. // All sub-groups must be the same size, while the last subgroup in any work-group (i.e. the subgroup with // the maximum index) could be the same or smaller size. // // The input value must be an array of uintptr values corresponding to the local work size parameter of the // intended dispatch. The number of dimensions in the ND-range will be inferred from the value specified for // input size. // // Input type: []uintptr // Returned type: uintptr // Since: 2.1 // Extension: cl_khr_subgroups KernelMaxSubGroupSizeForNDRangeInfo KernelSubGroupInfoName = C.CL_KERNEL_MAX_SUB_GROUP_SIZE_FOR_NDRANGE // KernelSubGroupCountForNDRangeInfo returns the number of sub-groups that will be present in each work-group for // a given local work size. All workgroups, apart from the last work-group in each dimension in the presence of // non-uniform work-group sizes, will have the same number of sub-groups. // // The input value must be an array of uintptr values corresponding to the local work size parameter of the // intended dispatch. The number of dimensions in the ND-range will be inferred from the value specified // for input size. // // Input type: []uintptr // Returned type: uintptr // Since: 2.1 // Extension: cl_khr_subgroups KernelSubGroupCountForNDRangeInfo KernelSubGroupInfoName = C.CL_KERNEL_SUB_GROUP_COUNT_FOR_NDRANGE // KernelLocalSizeForSubGroupCountInfo returns the local size that will generate the requested number of // sub-groups for the kernel. The output array must be an array of uintptr values corresponding to the local // size parameter. Any returned work-group will have one dimension. Other dimensions inferred from the value // specified for param_value_size will be filled with the value 1. The returned value will produce an exact number // of sub-groups and result in no partial groups for an executing kernel except in the case where the last // work-group in a dimension has a size different from that of the other groups. // If no work-group size can accommodate the requested number of sub-groups, 0 will be returned in each element // of the return array. // // Input type: uintptr // Returned type: []uintptr // Since: 2.1 // Extension: cl_khr_subgroups KernelLocalSizeForSubGroupCountInfo KernelSubGroupInfoName = C.CL_KERNEL_LOCAL_SIZE_FOR_SUB_GROUP_COUNT // KernelMaxNumSubGroupsInfo provides a mechanism for the application to query the maximum number of sub-groups // that may make up each work-group to execute a kernel on a specific device given by device. // The OpenCL implementation uses the resource requirements of the kernel (register usage etc.) to determine // what this work-group size should be. The returned value may be used to compute a work-group size to enqueue // the kernel with to give a round number of sub-groups for an enqueue. // // Input type: (ignored) // Returned type: uintptr // Since: 2.1 // Extension: cl_khr_subgroups KernelMaxNumSubGroupsInfo KernelSubGroupInfoName = C.CL_KERNEL_MAX_NUM_SUB_GROUPS // KernelCompileNumSubGroupsInfo returns the number of sub-groups per work-group specified in the kernel source // or IL. If the sub-group count is not specified then 0 is returned. // // Input type: (ignored) // Returned type: uintptr // Since: 2.1 // Extension: cl_khr_subgroups KernelCompileNumSubGroupsInfo KernelSubGroupInfoName = C.CL_KERNEL_COMPILE_NUM_SUB_GROUPS )
type KernelWorkGroupInfoName ¶
type KernelWorkGroupInfoName C.cl_kernel_work_group_info
KernelWorkGroupInfoName identifies properties of a kernel work group, which can be queried with KernelWorkGroupInfo().
const ( // KernelWorkGroupSizeInfo provides a mechanism for the application to query the maximum work-group size // that can be used to execute the kernel on a specific device given by device. // The OpenCL implementation uses the resource requirements of the kernel (register usage etc.) to determine what // this work-group size should be. // // As a result and unlike DeviceMaxWorkGroupSizeInfo this value may vary from one kernel to another as well as // one device to another. // // KernelCompileWorkGroupSizeInfo will be less than or equal to DeviceMaxWorkGroupSizeInfo for a given kernel object. // // Returned type: uintptr KernelWorkGroupSizeInfo KernelWorkGroupInfoName = C.CL_KERNEL_WORK_GROUP_SIZE // KernelCompileWorkGroupSizeInfo returns the work-group size specified in the kernel source or IL. // // If the work-group size is not specified in the kernel source or IL, (0, 0, 0) is returned. // // Returned type: [3]uintptr KernelCompileWorkGroupSizeInfo KernelWorkGroupInfoName = C.CL_KERNEL_COMPILE_WORK_GROUP_SIZE // KernelLocalMemSizeInfo returns the amount of local memory in bytes being used by a kernel. // This includes local memory that may be needed by an implementation to execute the kernel, variables declared // inside the kernel with the __local address qualifier and local memory to be allocated for arguments to the // kernel declared as pointers with the __local address qualifier and whose size is specified with SetKernelArg(). // // If the local memory size, for any pointer argument to the kernel declared with the __local address qualifier, // is not specified, its size is assumed to be 0. // // Returned type: uint64 KernelLocalMemSizeInfo KernelWorkGroupInfoName = C.CL_KERNEL_LOCAL_MEM_SIZE // KernelPreferredWorkGroupSizeMultipleInfo returns the preferred multiple of work-group size for launch. // This is a performance hint. Specifying a work-group size that is not a multiple of the value returned by this // query as the value of the local work size argument to EnqueueNDRangeKernel() will not fail to enqueue the kernel // for execution unless the work-group size specified is larger than the device maximum. // // Returned type: uintptr KernelPreferredWorkGroupSizeMultipleInfo KernelWorkGroupInfoName = C.CL_KERNEL_PREFERRED_WORK_GROUP_SIZE_MULTIPLE // KernelPrivateMemSizeInfo returns the minimum amount of private memory, in bytes, used by each work-item in // the kernel. This value may include any private memory needed by an implementation to execute the kernel, // including that used by the language built-ins and variable declared inside the kernel with the __private qualifier. // // Returned type: uint64 KernelPrivateMemSizeInfo KernelWorkGroupInfoName = C.CL_KERNEL_PRIVATE_MEM_SIZE // KernelGlobalWorkSizeInfo provides a mechanism for the application to query the maximum global size that can be // used to execute a kernel (i.e. globalWorkSize argument to EnqueueNDRangeKernel()) on a custom device given by // device or a built-in kernel on an OpenCL device given by device. // // If device is not a custom device and kernel is not a built-in kernel, GetKernelWorkGroupInfo() returns the // error ErrInvalidValue. // // Returned type: [3]uintptr // Since: 1.2 KernelGlobalWorkSizeInfo KernelWorkGroupInfoName = C.CL_KERNEL_GLOBAL_WORK_SIZE )
type MapFlags ¶
type MapFlags C.cl_map_flags
MapFlags describe how a memory object shall be mapped into host memory.
const ( // MapRead specifies that the region being mapped in the memory object is being mapped for reading. MapRead MapFlags = C.CL_MAP_READ // MapWrite specifies that the region being mapped in the memory object is being mapped for writing. MapWrite MapFlags = C.CL_MAP_WRITE // MapWriteInvalidateRegion specifies that the region being mapped in the memory object is being mapped for writing. // // The contents of the region being mapped are to be discarded. This is typically the case when the region // being mapped is overwritten by the host. This flag allows the implementation to no longer guarantee that the // pointer returned by EnqueueMapBuffer() (EnqueueMapImage()) contains the latest bits in the region being mapped // which can be a significant performance enhancement. // // Since: 1.2 MapWriteInvalidateRegion MapFlags = C.CL_MAP_WRITE_INVALIDATE_REGION )
type MappedImage ¶
MappedImage describes an image as it was mapped into host memory.
func EnqueueMapImage ¶
func EnqueueMapImage(commandQueue CommandQueue, image MemObject, blocking bool, flags MapFlags, origin, region [3]uintptr, waitList []Event, event *Event) (MappedImage, error)
EnqueueMapImage enqueues a command to map a region of an image object into the host address space and returns a description of this mapped region.
See also: https://registry.khronos.org/OpenCL/sdk/2.2/docs/man/html/clEnqueueMapImage.html
type MemMigrationFlags ¶
type MemMigrationFlags C.cl_mem_migration_flags
MemMigrationFlags determine the migration options of memory objects.
const ( // MigrateMemObjectHost indicates that the specified set of memory objects are to be migrated to the host, // regardless of the target command-queue. // // Since: 1.2 MigrateMemObjectHost MemMigrationFlags = C.CL_MIGRATE_MEM_OBJECT_HOST // MigrateMemObjectContentUndefined indicates that the contents of the set of memory objects are undefined after // migration. The specified set of memory objects are migrated to the device associated with the command-queue // without incurring the overhead of migrating their contents. // // Since: 1.2 MigrateMemObjectContentUndefined MemMigrationFlags = C.CL_MIGRATE_MEM_OBJECT_CONTENT_UNDEFINED )
type MemObject ¶
type MemObject uintptr
MemObject represents a reference counted region of global memory.
func CreateBuffer ¶
func CreateBuffer(context Context, flags MemFlags, size int, hostPtr unsafe.Pointer) (MemObject, error)
CreateBuffer creates a buffer object.
See also: https://registry.khronos.org/OpenCL/sdk/2.2/docs/man/html/clCreateBuffer.html
func CreateImage ¶
func CreateImage(context Context, flags MemFlags, format ImageFormat, desc ImageDesc, hostPtr unsafe.Pointer) (MemObject, error)
CreateImage creates a 1D image, 1D image buffer, 1D image array, 2D image, 2D image array, or 3D image object.
Since: 1.2 See also: https://registry.khronos.org/OpenCL/sdk/2.2/docs/man/html/clCreateImage.html
func CreatePipe ¶
func CreatePipe(context Context, flags MemFlags, packetSize, maxPackets uint32, properties ...PipeProperty) (MemObject, error)
CreatePipe creates a pipe object.
For the flags parameter, only MemReadWriteFlag and MemHostNoAccessFlag can be specified when creating a pipe object. If the value specified for flags is 0, the default is used which is MemReadWriteFlag | MemHostNoAccessFlag.
Since: 2.0 See also: https://registry.khronos.org/OpenCL/sdk/2.2/docs/man/html/clCreatePipe.html
func CreateSubBuffer ¶
func CreateSubBuffer(buffer MemObject, flags MemFlags, createType BufferCreateType, createInfo unsafe.Pointer) (MemObject, error)
CreateSubBuffer creates a new buffer object (referred to as a sub-buffer object) from an existing buffer object.
The createInfo parameter is dependent on the specified createType.
Since: 1.1 See also: https://registry.khronos.org/OpenCL/sdk/2.2/docs/man/html/clCreateSubBuffer.html
type MemObjectInfoName ¶
type MemObjectInfoName C.cl_mem_info
MemObjectInfoName identifies properties of a memory object, which can be queried with MemObjectInfo().
const ( // MemTypeInfo returns the type of the memory object. // // Returned type: MemObjectType MemTypeInfo MemObjectInfoName = C.CL_MEM_TYPE // MemFlagsInfo returns the flags argument value specified when the memory object was created. // If the memory object is a sub-buffer the memory access qualifiers inherited from parent buffer are also returned. // // Returned type: MemFlags MemFlagsInfo MemObjectInfoName = C.CL_MEM_FLAGS // MemSizeInfo returns the actual size of the data store associated with the memory object in bytes. // // Returned type: uintptr MemSizeInfo MemObjectInfoName = C.CL_MEM_SIZE // MemHostPtrInfo returns the underlying host pointer for a MemObject if it (or its source buffer) was // created with the MemUseHostPtrFlag. It returns nil otherwise. // // Returned type: unsafe.Pointer MemHostPtrInfo MemObjectInfoName = C.CL_MEM_HOST_PTR // MemContextInfo returns the context specified when memory object is created. // // Returned type: Context MemContextInfo MemObjectInfoName = C.CL_MEM_CONTEXT // MemOffsetInfo returns the offset if memory object is a sub-buffer object created using CreateSubBuffer(). // It returns 0 if memory object is not a sub-buffer object. // // Returned type: uintptr // Since: 1.1 MemOffsetInfo MemObjectInfoName = C.CL_MEM_OFFSET // MemMapCountInfo returns the current map count. // // Note: The map count returned should be considered immediately stale. It is unsuitable for // general use in applications. This feature is provided for debugging. // // Returned type: uint32 MemMapCountInfo MemObjectInfoName = C.CL_MEM_MAP_COUNT // MemReferenceCountInfo returns the memory reference count. // // Note: The reference count returned should be considered immediately stale. It is unsuitable for // general use in applications. This feature is provided for identifying memory leaks. // // Returned type: uint32 MemReferenceCountInfo MemObjectInfoName = C.CL_MEM_REFERENCE_COUNT // MemAssociatedMemObjectInfo returns the memory object from which the queried memory object is created. // // Returned type: MemObject // Since: 1.1 MemAssociatedMemObjectInfo MemObjectInfoName = C.CL_MEM_ASSOCIATED_MEMOBJECT // MemUsesSvmPointerInfo returns True if memory object is a buffer object that was created with // MemUseHostPtrFlag or is a sub-buffer object of a buffer object that was created with MemUseHostPtrFlag and // the host pointer specified when the buffer object was created is an SVM pointer; otherwise returns False. // // Returned type: Bool // Since: 2.0 MemUsesSvmPointerInfo MemObjectInfoName = C.CL_MEM_USES_SVM_POINTER )
type MemObjectType ¶
type MemObjectType C.cl_mem_object_type
MemObjectType identifies the specific type of MemObject.
const ( MemObjectBufferType MemObjectType = C.CL_MEM_OBJECT_BUFFER MemObjectImage2DType MemObjectType = C.CL_MEM_OBJECT_IMAGE2D MemObjectImage3DType MemObjectType = C.CL_MEM_OBJECT_IMAGE3D MemObjectImage2DArrayType MemObjectType = C.CL_MEM_OBJECT_IMAGE2D_ARRAY MemObjectImage1DType MemObjectType = C.CL_MEM_OBJECT_IMAGE1D MemObjectImage1DArrayType MemObjectType = C.CL_MEM_OBJECT_IMAGE1D_ARRAY MemObjectImage1DBufferType MemObjectType = C.CL_MEM_OBJECT_IMAGE1D_BUFFER MemObjectPipeType MemObjectType = C.CL_MEM_OBJECT_PIPE )
These constants represent specific type identifier.
type PipeInfoName ¶
type PipeInfoName C.cl_pipe_info
PipeInfoName identifies properties of a pipe, which can be queried with PipeInfo().
const ( // PipePacketSizeInfo returns pipe packet size specified when pipe is created with CreatePipe(). // // Returned type: uint32 // Since: 2.0 PipePacketSizeInfo PipeInfoName = C.CL_PIPE_PACKET_SIZE // PipeMaxPacketsInfo returns maximum number of packets specified when pipe is created with CreatePipe(). // // Returned type: uint32 // Since: 2.0 PipeMaxPacketsInfo PipeInfoName = C.CL_PIPE_MAX_PACKETS )
type PipeProperty ¶
type PipeProperty []uintptr
PipeProperty is one entry of properties which are taken into account when creating pipes.
type PlatformID ¶
type PlatformID uintptr
PlatformID references one of the available OpenCL platforms of the system. It allows applications to query OpenCL devices, device configuration information, and to create OpenCL contexts using one or more devices. Retrieve a list of available platforms with the function PlatformIDs().
func PlatformIDs ¶
func PlatformIDs() ([]PlatformID, error)
PlatformIDs returns the list of available platforms on the system.
See also: https://registry.khronos.org/OpenCL/sdk/2.2/docs/man/html/clGetPlatformIDs.html
func (PlatformID) String ¶
func (id PlatformID) String() string
String provides a readable presentation of the platform identifier. It is based on the numerical value of the underlying pointer.
type PlatformInfoName ¶
type PlatformInfoName C.cl_platform_info
PlatformInfoName identifies properties of a platform, which can be queried with PlatformInfo().
const ( // PlatformNameInfo refers to a human-readable string that identifies the platform. // // Returned type: string PlatformNameInfo PlatformInfoName = C.CL_PLATFORM_NAME // PlatformVendorInfo refers to a human-readable string that identifies the vendor of the platform. // // Returned type: string PlatformVendorInfo PlatformInfoName = C.CL_PLATFORM_VENDOR // PlatformProfileInfo refers to the profile name supported by the implementation. // The profile name returned can be one of the following strings: // // "FULL_PROFILE" - if the implementation supports the OpenCL specification (functionality defined as part of the // core specification and does not require any extensions to be supported). // // "EMBEDDED_PROFILE" - if the implementation supports the OpenCL embedded profile. The embedded profile is defined // to be a subset for each version of OpenCL. // // Returned type: string PlatformProfileInfo PlatformInfoName = C.CL_PLATFORM_PROFILE // PlatformVersionInfo refers to the OpenCL version supported by the implementation. // This version string has the following format: // // OpenCL<space><major_version.minor_version><space><platform-specific information> // // Returned type: string PlatformVersionInfo PlatformInfoName = C.CL_PLATFORM_VERSION // PlatformExtensionsInfo refers to a space separated list of extension names (the extension names themselves do not // contain any spaces) supported by the platform. Each extension that is supported by all devices associated with // this platform must be reported here. // // Returned type: string PlatformExtensionsInfo PlatformInfoName = C.CL_PLATFORM_EXTENSIONS // PlatformHostTimerResolutionInfo refers to the resolution of the host timer in nanoseconds as used by // DeviceAndHostTimer() and HostTimer(). // This value must be 0 for devices that do not support device and host timer synchronization. // // Returned type: uint64 // Since: 2.1 PlatformHostTimerResolutionInfo PlatformInfoName = C.CL_PLATFORM_HOST_TIMER_RESOLUTION )
type Program ¶
type Program uintptr
Program objects contain executable code for the OpenCL runtime.
func CreateProgramWithBinary ¶
func CreateProgramWithBinary(context Context, devices []DeviceID, binaries [][]byte) (Program, []error, error)
CreateProgramWithBinary creates a program object for a context, and loads binary bits into the program object.
The returned slice of errors represents the load-status per device.
See also: https://registry.khronos.org/OpenCL/sdk/2.2/docs/man/html/clCreateProgramWithBinary.html
func CreateProgramWithBuiltInKernels ¶
func CreateProgramWithBuiltInKernels(context Context, devices []DeviceID, kernelNames string) (Program, error)
CreateProgramWithBuiltInKernels creates a program object for a context, and loads the information related to the built-in kernels into a program object.
Since: 1.2 See also: https://registry.khronos.org/OpenCL/sdk/2.2/docs/man/html/clCreateProgramWithBuiltInKernels.html
func CreateProgramWithIl ¶
CreateProgramWithIl creates a program object for a context, and loads the intermediate language (IL) into the program object.
The intermediate language pointed to by il will be loaded into the program object. The devices associated with the program object are the devices associated with context.
Since: 2.1 See also: https://registry.khronos.org/OpenCL/sdk/2.2/docs/man/html/clCreateProgramWithIL.html
func CreateProgramWithSource ¶
CreateProgramWithSource creates a program object for a context, and loads source code specified by text strings into the program object.
See also: https://registry.khronos.org/OpenCL/sdk/2.2/docs/man/html/clCreateProgramWithSource.html
func LinkProgram ¶
func LinkProgram(context Context, devices []DeviceID, options string, programs []Program, callback func(Program)) (Program, error)
LinkProgram links a set of compiled program objects and libraries for all the devices or a specific device(s) in the OpenCL context and creates a library or executable.
The notification routine is a callback function that an application can register and which will be called when the program executable has been built (successfully or unsuccessfully). If callback is not nil, LinkProgram() does not have to wait until the linker to complete and can return if the linking operation can begin.
Since: 1.2 See also: https://registry.khronos.org/OpenCL/sdk/2.2/docs/man/html/clLinkProgram.html
type ProgramBinaryType ¶
type ProgramBinaryType C.cl_program_binary_type
ProgramBinaryType identifies the program binary type for devices.
const ( // ProgramBinaryTypeNone is set if there is no binary associated with the specified program object for device. ProgramBinaryTypeNone ProgramBinaryType = C.CL_PROGRAM_BINARY_TYPE_NONE // ProgramBinaryTypeCompiledObject is a compiled binary associated with device. // This is the case when the specified program object was created using CreateProgramWithSource() and compiled // using CompileProgram(), or when a compiled binary was loaded using CreateProgramWithBinary(). ProgramBinaryTypeCompiledObject ProgramBinaryType = C.CL_PROGRAM_BINARY_TYPE_COMPILED_OBJECT // ProgramBinaryTypeLibrary is a library binary associated with device. // This is the case when the specified program object was linked by LinkProgram() using the -create-library link // option, or when a compiled library binary was loaded using CreateProgramWithBinary(). ProgramBinaryTypeLibrary ProgramBinaryType = C.CL_PROGRAM_BINARY_TYPE_LIBRARY // ProgramBinaryTypeExecutable is an executable binary associated with device. // This is the case when the specified program object was linked by LinkProgram() without the -create-library link // option, or when an executable binary was built using BuildProgram(). ProgramBinaryTypeExecutable ProgramBinaryType = C.CL_PROGRAM_BINARY_TYPE_EXECUTABLE )
type ProgramBuildInfoName ¶
type ProgramBuildInfoName C.cl_program_build_info
ProgramBuildInfoName identifies properties of a program build, which can be queried with ProgramBuildInfo().
const ( // ProgramBuildStatusInfo returns the build, compile, or link status, whichever was performed last on the // specified program object for device. // // Returned type: BuildStatus ProgramBuildStatusInfo ProgramBuildInfoName = C.CL_PROGRAM_BUILD_STATUS // ProgramBuildOptionsInfo return the build, compile, or link options specified by the options argument in // BuildProgram(), CompileProgram(), or LinkProgram(), whichever was performed last on the specified program // object for device. // // If build status of the specified program for device is BuildNoneStatus, an empty string is returned. // // Returned type: string ProgramBuildOptionsInfo ProgramBuildInfoName = C.CL_PROGRAM_BUILD_OPTIONS // ProgramBuildLogInfo returns the build, compile, or link log for BuildProgram(), CompileProgram(), or // LinkProgram(), whichever was performed last on program for device. // // If build status of the specified program for device is BuildNoneStatus, an empty string is returned. // // Returned type: string ProgramBuildLogInfo ProgramBuildInfoName = C.CL_PROGRAM_BUILD_LOG // ProgramBinaryTypeInfo returns the program binary type for device. // // Returned type: ProgramBinaryType // Since: 1.2 ProgramBinaryTypeInfo ProgramBuildInfoName = C.CL_PROGRAM_BINARY_TYPE // ProgramBuildGlobalVariableTotalSizeInfo returns the total amount of storage, in bytes, used by program // variables in the global address space. // // Returned type: uintptr // Since: 2.0 ProgramBuildGlobalVariableTotalSizeInfo ProgramBuildInfoName = C.CL_PROGRAM_BUILD_GLOBAL_VARIABLE_TOTAL_SIZE )
type ProgramInfoName ¶
type ProgramInfoName C.cl_program_info
ProgramInfoName identifies properties of a program, which can be queried with ProgramInfo().
const ( // ProgramReferenceCountInfo returns the program reference count. // // Note: The reference count returned should be considered immediately stale. It is unsuitable for // general use in applications. This feature is provided for identifying memory leaks. // // Returned type: uint32 ProgramReferenceCountInfo ProgramInfoName = C.CL_PROGRAM_REFERENCE_COUNT // ProgramContextInfo returns the context specified when the program object is created. // // Returned type: Context ProgramContextInfo ProgramInfoName = C.CL_PROGRAM_CONTEXT // ProgramNumDevicesInfo returns the number of devices associated with program. // // Returned type: uint32 ProgramNumDevicesInfo ProgramInfoName = C.CL_PROGRAM_NUM_DEVICES // ProgramDevicesInfo returns the list of devices associated with the program object. This can be the // devices associated with context on which the program object has been created or can be a subset of devices // that are specified when a program object is created using CreateProgramWithBinary(). // // Returned type: []DeviceID ProgramDevicesInfo ProgramInfoName = C.CL_PROGRAM_DEVICES // ProgramSourceInfo returns the program source code specified by CreateProgramWithSource(). // The source string returned is a concatenation of all source strings specified to CreateProgramWithSource(). // // If program is created using CreateProgramWithBinary(), CreateProgramWithIl(), or // CreateProgramWithBuiltInKernels(), an empty string or the appropriate program source code is returned depending // on whether the program source code is stored in the binary. // // Returned type: string ProgramSourceInfo ProgramInfoName = C.CL_PROGRAM_SOURCE // ProgramBinarySizesInfo returns an array that contains the size in bytes of the program binary // (could be an executable binary, compiled binary, or library binary) for each device associated with program. // The size of the array is the number of devices associated with program. If a binary is not available for a // device(s), a size of zero is returned. // // If program is created using CreateProgramWithBuiltInKernels(), the implementation may return zero in any // entries of the returned array. // // Returned type: []uintptr ProgramBinarySizesInfo ProgramInfoName = C.CL_PROGRAM_BINARY_SIZES // ProgramBinariesInfo returns the program binaries (could be an executable binary, compiled binary, or // library binary) for all devices associated with program. For each device in program, the binary returned can // be the binary specified for the device when program is created with CreateProgramWithBinary() or it can be the // executable binary generated by BuildProgram() or LinkProgram(). // If program is created with CreateProgramWithSource() or CreateProgramWithIl(), the binary returned is the // binary generated by BuildProgram(), CompileProgram(), or LinkProgram(). The bits returned can be an // implementation-specific intermediate representation (a.k.a. IR) or device specific executable bits or both. // The decision on which information is returned in the binary is up to the OpenCL implementation. // // The paramValue points to an array of N pointers allocated by the caller, where N is the number of devices // associated with program. The buffer sizes needed to allocate the memory that these N pointers refer to can // be queried using the ProgramBinarySizesInfo query. // // Each entry in this array is used by the implementation as the location in memory where to copy the program // binary for a specific device, if there is a binary available. To find out which device the program binary // in the array refers to, use the ProgramDevicesInfo query to get the list of devices. There is a one-to-one // correspondence between the array of N pointers returned by ProgramBinariesInfo and array of devices returned // by ProgramDevicesInfo. // // Returned type: []unsafe.Pointer (pointing to byte arrays) ProgramBinariesInfo ProgramInfoName = C.CL_PROGRAM_BINARIES // ProgramNumKernelsInfo returns the number of kernels declared in program that can be created with CreateKernel(). // This information is only available after a successful program executable has been built for at least one device // in the list of devices associated with program. // // Returned type: uintptr // Since: 1.2 ProgramNumKernelsInfo ProgramInfoName = C.CL_PROGRAM_NUM_KERNELS // ProgramKernelNamesInfo returns a semi-colon separated list of kernel names in program that can be created // with CreateKernel(). This information is only available after a successful program executable has been built // for at least one device in the list of devices associated with program. // // Returned type: string // Since: 1.2 ProgramKernelNamesInfo ProgramInfoName = C.CL_PROGRAM_KERNEL_NAMES // ProgramIlInfo returns the program intermediate language (IL) for programs created with CreateProgramWithIl(). // // If program is created with CreateProgramWithSource(), CreateProgramWithBinary(), or // CreateProgramWithBuiltInKernels() the memory pointed to by paramValue will be unchanged and // the returned size be 0. // // Returned type: []byte // Since: 2.1 ProgramIlInfo ProgramInfoName = C.CL_PROGRAM_IL // ProgramScopeGlobalCtorsPresentInfo indicates that the program object contains non-trivial constructor(s) // that will be executed by runtime before any kernel from the program is executed. // This information is only available after a successful program executable has been built for at least one // device in the list of devices associated with program. // // Querying ProgramScopeGlobalCtorsPresentInfo may unconditionally return False if no devices associated // with program support constructors for program scope global variables. Support for constructors and destructors // for program scope global variables is required only for OpenCL 2.2 devices. // // Returned type: Bool // Since: 2.2 ProgramScopeGlobalCtorsPresentInfo ProgramInfoName = C.CL_PROGRAM_SCOPE_GLOBAL_CTORS_PRESENT // ProgramScopeGlobalDtorsPresentInfo indicates that the program object contains non-trivial destructor(s) // that will be executed by runtime when program is destroyed. // This information is only available after a successful program executable has been built for at least one // device in the list of devices associated with program. // // Querying ProgramScopeGlobalDtorsPresentInfo may unconditionally return False if no devices associated // with program support destructors for program scope global variables. Support for constructors and destructors // for program scope global variables is required only for OpenCL 2.2 devices. // // Returned type: Bool // Since: 2.2 ProgramScopeGlobalDtorsPresentInfo ProgramInfoName = C.CL_PROGRAM_SCOPE_GLOBAL_DTORS_PRESENT )
type Sampler ¶
type Sampler uintptr
Sampler objects describe how color information from an image is being sampled.
func CreateSampler
deprecated
func CreateSampler(context Context, normalizedCoords bool, addressingMode SamplerAddressingMode, filterMode SamplerFilterMode) (Sampler, error)
CreateSampler creates a sampler object.
Deprecated: 1.2; Use CreateSamplerWithProperties() instead. See also: https://registry.khronos.org/OpenCL/sdk/2.2/docs/man/html/clCreateSampler.html
func CreateSamplerWithProperties ¶
func CreateSamplerWithProperties(context Context, properties ...SamplerProperty) (Sampler, error)
CreateSamplerWithProperties creates a sampler object.
See also: https://registry.khronos.org/OpenCL/sdk/2.2/docs/man/html/clCreateSamplerWithProperties.html
type SamplerAddressingMode ¶
type SamplerAddressingMode C.cl_addressing_mode
SamplerAddressingMode specifies how out-of-range image coordinates are handled when reading from an image.
const ( // AddressNoneMode specifies that behavior is undefined for out-of-range image coordinates. AddressNoneMode SamplerAddressingMode = C.CL_ADDRESS_NONE // AddressClampToEdgeMode specifies that out-of-range image coordinates are clamped to the edge of the image. AddressClampToEdgeMode SamplerAddressingMode = C.CL_ADDRESS_CLAMP_TO_EDGE // AddressClampMode specifies that out-of-range image coordinates are assigned a border color value. AddressClampMode SamplerAddressingMode = C.CL_ADDRESS_CLAMP // AddressRepeatMode specifies that out-of-range image coordinates read from the image as-if the image data were // replicated in all dimensions. AddressRepeatMode SamplerAddressingMode = C.CL_ADDRESS_REPEAT // AddressMirroredRepeatMode specifies that out-of-range image coordinates read from the image as-if the image data // were replicated in all dimensions, mirroring the image contents at the edge of each replication. // // Since: 1.1 AddressMirroredRepeatMode SamplerAddressingMode = C.CL_ADDRESS_MIRRORED_REPEAT )
type SamplerFilterMode ¶
type SamplerFilterMode C.cl_filter_mode
SamplerFilterMode specifies the type of filter that is applied when reading an image.
const ( // FilterNearestMode returns the image element nearest to the image coordinate. FilterNearestMode SamplerFilterMode = C.CL_FILTER_NEAREST // FilterLinearMode returns a weighted average of the four image elements nearest to the image coordinate. FilterLinearMode SamplerFilterMode = C.CL_FILTER_LINEAR )
type SamplerInfoName ¶
type SamplerInfoName C.cl_sampler_info
SamplerInfoName identifies properties of a sampler, which can be queried with SamplerInfo().
const ( // SamplerReferenceCountInfo returns the sampler reference count. // // Note: The reference count returned should be considered immediately stale. It is unsuitable for general use // in applications. This feature is provided for identifying memory leaks. // // Returned type: uint32 SamplerReferenceCountInfo SamplerInfoName = C.CL_SAMPLER_REFERENCE_COUNT // SamplerContextInfo returns the context specified when the sampler is created. // // Returned type: Context SamplerContextInfo SamplerInfoName = C.CL_SAMPLER_CONTEXT // SamplerNormalizedCoordsInfo return the normalized coords value associated with sampler. // // Returned type: Bool SamplerNormalizedCoordsInfo SamplerInfoName = C.CL_SAMPLER_NORMALIZED_COORDS // SamplerAddressingModeInfo returns the addressing mode value associated with sampler. // // Returned type: SamplerAddressingMode SamplerAddressingModeInfo SamplerInfoName = C.CL_SAMPLER_ADDRESSING_MODE // SamplerFilterModeInfo returns the filter mode value associated with sampler. // // Returned type: SamplerFilterMode SamplerFilterModeInfo SamplerInfoName = C.CL_SAMPLER_FILTER_MODE )
type SamplerProperty ¶
type SamplerProperty []uint64
SamplerProperty is one entry of properties which are taken into account when creating sampler objects.
func WithAddressingMode ¶
func WithAddressingMode(mode SamplerAddressingMode) SamplerProperty
WithAddressingMode is a convenience function to create a valid SamplerAddressingModeProperty. Use it in combination with CreateSamplerWithProperties().
func WithFilterMode ¶
func WithFilterMode(mode SamplerFilterMode) SamplerProperty
WithFilterMode is a convenience function to create a valid SamplerFilterModeProperty. Use it in combination with CreateSamplerWithProperties().
func WithNormalizedCoords ¶
func WithNormalizedCoords(enabled bool) SamplerProperty
WithNormalizedCoords is a convenience function to create a valid SamplerNormalizedCoordsProperty. Use it in combination with CreateSamplerWithProperties().
type StatusError ¶
StatusError represents an error based on a status value from an OpenCL call.
const ( ErrDeviceNotFound StatusError = C.CL_DEVICE_NOT_FOUND ErrDeviceNotAvailable StatusError = C.CL_DEVICE_NOT_AVAILABLE ErrCompilerNotAvailable StatusError = C.CL_COMPILER_NOT_AVAILABLE ErrMemObjectAllocationFailure StatusError = C.CL_MEM_OBJECT_ALLOCATION_FAILURE ErrOutOfResources StatusError = C.CL_OUT_OF_RESOURCES ErrOutOfHostMemory StatusError = C.CL_OUT_OF_HOST_MEMORY ErrProfilingInfoNotAvailable StatusError = C.CL_PROFILING_INFO_NOT_AVAILABLE ErrMemCopyOverlap StatusError = C.CL_MEM_COPY_OVERLAP ErrImageFormatMismatch StatusError = C.CL_IMAGE_FORMAT_MISMATCH ErrImageFormatNotSupported StatusError = C.CL_IMAGE_FORMAT_NOT_SUPPORTED ErrBuildProgramFailure StatusError = C.CL_BUILD_PROGRAM_FAILURE ErrMapFailure StatusError = C.CL_MAP_FAILURE ErrMisalignedSubBufferOffset StatusError = C.CL_MISALIGNED_SUB_BUFFER_OFFSET ErrExecStatusErrorForEventsInWaitList StatusError = C.CL_EXEC_STATUS_ERROR_FOR_EVENTS_IN_WAIT_LIST ErrCompileProgramFailure StatusError = C.CL_COMPILE_PROGRAM_FAILURE ErrLinkerNotAvailable StatusError = C.CL_LINKER_NOT_AVAILABLE ErrLinkProgramFailure StatusError = C.CL_LINK_PROGRAM_FAILURE ErrDevicePartitionFailed StatusError = C.CL_DEVICE_PARTITION_FAILED ErrKernelArgInfoNotAvailable StatusError = C.CL_KERNEL_ARG_INFO_NOT_AVAILABLE ErrInvalidValue StatusError = C.CL_INVALID_VALUE ErrInvalidDeviceType StatusError = C.CL_INVALID_DEVICE_TYPE ErrInvalidPlatform StatusError = C.CL_INVALID_PLATFORM ErrInvalidDevice StatusError = C.CL_INVALID_DEVICE ErrInvalidContext StatusError = C.CL_INVALID_CONTEXT ErrInvalidQueueProperties StatusError = C.CL_INVALID_QUEUE_PROPERTIES ErrInvalidCommandQueue StatusError = C.CL_INVALID_COMMAND_QUEUE ErrInvalidHostPtr StatusError = C.CL_INVALID_HOST_PTR ErrInvalidMemObject StatusError = C.CL_INVALID_MEM_OBJECT ErrINvalidImageFormatDescriptor StatusError = C.CL_INVALID_IMAGE_FORMAT_DESCRIPTOR ErrInvalidImageSize StatusError = C.CL_INVALID_IMAGE_SIZE ErrInvalidSampler StatusError = C.CL_INVALID_SAMPLER ErrInvalidBinary StatusError = C.CL_INVALID_BINARY ErrInvalidBuildOptions StatusError = C.CL_INVALID_BUILD_OPTIONS ErrInvalidProgram StatusError = C.CL_INVALID_PROGRAM ErrInvalidProgramExecutable StatusError = C.CL_INVALID_PROGRAM_EXECUTABLE ErrInvalidKernelName StatusError = C.CL_INVALID_KERNEL_NAME ErrInvalidKernelDefinition StatusError = C.CL_INVALID_KERNEL_DEFINITION ErrInvalidKernel StatusError = C.CL_INVALID_KERNEL ErrInvalidArgIndex StatusError = C.CL_INVALID_ARG_INDEX ErrInvalidArgValue StatusError = C.CL_INVALID_ARG_VALUE ErrInvalidArgSize StatusError = C.CL_INVALID_ARG_SIZE ErrInvalidKernelArgs StatusError = C.CL_INVALID_KERNEL_ARGS ErrInvalidWorkDimension StatusError = C.CL_INVALID_WORK_DIMENSION ErrInvalidWorkGroupSize StatusError = C.CL_INVALID_WORK_GROUP_SIZE ErrInvalidWorkItemSize StatusError = C.CL_INVALID_WORK_ITEM_SIZE ErrInvalidGlobalOffset StatusError = C.CL_INVALID_GLOBAL_OFFSET ErrInvalidEventWaitList StatusError = C.CL_INVALID_EVENT_WAIT_LIST ErrInvalidEvent StatusError = C.CL_INVALID_EVENT ErrInvalidOperation StatusError = C.CL_INVALID_OPERATION ErrInvalidGlObject StatusError = C.CL_INVALID_GL_OBJECT ErrInvalidBufferSize StatusError = C.CL_INVALID_BUFFER_SIZE ErrInvalidMipLevel StatusError = C.CL_INVALID_MIP_LEVEL ErrInvalidGlobalWorkSize StatusError = C.CL_INVALID_GLOBAL_WORK_SIZE ErrInvalidProperty StatusError = C.CL_INVALID_PROPERTY ErrInvalidImageDescriptor StatusError = C.CL_INVALID_IMAGE_DESCRIPTOR ErrInvalidCompilerOptions StatusError = C.CL_INVALID_COMPILER_OPTIONS ErrInvalidLinkerOptions StatusError = C.CL_INVALID_LINKER_OPTIONS ErrInvalidDevicePartitionCount StatusError = C.CL_INVALID_DEVICE_PARTITION_COUNT ErrInvalidPipeSize StatusError = C.CL_INVALID_PIPE_SIZE ErrInvalidDeviceQueue StatusError = C.CL_INVALID_DEVICE_QUEUE ErrInvalidSpecID StatusError = C.CL_INVALID_SPEC_ID ErrMaxSizeRestrictionExceeded StatusError = C.CL_MAX_SIZE_RESTRICTION_EXCEEDED )
This block contains common error constants.
func (StatusError) Error ¶
func (err StatusError) Error() string
Error returns the string presentation of the numeric value. A name lookup is not performed as errors can be extended through extensions, making a consistent presentation difficult.
type SvmMemFlags ¶
type SvmMemFlags C.cl_mem_flags
SvmMemFlags describe properties of a shared virtual memory (SVM) buffer.
type WorkDimension ¶
WorkDimension describes the parameters within one dimension of a work group.
type WrapperError ¶
type WrapperError string
WrapperError represents a basic error that occurs within the wrapper.
const ( // ErrExtensionNotAvailable is returned in case an extension loader function could not complete its setup. ErrExtensionNotAvailable WrapperError = "extension not available" // ErrExtensionNotLoaded is returned in case an extension was used without being loaded. ErrExtensionNotLoaded WrapperError = "extension not loaded" // ErrDataSizeLimitExceeded is returned by convenience functions that query information, typically string-loading // functions. The error occurs if the required size would be beyond a (feasible) limit. ErrDataSizeLimitExceeded WrapperError = "data size limit exceeded" // ErrOutOfMemory is returned by wrapper functions that need to allocate memory. ErrOutOfMemory WrapperError = "out of memory" )