packages feed

OpenCLRaw (empty) → 1.0.1000

raw patch · 18 files changed

+1696/−0 lines, 18 filesdep +basedep +bytestringdep +mtlsetup-changed

Dependencies added: base, bytestring, mtl

Files

+ LICENSE view
@@ -0,0 +1,49 @@+RENCI Open Source Software License+The University of North Carolina at Chapel Hill++The University of North Carolina at Chapel Hill (the "Licensor") through +its Renaissance Computing Institute (RENCI) is making an original work of +authorship (the "Software") available through RENCI upon the terms set +forth in this Open Source Software License (this "License").  This License +applies to any Software that has placed the following notice immediately +following the copyright notice for the Software:  Licensed under the RENCI +Open Source Software License v. 1.0.++Licensor grants You, free of charge, a world-wide, royalty-free, +non-exclusive, perpetual, sublicenseable license to do the following to +deal in the Software without restriction, including without limitation the +rights to use, copy, modify, merge, publish, distribute, sublicense, +and/or sell copies of the Software, and to permit persons to whom the +Software is furnished to do so, subject to the following conditions:++. Redistributions of source code must retain the above copyright notice, +this list of conditions and the following disclaimers.++. Redistributions in binary form must reproduce the above copyright +notice, this list of conditions and the following disclaimers in the +documentation and/or other materials provided with the distribution.++. Neither You nor any sublicensor of the Software may use the names of +Licensor (or any derivative thereof), of RENCI, or of contributors to the +Software without explicit prior written permission.  Nothing in this +License shall be deemed to grant any rights to trademarks, copyrights, +patents, trade secrets or any other intellectual property of Licensor +except as expressly stated herein.++THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL +THE CONTIBUTORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR +OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, +ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR +OTHER DEALINGS IN THE SOFTWARE.++You may use the Software in all ways not otherwise restricted or +conditioned by this License or by law, and Licensor promises not to +interfere with or be responsible for such uses by You.  This Software may +be subject to U.S. law dealing with export controls.  If you are in the +U.S., please do not mirror this Software unless you fully understand the +U.S. export regulations.  Licensees in other countries may face similar +restrictions.  In all cases, it is licensee's responsibility to comply +with any export regulations applicable in licensee's jurisdiction.+
+ OpenCLRaw.cabal view
@@ -0,0 +1,71 @@+name: OpenCLRaw+version: 1.0.1000+cabal-version: >=1.2+build-type: Simple+license: BSD3+license-file: LICENSE+copyright: Renaissance Computing Institute+maintainer: J.R. Heard+build-depends: base <= 4.1.0.0, bytestring -any, mtl -any+stability: Experimental+homepage: http://vis.renci.org/jeff/opencl+package-url:+bug-reports:+synopsis: The OpenCL Standard for heterogenous data-parallel computing+description: The OpenCL system for open heterogenous data parallel supercomputing.++ **General Notes on the differences between Haskell and the OpenCL-C implementation**++    * Side-effectful procedures capable of returning an error code only return a Maybe ErrorCode, with Nothing returned upon success+    +    * Procedures which follow the pattern of returning a pointer to an object and taking a final parameter as an error code instead return Either ErrorCode ObjectType+    +    * Procedures which prefix with clGetInfo* merely take the object, parameter name, and parameter size to allocate. The allocation handled by OpenCLRaw and returned as a Haskell-managed ForeignPtr ()+    +    * Enumerations and constants are replaced by newtypes for the sake of type-safety.  ++category: Graphics+author: J.R. Heard+tested-with:+data-files:+data-dir: ""+extra-source-files: +extra-tmp-files:+exposed-modules: System.OpenCL.Raw.V10.CommandQueue+                 System.OpenCL.Raw.V10.Context+                 System.OpenCL.Raw.V10.DeviceInfo+                 System.OpenCL.Raw.V10.Errors+                 System.OpenCL.Raw.V10.Etc+                 System.OpenCL.Raw.V10.EventObject+                 System.OpenCL.Raw.V10.FlushFinish+                 System.OpenCL.Raw.V10.Kernel+                 System.OpenCL.Raw.V10.MemoryObject+                 System.OpenCL.Raw.V10.OutOfOrder+                 System.OpenCL.Raw.V10.PlatformInfo+                 System.OpenCL.Raw.V10.ProgramObject+                 System.OpenCL.Raw.V10.Sampler+                 System.OpenCL.Raw.V10.Types+                 System.OpenCL.Raw.V10+exposed: True+buildable: True+build-tools:+cpp-options:+cc-options:+ld-options:+pkgconfig-depends:+frameworks:+c-sources:+extensions:+extra-libraries:+extra-lib-dirs:+includes:+install-includes:+include-dirs:+hs-source-dirs: .+other-modules:+ghc-prof-options:+ghc-shared-options:+ghc-options:+hugs-options:+nhc98-options:+jhc-options:
+ Setup.lhs view
@@ -0,0 +1,6 @@+#!/usr/bin/runhaskell +> module Main where+> import Distribution.Simple+> main :: IO ()+> main = defaultMain+
+ System/OpenCL/Raw/V10.hs view
@@ -0,0 +1,76 @@+{-|+    The OpenCL system for open heterogenous data parallel supercomputing.+    +    Wrapper to the FFI written and maintained by Jeff Heard of the Renaissance Computing Institute <mailto:jeff@renci.org>+    +    From the introduction: +    +    OpenCL (Open Computing Language) is an open royalty-free standard for general purpose +    parallel programming across CPUs, GPUs and other processors, giving software developers +    portable and efficient access to the power of these heterogeneous processing platforms.   ++    OpenCL supports a wide range of applications, ranging from embedded and consumer software +    to HPC solutions, through a low-level, high-performance, portable abstraction.  By creating an +    efficient, close-to-the-metal programming interface, OpenCL will form the foundation layer of a +    parallel computing ecosystem of platform-independent tools, middleware and applications.  +    OpenCL is particularly suited to play an increasingly significant role in emerging interactive +    graphics applications that combine general parallel compute algorithms with graphics rendering +    pipelines. ++    OpenCL consists of an API for coordinating parallel computation across +    heterogeneous processors; and a cross-platform programming language with a well- +    specified computation environment.  The OpenCL standard: ++    * Supports both data- and task-based parallel programming models +    +    * Utilizes a subset of ISO C99 with extensions for parallelism +    +    * Defines consistent numerical requirements based on IEEE 754 +    +    * Defines a configuration profile for handheld and embedded devices +    +    * Efficiently interoperates with OpenGL, OpenGL ES and other graphics APIs+    +    _General Notes on the differences between Haskell and the OpenCL-C implementation_+    +    * Side-effectful procedures capable of returning an error code only return a Maybe ErrorCode, with Nothing returned upon success+    +    * Procedures which follow the pattern of returning a pointer to an object and taking a final parameter as an error code instead+      return Either ErrorCode @ObjectType@ +      +    * Procedures which prefix with clGetInfo* merely take the object, parameter name, and parameter size to allocate.  The allocation+      handled by OpenCLRaw and returned as a Haskell-managed @ForeignPtr ()@+      +    * Enumerations and constants are replaced by newtypes for the sake of type-safety.+-}+module System.OpenCL.Raw.V10 +    (module System.OpenCL.Raw.V10.CommandQueue+    ,module System.OpenCL.Raw.V10.Context+    ,module System.OpenCL.Raw.V10.DeviceInfo+    ,module System.OpenCL.Raw.V10.Errors+    ,module System.OpenCL.Raw.V10.Etc+    ,module System.OpenCL.Raw.V10.EventObject+    ,module System.OpenCL.Raw.V10.FlushFinish+    ,module System.OpenCL.Raw.V10.Kernel+    ,module System.OpenCL.Raw.V10.MemoryObject+    ,module System.OpenCL.Raw.V10.OutOfOrder+    ,module System.OpenCL.Raw.V10.PlatformInfo+    ,module System.OpenCL.Raw.V10.ProgramObject+    ,module System.OpenCL.Raw.V10.Sampler+    ,module System.OpenCL.Raw.V10.Types)    +where++import System.OpenCL.Raw.V10.CommandQueue+import System.OpenCL.Raw.V10.Context+import System.OpenCL.Raw.V10.DeviceInfo+import System.OpenCL.Raw.V10.Errors+import System.OpenCL.Raw.V10.Etc+import System.OpenCL.Raw.V10.EventObject+import System.OpenCL.Raw.V10.FlushFinish+import System.OpenCL.Raw.V10.Kernel+import System.OpenCL.Raw.V10.MemoryObject+import System.OpenCL.Raw.V10.OutOfOrder+import System.OpenCL.Raw.V10.PlatformInfo+import System.OpenCL.Raw.V10.ProgramObject+import System.OpenCL.Raw.V10.Sampler+import System.OpenCL.Raw.V10.Types
+ System/OpenCL/Raw/V10/CommandQueue.hs view
@@ -0,0 +1,46 @@+{-# LANGUAGE ForeignFunctionInterface #-}+{-| +    Corresponds to section 5.1, Command Queues of the OpenCL 1.0 specifications.+-}+module System.OpenCL.Raw.V10.CommandQueue +    (clCreateCommandQueue+    ,clRetainCommandQueue+    ,clGetCommandQueueInfo+    ,clSetCommandQueueProperty)+where++import System.OpenCL.Raw.V10.Types+import System.OpenCL.Raw.V10.Errors+import System.OpenCL.Raw.V10.Utils+import Foreign+import Control.Applicative+import Data.Bits+import Data.Maybe+++foreign import ccall "clCreateCommandQueue" raw_clCreateCommandQueue :: Context -> DeviceID -> CLbitfield -> Ptr CLint -> IO CommandQueue+clCreateCommandQueue :: Context -> DeviceID -> CommandQueueProperties -> IO (Either ErrorCode CommandQueue)+clCreateCommandQueue ctx devid (CommandQueueProperties properties) = +    wrapErrorEither $ raw_clCreateCommandQueue ctx devid properties ++foreign import ccall "clRetainCommandQueue" raw_clRetainCommandQueue :: CommandQueue -> IO CLint+clRetainCommandQueue :: CommandQueue -> IO (Maybe ErrorCode)+clRetainCommandQueue queue = wrapError (raw_clRetainCommandQueue queue)++foreign import ccall "clReleaseCommandQueue" raw_clReleaseCommandQueue :: CommandQueue -> IO CLint+clReleaseCommandQueue :: CommandQueue -> IO (Maybe ErrorCode)+clReleaseCommandQueue queue = wrapError (raw_clReleaseCommandQueue queue)++foreign import ccall "clGetCommandQueueInfo" raw_clGetCommandQueueInfo :: CommandQueue -> CLuint -> CLsizei -> Ptr () -> Ptr CLsizei -> IO CLint+clGetCommandQueueInfo :: CommandQueue -> CommandQueueInfo -> CLsizei -> IO (Either ErrorCode (ForeignPtr (), CLsizei))+clGetCommandQueueInfo ctx (CommandQueueInfo param_name) param_size = wrapGetInfo (raw_clGetCommandQueueInfo ctx param_name) param_size++foreign import ccall "clSetCommandQueueProperty" raw_clSetCommandQueueProperty :: CommandQueue -> CLbitfield -> CLbool -> Ptr CLbitfield -> IO CLint+clSetCommandQueueProperty :: CommandQueue -> CommandQueueProperties -> Bool -> IO (Either ErrorCode CommandQueueProperties)+clSetCommandQueueProperty queue (CommandQueueProperties properties) enable = alloca $ \old_properties -> do +    err <- ErrorCode <$> raw_clSetCommandQueueProperty queue properties (if enable then clTrue else clFalse) old_properties+    if err == clSuccess +        then Right . CommandQueueProperties <$> peek old_properties+        else return . Left $ err+        +
+ System/OpenCL/Raw/V10/Context.hs view
@@ -0,0 +1,62 @@+{-# LANGUAGE ForeignFunctionInterface #-}+{-|+    Conforms to section 4.3 of the OpenCL 1.0 specification+-}+module System.OpenCL.Raw.V10.Context +    (clCreateContext+    ,ContextCallback+    ,clCreateContextFromType+    ,clRetainContext+    ,clReleaseContext+    ,clGetContextInfo+    )+where++import System.OpenCL.Raw.V10.Types+import System.OpenCL.Raw.V10.Errors+import System.OpenCL.Raw.V10.Utils+import Foreign+import Foreign.C+import Control.Applicative+import Data.Bits+import Data.Maybe+++type ContextCallback = (CString -> Ptr () -> CLsizei -> Ptr () -> IO ())+foreign import ccall "clCreateContext" raw_clCreateContext :: Ptr (Ptr CLint) -> CLuint -> Ptr DeviceID -> FunPtr ContextCallback -> Ptr () -> Ptr CLint -> IO Context+foreign import ccall "wrapper" wrapCreateContextCallback :: ContextCallback -> IO (FunPtr ContextCallback)++clCreateContext :: [ContextProperties] -> [DeviceID] -> ContextCallback -> Ptr () -> IO (Either ErrorCode Context)    +clCreateContext properties devices pfn_notify user_dat =+    allocaArray (propertiesN+1) $ \propertiesP -> allocaArray devicesN $ \devicesP -> do+        pokeArray0 nullPtr propertiesP properties+        pokeArray devicesP devices+        fptr <- wrapCreateContextCallback pfn_notify+        wrapErrorEither $ raw_clCreateContext propertiesP (fromIntegral devicesN) devicesP fptr user_dat             +    where propertiesN = length properties+          devicesN = length devices+          +    +foreign import ccall "clCreateContextFromType" raw_clCreateContextFromType :: Ptr ContextProperties -> CLbitfield -> FunPtr ContextCallback -> Ptr a -> Ptr CLint -> IO Context++clCreateContextFromType :: [ContextProperties] -> DeviceType -> ContextCallback -> Ptr () -> IO (Either ErrorCode Context)+clCreateContextFromType properties (DeviceType device_type) pfn_notify user_data = allocaArray (propertiesN+1) $ \propertiesP -> do+    pokeArray0 nullPtr propertiesP properties+    fptr <- wrapCreateContextCallback pfn_notify+    wrapErrorEither $ raw_clCreateContextFromType propertiesP device_type fptr user_data+    where propertiesN = length properties +    +foreign import ccall "clRetainContext" raw_clRetainContext :: Context -> IO CLint+clRetainContext :: Context -> IO (Maybe ErrorCode)+clRetainContext ctx = wrapError (raw_clRetainContext ctx)++foreign import ccall "clReleaseContext" raw_clReleaseContext :: Context -> IO CLint+clReleaseContext :: Context -> IO (Maybe ErrorCode)+clReleaseContext ctx = wrapError (raw_clReleaseContext ctx)++foreign import ccall "clGetContextInfo" raw_clGetContextInfo :: Context -> CLuint -> CLsizei -> Ptr () -> Ptr CLsizei -> IO CLint+clGetContextInfo :: Context -> ContextInfo -> CLsizei -> IO (Either ErrorCode (ForeignPtr (), CLsizei))+clGetContextInfo ctx (ContextInfo param_name) param_size = wrapGetInfo (raw_clGetContextInfo ctx param_name) param_size+++
+ System/OpenCL/Raw/V10/DeviceInfo.hs view
@@ -0,0 +1,28 @@+{-# LANGUAGE ForeignFunctionInterface, ScopedTypeVariables #-}+{-| Conforms to section 4.2 of the OpenCL 1.0 specification -}+module System.OpenCL.Raw.V10.DeviceInfo+    (clGetDeviceIDs+    ,clGetDeviceInfo)+where++import System.OpenCL.Raw.V10.Types+import System.OpenCL.Raw.V10.Errors+import System.OpenCL.Raw.V10.Utils+import Foreign+import Control.Applicative+import Data.Bits+++foreign import ccall "clGetDeviceIDs" raw_clGetDeviceIDs :: PlatformID -> CLbitfield -> CLuint -> Ptr DeviceID -> Ptr CLuint -> IO CLint+clGetDeviceIDs :: PlatformID -> DeviceType -> CLuint -> IO (Either ErrorCode [DeviceID])+clGetDeviceIDs platform (DeviceType device_type) num_entries = alloca $ \(devices::Ptr DeviceID) -> alloca $ \(num_devices::Ptr CLuint) -> do+  errcode <- ErrorCode <$> raw_clGetDeviceIDs platform device_type num_entries devices num_devices+  if errcode == clSuccess+      then Right <$> (peek num_devices >>= \num_devicesN -> peekArray (fromIntegral num_devicesN) devices)+      else return $ Left errcode+      +foreign import ccall "clGetDeviceInfo" raw_clGetDeviceInfo :: DeviceID -> CLuint -> CLsizei -> Ptr () -> Ptr CLsizei -> IO CLint+clGetDeviceInfo :: DeviceID -> DeviceInfo -> CLsizei -> IO (Either ErrorCode (ForeignPtr (), CLsizei))+clGetDeviceInfo obj (DeviceInfo param_name) param_size = wrapGetInfo (raw_clGetDeviceInfo obj param_name) param_size++
+ System/OpenCL/Raw/V10/Errors.hs view
@@ -0,0 +1,142 @@+{-| A collection of all the error codes that OpenCL functions return -}+module System.OpenCL.Raw.V10.Errors where++import System.OpenCL.Raw.V10.Types++clSuccess :: ErrorCode+clSuccess = ErrorCode (0)++clDeviceNotFound :: ErrorCode+clDeviceNotFound = ErrorCode (-1)++clDeviceNotAvailable :: ErrorCode+clDeviceNotAvailable = ErrorCode (-2)++clCompilerNotAvailable :: ErrorCode+clCompilerNotAvailable = ErrorCode (-3)++clMemObjectAllocationFailure :: ErrorCode+clMemObjectAllocationFailure = ErrorCode (-4)++clOutOfResources :: ErrorCode+clOutOfResources = ErrorCode (-5)++clOutOfHostMemory :: ErrorCode+clOutOfHostMemory = ErrorCode (-6)++clProfilingInfoNotAvailable :: ErrorCode+clProfilingInfoNotAvailable = ErrorCode (-7)++clMemCopyOverlap :: ErrorCode+clMemCopyOverlap = ErrorCode (-8)++clImageFormatMismatch :: ErrorCode+clImageFormatMismatch = ErrorCode (-9)++clImageFormatNotSupported :: ErrorCode+clImageFormatNotSupported = ErrorCode (-10)++clBuildProgramFailure :: ErrorCode+clBuildProgramFailure = ErrorCode (-11)++clMapFailure :: ErrorCode+clMapFailure = ErrorCode (-12)++clInvalidValue :: ErrorCode+clInvalidValue = ErrorCode (-30)++clInvalidDeviceType :: ErrorCode+clInvalidDeviceType = ErrorCode (-31)++clInvalidPlatform :: ErrorCode+clInvalidPlatform = ErrorCode (-32)++clInvalidDevice :: ErrorCode+clInvalidDevice = ErrorCode (-33)++clInvalidContext :: ErrorCode+clInvalidContext = ErrorCode (-34)++clInvalidQueueProperties :: ErrorCode+clInvalidQueueProperties = ErrorCode (-35)++clInvalidCommandQueue :: ErrorCode+clInvalidCommandQueue = ErrorCode (-36)++clInvalidHostPtr :: ErrorCode+clInvalidHostPtr = ErrorCode (-37)++clInvalidMemObject :: ErrorCode+clInvalidMemObject = ErrorCode (-38)++clInvalidImageFormatDescriptor :: ErrorCode+clInvalidImageFormatDescriptor = ErrorCode (-39)++clInvalidImageSize :: ErrorCode+clInvalidImageSize = ErrorCode (-40)++clInvalidSampler :: ErrorCode+clInvalidSampler = ErrorCode (-41)++clInvalidBinary :: ErrorCode+clInvalidBinary = ErrorCode (-42)++clInvalidBuildOptions :: ErrorCode+clInvalidBuildOptions = ErrorCode (-43)++clInvalidProgram :: ErrorCode+clInvalidProgram = ErrorCode (-44)++clInvalidProgramExecutable :: ErrorCode+clInvalidProgramExecutable = ErrorCode (-45)++clInvalidKernelName :: ErrorCode+clInvalidKernelName = ErrorCode (-46)++clInvalidKernelDefinition :: ErrorCode+clInvalidKernelDefinition = ErrorCode (-47)++clInvalidKernel :: ErrorCode+clInvalidKernel = ErrorCode (-48)++clInvalidArgIndex :: ErrorCode+clInvalidArgIndex = ErrorCode (-49)++clInvalidArgValue :: ErrorCode+clInvalidArgValue = ErrorCode (-50)++clInvalidArgSize :: ErrorCode+clInvalidArgSize = ErrorCode (-51)++clInvalidKernelArgs :: ErrorCode+clInvalidKernelArgs = ErrorCode (-52)++clInvalidWorkDimension :: ErrorCode+clInvalidWorkDimension = ErrorCode (-53)++clInvalidWorkGroupSize :: ErrorCode+clInvalidWorkGroupSize = ErrorCode (-54)+clInvalidWorkItemSize :: ErrorCode++clInvalidWorkItemSize = ErrorCode (-55)+clInvalidGlobalOffset :: ErrorCode++clInvalidGlobalOffset = ErrorCode (-56)+clInvalidEventWaitList :: ErrorCode++clInvalidEventWaitList = ErrorCode (-57)+clInvalidEvent :: ErrorCode++clInvalidEvent = ErrorCode (-58)+clInvalidOperation :: ErrorCode++clInvalidOperation = ErrorCode (-59)+clInvalidGLObject :: ErrorCode++clInvalidGLObject = ErrorCode (-60)+clInvalidBufferSize :: ErrorCode++clInvalidBufferSize = ErrorCode (-61)+clInvalidMipLevel = ErrorCode (-62)++
+ System/OpenCL/Raw/V10/Etc.hs view
@@ -0,0 +1,16 @@+{-# LANGUAGE ForeignFunctionInterface #-}+{-| Module for querying extensions -}+module System.OpenCL.Raw.V10.Etc +    (clGetExtensionFunctionAddress)+where++import System.OpenCL.Raw.V10.Types+import System.OpenCL.Raw.V10.Errors+import System.OpenCL.Raw.V10.Utils+import Foreign+import Foreign.C+import Control.Applicative++foreign import ccall "clGetExtensionFunctionAddress" raw_clGetExtensionFunctionAddress :: CString -> IO (Ptr ())+clGetExtensionFunctionAddress :: String -> IO (Ptr ())+clGetExtensionFunctionAddress str = withCString str raw_clGetExtensionFunctionAddress
+ System/OpenCL/Raw/V10/EventObject.hs view
@@ -0,0 +1,38 @@+{-# LANGUAGE ForeignFunctionInterface #-}+{-| Conforms to section 5.7 of the OpenCL 1.0 specification -}+module System.OpenCL.Raw.V10.EventObject +    (clWaitForEvents+    ,clGetEventInfo+    ,clRetainEvent+    ,clReleaseEvent+    ,clGetEventProfilingInfo)+where ++import System.OpenCL.Raw.V10.Types+import System.OpenCL.Raw.V10.Errors+import System.OpenCL.Raw.V10.Utils+import System.OpenCL.Raw.V10.Utils+import Foreign+import Control.Applicative+++foreign import ccall "clWaitForEvents" raw_clWaitForEvents :: CLuint -> Ptr Event -> IO CLint+clWaitForEvents :: [Event] -> IO (Maybe ErrorCode)+clWaitForEvents evts = allocaArray nEvents $ \eventP -> pokeArray eventP evts >> (wrapError $ raw_clWaitForEvents (fromIntegral nEvents) eventP)+    where nEvents = length evts+                            +foreign import ccall "clGetEventInfo" raw_clGetEventInfo :: Event -> CLuint -> CLsizei -> Ptr () -> Ptr CLsizei -> IO CLint+clGetEventInfo :: Event -> EventInfo -> CLsizei -> IO (Either ErrorCode (ForeignPtr (), CLsizei))+clGetEventInfo obj (EventInfo param_name) param_size = wrapGetInfo (raw_clGetEventInfo obj param_name) param_size++foreign import ccall "clRetainEvent" raw_clRetainEvent :: Event -> IO CLint +clRetainEvent :: Event -> IO (Maybe ErrorCode)+clRetainEvent evt = wrapError $ raw_clRetainEvent evt++foreign import ccall "clReleaseEvent" raw_clReleaseEvent :: Event -> IO CLint +clReleaseEvent :: Event -> IO (Maybe ErrorCode)+clReleaseEvent evt = wrapError $ raw_clReleaseEvent evt ++foreign import ccall "clGetEventProfilingInfo" raw_clGetEventProfilingInfo :: Event -> CLuint -> CLsizei -> Ptr () -> Ptr CLsizei -> IO CLint+clGetEventProfilingInfo :: Event -> ProfilingInfo -> CLsizei -> IO (Either ErrorCode (ForeignPtr (), CLsizei))+clGetEventProfilingInfo obj (ProfilingInfo param_name) param_size = wrapGetInfo (raw_clGetEventProfilingInfo obj param_name) param_size                                
+ System/OpenCL/Raw/V10/FlushFinish.hs view
@@ -0,0 +1,21 @@+{-# LANGUAGE ForeignFunctionInterface #-}+{-| Conforms to section 5.10 of the OpenCL 1.0 specification -}+module System.OpenCL.Raw.V10.FlushFinish +    (clFlush+    ,clFinish)+where++import System.OpenCL.Raw.V10.Types+import System.OpenCL.Raw.V10.Errors+import System.OpenCL.Raw.V10.Utils+import Foreign+import Control.Applicative++foreign import ccall "clFlush" raw_clFlush :: CommandQueue -> IO CLint+clFlush :: CommandQueue -> IO (Maybe ErrorCode)+clFlush queue = wrapError $ raw_clFlush queue++foreign import ccall "clFinish" raw_clFinish :: CommandQueue -> IO CLint+clFinish :: CommandQueue -> IO (Maybe ErrorCode)+clFinish queue = wrapError $ raw_clFinish queue+
+ System/OpenCL/Raw/V10/Kernel.hs view
@@ -0,0 +1,109 @@+{-# LANGUAGE ForeignFunctionInterface #-}+{-| Conforms to section 5.5 of the OpenCL 1.0 specification -}+module System.OpenCL.Raw.V10.Kernel +    (clCreateKernel+    ,clCreateKernelsInProgram+    ,clRetainKernel+    ,clReleaseKernel+    ,clGetKernelInfo+    ,clGetKernelWorkGroupInfo+    ,clEnqueueNDRangeKernel+    ,clEnqueueTask+    ,clEnqueueNativeKernel)+where++import System.OpenCL.Raw.V10.Types+import System.OpenCL.Raw.V10.Errors+import System.OpenCL.Raw.V10.Utils+import Foreign+import Foreign.C+import Control.Applicative+import Data.Maybe+++foreign import ccall "clCreateKernel" raw_clCreateKernel :: Program -> CString -> Ptr CLint -> IO Kernel +clCreateKernel program kernel_name = wrapErrorEither $ raw_clCreateKernel program kernel_name ++foreign import ccall "clCreateKernelsInProgram" raw_clCreateKernelsInProgram :: Program -> CLuint -> Ptr Kernel -> Ptr CLuint -> IO CLint +clCreateKernelsInProgram :: Program -> CLuint -> IO (Either ErrorCode [Kernel])+clCreateKernelsInProgram program num_kernels = allocaArray (fromIntegral num_kernels) $ \kernels -> alloca $ \num_kernels_ret -> do+    err <- wrapError $ raw_clCreateKernelsInProgram program num_kernels kernels num_kernels_ret+    if err== Nothing+        then do +            nkr <- peek num_kernels_ret+            Right <$> peekArray (fromIntegral nkr) kernels+        else+            return $ Left . fromJust $ err++foreign import ccall "clRetainKernel" raw_clRetainKernel :: Kernel -> IO CLint +clRetainKernel :: Kernel -> IO (Maybe ErrorCode)+clRetainKernel kernel = wrapError $ raw_clRetainKernel kernel++foreign import ccall "clReleaseKernel" raw_clReleaseKernel :: Kernel -> IO CLint +clReleaseKernel :: Kernel -> IO (Maybe ErrorCode)+clReleaseKernel kernel = wrapError $ raw_clRetainKernel kernel++foreign import ccall "clSetKernelArg" raw_clSetKernelArg :: Kernel -> CLuint -> CLsizei -> Ptr () -> IO CLint+clSetKernelArg :: Kernel -> CLuint -> CLsizei -> Ptr () -> IO (Maybe ErrorCode)+clSetKernelArg kernel arg_index arg_size arg_value = +    wrapError $ raw_clSetKernelArg kernel arg_index arg_size arg_value++foreign import ccall "clGetKernelInfo" raw_clGetKernelInfo :: Kernel -> CLuint -> CLsizei -> Ptr () -> Ptr CLsizei -> IO CLint+clGetKernelInfo :: Kernel -> KernelInfo -> CLsizei -> IO (Either ErrorCode (ForeignPtr (), CLsizei))+clGetKernelInfo kernel (KernelInfo param_name) param_value_size = wrapGetInfo (raw_clGetKernelInfo kernel param_name) param_value_size++foreign import ccall "clGetKernelWorkGroupInfo" raw_clGetKernelWorkGroupInfo :: Kernel -> DeviceID -> CLuint -> CLsizei -> Ptr () -> Ptr CLsizei -> IO CLint+clGetKernelWorkGroupInfo :: Kernel -> DeviceID -> KernelWorkGroupInfo -> CLsizei -> IO (Either ErrorCode (ForeignPtr (), CLsizei))+clGetKernelWorkGroupInfo kernel device (KernelWorkGroupInfo param_name) param_value_size = wrapGetInfo (raw_clGetKernelWorkGroupInfo kernel device param_name) param_value_size++foreign import ccall "clEnqueueNDRangeKernel" raw_clEnqueueNDRangeKernel :: CommandQueue -> Kernel -> CLuint -> Ptr CLsizei -> Ptr CLsizei -> Ptr CLsizei -> CLuint -> Ptr Event  -> Ptr Event -> IO CLint+clEnqueueNDRangeKernel :: CommandQueue -> Kernel -> [CLsizei] -> [CLsizei] -> [Event] -> IO (Either ErrorCode Event) +clEnqueueNDRangeKernel queue kernel global_work_sizeL local_work_sizeL event_wait_listL = +    allocaArray work_dim $ \global_work_size ->+    allocaArray work_dim $ \local_work_size ->+    allocaArray num_events_in_wait_list $ \event_wait_list ->+    alloca $ \event -> do+        pokeArray global_work_size global_work_sizeL+        pokeArray local_work_size local_work_sizeL+        pokeArray event_wait_list event_wait_listL+        err <- wrapError $ raw_clEnqueueNDRangeKernel queue kernel (fromIntegral work_dim) nullPtr global_work_size local_work_size (fromIntegral num_events_in_wait_list) event_wait_list event+        if err == Nothing+            then Right <$> peek event+            else return $ Left . fromJust $ err+    where work_dim = length global_work_sizeL+          num_events_in_wait_list = length event_wait_listL+        +foreign import ccall "clEnqueueTask" raw_clEnqueueTask :: CommandQueue -> Kernel -> CLuint -> Ptr Event -> Ptr Event -> IO CLint+clEnqueueTask :: CommandQueue -> Kernel -> [Event] -> IO (Either ErrorCode Event)+clEnqueueTask queue kernel event_wait_listL = +    allocaArray num_events_in_wait_list $ \event_wait_list ->+    alloca $ \event -> do+        pokeArray event_wait_list event_wait_listL+        err <- wrapError $ raw_clEnqueueTask queue kernel (fromIntegral num_events_in_wait_list) event_wait_list event +        if err == Nothing+            then Right <$> peek event+            else return $ Left . fromJust $ err+    where num_events_in_wait_list = length event_wait_listL++type NKCallbackFunction = Ptr () -> IO ()+foreign import ccall "wrapper" wrapNativeKernelCallback :: NKCallbackFunction -> IO (FunPtr NKCallbackFunction)+foreign import ccall "clEnqueueNativeKernel" raw_clEnqueueNativeKernel :: FunPtr NKCallbackFunction -> Ptr () -> CLsizei -> CLuint -> Ptr Mem -> Ptr (Ptr ()) -> CLuint -> Ptr Event -> Ptr Event -> IO CLint +clEnqueueNativeKernel :: NKCallbackFunction -> Ptr () -> CLsizei -> [Mem] -> [Ptr ()] -> [Event] -> IO (Either ErrorCode Event)+clEnqueueNativeKernel user_funcF args cb_args mem_listL args_mem_locL event_wait_listL = +    allocaArray num_events_in_wait_list $ \event_wait_list ->+    allocaArray num_mem_objects $ \mem_list ->+    allocaArray (length args_mem_locL) $ \args_mem_loc -> +    alloca $ \event -> do+        user_func <- wrapNativeKernelCallback user_funcF+        pokeArray event_wait_list event_wait_listL+        pokeArray mem_list mem_listL+        pokeArray args_mem_loc args_mem_locL+        err <- wrapError $ raw_clEnqueueNativeKernel user_func args cb_args (fromIntegral num_mem_objects) mem_list args_mem_loc (fromIntegral num_events_in_wait_list) event_wait_list event+        if err == Nothing+            then Right <$> peek event+            else return $ Left . fromJust $ err+    where num_events_in_wait_list = length event_wait_listL+          num_mem_objects = length mem_listL+++
+ System/OpenCL/Raw/V10/MemoryObject.hs view
@@ -0,0 +1,232 @@+{-# LANGUAGE ForeignFunctionInterface #-}+{-| Conforms to section 5.2 of the OpenCL 1.0 specification -}+module System.OpenCL.Raw.V10.MemoryObject +    (clCreateBuffer+    ,clCreateImage2D+    ,clCreateImage3D+    ,clRetainMemObject+    ,clReleaseMemObject+    ,clGetSupportedImageFormats+    ,clGetMemObjectInfo+    ,clGetImageInfo+    ,clEnqueueReadBuffer+    ,clEnqueueWriteBuffer+    ,clEnqueueCopyBuffer+    ,clEnqueueReadImage+    ,clEnqueueWriteImage+    ,clEnqueueCopyImage+    ,clEnqueueCopyImageToBuffer+    ,clEnqueueCopyBufferToImage+    ,clEnqueueMapBuffer+    ,clEnqueueMapImage+    ,clEnqueueUnmapMemObject)+where++import System.OpenCL.Raw.V10.Types+import System.OpenCL.Raw.V10.Errors+import System.OpenCL.Raw.V10.Utils+import Foreign+import Control.Applicative+import Data.Maybe+import Data.Bits+++foreign import ccall "clCreateBuffer" raw_clCreateBuffer :: Context -> CLbitfield -> CLsizei -> Ptr () -> Ptr CLint -> IO Mem+clCreateBuffer :: Context -> MemFlags -> CLsizei -> Ptr () -> IO (Either ErrorCode Mem)+clCreateBuffer ctx (MemFlags flags) size host_ptr = wrapErrorEither $ raw_clCreateBuffer ctx flags size host_ptr +              +foreign import ccall "clCreateImage2D" raw_clCreateImage2D :: Context -> CLbitfield -> Ptr CLuint -> CLsizei -> CLsizei -> CLsizei -> Ptr () -> Ptr CLint -> IO Mem+clCreateImage2D :: Context -> MemFlags -> ImageFormat -> CLsizei -> CLsizei -> CLsizei -> Ptr () -> IO (Either ErrorCode Mem)+clCreateImage2D ctx (MemFlags memflags) (ChannelOrder corder, ChannelType ctype) image_width image_height image_row_pitch host_ptr = allocaArray 2 $ \image_format -> do+    pokeArray image_format [corder,ctype] +    wrapErrorEither $ raw_clCreateImage2D ctx memflags image_format image_width image_height image_row_pitch host_ptr+                        +foreign import ccall "clCreateImage3D" raw_clCreateImage3D :: Context -> CLbitfield -> Ptr CLuint -> CLsizei -> CLsizei -> CLsizei -> CLsizei -> CLsizei -> Ptr () -> Ptr CLint -> IO Mem+clCreateImage3D :: Context -> MemFlags -> ImageFormat -> CLsizei -> CLsizei -> CLsizei -> CLsizei -> CLsizei -> Ptr () -> IO (Either ErrorCode Mem)+clCreateImage3D ctx (MemFlags memflags) (ChannelOrder corder, ChannelType ctype) image_width image_height image_depth image_row_pitch image_slice_pitch host_ptr = allocaArray 2 $ \image_format -> do+    pokeArray image_format [corder,ctype] +    wrapErrorEither $ raw_clCreateImage3D ctx memflags image_format image_width image_height image_depth image_row_pitch image_slice_pitch host_ptr +                        +foreign import ccall "clRetainMemObject" raw_clRetainMemObject :: Mem -> IO CLint+clRetainMemObject :: Mem -> IO (Maybe ErrorCode) +clRetainMemObject mem = wrapError $ raw_clRetainMemObject mem++foreign import ccall "clReleaseMemObject" raw_clReleaseMemObject :: Mem -> IO CLint+clReleaseMemObject :: Mem -> IO (Maybe ErrorCode) +clReleaseMemObject mem = wrapError $ raw_clReleaseMemObject mem+                                    +foreign import ccall "clGetSupportedImageFormats" raw_clGetSupportedImageFormats :: Context -> CLbitfield -> CLuint -> CLuint -> Ptr CLuint -> Ptr CLuint -> IO CLint+clGetSupportedImageFormats :: Context -> MemFlags -> MemObjectType -> IO (Either ErrorCode [ImageFormat])+clGetSupportedImageFormats ctx (MemFlags flags) (MemObjectType image_type) = allocaArray 512 $ \image_formats -> alloca $ \num_image_formats -> do+    err <- wrapError $ raw_clGetSupportedImageFormats ctx flags image_type 512 image_formats num_image_formats+    maybe (do num_image_formatsN <- peek num_image_formats+              image_formatsN <- peekArray (fromIntegral num_image_formatsN*2) image_formats+              let sift (a:b:cs) = (ChannelOrder a,ChannelType b) : sift cs+                  sift [] = [] +              return . Right $ sift image_formatsN )+          (return . Left) +          err++foreign import ccall "clGetMemObjectInfo" raw_clGetMemObjectInfo :: Mem -> CLuint -> CLsizei -> Ptr () -> Ptr CLsizei -> IO CLint+clGetMemObjectInfo :: Mem -> MemInfo -> CLsizei -> IO (Either ErrorCode (ForeignPtr (), CLsizei))+clGetMemObjectInfo mem (MemInfo param_name) param_value_size = wrapGetInfo (raw_clGetMemObjectInfo mem param_name) param_value_size ++foreign import ccall "clGetImageInfo" raw_clGetImageInfo :: Mem -> CLuint -> CLsizei -> Ptr () -> Ptr CLsizei -> IO CLint+clGetImageInfo :: Mem -> MemInfo -> CLsizei -> IO (Either ErrorCode (ForeignPtr (), CLsizei))+clGetImageInfo mem (MemInfo param_name) param_value_size = wrapGetInfo (raw_clGetImageInfo mem param_name) param_value_size +        +enqueue :: (CommandQueue -> CLuint -> Ptr Event -> Ptr Event -> IO CLint) -> CommandQueue -> [Event] -> IO (Either ErrorCode Event)      +enqueue fn queue events = alloca $ \event -> allocaArray events_in_wait_list $ \event_wait_list -> do+    pokeArray event_wait_list events+    err <- wrapError $ fn queue (fromIntegral events_in_wait_list) event_wait_list event+    if err == Nothing +        then Right <$> peek event +        else return (Left . fromJust $ err)+    where events_in_wait_list = length events+    +    +foreign import ccall "clEnqueueReadBuffer" raw_clEnqueueReadBuffer :: CommandQueue -> Mem -> CLbool -> CLsizei -> CLsizei -> Ptr () -> CLuint -> Ptr Event -> Ptr Event -> IO CLint+clEnqueueReadBuffer buffer blocking_read offset cb ptr = +    enqueue (\command_queue num_events_in_wait_list event_wait_list event -> +                raw_clEnqueueReadBuffer +                    command_queue +                    buffer +                    (if blocking_read then clTrue else clFalse) +                    offset +                    cb +                    ptr +                    num_events_in_wait_list +                    event_wait_list +                    event)+                            ++foreign import ccall "clEnqueueWriteBuffer" raw_clEnqueueWriteBuffer :: CommandQueue -> Mem -> CLbool -> CLsizei -> CLsizei -> Ptr () -> CLuint -> Ptr Event -> Ptr Event -> IO CLint+clEnqueueWriteBuffer buffer blocking_write offset cb ptr = +    enqueue (\command_queue num_events_in_wait_list event_wait_list event -> +                raw_clEnqueueWriteBuffer command_queue buffer (if blocking_write then clTrue else clFalse) offset cb ptr num_events_in_wait_list event_wait_list event)  +++foreign import ccall "clEnqueueCopyBuffer" raw_clEnqueueCopyBuffer :: CommandQueue -> Mem -> Mem -> CLsizei -> CLsizei -> CLsizei -> CLuint -> Ptr Event -> Ptr Event -> IO CLint+clEnqueueCopyBuffer src_buffer dst_buffer src_offset dst_offset cb = +    enqueue (\command_queue num_events_in_wait_list event_wait_list event -> +                raw_clEnqueueCopyBuffer command_queue src_buffer dst_buffer src_offset dst_offset cb num_events_in_wait_list event_wait_list event)                       ++type ImageDims = (CLsizei,CLsizei,CLsizei)+foreign import ccall "clEnqueueReadImage" raw_clEnqueueReadImage :: CommandQueue -> Mem -> CLbool -> Ptr CLsizei -> Ptr CLsizei -> CLsizei -> CLsizei -> Ptr () -> CLuint -> Ptr Event -> Ptr Event -> IO CLint+clEnqueueReadImage image blocking_read (oa,ob,oc) (ra,rb,rc) row_pitch slice_pitch ptr = +    enqueue (\command_queue num_events_in_wait_list event_wait_list event -> allocaArray 3 $ \origin -> allocaArray 3 $ \region -> do +                pokeArray region [ra,rb,rc]+                pokeArray origin [oa,ob,oc]+                raw_clEnqueueReadImage command_queue image (if blocking_read then clTrue else clFalse) origin region row_pitch slice_pitch ptr num_events_in_wait_list event_wait_list event) +                    +foreign import ccall "clEnqueueWriteImage" raw_clEnqueueWriteImage :: CommandQueue -> Mem -> CLbool -> Ptr CLsizei -> Ptr CLsizei -> CLsizei -> CLsizei -> Ptr () -> CLuint -> Ptr Event -> Ptr Event -> IO CLint+clEnqueueWriteImage image blocking_read (oa,ob,oc) (ra,rb,rc) row_pitch slice_pitch ptr = +    enqueue (\command_queue num_events_in_wait_list event_wait_list event -> allocaArray 3 $ \origin -> allocaArray 3 $ \region -> do +                pokeArray region [ra,rb,rc]+                pokeArray origin [oa,ob,oc]+                raw_clEnqueueWriteImage command_queue image (if blocking_read then clTrue else clFalse) origin region row_pitch slice_pitch ptr num_events_in_wait_list event_wait_list event)                 ++foreign import ccall "clEnqueueCopyImage" raw_clEnqueueCopyImage :: CommandQueue -> Mem -> Mem -> Ptr CLsizei -> Ptr CLsizei -> Ptr CLsizei -> CLuint -> Ptr Event -> Ptr Event -> IO CLint+clEnqueueCopyImage :: Mem -> Mem -> ImageDims -> ImageDims -> ImageDims -> CommandQueue -> [Event] -> IO (Either ErrorCode Event)  +clEnqueueCopyImage src_image dst_image (soa,sob,soc) (doa,dob,doc) (ra,rb,rc) = +    enqueue (\command_queue num_events_in_wait_list event_wait_list event -> allocaArray 3 $ \src_origin -> allocaArray 3 $ \dst_origin -> allocaArray 3 $ \region -> do +                pokeArray region [ra,rb,rc]+                pokeArray src_origin [soa,sob,soc]+                pokeArray dst_origin [doa,dob,doc]+                raw_clEnqueueCopyImage command_queue src_image dst_image src_origin dst_origin region num_events_in_wait_list event_wait_list event)++                           +foreign import ccall "clEnqueueCopyImageToBuffer" raw_clEnqueueCopyImageToBuffer :: CommandQueue -> Mem -> Mem -> Ptr CLsizei -> Ptr CLsizei -> CLsizei -> CLuint -> Ptr Event -> Ptr Event -> IO CLint +clEnqueueCopyImageToBuffer :: Mem -> Mem -> ImageDims -> ImageDims -> CLsizei -> CommandQueue -> [Event] -> IO (Either ErrorCode Event)  +clEnqueueCopyImageToBuffer src_image dst_buffer (soa,sob,soc) (ra,rb,rc) dst_offset = +    enqueue (\command_queue num_events_in_wait_list event_wait_list event -> allocaArray 3 $ \src_origin -> allocaArray 3 $ \region -> do +                pokeArray region [ra,rb,rc]+                pokeArray src_origin [soa,sob,soc]+                raw_clEnqueueCopyImageToBuffer +                    command_queue +                    src_image +                    dst_buffer +                    src_origin +                    region +                    dst_offset +                    num_events_in_wait_list +                    event_wait_list +                    event)+++foreign import ccall "clEnqueueCopyBufferToImage" raw_clEnqueueCopyBufferToImage :: CommandQueue -> Mem -> Mem -> CLsizei -> Ptr CLsizei -> Ptr CLsizei -> CLuint -> Ptr Event -> Ptr Event -> IO CLint +clEnqueueCopyBufferToImage :: Mem -> Mem -> CLsizei -> ImageDims -> ImageDims -> CommandQueue -> [Event] -> IO (Either ErrorCode Event)  +clEnqueueCopyBufferToImage src_buffer dst_image src_offset (soa,sob,soc) (ra,rb,rc) = +    enqueue (\command_queue num_events_in_wait_list event_wait_list event -> allocaArray 3 $ \dst_origin -> allocaArray 3 $ \region -> do +                pokeArray region [ra,rb,rc]+                pokeArray dst_origin [soa,sob,soc]+                raw_clEnqueueCopyBufferToImage +                    command_queue +                    src_buffer +                    dst_image +                    src_offset +                    dst_origin +                    region +                    num_events_in_wait_list +                    event_wait_list +                    event)+++foreign import ccall "clEnqueueMapBuffer" raw_clEnqueueMapBuffer :: CommandQueue -> Mem -> CLbool -> CLbitfield -> CLsizei -> CLsizei -> CLuint -> Ptr Event -> Ptr Event -> Ptr CLint -> IO (Ptr ())+clEnqueueMapBuffer :: Mem -> Bool -> MapFlags -> CLsizei -> CLsizei -> CommandQueue -> [Event] -> IO (Either ErrorCode (Ptr (),Event))+clEnqueueMapBuffer buffer blocking_map (MapFlags map_flags) offset cb command_queue events = +    allocaArray num_events_in_wait_list $ \event_wait_list -> alloca $ \event -> do+        ret <- wrapErrorEither $ raw_clEnqueueMapBuffer +            command_queue +            buffer +            (if blocking_map then clTrue else clFalse) +            map_flags +            offset +            cb +            (fromIntegral num_events_in_wait_list) +            event_wait_list +            event+        case ret of +            Left err -> return (Left err)+            Right ptr -> peek event >>= \event -> return $ Right (ptr,event)+    where num_events_in_wait_list = length events++foreign import ccall "clEnqueueMapImage" raw_clEnqueueMapImage :: CommandQueue -> Mem -> CLbool -> CLbitfield -> Ptr CLsizei -> Ptr CLsizei -> Ptr CLsizei -> Ptr CLsizei -> CLuint -> Ptr Event -> Ptr Event -> Ptr CLint -> IO (Ptr ())+clEnqueueMapImage :: Mem -> Bool -> MapFlags -> ImageDims -> ImageDims -> CommandQueue -> [Event] -> IO (Either ErrorCode (Ptr (),CLsizei,CLsizei,Event))+clEnqueueMapImage buffer blocking_map (MapFlags map_flags) (oa,ob,oc) (ra,rb,rc) command_queue events = +    allocaArray num_events_in_wait_list $ \event_wait_list -> +    alloca $ \event -> +    allocaArray 3 $ \region -> +    allocaArray 3 $ \origin -> +    alloca $ \image_row_pitch -> +    alloca $ \image_slice_pitch -> do+        pokeArray origin [oa,ob,oc]+        pokeArray region [ra,rb,rc]        +        ret <- wrapErrorEither $ raw_clEnqueueMapImage+            command_queue +            buffer +            (if blocking_map then clTrue else clFalse) +            map_flags +            origin +            region +            image_row_pitch +            image_slice_pitch +            (fromIntegral num_events_in_wait_list) +            event_wait_list +            event+        case ret of +            Left err -> return (Left err)+            Right ptr -> do +                event' <- peek event+                image_row_pitch' <- peek image_row_pitch+                image_slice_pitch' <- peek image_slice_pitch+                return  $ Right (ptr,image_row_pitch',image_slice_pitch', event') +        where num_events_in_wait_list = length events+                  ++foreign import ccall "clEnqueueUnmapMemObject" raw_clEnqueueUnmapMemObject :: CommandQueue -> Mem -> Ptr () -> CLuint -> Ptr Event -> Ptr Event -> IO CLint+clEnqueueUnmapMemObject mem mapped_ptr = enqueue+    (\command_queue num_events_in_wait_list event_wait_list event -> +        raw_clEnqueueUnmapMemObject command_queue mem mapped_ptr num_events_in_wait_list event_wait_list event)++
+ System/OpenCL/Raw/V10/OutOfOrder.hs view
@@ -0,0 +1,36 @@+{-# LANGUAGE ForeignFunctionInterface #-}+{-| Conforms to section 5.8 of the OpenCL 1.0 specification -}+module System.OpenCL.Raw.V10.OutOfOrder+    (clEnqueueMarker+    ,clEnqueueWaitForEvents+    ,clEnqueueBarrier)+where ++import System.OpenCL.Raw.V10.Types+import System.OpenCL.Raw.V10.Errors+import System.OpenCL.Raw.V10.Utils+import Foreign+import Control.Applicative+import Data.Maybe++foreign import ccall "clEnqueueMarker" raw_clEnqueueMarker :: CommandQueue -> Ptr Event -> IO CLint +clEnqueueMarker :: CommandQueue -> IO (Either ErrorCode Event)+clEnqueueMarker queue = alloca $ \eventP -> do+    err <- wrapError $ raw_clEnqueueMarker queue eventP+    if err == Nothing +        then Right <$> peek eventP+        else return $ Left . fromJust $  err+    +foreign import ccall "clEnqueueWaitForEvents" raw_clEnqueueWaitForEvents :: CommandQueue -> CLuint -> Ptr Event -> IO CLint+clEnqueueWaitForEvents :: CommandQueue -> [Event] -> IO (Maybe ErrorCode)+clEnqueueWaitForEvents queue events = +    allocaArray num_events $ \eventsP -> do+        pokeArray eventsP events+        wrapError $ raw_clEnqueueWaitForEvents queue (fromIntegral num_events) eventsP +    where num_events = length events++foreign import ccall "clEnqueueBarrier" raw_clEnqueueBarrier :: CommandQueue -> IO CLint +clEnqueueBarrier :: CommandQueue -> IO (Maybe ErrorCode) +clEnqueueBarrier queue = wrapError $ raw_clEnqueueBarrier queue++
+ System/OpenCL/Raw/V10/PlatformInfo.hs view
@@ -0,0 +1,35 @@+{-# LANGUAGE ForeignFunctionInterface, ScopedTypeVariables #-}+{-| Conforms to section 4.1 of the OpenCL 1.0 specification -}+module System.OpenCL.Raw.V10.PlatformInfo (+    clGetPlatformIDs+  , clGetPlatformInfo+  ) where++import System.OpenCL.Raw.V10.Types+import System.OpenCL.Raw.V10.Errors+import System.OpenCL.Raw.V10.Utils+import Foreign+import Foreign.C+import Control.Applicative+import Data.Maybe+++foreign import ccall "clGetPlatformIDs" raw_clGetPlatformIDs :: CLuint -> Ptr PlatformID -> Ptr CLuint -> IO CLint+++clGetPlatformIDs :: CLuint -> IO (Either ErrorCode [PlatformID])+clGetPlatformIDs num_entries = alloca $ \(platforms::Ptr PlatformID) -> alloca $ \(num_platforms::Ptr CLuint) -> do+  errcode <- ErrorCode <$> raw_clGetPlatformIDs (fromIntegral num_entries) platforms num_platforms+  if errcode == clSuccess+      then Right <$> (peek num_platforms >>= \num_platformsN -> peekArray (fromIntegral num_platformsN) platforms)+      else return $ Left errcode+      +      +foreign import ccall "clGetPlatformInfo" raw_clGetPlatformInfo :: PlatformID -> CLuint -> CSize -> Ptr () -> Ptr CSize -> IO CLint ++clGetPlatformInfo :: PlatformID -> PlatformInfo -> CLsizei -> Ptr () -> IO (Either ErrorCode CLsizei)+clGetPlatformInfo mem (PlatformInfo param_name) param_value_size param_value = alloca $ \param_value_size_ret -> do+    err <- wrapError $ raw_clGetPlatformInfo mem param_name param_value_size param_value param_value_size_ret+    if err == Nothing+        then peek param_value_size_ret >>= return . Right +        else return . Left . fromJust $ err
+ System/OpenCL/Raw/V10/ProgramObject.hs view
@@ -0,0 +1,86 @@+{-# LANGUAGE ForeignFunctionInterface #-}+{-| Conforms to section 5.4 of the OpenCL 1.0 specification -}+module System.OpenCL.Raw.V10.ProgramObject +    (clCreateProgramWithSource+    ,clCreateProgramWithBinary+    ,clRetainProgram+    ,clReleaseProgram+    ,clBuildProgram+    ,clUnloadCompiler+    ,clGetProgramInfo+    ,clGetProgramBuildInfo)+where++import Control.Monad.Cont+import System.OpenCL.Raw.V10.Types+import System.OpenCL.Raw.V10.Errors+import System.OpenCL.Raw.V10.Utils+import Foreign+import Foreign.C+import Control.Applicative+import qualified Data.ByteString as SBS+import qualified Data.ByteString.Internal as SBS++foreign import ccall "clCreateProgramWithSource" raw_clCreateProgramWithSource :: Context -> CLuint -> Ptr CString -> Ptr CLsizei -> Ptr CLint -> IO Program+clCreateProgramWithSource :: Context -> String -> IO (Either ErrorCode Program) +clCreateProgramWithSource ctx source_code = do+    let count = length strings+        strings = lines source_code+        lengths = (fromIntegral . length) <$> strings+    withArray lengths $ (\lengthsP -> +        withCStringArray0 strings $ (\stringsP -> +            wrapErrorEither $ raw_clCreateProgramWithSource ctx (fromIntegral count) stringsP lengthsP))   ++foreign import ccall "clCreateProgramWithBinary" raw_clCreateProgramWithBinary :: Context -> CLuint -> Ptr DeviceID -> Ptr CLsizei -> Ptr (Ptr Word8) -> Ptr CLint -> Ptr CLint -> IO Program+clCreateProgramWithBinary :: Context -> [(DeviceID,SBS.ByteString)] ->  IO (Either ErrorCode Program)+clCreateProgramWithBinary context devbin_pair = +    allocaArray num_devices $ \lengths -> +    allocaArray num_devices $ \binaries ->+    allocaArray num_devices $ \devices -> +    alloca $ \binary_status ->+    alloca $ \errcode_ret -> do+        pokeArray lengths (map (fromIntegral . SBS.length) bins)+        pokeArray devices device_list+        pokeArray binaries ((unsafeForeignPtrToPtr . bsPtr) `map` bins) +        program <- raw_clCreateProgramWithBinary context (fromIntegral num_devices) devices lengths binaries binary_status errcode_ret+        errcode <- ErrorCode <$> peek errcode_ret+        binstatus <- ErrorCode <$> peek binary_status+        if errcode == clSuccess && binstatus == clSuccess+            then return $ Right program+            else return $ Left (if errcode == clSuccess then binstatus else errcode)+    where bsPtr (SBS.PS p _ _) = p+          num_devices = length device_list+          (device_list,bins) = unzip devbin_pair+        +foreign import ccall "clRetainProgram" raw_clRetainProgram :: Program -> IO CLint+clRetainProgram :: Program -> IO (Maybe ErrorCode) +clRetainProgram prog = wrapError $ raw_clRetainProgram prog++foreign import ccall "clReleaseProgram" raw_clReleaseProgram :: Program -> IO CLint+clReleaseProgram :: Program -> IO (Maybe ErrorCode) +clReleaseProgram prog = wrapError $ raw_clReleaseProgram prog++type BuildProgramCallback = Program -> Ptr () -> IO ()+foreign import ccall "wrapper" wrapBuildProgramCallback :: BuildProgramCallback -> IO (FunPtr BuildProgramCallback)+foreign import ccall "clBuildProgram" raw_clBuildProgram :: Program -> CLuint -> Ptr DeviceID -> CString -> FunPtr BuildProgramCallback -> Ptr () -> IO CLint+clBuildProgram :: Program -> [DeviceID] -> String -> BuildProgramCallback -> Ptr () -> IO (Maybe ErrorCode)+clBuildProgram program devices ops pfn_notifyF user_data = +    allocaArray num_devices $ \device_list -> +    withCString ops $ \options -> do +        pokeArray device_list devices+        pfn_notify <- wrapBuildProgramCallback pfn_notifyF+        wrapError $ raw_clBuildProgram program (fromIntegral num_devices) device_list options pfn_notify user_data+    where num_devices = length devices   ++foreign import ccall "clUnloadCompiler" raw_clUnloadCompiler :: IO CLint+clUnloadCompiler :: IO (Maybe ErrorCode)+clUnloadCompiler = wrapError $ raw_clUnloadCompiler++foreign import ccall "clGetProgamInfo" raw_clGetProgramInfo :: Program -> CLuint -> CLsizei -> Ptr () -> Ptr CLsizei -> IO CLint+clGetProgramInfo :: Program -> ProgramInfo -> CLsizei -> IO (Either ErrorCode (ForeignPtr (), CLsizei))+clGetProgramInfo program (ProgramInfo param_name) param_value_size = wrapGetInfo (raw_clGetProgramInfo program param_name) param_value_size++foreign import ccall "clGetProgramBuildInfo"  raw_clGetProgramBuildInfo :: Program -> CLuint -> CLsizei -> Ptr () -> Ptr CLsizei -> IO CLint+clGetProgramBuildInfo :: Program -> ProgramBuildInfo -> CLsizei -> IO (Either ErrorCode (ForeignPtr (), CLsizei))+clGetProgramBuildInfo program (ProgramBuildInfo param_name) param_value_size = wrapGetInfo (raw_clGetProgramInfo program param_name) param_value_size+
+ System/OpenCL/Raw/V10/Sampler.hs view
@@ -0,0 +1,51 @@+{-# LANGUAGE ForeignFunctionInterface #-}+{-| Conforms to section 5.3 of the OpenCL 1.0 specification -}+module System.OpenCL.Raw.V10.Sampler+    (clCreateSampler+    ,clRetainSampler+    ,clReleaseSampler+    ,clGetSamplerInfo)+where++import System.OpenCL.Raw.V10.Types+import System.OpenCL.Raw.V10.Errors+import System.OpenCL.Raw.V10.Utils+import Foreign+import Foreign.C+import Control.Applicative+import Data.Maybe++++foreign import ccall "clCreateSampler" raw_clCreateSampler :: Context -> CLbool -> CLuint -> CLuint -> Ptr CLint -> IO Sampler+clCreateSampler :: Context -> Bool -> AddressingMode -> FilterMode -> IO (Either ErrorCode Sampler)+clCreateSampler ctx normalized_coords (AddressingMode addressing_mode) (FilterMode filter_mode) = +    wrapErrorEither $ raw_clCreateSampler ctx (if normalized_coords then clTrue else clFalse) addressing_mode filter_mode++foreign import ccall "clRetainSampler" raw_clRetainSampler :: Sampler -> IO CLint+clRetainSampler :: Sampler -> IO (Maybe ErrorCode) +clRetainSampler sampler = wrapError $ raw_clRetainSampler sampler++foreign import ccall "clReleaseSampler" raw_clReleaseSampler :: Sampler -> IO CLint+clReleaseSampler :: Sampler -> IO (Maybe ErrorCode) +clReleaseSampler sampler = wrapError $ raw_clReleaseSampler sampler++foreign import ccall "clGetSamplerInfo" raw_clGetSamplerInfo :: Sampler -> CLuint -> CLsizei -> Ptr () -> Ptr CLsizei -> IO CLint+clGetSamplerInfo :: Sampler -> SamplerInfo -> CLsizei -> Ptr () -> IO (Either ErrorCode CLsizei)+clGetSamplerInfo mem (SamplerInfo param_name) param_value_size param_value = alloca $ \param_value_size_ret -> do+    err <- wrapError $ raw_clGetSamplerInfo mem param_name param_value_size param_value param_value_size_ret+    if err == Nothing+        then peek param_value_size_ret >>= return . Right +        else return . Left . fromJust $ err+                            +++++++++++
+ System/OpenCL/Raw/V10/Types.hs view
@@ -0,0 +1,592 @@+{-| Declaration of types, bounds and constants for OpenCL 1.0 -}+module System.OpenCL.Raw.V10.Types where++import Foreign.C.Types+import Foreign++data PlatformIDc = PlatformIDc+data DeviceIDc = DeviceIDc+data Contextc = Contextc+data CommandQueuec = CommandQueuec+data Memc = Memc+data Programc = Programc+data Kernelc = Kernelc+data Eventc = Eventc+data Samplerc = Samplerc++newtype ChannelOrder = ChannelOrder CLuint+newtype ChannelType = ChannelType CLuint+newtype DeviceType = DeviceType CLbitfield++newtype ContextInfo = ContextInfo CLuint++type ContextProperties = Ptr CLint+type PlatformID = Ptr PlatformIDc+type DeviceID = Ptr DeviceIDc+type Context = Ptr Contextc+type CommandQueue = Ptr CommandQueuec+type Mem = Ptr Memc+type Program = Ptr Programc+type Event = Ptr Eventc+type Sampler = Ptr Samplerc+type Kernel = Ptr Kernelc++type CLsizei = CSize+type CLint = CInt+type CLuint = CUInt+type CLbool = CLuint+type CLulong = CULong+type CLbitfield = CLulong++data ImageFormatc = ImageFormatc+type ImageFormatp = Ptr ImageFormat+type ImageFormat = (ChannelOrder,ChannelType)++newtype CommandQueueProperties = CommandQueueProperties CLbitfield+newtype CommandQueueInfo = CommandQueueInfo CLuint+newtype ErrorCode = ErrorCode CLint deriving (Eq,Ord,Show,Read)+newtype EventInfo = EventInfo CLuint+newtype ProfilingInfo = ProfilingInfo CLuint+newtype KernelInfo = KernelInfo CLuint+newtype KernelWorkGroupInfo = KernelWorkGroupInfo CLuint+newtype MapFlags = MapFlags CLbitfield+newtype MemFlags = MemFlags CLbitfield+newtype MemObjectType = MemObjectType CLuint+newtype MemInfo = MemInfo CLuint+newtype ImageInfo = ImageInfo CLuint+newtype PlatformInfo = PlatformInfo CLuint+newtype SamplerInfo = SamplerInfo CLuint+newtype AddressingMode = AddressingMode CLuint+newtype FilterMode = FilterMode CLuint+newtype ProgramInfo = ProgramInfo CLuint+newtype ProgramBuildInfo = ProgramBuildInfo CLuint+newtype BuildStatus = BuildStatus CLint+newtype DeviceInfo = DeviceInfo CLuint+newtype DeviceFPConfig = DeviceFPConfig CLbitfield++clQueueOutOfOrderExecModeEnable :: CommandQueueProperties +clQueueOutOfOrderExecModeEnable = CommandQueueProperties (1`shiftL`0)++clQueueProfilingEnable :: CommandQueueProperties +clQueueProfilingEnable = CommandQueueProperties (1`shiftL`1)++clQueueContext :: CommandQueueInfo +clQueueContext = CommandQueueInfo 0x1090++clQueueDevice :: CommandQueueInfo +clQueueDevice = CommandQueueInfo 0x1091++clQueueReferenceCount :: CommandQueueInfo +clQueueReferenceCount = CommandQueueInfo 0x1092++clQueueProperties :: CommandQueueInfo +clQueueProperties = CommandQueueInfo 0x1093++clDeviceType :: DeviceInfo +clDeviceType = DeviceInfo 0x1000 ++clDeviceVendorID :: DeviceInfo +clDeviceVendorID = DeviceInfo 0x1001++clDeviceMaxComputeUnits :: DeviceInfo +clDeviceMaxComputeUnits = DeviceInfo 0x1002++clDeviceMaxWorkItemDimensions :: DeviceInfo +clDeviceMaxWorkItemDimensions = DeviceInfo 0x1003++clDeviceMaxWorkGroupSize :: DeviceInfo +clDeviceMaxWorkGroupSize = DeviceInfo 0x1004++clDeviceMaxWorkItemSizes :: DeviceInfo +clDeviceMaxWorkItemSizes = DeviceInfo 0x1005++clDevicePreferredVectorWidthChar :: DeviceInfo +clDevicePreferredVectorWidthChar = DeviceInfo 0x1006++clDevicePreferredVectorWidthShort :: DeviceInfo +clDevicePreferredVectorWidthShort = DeviceInfo 0x1007++clDevicePreferredVectorWidthInt :: DeviceInfo +clDevicePreferredVectorWidthInt = DeviceInfo 0x1008++clDevicePreferredVectorWidthLong :: DeviceInfo +clDevicePreferredVectorWidthLong = DeviceInfo 0x1009++clDevicePreferredVectorWidthFloat :: DeviceInfo +clDevicePreferredVectorWidthFloat = DeviceInfo 0x100A++clDevicePreferredVectorWidthDouble :: DeviceInfo +clDevicePreferredVectorWidthDouble = DeviceInfo 0x100B++clDeviceMaxClockFrequency :: DeviceInfo +clDeviceMaxClockFrequency = DeviceInfo 0x100C++clDeviceAddressBits :: DeviceInfo +clDeviceAddressBits = DeviceInfo 0x100D++clDeviceMaxReadImageArgs :: DeviceInfo +clDeviceMaxReadImageArgs = DeviceInfo 0x100E ++clDeviceMaxWriteImageArgs :: DeviceInfo +clDeviceMaxWriteImageArgs = DeviceInfo 0x100F++clDeviceMaxMemAllocSize :: DeviceInfo +clDeviceMaxMemAllocSize = DeviceInfo 0x1010++clDeviceImage2DMaxWidth :: DeviceInfo +clDeviceImage2DMaxWidth = DeviceInfo 0x1011++clDeviceImage2DMaxHeight :: DeviceInfo +clDeviceImage2DMaxHeight = DeviceInfo 0x1012++clDeviceImage3DMaxWidth :: DeviceInfo +clDeviceImage3DMaxWidth = DeviceInfo 0x1013++clDeviceImage3DMaxHeight :: DeviceInfo +clDeviceImage3DMaxHeight = DeviceInfo 0x1014++clDeviceImage3DMaxDepth :: DeviceInfo +clDeviceImage3DMaxDepth = DeviceInfo 0x1015++clDeviceImageSupport :: DeviceInfo +clDeviceImageSupport = DeviceInfo 0x1016++clDeviceMaxParameterSize :: DeviceInfo +clDeviceMaxParameterSize = DeviceInfo 0x1017++clDeviceMaxSamplers :: DeviceInfo +clDeviceMaxSamplers = DeviceInfo 0x1018++clDeviceMemBaseAddrAlign :: DeviceInfo +clDeviceMemBaseAddrAlign = DeviceInfo 0x1019++clDeviceMinDataTypeAlignSize :: DeviceInfo +clDeviceMinDataTypeAlignSize = DeviceInfo 0x101A++clDeviceSingleFPConfig :: DeviceInfo +clDeviceSingleFPConfig = DeviceInfo 0x101B++clDeviceGlobalMemCacheType :: DeviceInfo +clDeviceGlobalMemCacheType = DeviceInfo 0x101C++clDeviceGlobalMemCacheLineSize :: DeviceInfo +clDeviceGlobalMemCacheLineSize = DeviceInfo 0x101D++clDeviceGlobalMemCacheSize :: DeviceInfo +clDeviceGlobalMemCacheSize = DeviceInfo 0x101E++clDeviceGlobalMemSize :: DeviceInfo +clDeviceGlobalMemSize = DeviceInfo 0x101F++clDeviceMaxConstantBuffersize :: DeviceInfo +clDeviceMaxConstantBuffersize = DeviceInfo 0x1020++clDeviceMaxConstantArgs :: DeviceInfo +clDeviceMaxConstantArgs = DeviceInfo 0x1021++clDeviceMLocalMemType :: DeviceInfo +clDeviceMLocalMemType = DeviceInfo 0x1022++clDeviceLocalMemSize :: DeviceInfo +clDeviceLocalMemSize = DeviceInfo 0x1023++clDeviceErrorCorrectionSupport :: DeviceInfo +clDeviceErrorCorrectionSupport = DeviceInfo 0x1024++clDeviceProfilingTimerResolution :: DeviceInfo +clDeviceProfilingTimerResolution = DeviceInfo 0x1025++clDeviceEndianLittle :: DeviceInfo +clDeviceEndianLittle = DeviceInfo 0x1026++clDeviceAvailable :: DeviceInfo +clDeviceAvailable = DeviceInfo 0x1027++clDeviceCompilerAvailable :: DeviceInfo +clDeviceCompilerAvailable = DeviceInfo 0x1028++clDeviceExecutionCapabilities :: DeviceInfo +clDeviceExecutionCapabilities = DeviceInfo 0x1029++clDeviceQueueProperties :: DeviceInfo +clDeviceQueueProperties = DeviceInfo 0x102A++clDeviceName :: DeviceInfo +clDeviceName = DeviceInfo 0x102B++clDeviceVendor :: DeviceInfo +clDeviceVendor = DeviceInfo 0x102C++clDriverVersion :: DeviceInfo +clDriverVersion = DeviceInfo 0x102D++clDeviceProfile :: DeviceInfo +clDeviceProfile = DeviceInfo 0x102E++clDeviceVersion :: DeviceInfo +clDeviceVersion = DeviceInfo 0x102F++clDeviceExtensions :: DeviceInfo +clDeviceExtensions = DeviceInfo 0x1030++clDevicePlatform :: DeviceInfo +clDevicePlatform = DeviceInfo 0x1031++++clFPDenorm :: DeviceFPConfig +clFPDenorm = DeviceFPConfig (1`shiftL`0)++clFPInfNan :: DeviceFPConfig +clFPInfNan = DeviceFPConfig (1`shiftL`1)++clFPRoundToNearest :: DeviceFPConfig +clFPRoundToNearest = DeviceFPConfig (1`shiftL`2)++clFPRoundToZero :: DeviceFPConfig +clFPRoundToZero = DeviceFPConfig (1`shiftL`3)++clFPRoundToInf :: DeviceFPConfig +clFPRoundToInf = DeviceFPConfig (1`shiftL`4)++clFPFMA :: DeviceFPConfig +clFPFMA = DeviceFPConfig (1`shiftL`5)++++clEventCommandQueue  :: EventInfo +clEventCommandQueue  = EventInfo 0x11D0++clEventCommandType :: EventInfo +clEventCommandType = EventInfo 0x11D1++clEventReferenceCount :: EventInfo +clEventReferenceCount = EventInfo 0x11D2++clEventCommandExecutionStatus :: EventInfo +clEventCommandExecutionStatus = EventInfo 0x11D3+++clProfilingCommandQueued :: ProfilingInfo +clProfilingCommandQueued = ProfilingInfo 0x1280++clProfilingCommandSubmit :: ProfilingInfo +clProfilingCommandSubmit = ProfilingInfo 0x1281++clProfilingCommandStart :: ProfilingInfo +clProfilingCommandStart = ProfilingInfo 0x1282++clProfilingCommandEnd  :: ProfilingInfo +clProfilingCommandEnd  = ProfilingInfo 0x1283+++clFalse = 0 :: CLbool+clTrue = 1 :: CLbool+++clDeviceTypeDefault :: DeviceType +clDeviceTypeDefault = DeviceType (1`shiftL`0)++clDeviceTypeCPU :: DeviceType +clDeviceTypeCPU = DeviceType (1`shiftL`1)++clDeviceTypeGPU :: DeviceType +clDeviceTypeGPU = DeviceType (1`shiftL`2)++clDeviceTypeAccelerator :: DeviceType +clDeviceTypeAccelerator = DeviceType (1`shiftL`3)++clDeviceTypeAll :: DeviceType +clDeviceTypeAll = DeviceType 0xFFFFFFFF+++clContextReferenceCount :: ContextInfo +clContextReferenceCount = ContextInfo 0x1080++clContextDevices :: ContextInfo +clContextDevices = ContextInfo 0x1081++clContextProperties :: ContextInfo +clContextProperties = ContextInfo 0x1082++clContextPlatform = 0x1084++++clKernelFunctionName  :: KernelInfo +clKernelFunctionName  = KernelInfo 0x1190++clKernelNumFlags :: KernelInfo +clKernelNumFlags = KernelInfo 0x1191++clKernelReferenceCount :: KernelInfo +clKernelReferenceCount = KernelInfo 0x1192++clKernelContext :: KernelInfo +clKernelContext = KernelInfo 0x1193++clKernelProgram :: KernelInfo +clKernelProgram = KernelInfo 0x1194+++clKernelWorkGroupSize :: KernelWorkGroupInfo +clKernelWorkGroupSize = KernelWorkGroupInfo 0x11B0++clKernelCompileWorkGroupSize :: KernelWorkGroupInfo +clKernelCompileWorkGroupSize = KernelWorkGroupInfo 0x11B1++clKernelLocalMemSize :: KernelWorkGroupInfo +clKernelLocalMemSize = KernelWorkGroupInfo 0x11B2++++clMemReadWrite :: MemFlags +clMemReadWrite = MemFlags (1 `shiftL` 0)++clMemWriteOnly :: MemFlags +clMemWriteOnly = MemFlags (1 `shiftL` 1)++clMemReadOnly :: MemFlags +clMemReadOnly = MemFlags (1 `shiftL` 2)++clMemUseHostPtr :: MemFlags +clMemUseHostPtr = MemFlags (1 `shiftL` 3)++clMemAllocHostPtr :: MemFlags +clMemAllocHostPtr = MemFlags (1 `shiftL` 4)++clMemCopyHostPtr :: MemFlags +clMemCopyHostPtr = MemFlags (1 `shiftL` 5)+++clR :: ChannelOrder +clR = ChannelOrder 0x10B0++clA :: ChannelOrder +clA = ChannelOrder 0x10B1++clRG :: ChannelOrder +clRG = ChannelOrder 0x10B2++clRA :: ChannelOrder +clRA = ChannelOrder 0x10B3++clRGB :: ChannelOrder +clRGB = ChannelOrder 0x10B4++clRGBA :: ChannelOrder +clRGBA = ChannelOrder 0x10B5++clBGRA :: ChannelOrder +clBGRA = ChannelOrder 0x10B6++clARGB :: ChannelOrder +clARGB = ChannelOrder 0x10B7++clIntensity :: ChannelOrder +clIntensity = ChannelOrder 0x10B8++clLuminance :: ChannelOrder +clLuminance = ChannelOrder 0x10B9+++clSNormInt8  :: ChannelType +clSNormInt8  = ChannelType 0x10D0++clSNormInt16 :: ChannelType +clSNormInt16 = ChannelType 0x10D1++clUNormInt8 :: ChannelType +clUNormInt8 = ChannelType 0x10D2++clUNormInt16 :: ChannelType +clUNormInt16 = ChannelType 0x10D3++clUNormShort565 :: ChannelType +clUNormShort565 = ChannelType 0x10D4++clUNormShort555 :: ChannelType +clUNormShort555 = ChannelType 0x10D5++clUNormInt101010 :: ChannelType +clUNormInt101010 = ChannelType 0x10D6++clSignedInt8 :: ChannelType +clSignedInt8 = ChannelType 0x10D7++clSignedInt16 :: ChannelType +clSignedInt16 = ChannelType 0x10D8++clSignedInt32 :: ChannelType +clSignedInt32 = ChannelType 0x10D9++clUnsignedInt8 :: ChannelType +clUnsignedInt8 = ChannelType 0x10DA++clUnsignedInt16 :: ChannelType +clUnsignedInt16 = ChannelType 0x10DB++clUnsignedInt32 :: ChannelType +clUnsignedInt32 = ChannelType 0x10DC++clHalfFloat :: ChannelType +clHalfFloat = ChannelType 0x10DD++clFloat  :: ChannelType +clFloat  = ChannelType 0x10DE+++clMemObjectBuffer :: MemObjectType +clMemObjectBuffer = MemObjectType 0x10F0++clMemObjectImage2D :: MemObjectType +clMemObjectImage2D = MemObjectType 0x10F1++clMemObjectImage3D :: MemObjectType +clMemObjectImage3D = MemObjectType 0x10F2+++clMemType :: MemInfo +clMemType = MemInfo 0x1100++clMemFlags :: MemInfo +clMemFlags = MemInfo 0x1101++clMemSize :: MemInfo +clMemSize = MemInfo 0x1102++clMemHostPtr :: MemInfo +clMemHostPtr = MemInfo 0x1103++clMemMapCount :: MemInfo +clMemMapCount = MemInfo 0x1104++clMemReferenceCount :: MemInfo +clMemReferenceCount = MemInfo 0x1105++clMemContext :: MemInfo +clMemContext = MemInfo 0x1106+++clImageFormat :: ImageInfo +clImageFormat = ImageInfo 0x1110++clImageElementSize :: ImageInfo +clImageElementSize = ImageInfo 0x1111++clImageRowPitch :: ImageInfo +clImageRowPitch = ImageInfo 0x1112++clImageSlicePitch :: ImageInfo +clImageSlicePitch = ImageInfo 0x1113++clImageWidth :: ImageInfo +clImageWidth = ImageInfo 0x1114++clImageHeight :: ImageInfo +clImageHeight = ImageInfo 0x1115++clImageDepth :: ImageInfo +clImageDepth = ImageInfo 0x1116+++clMapRead :: MapFlags +clMapRead = MapFlags (1 `shiftL` 0)++clMapWrite :: MapFlags +clMapWrite = MapFlags (1 `shiftL` 1)+++clPlatformProfile :: PlatformInfo+clPlatformProfile = PlatformInfo 0x0900 ++clPlatformVersion :: PlatformInfo+clPlatformVersion = PlatformInfo 0x0901++clPlatformName :: PlatformInfo+clPlatformName = PlatformInfo 0x0902++clPlatformVendor :: PlatformInfo+clPlatformVendor = PlatformInfo 0x0903+++clPlatformExtensions :: PlatformInfo+clPlatformExtensions = PlatformInfo 0x0904++clProgramReferenceCount :: ProgramInfo +clProgramReferenceCount = ProgramInfo 0x1160++clProgramContext :: ProgramInfo +clProgramContext = ProgramInfo 0x1161++clProgramNumDevices :: ProgramInfo +clProgramNumDevices = ProgramInfo 0x1162++clProgramDevices :: ProgramInfo +clProgramDevices = ProgramInfo 0x1163++clProgramSource :: ProgramInfo +clProgramSource = ProgramInfo 0x1164++clProgramBinarySizes :: ProgramInfo +clProgramBinarySizes = ProgramInfo 0x1165++clProgramBinaries :: ProgramInfo +clProgramBinaries = ProgramInfo 0x1166+++clProgramBuildStatus :: ProgramBuildInfo +clProgramBuildStatus = ProgramBuildInfo 0x1181++clProgramBuildOptions :: ProgramBuildInfo +clProgramBuildOptions = ProgramBuildInfo 0x1182++clProgramBuildLog :: ProgramBuildInfo +clProgramBuildLog = ProgramBuildInfo 0x1183                    +++clBuildSuccess :: BuildStatus +clBuildSuccess = BuildStatus 0++clBuildNone :: BuildStatus +clBuildNone = BuildStatus (-1)++clBuildError :: BuildStatus +clBuildError = BuildStatus (-2)++clBuildInProgress :: BuildStatus +clBuildInProgress = BuildStatus (-3) ++++clAddressNone :: AddressingMode +clAddressNone = AddressingMode 0x1130++clAddressClampToEdge :: AddressingMode +clAddressClampToEdge = AddressingMode 0x1131++clAddressClamp :: AddressingMode +clAddressClamp = AddressingMode 0x1132++clAddressRepeat :: AddressingMode +clAddressRepeat = AddressingMode 0x1133++clFilterNearest = FilterMode 0x1140+clFilterLinear = FilterMode 0x1141+++clSamplerReferenceCount :: SamplerInfo +clSamplerReferenceCount = SamplerInfo 0x1150++clSamplerContext :: SamplerInfo +clSamplerContext = SamplerInfo 0x1151++clSamplerNormalizedCoords :: SamplerInfo +clSamplerNormalizedCoords = SamplerInfo 0x1152++clSamplerAddressingMode :: SamplerInfo +clSamplerAddressingMode = SamplerInfo 0x1153++clSamplerFilterMode :: SamplerInfo +clSamplerFilterMode = SamplerInfo 0x1154+