chickadee » opencl » kernel-arg-set!

kernel-arg-set! kernel idx valueprocedure

Calls clSetKernelArg. idx must be an integer, where 0 is the first kernel argument. value must be a srfi-4 vector for by-value argument types, or cl_buffer for arguments pointers.

The type of the kernel argument (ie. float2) must match the srfi-4 vector type (ie. (f32vector 1 1)). It is unfortunately not possible to enforce checks for this. The srfi-4 vector's length must match the kernel argument. For example, the arguments to __kernel foo(long4 a, float *result) could be initialized like this:

 
(kernel-arg-set! kernel 0 (s64vector 1 2 3 4))
(kernel-arg-set! kernel 1 (buffer-create (* 4 1000) ctx type: 'f32))

I don't know if you must call this for all arguments each time.