-- Hoogle documentation, generated by Haddock -- See Hoogle, http://www.haskell.org/hoogle/ -- | Haskell high-level wrapper for OpenCL -- -- Haskell FFI binding to OpenCL library. It includes high-level wrappers -- to help development. Based on the OpenCLRaw package. -- -- Most of the functions can throw a CLError exception. Using the -- module Control.Exception helps to work with this package's -- exceptions. @package OpenCL @version 1.0.2.6 module System.GPU.OpenCL.Program type CLProgram = Ptr () -- | data CLBuildStatus CL_BUILD_NONE :: CLBuildStatus CL_BUILD_ERROR :: CLBuildStatus CL_BUILD_SUCCESS :: CLBuildStatus CL_BUILD_IN_PROGRESS :: CLBuildStatus type CLKernel = Ptr () -- | Creates a program object for a context, and loads the source code -- specified by the text strings in the strings array into the program -- object. The devices associated with the program object are the devices -- associated with context. -- -- OpenCL allows applications to create a program object using the -- program source or binary and build appropriate program executables. -- This allows applications to determine whether they want to use the -- pre-built offline binary or load and compile the program source and -- use the executable compiled/linked online as the program executable. -- This can be very useful as it allows applications to load and build -- program executables online on its first instance for appropriate -- OpenCL devices in the system. These executables can now be queried and -- cached by the application. Future instances of the application -- launching will no longer need to compile and build the program -- executables. The cached executables can be read and loaded by the -- application, which can help significantly reduce the application -- initialization time. -- -- An OpenCL program consists of a set of kernels that are identified as -- functions declared with the __kernel qualifier in the program source. -- OpenCL programs may also contain auxiliary functions and constant data -- that can be used by __kernel functions. The program executable can be -- generated online or offline by the OpenCL compiler for the appropriate -- target device(s). -- -- clCreateProgramWithSource returns a valid non-zero program -- object if the program object is created successfully. Otherwise, it -- throws one of the following CLError exceptions: -- -- clCreateProgramWithSource :: CLContext -> String -> IO CLProgram -- | Creates a program object for a context, and loads specified binary -- data into the program object. -- -- The program binaries specified by binaries contain the bits that -- describe the program executable that will be run on the device(s) -- associated with context. The program binary can consist of either or -- both of device-specific executable(s), and/or implementation-specific -- intermediate representation (IR) which will be converted to the -- device-specific executable. -- -- OpenCL allows applications to create a program object using the -- program source or binary and build appropriate program executables. -- This allows applications to determine whether they want to use the -- pre-built offline binary or load and compile the program source and -- use the executable compiled/linked online as the program executable. -- This can be very useful as it allows applications to load and build -- program executables online on its first instance for appropriate -- OpenCL devices in the system. These executables can now be queried and -- cached by the application. Future instances of the application -- launching will no longer need to compile and build the program -- executables. The cached executables can be read and loaded by the -- application, which can help significantly reduce the application -- initialization time. -- -- Returns a valid non-zero program object and a list of CLError -- values whether the program binary for each device specified in -- device_list was loaded successfully or not. It is list of the same -- length the list of devices with CL_SUCCESS if binary was -- successfully loaded for device specified by same position; otherwise -- returns CL_INVALID_VALUE if length of binary is zero or -- CL_INVALID_BINARY if program binary is not a valid binary for -- the specified device. -- -- The function can throw on of the following CLError exceptions: -- -- clCreateProgramWithBinary :: CLContext -> [CLDeviceID] -> [[Word8]] -> IO (CLProgram, [CLError]) -- | Increments the program reference count. clRetainProgram returns -- True if the function is executed successfully. It returns -- False if program is not a valid program object. clRetainProgram :: CLProgram -> IO Bool -- | 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. clReleseProgram -- returns True if the function is executed successfully. It -- returns False if program is not a valid program object. clReleaseProgram :: CLProgram -> IO Bool -- | Allows the implementation to release the resources allocated by the -- OpenCL compiler. 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 -- clBuildProgram after clUnloadCompiler will reload the -- compiler, if necessary, to build the appropriate program executable. clUnloadCompiler :: IO () -- | Builds (compiles and links) a program executable from the program -- source or binary. OpenCL allows program executables to be built using -- the source or the binary. The build options are categorized as -- pre-processor options, options for math intrinsics, options that -- control optimization and miscellaneous options. This specification -- defines a standard set of options that must be supported by an OpenCL -- compiler when building program executables online or offline. These -- may be extended by a set of vendor- or platform-specific options. -- -- -- -- These options control the OpenCL preprocessor which is run on each -- program source before actual compilation. -D options are processed in -- the order they are given in the options argument to clBuildProgram. -- -- -- -- -- -- These options control compiler behavior regarding floating-point -- arithmetic. These options trade off between speed and correctness. -- -- -- -- This option is ignored for single precision numbers if the device does -- not support single precision denormalized numbers i.e. -- CL_FP_DENORM bit is not set in -- clGetDeviceSingleFPConfig. -- -- This option is ignored for double precision numbers if the device does -- not support double precision or if it does support double precison but -- CL_FP_DENORM bit is not set in -- clGetDeviceDoubleFPConfig. -- -- This flag only applies for scalar and vector single precision -- floating-point variables and computations on these floating-point -- variables inside a program. It does not apply to reading from or -- writing to image objects. -- -- -- -- These options control various sorts of optimizations. Turning on -- optimization flags makes the compiler attempt to improve the -- performance and/or code size at the expense of compilation time and -- possibly the ability to debug the program. -- -- -- -- The following options control compiler behavior regarding -- floating-point arithmetic. These options trade off between performance -- and correctness and must be specifically enabled. These options are -- not turned on by default since it can result in incorrect output for -- programs which depend on an exact implementation of IEEE 754 -- rules/specifications for math functions. -- -- -- -- -- -- Warnings are diagnostic messages that report constructions which are -- not inherently erroneous but which are risky or suggest there may have -- been an error. The following languageindependent options do not enable -- specific warnings but control the kinds of diagnostics produced by the -- OpenCL compiler. -- -- -- -- clBuildProgram can throw the following CLError exceptions when -- fails: -- -- clBuildProgram :: CLProgram -> [CLDeviceID] -> String -> IO () -- | Return the program reference count. 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. -- -- This function execute OpenCL clGetProgramInfo with -- CL_PROGRAM_REFERENCE_COUNT. clGetProgramReferenceCount :: CLProgram -> IO CLuint -- | Return the context specified when the program object is created. -- -- This function execute OpenCL clGetProgramInfo with -- CL_PROGRAM_CONTEXT. clGetProgramContext :: CLProgram -> IO CLContext -- | Return the number of devices associated with program. -- -- This function execute OpenCL clGetProgramInfo with -- CL_PROGRAM_NUM_DEVICES. clGetProgramNumDevices :: CLProgram -> IO CLuint -- | Return 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 progam object is created using clCreateProgramWithBinary. -- -- This function execute OpenCL clGetProgramInfo with -- CL_PROGRAM_DEVICES. clGetProgramDevices :: CLProgram -> IO [CLDeviceID] -- | Return the program source code specified by -- clCreateProgramWithSource. The source string returned is a -- concatenation of all source strings specified to -- clCreateProgramWithSource with a null terminator. The -- concatenation strips any nulls in the original source strings. The -- actual number of characters that represents the program source code -- including the null terminator is returned in param_value_size_ret. -- -- This function execute OpenCL clGetProgramInfo with -- CL_PROGRAM_SOURCE. clGetProgramSource :: CLProgram -> IO String -- | Returns an array that contains the size in bytes of the program 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. -- -- This function execute OpenCL clGetProgramInfo with -- CL_PROGRAM_BINARY_SIZES. clGetProgramBinarySizes :: CLProgram -> IO [CSize] -- | Return the program binaries 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 -- clCreateProgramWithBinary or it can be the executable binary -- generated by clBuildProgram. If program is created with -- clCreateProgramWithSource, the binary returned is the binary -- generated by clBuildProgram. 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. -- -- To find out which device the program binary in the array refers to, -- use the clGetProgramDevices query to get the list of devices. -- There is a one-to-one correspondence between the array of data -- returned by clGetProgramBinaries and array of devices returned -- by clGetProgramDevices. -- -- This function execute OpenCL clGetProgramInfo with -- CL_PROGRAM_BINARIES. clGetProgramBinaries :: CLProgram -> IO [[Word8]] -- | Returns the build status of program for a specific device as given by -- device. -- -- This function execute OpenCL clGetProgramBuildInfo with -- CL_PROGRAM_BUILD_STATUS. clGetProgramBuildStatus :: CLProgram -> CLDeviceID -> IO CLBuildStatus -- | Return the build options specified by the options argument in -- clBuildProgram for device. If build status of program for device is -- CL_BUILD_NONE, an empty string is returned. -- -- This function execute OpenCL clGetProgramBuildInfo with -- CL_PROGRAM_BUILD_OPTIONS. clGetProgramBuildOptions :: CLProgram -> CLDeviceID -> IO String -- | Return the build log when clBuildProgram was called for device. -- If build status of program for device is CL_BUILD_NONE, an -- empty string is returned. -- -- This function execute OpenCL clGetProgramBuildInfo with -- CL_PROGRAM_BUILD_LOG. clGetProgramBuildLog :: CLProgram -> CLDeviceID -> IO String -- | Creates a kernal object. A kernel is a function declared in a program. -- A kernel is identified by the __kernel qualifier applied to any -- function in a program. A kernel object encapsulates the specific -- __kernel function declared in a program and the argument values to be -- used when executing this __kernel function. -- -- clCreateKernel returns a valid non-zero kernel object if the -- kernel object is created successfully. Otherwise, it throws one of the -- following CLError exceptions: -- -- clCreateKernel :: CLProgram -> String -> IO CLKernel -- | 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 clBuildProgram return -- CL_INVALID_OPERATION 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. -- -- clCreateKernelsInProgram will return the kernel objects if the -- kernel objects were successfully allocated, throws -- CL_INVALID_PROGRAM if program is not a valid program object, -- throws CL_INVALID_PROGRAM_EXECUTABLE if there is no -- successfully built executable for any device in program and throws -- CL_OUT_OF_HOST_MEMORY if there is a failure to allocate -- resources required by the OpenCL implementation on the host. clCreateKernelsInProgram :: CLProgram -> IO [CLKernel] -- | Increments the program program reference count. clRetainKernel -- returns True if the function is executed successfully. -- clCreateKernel or clCreateKernelsInProgram do an -- implicit retain. clRetainKernel :: CLKernel -> IO Bool -- | 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. clReleaseKernel returns True if the -- function is executed successfully. clReleaseKernel :: CLKernel -> IO Bool -- | Used to set the argument value for a specific argument of a kernel. -- -- A kernel object does not update the reference count for objects such -- as memory, sampler objects specified as argument values by -- clSetKernelArg, Users may not rely on a kernel object to retain -- objects specified as argument values to the kernel. -- -- Implementations shall not allow CLKernel objects to hold -- reference counts to CLKernel arguments, because no mechanism is -- provided for the user to tell the kernel to release that ownership -- right. If the kernel holds ownership rights on kernel args, that would -- make it impossible for the user to tell with certainty when he may -- safely release user allocated resources associated with OpenCL objects -- such as the CLMem backing store used with -- CL_MEM_USE_HOST_PTR. -- -- clSetKernelArg throws one of the following CLError -- exceptions when fails: -- -- clSetKernelArg :: Storable a => CLKernel -> CLuint -> a -> IO () -- | Return the kernel function name. -- -- This function execute OpenCL clGetKernelInfo with -- CL_KERNEL_FUNCTION_NAME. clGetKernelFunctionName :: CLKernel -> IO String -- | Return the number of arguments to kernel. -- -- This function execute OpenCL clGetKernelInfo with -- CL_KERNEL_NUM_ARGS. clGetKernelNumArgs :: CLKernel -> IO CLuint -- | Return the kernel reference count. 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. -- -- This function execute OpenCL clGetKernelInfo with -- CL_KERNEL_REFERENCE_COUNT. clGetKernelReferenceCount :: CLKernel -> IO CLuint -- | Return the context associated with kernel. -- -- This function execute OpenCL clGetKernelInfo with -- CL_KERNEL_CONTEXT. clGetKernelContext :: CLKernel -> IO CLContext -- | Return the program object associated with kernel. -- -- This function execute OpenCL clGetKernelInfo with -- CL_KERNEL_PROGRAM. clGetKernelProgram :: CLKernel -> IO CLProgram -- | This provides a mechanism for the application to query the work-group -- size that can be used 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. -- -- This function execute OpenCL clGetKernelWorkGroupInfo with -- CL_KERNEL_WORK_GROUP_SIZE. clGetKernelWorkGroupSize :: CLKernel -> CLDeviceID -> IO CSize -- | Returns the work-group size specified by the -- __attribute__((reqd_work_gr oup_size(X, Y, Z))) qualifier. See -- Function Qualifiers. If the work-group size is not specified using the -- above attribute qualifier (0, 0, 0) is returned. -- -- This function execute OpenCL clGetKernelWorkGroupInfo with -- CL_KERNEL_COMPILE_WORK_GROUP_SIZE. clGetKernelCompileWorkGroupSize :: CLKernel -> CLDeviceID -> IO [CSize] -- | 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 clSetKernelArg. -- -- 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. -- -- This function execute OpenCL clGetKernelWorkGroupInfo with -- CL_KERNEL_LOCAL_MEM_SIZE. clGetKernelLocalMemSize :: CLKernel -> CLDeviceID -> IO CLulong instance Enum CLKernelGroupInfo instance Enum CLKernelInfo instance Enum CLProgramBuildInfo instance Enum CLProgramInfo module System.GPU.OpenCL.Event type CLEvent = Ptr () -- | Command associated with an event. data CLCommandType CL_COMMAND_NDRANGE_KERNEL :: CLCommandType CL_COMMAND_TASK :: CLCommandType CL_COMMAND_NATIVE_KERNEL :: CLCommandType CL_COMMAND_READ_BUFFER :: CLCommandType CL_COMMAND_WRITE_BUFFER :: CLCommandType CL_COMMAND_COPY_BUFFER :: CLCommandType CL_COMMAND_READ_IMAGE :: CLCommandType CL_COMMAND_WRITE_IMAGE :: CLCommandType CL_COMMAND_COPY_IMAGE :: CLCommandType CL_COMMAND_COPY_BUFFER_TO_IMAGE :: CLCommandType CL_COMMAND_COPY_IMAGE_TO_BUFFER :: CLCommandType CL_COMMAND_MAP_BUFFER :: CLCommandType CL_COMMAND_MAP_IMAGE :: CLCommandType CL_COMMAND_UNMAP_MEM_OBJECT :: CLCommandType CL_COMMAND_MARKER :: CLCommandType CL_COMMAND_ACQUIRE_GL_OBJECTS :: CLCommandType CL_COMMAND_RELEASE_GL_OBJECTS :: CLCommandType -- | Specifies the profiling data. -- -- data CLProfilingInfo CL_PROFILING_COMMAND_QUEUED :: CLProfilingInfo CL_PROFILING_COMMAND_SUBMIT :: CLProfilingInfo CL_PROFILING_COMMAND_START :: CLProfilingInfo CL_PROFILING_COMMAND_END :: CLProfilingInfo -- | data CLCommandExecutionStatus CL_QUEUED :: CLCommandExecutionStatus CL_SUBMITTED :: CLCommandExecutionStatus CL_RUNNING :: CLCommandExecutionStatus CL_COMPLETE :: CLCommandExecutionStatus CL_EXEC_ERROR :: CLCommandExecutionStatus -- | Waits on the host thread for commands identified by event objects in -- event_list to complete. A command is considered complete if its -- execution status is CL_COMPLETE or a negative value. Returns -- True if the function was executed successfully. It returns -- False if the list of events is empty, or if events specified in -- event_list do not belong to the same context, or if event objects -- specified in event_list are not valid event objects. clWaitForEvents :: [CLEvent] -> IO Bool -- | Increments the event reference count. The OpenCL commands that return -- an event perform an implicit retain. Returns True if the -- function is executed successfully. It returns False if event is -- not a valid event object. clRetainEvent :: CLEvent -> IO Bool -- | Decrements the event reference count. Decrements the event reference -- count. The event object is deleted once the reference count becomes -- zero, the specific command identified by this event has completed (or -- terminated) and there are no commands in the command-queues of a -- context that require a wait for this event to complete. Returns -- True if the function is executed successfully. It returns -- False if event is not a valid event object. clReleaseEvent :: CLEvent -> IO Bool -- | Return the command-queue associated with event. -- -- This function execute OpenCL clGetEventInfo with -- CL_EVENT_COMMAND_QUEUE. clGetEventCommandQueue :: CLEvent -> IO CLCommandQueue -- | Return the command associated with event. -- -- This function execute OpenCL clGetEventInfo with -- CL_EVENT_COMMAND_TYPE. clGetEventCommandType :: CLEvent -> IO CLCommandType -- | Return the event reference count. 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. -- -- This function execute OpenCL clGetEventInfo with -- CL_EVENT_REFERENCE_COUNT. clGetEventReferenceCount :: CLEvent -> IO CLint -- | Return the execution status of the command identified by event. -- -- This function execute OpenCL clGetEventInfo with -- CL_EVENT_COMMAND_EXECUTION_STATUS. clGetEventCommandExecutionStatus :: CLEvent -> IO CLCommandExecutionStatus -- | Returns profiling information for the command associated with event if -- profiling is enabled. The unsigned 64-bit values returned can be used -- to measure the time in nano-seconds consumed by OpenCL commands. -- -- OpenCL devices are required to correctly track time across changes in -- device frequency and power states. The -- CL_DEVICE_PROFILING_TIMER_RESOLUTION specifies the resolution -- of the timer i.e. the number of nanoseconds elapsed before the timer -- is incremented. -- -- Event objects can be used to capture profiling information that -- measure execution time of a command. Profiling of OpenCL commands can -- be enabled either by using a command-queue created with -- CL_QUEUE_PROFILING_ENABLE flag set in properties argument to -- clCreateCommandQueue or by setting the -- CL_QUEUE_PROFILING_ENABLE flag in properties argument to -- clSetCommandQueueProperty. -- -- clGetEventProfilingInfo returns the valueif the function is -- executed successfully and the profiling information has been recorded, -- and returns Nothing if the CL_QUEUE_PROFILING_ENABLE -- flag is not set for the command-queue and if the profiling information -- is currently not available (because the command identified by event -- has not completed), or if event is a not a valid event object. clGetEventProfilingInfo :: CLEvent -> CLProfilingInfo -> IO CLulong instance Enum CLEventInfo module System.GPU.OpenCL.Memory type CLMem = Ptr () type CLSampler = Ptr () -- | data CLMemFlag CL_MEM_READ_WRITE :: CLMemFlag CL_MEM_WRITE_ONLY :: CLMemFlag CL_MEM_READ_ONLY :: CLMemFlag CL_MEM_USE_HOST_PTR :: CLMemFlag CL_MEM_ALLOC_HOST_PTR :: CLMemFlag CL_MEM_COPY_HOST_PTR :: CLMemFlag -- | data CLMemObjectType CL_MEM_OBJECT_BUFFER :: CLMemObjectType CL_MEM_OBJECT_IMAGE2D :: CLMemObjectType CL_MEM_OBJECT_IMAGE3D :: CLMemObjectType data CLAddressingMode CL_ADDRESS_REPEAT :: CLAddressingMode CL_ADDRESS_CLAMP_TO_EDGE :: CLAddressingMode CL_ADDRESS_CLAMP :: CLAddressingMode CL_ADDRESS_NONE :: CLAddressingMode data CLFilterMode CL_FILTER_NEAREST :: CLFilterMode CL_FILTER_LINEAR :: CLFilterMode -- | Creates a buffer object. Returns a valid non-zero buffer object if the -- buffer object is created successfully. Otherwise, it throws the -- CLError: -- -- clCreateBuffer :: Integral a => CLContext -> [CLMemFlag] -> (a, Ptr ()) -> IO CLMem -- | Increments the memory object reference count. returns True if -- the function is executed successfully. After the memobj reference -- count becomes zero and commands queued for execution on a -- command-queue(s) that use memobj have finished, the memory object is -- deleted. It returns False if memobj is not a valid memory -- object. clRetainMemObject :: CLMem -> IO Bool -- | Decrements the memory object reference count. After the memobj -- reference count becomes zero and commands queued for execution on a -- command-queue(s) that use memobj have finished, the memory object is -- deleted. Returns True if the function is executed successfully. -- It returns False if memobj is not a valid memory object. clReleaseMemObject :: CLMem -> IO Bool -- | Returns the mem object type. -- -- This function execute OpenCL clGetMemObjectInfo with -- CL_MEM_TYPE. clGetMemType :: CLMem -> IO CLMemObjectType -- | Return the flags argument value specified when memobj was created. -- -- This function execute OpenCL clGetMemObjectInfo with -- CL_MEM_FLAGS. clGetMemFlags :: CLMem -> IO [CLMemFlag] -- | Return actual size of memobj in bytes. -- -- This function execute OpenCL clGetMemObjectInfo with -- CL_MEM_SIZE. clGetMemSize :: CLMem -> IO CSize -- | Return the host_ptr argument value specified when memobj is created. -- -- This function execute OpenCL clGetMemObjectInfo with -- CL_MEM_HOST_PTR. clGetMemHostPtr :: CLMem -> IO (Ptr ()) -- | Map count. The map count returned should be considered immediately -- stale. It is unsuitable for general use in applications. This feature -- is provided for debugging. -- -- This function execute OpenCL clGetMemObjectInfo with -- CL_MEM_MAP_COUNT. clGetMemMapCount :: CLMem -> IO CLuint -- | Return memobj reference count. 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. -- -- This function execute OpenCL clGetMemObjectInfo with -- CL_MEM_REFERENCE_COUNT. clGetMemReferenceCount :: CLMem -> IO CLuint -- | Return context specified when memory object is created. -- -- This function execute OpenCL clGetMemObjectInfo with -- CL_MEM_CONTEXT. clGetMemContext :: CLMem -> IO CLContext -- | Creates a sampler object. A sampler object describes how to sample an -- image when the image is read in the kernel. The built-in functions to -- read from an image in a kernel take a sampler as an argument. The -- sampler arguments to the image read function can be sampler objects -- created using OpenCL functions and passed as argument values to the -- kernel or can be samplers declared inside a kernel. In this section we -- discuss how sampler objects are created using OpenCL functions. -- -- Returns a valid non-zero sampler object if the sampler object is -- created successfully. Otherwise, it throws one of the following -- CLError exceptions: -- -- clCreateSampler :: CLContext -> Bool -> CLAddressingMode -> CLFilterMode -> IO CLSampler -- | Increments the sampler reference count. clCreateSampler does an -- implicit retain. Returns True if the function is executed -- successfully. It returns False if sampler is not a valid -- sampler object. clRetainSampler :: CLSampler -> IO Bool -- | 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. -- clReleaseSampler returns True if the function is -- executed successfully. It returns False if sampler is not a -- valid sampler object. clReleaseSampler :: CLSampler -> IO Bool -- | Return the sampler reference count. 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. -- -- This function execute OpenCL clGetSamplerInfo with -- CL_SAMPLER_REFERENCE_COUNT. clGetSamplerReferenceCount :: CLSampler -> IO CLuint -- | Return the context specified when the sampler is created. -- -- This function execute OpenCL clGetSamplerInfo with -- CL_SAMPLER_CONTEXT. clGetSamplerContext :: CLSampler -> IO CLContext -- | Return the value specified by addressing_mode argument to -- clCreateSampler. -- -- This function execute OpenCL clGetSamplerInfo with -- CL_SAMPLER_ADDRESSING_MODE. clGetSamplerAddressingMode :: CLSampler -> IO CLAddressingMode -- | Return the value specified by filter_mode argument to clCreateSampler. -- -- This function execute OpenCL clGetSamplerInfo with -- CL_SAMPLER_FILTER_MODE. clGetSamplerFilterMode :: CLSampler -> IO CLFilterMode -- | Return the value specified by normalized_coords argument to -- clCreateSampler. -- -- This function execute OpenCL clGetSamplerInfo with -- CL_SAMPLER_NORMALIZED_COORDS. clGetSamplerNormalizedCoords :: CLSampler -> IO Bool instance Enum CLSamplerInfo instance Enum CLMemInfo module System.GPU.OpenCL.CommandQueue type CLCommandQueue = Ptr () -- | data CLCommandQueueProperty CL_QUEUE_OUT_OF_ORDER_EXEC_MODE_ENABLE :: CLCommandQueueProperty CL_QUEUE_PROFILING_ENABLE :: CLCommandQueueProperty -- | Create a command-queue on a specific device. -- -- The OpenCL functions that are submitted to a command-queue are -- enqueued in the order the calls are made but can be configured to -- execute in-order or out-of-order. The properties argument in -- clCreateCommandQueue can be used to specify the execution order. -- -- If the CL_QUEUE_OUT_OF_ORDER_EXEC_MODE_ENABLE property of a -- command-queue is not set, the commands enqueued to a command-queue -- execute in order. For example, if an application calls -- clEnqueueNDRangeKernel to execute kernel A followed by a -- clEnqueueNDRangeKernel to execute kernel B, the application can -- assume that kernel A finishes first and then kernel B is executed. If -- the memory objects output by kernel A are inputs to kernel B then -- kernel B will see the correct data in memory objects produced by -- execution of kernel A. If the -- CL_QUEUE_OUT_OF_ORDER_EXEC_MODE_ENABLE property of a -- commandqueue is set, then there is no guarantee that kernel A will -- finish before kernel B starts execution. -- -- Applications can configure the commands enqueued to a command-queue to -- execute out-of-order by setting the -- CL_QUEUE_OUT_OF_ORDER_EXEC_MODE_ENABLE property of the -- command-queue. This can be specified when the command-queue is created -- or can be changed dynamically using clCreateCommandQueue. In -- out-of-order execution mode there is no guarantee that the enqueued -- commands will finish execution in the order they were queued. As there -- is no guarantee that kernels will be executed in order, i.e. based on -- when the clEnqueueNDRangeKernel calls are made within a -- command-queue, it is therefore possible that an earlier -- clEnqueueNDRangeKernel call to execute kernel A identified by -- event A may execute and/or finish later than a -- clEnqueueNDRangeKernel call to execute kernel B which was -- called by the application at a later point in time. To guarantee a -- specific order of execution of kernels, a wait on a particular event -- (in this case event A) can be used. The wait for event A can be -- specified in the event_wait_list argument to -- clEnqueueNDRangeKernel for kernel B. -- -- In addition, a wait for events or a barrier command can be enqueued to -- the command-queue. The wait for events command ensures that previously -- enqueued commands identified by the list of events to wait for have -- finished before the next batch of commands is executed. The barrier -- command ensures that all previously enqueued commands in a -- command-queue have finished execution before the next batch of -- commands is executed. -- -- Similarly, commands to read, write, copy or map memory objects that -- are enqueued after clEnqueueNDRangeKernel, clEnqueueTask -- or clEnqueueNativeKernel commands are not guaranteed to wait -- for kernels scheduled for execution to have completed (if the -- CL_QUEUE_OUT_OF_ORDER_EXEC_MODE_ENABLE property is set). To -- ensure correct ordering of commands, the event object returned by -- clEnqueueNDRangeKernel, clEnqueueTask or -- clEnqueueNativeKernel can be used to enqueue a wait for event -- or a barrier command can be enqueued that must complete before reads -- or writes to the memory object(s) occur. clCreateCommandQueue :: CLContext -> CLDeviceID -> [CLCommandQueueProperty] -> IO CLCommandQueue -- | Increments the command_queue reference count. -- clCreateCommandQueue performs 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. Returns True if the function is -- executed successfully. It returns False if command_queue is not -- a valid command-queue. clRetainCommandQueue :: CLCommandQueue -> IO Bool -- | Decrements the command_queue reference count. After the command_queue -- reference count becomes zero and all commands queued to command_queue -- have finished (e.g., kernel executions, memory object updates, etc.), -- the command-queue is deleted. Returns True if the function is -- executed successfully. It returns False if command_queue is not -- a valid command-queue. clReleaseCommandQueue :: CLCommandQueue -> IO Bool -- | Return the context specified when the command-queue is created. -- -- This function execute OpenCL clGetCommandQueueInfo with -- CL_QUEUE_CONTEXT. clGetCommandQueueContext :: CLCommandQueue -> IO CLContext -- | Return the device specified when the command-queue is created. -- -- This function execute OpenCL clGetCommandQueueInfo with -- CL_QUEUE_DEVICE. clGetCommandQueueDevice :: CLCommandQueue -> IO CLDeviceID -- | Return the command-queue reference count. 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. -- -- This function execute OpenCL clGetCommandQueueInfo with -- CL_QUEUE_REFERENCE_COUNT. clGetCommandQueueReferenceCount :: CLCommandQueue -> IO CLuint -- | Return the currently specified properties for the command-queue. These -- properties are specified by the properties argument in -- clCreateCommandQueue , and can be changed by -- clSetCommandQueueProperty. -- -- This function execute OpenCL clGetCommandQueueInfo with -- CL_QUEUE_PROPERTIES. clGetCommandQueueProperties :: CLCommandQueue -> IO [CLCommandQueueProperty] -- | Enable or disable the properties of a command-queue. Returns the -- command-queue properties before they were changed by -- clSetCommandQueueProperty. As specified for -- clCreateCommandQueue, the -- CL_QUEUE_OUT_OF_ORDER_EXEC_MODE_ENABLE command-queue property -- determines whether the commands in a command-queue are executed -- in-order or out-of-order. Changing this command-queue property will -- cause the OpenCL implementation to block until all previously queued -- commands in command_queue have completed. This can be an expensive -- operation and therefore changes to the -- CL_QUEUE_OUT_OF_ORDER_EXEC_MODE_ENABLE property should be only -- done when absolutely necessary. -- -- It is possible that a device(s) becomes unavailable after a context -- and command-queues that use this device(s) have been created and -- commands have been queued to command-queues. In this case the behavior -- of OpenCL API calls that use this context (and command-queues) are -- considered to be implementation-defined. The user callback function, -- if specified when the context is created, can be used to record -- appropriate information when the device becomes unavailable. clSetCommandQueueProperty :: CLCommandQueue -> [CLCommandQueueProperty] -> Bool -> IO [CLCommandQueueProperty] -- | Enqueue commands to read from a buffer object to host memory. Calling -- clEnqueueReadBuffer to read a region of the buffer object with the ptr -- argument value set to host_ptr + offset, where host_ptr is a pointer -- to the memory region specified when the buffer object being read is -- created with CL_MEM_USE_HOST_PTR, must meet the following -- requirements in order to avoid undefined behavior: -- -- -- -- clEnqueueReadBuffer returns the event if the function is -- executed successfully. It can throw the following CLError -- exceptions: -- -- clEnqueueReadBuffer :: Integral a => CLCommandQueue -> CLMem -> Bool -> a -> a -> Ptr () -> [CLEvent] -> IO CLEvent -- | Enqueue commands to write to a buffer object from host memory.Calling -- clEnqueueWriteBuffer to update the latest bits in a region of the -- buffer object with the ptr argument value set to host_ptr + offset, -- where host_ptr is a pointer to the memory region specified when the -- buffer object being written is created with -- CL_MEM_USE_HOST_PTR, must meet the following requirements in -- order to avoid undefined behavior: -- -- -- -- clEnqueueWriteBuffer returns the Event if the function is -- executed successfully. It can throw the following CLError -- exceptions: -- -- clEnqueueWriteBuffer :: Integral a => CLCommandQueue -> CLMem -> Bool -> a -> a -> Ptr () -> [CLEvent] -> IO CLEvent -- | Enqueues a command to execute a kernel on a device. Each work-item is -- uniquely identified by a global identifier. The global ID, which can -- be read inside the kernel, is computed using the value given by -- global_work_size and global_work_offset. In OpenCL 1.0, the starting -- global ID is always (0, 0, ... 0). In addition, a work-item is also -- identified within a work-group by a unique local ID. The local ID, -- which can also be read by the kernel, is computed using the value -- given by local_work_size. The starting local ID is always (0, 0, ... -- 0). -- -- Returns the event if the kernel execution was successfully queued. It -- can throw the following CLError exceptions: -- -- clEnqueueNDRangeKernel :: Integral a => CLCommandQueue -> CLKernel -> [a] -> [a] -> [CLEvent] -> IO CLEvent -- | Enqueues a command to execute a kernel on a device. The kernel is -- executed using a single work-item. -- -- clEnqueueTask is equivalent to calling -- clEnqueueNDRangeKernel with work_dim = 1, global_work_offset = -- [], global_work_size[0] set to 1, and local_work_size[0] set to 1. -- -- Returns the evens if the kernel execution was successfully queued. It -- can throw the following CLError exceptions: -- -- clEnqueueTask :: CLCommandQueue -> CLKernel -> [CLEvent] -> IO CLEvent -- | Enqueues a marker command to command_queue. The marker command returns -- an event which can be used to queue a wait on this marker event i.e. -- wait for all commands queued before the marker command to complete. -- Returns the event if the function is successfully executed. It throw -- the CLError exception CL_INVALID_COMMAND_QUEUE if -- command_queue is not a valid command-queue and throw -- CL_OUT_OF_HOST_MEMORY if there is a failure to allocate -- resources required by the OpenCL implementation on the host. clEnqueueMarker :: CLCommandQueue -> IO CLEvent -- | Enqueues a wait for a specific event or a list of events to complete -- before any future commands queued in the command-queue are executed. -- The context associated with events in event_list and command_queue -- must be the same. -- -- It can throw the following CLError exceptions: -- -- clEnqueueWaitForEvents :: CLCommandQueue -> [CLEvent] -> IO () -- | clEnqueueBarrier is a synchronization point that ensures that -- all queued commands in command_queue have finished execution before -- the next batch of commands can begin execution. It throws -- CL_INVALID_COMMAND_QUEUE if command_queue is not a valid -- command-queue and throws CL_OUT_OF_HOST_MEMORY if there is a -- failure to allocate resources required by the OpenCL implementation on -- the host. clEnqueueBarrier :: CLCommandQueue -> IO () -- | Issues all previously queued OpenCL commands in a command-queue to the -- device associated with the command-queue. clFlush only -- guarantees that all queued commands to command_queue get issued to the -- appropriate device. There is no guarantee that they will be complete -- after clFlush returns. -- -- clFlush returns True if the function call was executed -- successfully. It returns False if command_queue is not a valid -- command-queue or if there is a failure to allocate resources required -- by the OpenCL implementation on the host. -- -- Any blocking commands queued in a command-queue such as -- clEnqueueReadImage or clEnqueueReadBuffer with -- blocking_read set to True, clEnqueueWriteImage or -- clEnqueueWriteBuffer with blocking_write set to True, -- clEnqueueMapImage or clEnqueueMapBuffer with -- blocking_map set to True or clWaitForEvents perform an -- implicit flush of the command-queue. -- -- To use event objects that refer to commands enqueued in a -- command-queue as event objects to wait on by commands enqueued in a -- different command-queue, the application must call a clFlush or -- any blocking commands that perform an implicit flush of the -- command-queue where the commands that refer to these event objects are -- enqueued. clFlush :: CLCommandQueue -> IO Bool -- | Blocks until all previously queued OpenCL commands in a command-queue -- are issued to the associated device and have completed. -- clFinish does not return until all queued commands in -- command_queue have been processed and completed. clFinish is -- also a synchronization point. -- -- clFinish returns True if the function call was executed -- successfully. It returns False if command_queue is not a valid -- command-queue or if there is a failure to allocate resources required -- by the OpenCL implementation on the host. clFinish :: CLCommandQueue -> IO Bool instance Enum CLCommandQueueInfo module System.GPU.OpenCL.Context type CLContext = Ptr () -- | Creates an OpenCL context. An OpenCL context is created with one or -- more devices. Contexts are 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. clCreateContext :: [CLDeviceID] -> (String -> IO ()) -> IO CLContext -- | Create an OpenCL context from a device type that identifies the -- specific device(s) to use. clCreateContextFromType :: [CLDeviceType] -> (String -> IO ()) -> IO CLContext -- | Increment the context reference count. clCreateContext and -- clCreateContextFromType 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. Returns True if the function is executed -- successfully, or False if context is not a valid OpenCL -- context. clRetainContext :: CLContext -> IO Bool -- | Decrement the context reference count. After the context reference -- count becomes zero and all the objects attached to context (such as -- memory objects, command-queues) are released, the context is deleted. -- Returns True if the function is executed successfully, or -- False if context is not a valid OpenCL context. clReleaseContext :: CLContext -> IO Bool -- | Return the context reference count. 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. -- -- This function execute OpenCL clGetContextInfo with -- CL_CONTEXT_REFERENCE_COUNT. clGetContextReferenceCount :: CLContext -> IO CLuint -- | Return the list of devices in context. -- -- This function execute OpenCL clGetContextInfo with -- CL_CONTEXT_DEVICES. clGetContextDevices :: CLContext -> IO [CLDeviceID] instance Enum CLContextInfo module System.GPU.OpenCL.Query -- | -- -- -- -- data CLPlatformInfo CL_PLATFORM_PROFILE :: CLPlatformInfo CL_PLATFORM_VERSION :: CLPlatformInfo CL_PLATFORM_NAME :: CLPlatformInfo CL_PLATFORM_VENDOR :: CLPlatformInfo CL_PLATFORM_EXTENSIONS :: CLPlatformInfo type CLPlatformID = Ptr () type CLDeviceID = Ptr () -- | data CLDeviceType CL_DEVICE_TYPE_CPU :: CLDeviceType CL_DEVICE_TYPE_GPU :: CLDeviceType CL_DEVICE_TYPE_ACCELERATOR :: CLDeviceType CL_DEVICE_TYPE_DEFAULT :: CLDeviceType CL_DEVICE_TYPE_ALL :: CLDeviceType -- | data CLDeviceFPConfig CL_FP_DENORM :: CLDeviceFPConfig CL_FP_INF_NAN :: CLDeviceFPConfig CL_FP_ROUND_TO_NEAREST :: CLDeviceFPConfig CL_FP_ROUND_TO_ZERO :: CLDeviceFPConfig CL_FP_ROUND_TO_INF :: CLDeviceFPConfig CL_FP_FMA :: CLDeviceFPConfig -- | data CLDeviceExecCapability CL_EXEC_KERNEL :: CLDeviceExecCapability CL_EXEC_NATIVE_KERNEL :: CLDeviceExecCapability data CLDeviceLocalMemType CL_LOCAL :: CLDeviceLocalMemType CL_GLOBAL :: CLDeviceLocalMemType data CLDeviceMemCacheType CL_NONE :: CLDeviceMemCacheType CL_READ_ONLY_CACHE :: CLDeviceMemCacheType CL_READ_WRITE_CACHE :: CLDeviceMemCacheType -- | Obtain the list of platforms available. Returns the list if the -- function is executed successfully. Otherwise it returns the empty -- list. clGetPlatformIDs :: IO [CLPlatformID] -- | Get specific information about the OpenCL platform. It returns Nothing -- if platform is not a valid platform. clGetPlatformInfo :: CLPlatformID -> CLPlatformInfo -> IO String -- | Obtain the list of devices available on a platform. Returns the list -- if the function is executed successfully. Otherwise it returns the -- empty list if platform is not a valid platform or no OpenCL devices -- that matched device_type were found. clGetDeviceIDs :: CLPlatformID -> CLDeviceType -> IO [CLDeviceID] -- | Describes the execution capabilities of the device. This is a list -- that describes one or more of the CLDeviceExecCapability -- values. The mandated minimum capability is CL_EXEC_KERNEL. -- -- This function execute OpenCL clGetDeviceInfo with -- CL_DEVICE_EXECUTION_CAPABILITIES. clGetDeviceExecutionCapabilities :: CLDeviceID -> IO [CLDeviceExecCapability] -- | The default compute device address space size specified as an unsigned -- integer value in bits. Currently supported values are 32 or 64 bits. -- -- This function execute OpenCL clGetDeviceInfo with -- CL_DEVICE_ADDRESS_BITS. clGetDeviceAddressBits :: CLDeviceID -> IO CLuint -- | Is True if the device is available and False if the -- device is not available. -- -- This function execute OpenCL clGetDeviceInfo with -- CL_DEVICE_AVAILABLE. clGetDeviceAvailable :: CLDeviceID -> IO Bool -- | Is False if the implementation does not have a compiler -- available to compile the program source. Is True if the -- compiler is available. This can be False for the embededed -- platform profile only. -- -- This function execute OpenCL clGetDeviceInfo with -- CL_DEVICE_COMPILER_AVAILABLE. clGetDeviceCompilerAvailable :: CLDeviceID -> IO Bool -- | Is True if the OpenCL device is a little endian device and -- False otherwise. -- -- This function execute OpenCL clGetDeviceInfo with -- CL_DEVICE_ENDIAN_LITTLE. clGetDeviceEndianLittle :: CLDeviceID -> IO Bool -- | Is True if the device implements error correction for the -- memories, caches, registers etc. in the device. Is False if the -- device does not implement error correction. This can be a requirement -- for certain clients of OpenCL. -- -- This function execute OpenCL clGetDeviceInfo with -- CL_DEVICE_ERROR_CORRECTION_SUPPORT. clGetDeviceErrorCorrectionSupport :: CLDeviceID -> IO Bool -- | Returns a space separated list of extension names (the extension names -- themselves do not contain any spaces). The list of extension names -- returned currently can include one or more of the following approved -- extension names: -- -- -- -- This function execute OpenCL clGetDeviceInfo with -- CL_DEVICE_EXTENSIONS. clGetDeviceExtensions :: CLDeviceID -> IO String -- | Size of global memory cache in bytes. -- -- This function execute OpenCL clGetDeviceInfo with -- CL_DEVICE_GLOBAL_MEM_CACHE_SIZE. clGetDeviceGlobalMemCacheSize :: CLDeviceID -> IO CLulong -- | Size of global memory cache line in bytes. -- -- This function execute OpenCL clGetDeviceInfo with -- CL_DEVICE_GLOBAL_MEM_CACHELINE_SIZE. clGetDeviceGlobalMemCachelineSize :: CLDeviceID -> IO CLuint -- | Size of global device memory in bytes. -- -- This function execute OpenCL clGetDeviceInfo with -- CL_DEVICE_GLOBAL_MEM_SIZE. clGetDeviceGlobalMemSize :: CLDeviceID -> IO CLulong -- | Is True if images are supported by the OpenCL device and -- False otherwise. -- -- This function execute OpenCL clGetDeviceInfo with -- CL_DEVICE_IMAGE_SUPPORT. clGetDeviceImageSupport :: CLDeviceID -> IO Bool -- | Max height of 2D image in pixels. The minimum value is 8192 if -- clGetDeviceImageSupport is True. -- -- This function execute OpenCL clGetDeviceInfo with -- CL_DEVICE_IMAGE2D_MAX_HEIGHT. clGetDeviceImage2DMaxHeight :: CLDeviceID -> IO CSize -- | Max width of 2D image in pixels. The minimum value is 8192 if -- clGetDeviceImageSupport is True. -- -- This function execute OpenCL clGetDeviceInfo with -- CL_DEVICE_IMAGE2D_MAX_WIDTH. clGetDeviceImage2DMaxWidth :: CLDeviceID -> IO CSize -- | Max depth of 3D image in pixels. The minimum value is 2048 if -- clGetDeviceImageSupport is True. -- -- This function execute OpenCL clGetDeviceInfo with -- CL_DEVICE_IMAGE3D_MAX_DEPTH. clGetDeviceImage3DMaxDepth :: CLDeviceID -> IO CSize -- | Max height of 3D image in pixels. The minimum value is 2048 if -- clGetDeviceImageSupport is True. -- -- This function execute OpenCL clGetDeviceInfo with -- CL_DEVICE_IMAGE3D_MAX_HEIGHT. clGetDeviceImage3DMaxHeight :: CLDeviceID -> IO CSize -- | Max width of 3D image in pixels. The minimum value is 2048 if -- clGetDeviceImageSupport is True. -- -- This function execute OpenCL clGetDeviceInfo with -- CL_DEVICE_IMAGE3D_MAX_WIDTH. clGetDeviceImage3DMaxWidth :: CLDeviceID -> IO CSize -- | Size of local memory arena in bytes. The minimum value is 16 KB. -- -- This function execute OpenCL clGetDeviceInfo with -- CL_DEVICE_LOCAL_MEM_SIZE. clGetDeviceLocalMemSize :: CLDeviceID -> IO CLulong -- | Maximum configured clock frequency of the device in MHz. -- -- This function execute OpenCL clGetDeviceInfo with -- CL_DEVICE_MAX_CLOCK_FREQUENCY. clGetDeviceMaxClockFrequency :: CLDeviceID -> IO CLuint -- | The number of parallel compute cores on the OpenCL device. The minimum -- value is 1. -- -- This function execute OpenCL clGetDeviceInfo with -- CL_DEVICE_MAX_COMPUTE_UNITS. clGetDeviceMaxComputeUnits :: CLDeviceID -> IO CLuint -- | Max number of arguments declared with the __constant qualifier in a -- kernel. The minimum value is 8. -- -- This function execute OpenCL clGetDeviceInfo with -- CL_DEVICE_MAX_CONSTANT_ARGS. clGetDeviceMaxConstantArgs :: CLDeviceID -> IO CLuint -- | Max size in bytes of a constant buffer allocation. The minimum value -- is 64 KB. -- -- This function execute OpenCL clGetDeviceInfo with -- CL_DEVICE_MAX_CONSTANT_BUFFER_SIZE. clGetDeviceMaxConstantBufferSize :: CLDeviceID -> IO CLulong -- | Max size of memory object allocation in bytes. The minimum value is -- max (1/4th of clGetDeviceGlobalMemSize, 128*1024*1024) -- -- This function execute OpenCL clGetDeviceInfo with -- CL_DEVICE_MAX_MEM_ALLOC_SIZE. clGetDeviceMaxMemAllocSize :: CLDeviceID -> IO CLulong -- | Max size in bytes of the arguments that can be passed to a kernel. The -- minimum value is 256. -- -- This function execute OpenCL clGetDeviceInfo with -- CL_DEVICE_MAX_PARAMETER_SIZE. clGetDeviceMaxParameterSize :: CLDeviceID -> IO CSize -- | Max number of simultaneous image objects that can be read by a kernel. -- The minimum value is 128 if clGetDeviceImageSupport is -- True. -- -- This function execute OpenCL clGetDeviceInfo with -- CL_DEVICE_MAX_READ_IMAGE_ARGS. clGetDeviceMaxReadImageArgs :: CLDeviceID -> IO CLuint -- | Maximum number of samplers that can be used in a kernel. The minimum -- value is 16 if clGetDeviceImageSupport is True. (Also -- see sampler type.) -- -- This function execute OpenCL clGetDeviceInfo with -- CL_DEVICE_MAX_SAMPLERS. clGetDeviceMaxSamplers :: CLDeviceID -> IO CLuint -- | Maximum number of work-items in a work-group executing a kernel using -- the data parallel execution model. (Refer to -- clEnqueueNDRangeKernel). The minimum value is 1. -- -- This function execute OpenCL clGetDeviceInfo with -- CL_DEVICE_MAX_WORK_GROUP_SIZE. clGetDeviceMaxWorkGroupSize :: CLDeviceID -> IO CSize -- | Maximum dimensions that specify the global and local work-item IDs -- used by the data parallel execution model. (Refer to -- clEnqueueNDRangeKernel). The minimum value is 3. -- -- This function execute OpenCL clGetDeviceInfo with -- CL_DEVICE_MAX_WORK_ITEM_DIMENSIONS. clGetDeviceMaxWorkItemDimensions :: CLDeviceID -> IO CLuint -- | Maximum number of work-items that can be specified in each dimension -- of the work-group to clEnqueueNDRangeKernel. Returns n -- entries, where n is the value returned by the query for -- clDeviceMaxWorkItemDimensions. The minimum value is (1, 1, 1). -- -- This function execute OpenCL clGetDeviceInfo with -- CL_DEVICE_MAX_WORK_ITEM_SIZES. clGetDeviceMaxWorkItemSizes :: CLDeviceID -> IO [CSize] -- | Max number of simultaneous image objects that can be written to by a -- kernel. The minimum value is 8 if clGetDeviceImageSupport is -- True. -- -- This function execute OpenCL clGetDeviceInfo with -- CL_DEVICE_MAX_WRITE_IMAGE_ARGS. clGetDeviceMaxWriteImageArgs :: CLDeviceID -> IO CLuint -- | Describes the alignment in bits of the base address of any allocated -- memory object. -- -- This function execute OpenCL clGetDeviceInfo with -- CL_DEVICE_MEM_BASE_ADDR_ALIGN. clGetDeviceMemBaseAddrAlign :: CLDeviceID -> IO CLuint -- | The smallest alignment in bytes which can be used for any data type. -- -- This function execute OpenCL clGetDeviceInfo with -- CL_DEVICE_MIN_DATA_TYPE_ALIGN_SIZE. clGetDeviceMinDataTypeAlignSize :: CLDeviceID -> IO CLuint -- | Device name string. -- -- This function execute OpenCL clGetDeviceInfo with -- CL_DEVICE_NAME. clGetDeviceName :: CLDeviceID -> IO String -- | The platform associated with this device. -- -- This function execute OpenCL clGetDeviceInfo with -- CL_DEVICE_PLATFORM. clGetDevicePlatform :: CLDeviceID -> IO CLPlatformID -- | Preferred native vector width size for built-in char 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. -- -- This function execute OpenCL clGetDeviceInfo with -- CL_DEVICE_PREFERRED_VECTOR_WIDTH_CHAR. clGetDevicePreferredVectorWidthChar :: CLDeviceID -> IO CLuint -- | Preferred native vector width size for built-in short 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. -- -- This function execute OpenCL clGetDeviceInfo with -- CL_DEVICE_PREFERRED_VECTOR_WIDTH_SHORT. clGetDevicePreferredVectorWidthShort :: CLDeviceID -> IO CLuint -- | Preferred native vector width size for built-in int 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. -- -- This function execute OpenCL clGetDeviceInfo with -- CL_DEVICE_PREFERRED_VECTOR_WIDTH_INT. clGetDevicePreferredVectorWidthInt :: CLDeviceID -> IO CLuint -- | Preferred native vector width size for built-in long 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. -- -- This function execute OpenCL clGetDeviceInfo with -- CL_DEVICE_PREFERRED_VECTOR_WIDTH_LONG. clGetDevicePreferredVectorWidthLong :: CLDeviceID -> IO CLuint -- | Preferred native vector width size for built-in float 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. -- -- This function execute OpenCL clGetDeviceInfo with -- CL_DEVICE_PREFERRED_VECTOR_WIDTH_FLOAT. clGetDevicePreferredVectorWidthFloat :: CLDeviceID -> IO CLuint -- | Preferred native vector width size for built-in double 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_fp64 -- extension is not supported, -- clGetDevicePreferredVectorWidthDouble must return 0. -- -- This function execute OpenCL clGetDeviceInfo with -- CL_DEVICE_PREFERRED_VECTOR_WIDTH_DOUBLE. clGetDevicePreferredVectorWidthDouble :: CLDeviceID -> IO CLuint -- | OpenCL profile string. Returns the profile name supported by the -- device (see note). The profile name returned can be one of the -- following strings: -- -- -- -- This function execute OpenCL clGetDeviceInfo with -- CL_DEVICE_PROFILE. clGetDeviceProfile :: CLDeviceID -> IO String -- | Describes the resolution of device timer. This is measured in -- nanoseconds. -- -- This function execute OpenCL clGetDeviceInfo with -- CL_DEVICE_PROFILING_TIMER_RESOLUTION. clGetDeviceProfilingTimerResolution :: CLDeviceID -> IO CSize -- | Vendor name string. -- -- This function execute OpenCL clGetDeviceInfo with -- CL_DEVICE_VENDOR. clGetDeviceVendor :: CLDeviceID -> IO String -- | A unique device vendor identifier. An example of a unique device -- identifier could be the PCIe ID. -- -- This function execute OpenCL clGetDeviceInfo with -- CL_DEVICE_VENDOR_ID. clGetDeviceVendorID :: CLDeviceID -> IO CLuint -- | OpenCL version string. Returns the OpenCL version supported by the -- device. This version string has the following format: OpenCL -- major_version.minor_version vendor-specific information The -- major_version.minor_version value returned will be 1.0. -- -- This function execute OpenCL clGetDeviceInfo with -- CL_DEVICE_VERSION. clGetDeviceVersion :: CLDeviceID -> IO String -- | OpenCL software driver version string in the form -- major_number.minor_number. -- -- This function execute OpenCL clGetDeviceInfo with -- CL_DRIVER_VERSION. clGetDeviceDriverVersion :: CLDeviceID -> IO String -- | Describes single precision floating-point capability of the device. -- This is a bit-field that describes one or more of the -- CLDeviceFPConfig values. The mandated minimum floating-point -- capability is CL_FP_ROUND_TO_NEAREST | CL_FP_INF_NAN. -- -- This function execute OpenCL clGetDeviceInfo with -- CL_DEVICE_SINGLE_FP_CONFIG. clGetDeviceSingleFPConfig :: CLDeviceID -> IO [CLDeviceFPConfig] -- | Describes the OPTIONAL double precision floating-point capability of -- the OpenCL device. This is a bit-field that describes one or more of -- the CLDeviceFPConfig values. The mandated minimum double -- precision floating-point capability is CL_FP_FMA | -- CL_FP_ROUND_TO_NEAREST | CL_FP_ROUND_TO_ZERO | -- CL_FP_ROUND_TO_INF | CL_FP_INF_NAN | -- CL_FP_DENORM. -- -- This function execute OpenCL clGetDeviceInfo with -- CL_DEVICE_DOUBLE_FP_CONFIG. clGetDeviceDoubleFPConfig :: CLDeviceID -> IO [CLDeviceFPConfig] -- | Describes the OPTIONAL half precision floating-point capability of the -- OpenCL device. This is a bit-field that describes one or more of the -- CLDeviceFPConfig values. The required minimum half precision -- floating-point capability as implemented by this extension is -- CL_FP_ROUND_TO_ZERO | CL_FP_ROUND_TO_INF | -- CL_FP_INF_NAN. -- -- This function execute OpenCL clGetDeviceInfo with -- CL_DEVICE_HALF_FP_CONFIG. clGetDeviceHalfFPConfig :: CLDeviceID -> IO [CLDeviceFPConfig] -- | Type of local memory supported. This can be set to CL_LOCAL -- implying dedicated local memory storage such as SRAM, or -- CL_GLOBAL. -- -- This function execute OpenCL clGetDeviceInfo with -- CL_DEVICE_LOCAL_MEM_TYPE. clGetDeviceLocalMemType :: CLDeviceID -> IO CLDeviceLocalMemType -- | Type of global memory cache supported. Valid values are: -- CL_NONE, CL_READ_ONLY_CACHE, and -- CL_READ_WRITE_CACHE. -- -- This function execute OpenCL clGetDeviceInfo with -- CL_DEVICE_GLOBAL_MEM_CACHE_TYPE. clGetDeviceGlobalMemCacheType :: CLDeviceID -> IO CLDeviceMemCacheType -- | Describes the command-queue properties supported by the device. This -- is a list that describes one or more of the CLCommandQueueProperty -- values. These properties are described in the table for -- clCreateCommandQueue. The mandated minimum capability is -- CL_QUEUE_PROFILING_ENABLE. -- -- This function execute OpenCL clGetDeviceInfo with -- CL_DEVICE_QUEUE_PROPERTIES. clGetDeviceQueueProperties :: CLDeviceID -> IO [CLCommandQueueProperty] -- | The OpenCL device type. Currently supported values are one of or a -- combination of: CL_DEVICE_TYPE_CPU, CL_DEVICE_TYPE_GPU, -- CL_DEVICE_TYPE_ACCELERATOR, or CL_DEVICE_TYPE_DEFAULT. -- -- This function execute OpenCL clGetDeviceInfo with -- CL_DEVICE_TYPE. clGetDeviceType :: CLDeviceID -> IO [CLDeviceType] instance Enum CLDeviceInfo module System.GPU.OpenCL -- | data CLError CL_BUILD_PROGRAM_FAILURE :: CLError CL_COMPILER_NOT_AVAILABLE :: CLError CL_DEVICE_NOT_AVAILABLE :: CLError CL_DEVICE_NOT_FOUND :: CLError CL_IMAGE_FORMAT_MISMATCH :: CLError CL_IMAGE_FORMAT_NOT_SUPPORTED :: CLError CL_INVALID_ARG_INDEX :: CLError CL_INVALID_ARG_SIZE :: CLError CL_INVALID_ARG_VALUE :: CLError CL_INVALID_BINARY :: CLError CL_INVALID_BUFFER_SIZE :: CLError CL_INVALID_BUILD_OPTIONS :: CLError CL_INVALID_COMMAND_QUEUE :: CLError CL_INVALID_CONTEXT :: CLError CL_INVALID_DEVICE :: CLError CL_INVALID_DEVICE_TYPE :: CLError CL_INVALID_EVENT :: CLError CL_INVALID_EVENT_WAIT_LIST :: CLError CL_INVALID_GL_OBJECT :: CLError CL_INVALID_GLOBAL_OFFSET :: CLError CL_INVALID_HOST_PTR :: CLError CL_INVALID_IMAGE_FORMAT_DESCRIPTOR :: CLError CL_INVALID_IMAGE_SIZE :: CLError CL_INVALID_KERNEL_NAME :: CLError CL_INVALID_KERNEL :: CLError CL_INVALID_KERNEL_ARGS :: CLError CL_INVALID_KERNEL_DEFINITION :: CLError CL_INVALID_MEM_OBJECT :: CLError CL_INVALID_OPERATION :: CLError CL_INVALID_PLATFORM :: CLError CL_INVALID_PROGRAM :: CLError CL_INVALID_PROGRAM_EXECUTABLE :: CLError CL_INVALID_QUEUE_PROPERTIES :: CLError CL_INVALID_SAMPLER :: CLError CL_INVALID_VALUE :: CLError CL_INVALID_WORK_DIMENSION :: CLError CL_INVALID_WORK_GROUP_SIZE :: CLError CL_INVALID_WORK_ITEM_SIZE :: CLError CL_MAP_FAILURE :: CLError CL_MEM_OBJECT_ALLOCATION_FAILURE :: CLError CL_MEM_COPY_OVERLAP :: CLError CL_OUT_OF_HOST_MEMORY :: CLError CL_OUT_OF_RESOURCES :: CLError CL_PROFILING_INFO_NOT_AVAILABLE :: CLError CL_SUCCESS :: CLError type CLint = CInt type CLuint = CUInt type CLulong = CULLong