0% found this document useful (0 votes)
11 views

Opencl20 Quick Reference Card

Uploaded by

D.Oray
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
11 views

Opencl20 Quick Reference Card

Uploaded by

D.Oray
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 12

OpenCL 2.

0 Reference Card Page 1


[n.n.n] and purple text
[n.n.n] and green text
[n.n.n] and blue text

CL_DEVICE_PROFILING_TIMER_RESOLUTION,
CL_DEVICE_QUEUE_ON_DEVICE_PROPERTIES,
CL_DEVICE_QUEUE_ON_HOST_PROPERTIES, CL_CONTEXT_ADAPTER_DXVA_KHR,
CL_DEVICE_QUEUE_ON_DEVICE_MAX_SIZE, CL_CONTEXT_MEMORY_INITIALIZE_KHR,
CL_DEVICE_QUEUE_ON_DEVICE_PREFERRED_SIZE, CL_CONTEXT_TERMINATE_KHR,
CL_DEVICE_{REFERENCE_COUNT, VENDOR_ID}, CL_GL_CONTEXT_KHR, CL_CGL_SHAREGROUP_KHR,
CL_DEVICE_SVM_CAPABILITIES, CL_{EGL, GLX}_DISPLAY_KHR, CL_WGL_HDC_KHR
CL_DEVICE_TERMINATE_CAPABILITY_KHR,
[4.1-2] [9.16.9] CL_DEVICE_{TYPE, VENDOR}, cl_context (
, CL_{DEVICE, DRIVER}_VERSION ,
) ,
[4.3] )
, in_device, ,
) , cb ),
, errcode_ret)
,
param_name, ) See
param_value, CL_DEVICE_PARTITION_EQUALLY, : See
) CL_DEVICE_PARTITION_BY_COUNTS, (cl_context context)
CL_DEVICE_PARTITION_BY_AFFINITY_DOMAIN
CL_PLATFORM_{PROFILE, VERSION}, (cl_context context)
CL_PLATFORM_{NAME, VENDOR, EXTENSIONS}, device)
CL_PLATFORM_ICD_SUFFIX_KHR (cl_context context,
device) param_name,
, param_value,
, [4.4] )
) cl_context (
, CL_CONTEXT_REFERENCE_COUNT,
, CL_CONTEXT_{DEVICES, NUM_DEVICES,
CL_DEVICE_TYPE_{ACCELERATOR, ALL, CPU}, PROPERTIES},
CL_DEVICE_TYPE_{CUSTOM, DEFAULT, GPU} )
, PREFER_SHARED_RESOURCES_KHR
device, cb ), (cl context context)
param_name, errcode_ret)
param_value, [9.2]
) NULL or CL_CONTEXT_PLATFORM, (
CL_CONTEXT_INTEROP_USER_SYNC, )
CL_DEVICE_ADDRESS_BITS, CL_DEVICE_AVAILABLE,
CL_DEVICE_BUILT_IN_KERNELS,
CL_DEVICE_COMPILER_AVAILABLE,
CL_DEVICE_{DOUBLE, HALF, SINGLE}_FP_CONFIG,
CL_DEVICE_ENDIAN_LITTLE, CL_DEVICE_EXTENSIONS, API calls that manage OpenCL objects such as
CL_DEVICE_ERROR_CORRECTION_SUPPORT, command-queues, memory objects, program objects,
CL_DEVICE_EXECUTION_CAPABILITIES,
CL_DEVICE_GLOBAL_MEM_CACHE_{SIZE, TYPE}, and calls that allow you to enqueue commands to a
CL_DEVICE_GLOBAL_MEM_{CACHELINE_SIZE, SIZE}, [5.2.1]
CL_DEVICE_GLOBAL_VARIABLE_SHARING, cl_mem (cl_context context,
CL_DEVICE_HOST_UNIFIED_MEMORY, ,
CL_DEVICE_IMAGE_MAX_{ARRAY, BUFFER}_SIZE, [5.1]
CL_DEVICE_IMAGE_SUPPORT, errcode_ret)
CL_DEVICE_IMAGE2D_MAX_{WIDTH, HEIGHT}, cl_command_queue (
cl_context context device, CL_MEM_READ_WRITE,
CL_DEVICE_IMAGE_BASE_ADDRESS_ALIGNMENT, , CL_MEM_{WRITE, READ}_ONLY,
CL_DEVICE_IMAGE_PITCH_ALIGNMENT, errcode_ret) CL_MEM_HOST_NO_ACCESS,
CL_DEVICE_LOCAL_MEM_{TYPE, SIZE}, CL_QUEUE_PROFILING_ENABLE, CL_MEM_HOST_{READ, WRITE}_ONLY,
CL_DEVICE_MAX_READ_IMAGE_ARGS, CL_QUEUE_OUT_OF_ORDER_EXEC_MODE_ ENABLE CL_MEM_{USE, ALLOC, COPY}_HOST_PTR
CL_DEVICE_MAX_WRITE_IMAGE_ARGS,
CL_DEVICE_MAX_{CLOCK_FREQUENCY, PIPE_ARGS}, cl_command_queue cl_mem (cl_mem ,
CL_DEVICE_MAX_{COMPUTE_UNITS, SAMPLERS}, ( ,
CL_DEVICE_MAX_CONSTANT_{ARGS,BUFFER_SIZE}, ,
CL_DEVICE_MAX_{MEM_ALLOC, PARAMETER}_SIZE, cl_context context device,
, errcode_ret)
CL_DEVICE_MAX_GLOBAL_VARIABLE_SIZE,
CL_DEVICE_MAX_ON_DEVICE_{QUEUES, EVENTS}, errcode_ret) : See
CL_DEVICE_MAX_WORK_GROUP_SIZE, CL_QUEUE_SIZE, : CL_BUFFER_CREATE_TYPE_REGION
CL_DEVICE_MAX_WORK_ITEM_{DIMENSIONS, SIZES},
CL_DEVICE_MEM_BASE_ADDR_ALIGN, [5.2.2]
CL_DEVICE_NAME, be: OUT_OF_ORDER_EXEC_MODE_ENABLE,
CL_DEVICE_NATIVE_VECTOR_WIDTH_{CHAR, INT}, (
PROFILING_ENABLE, ON_DEVICE[_DEFAULT]) cl_command_queue command_queue,
CL_DEVICE_NATIVE_VECTOR_WIDTH_{LONG, SHORT},
CL_DEVICE_NATIVE_VECTOR_WIDTH_{DOUBLE, HALF}, cl_mem ,
CL_DEVICE_NATIVE_VECTOR_WIDTH_FLOAT, ( cl_bool ,
CL_DEVICE_{OPENCL_C_VERSION, PARENT_DEVICE}, cl_command_queue command_queue) ptr ,
CL_DEVICE_PARTITION_AFFINITY_DOMAIN,
( event)
CL_DEVICE_PARTITION_MAX_SUB_DEVICES,
CL_DEVICE_PARTITION_{PROPERTIES, TYPE}, cl_command_queue command_queue) (
CL_DEVICE_PIPE_MAX_ACTIVE_RESERVATIONS, cl_command_queue command_queue,
CL_DEVICE_PIPE_MAX_PACKET_SIZE, ( cl_mem ,
CL_DEVICE_{PLATFORM, PRINTF_BUFFER_SIZE}, cl_command_queue command_queue, cl_bool ,
CL_DEVICE_PREFERRED_VECTOR_WIDTH_{CHAR, INT}, param_name, ,
CL_DEVICE_PREFERRED_VECTOR_WIDTH_DOUBLE, param_value, ,
CL_DEVICE_PREFERRED_VECTOR_WIDTH_HALF, ) ,
CL_DEVICE_PREFERRED_VECTOR_WIDTH_LONG, CL_QUEUE_CONTEXT, ptr ,
CL_DEVICE_PREFERRED_VECTOR_WIDTH_SHORT, CL_QUEUE_DEVICE, CL_QUEUE_SIZE,
CL_DEVICE_PREFERRED_VECTOR_WIDTH_FLOAT, event)
CL_DEVICE_PREFERRED_INTEROP_USER_SYNC, CL_QUEUE_REFERENCE_COUNT,
CL_DEVICE_PROFILE, CL_QUEUE_PROPERTIES

©2013 Khronos Group - Rev. 0713 www.khronos.org/opencl


OpenCL 2.0 Reference Card Page 2

(
cl_command_queue command_queue, cl_mem , cl_bool ,
ptr ,
event)
(
cl_command_queue command_queue, cl_mem , cl_bool ,
, abstract classes {abstract}
,
ptr ,
event)
(
cl_command_queue command_queue, cl_mem ,
,
event)
many
(
cl_command_queue command_queue, cl_mem , cl_mem , one and only one
,
event) one or more
(
cl_command_queue command_queue, cl_mem , cl_mem ,
,
,
,
event)

[5.2.4]
(
cl_command_queue command_queue, cl_mem , cl_bool ,
,
,
event errcode_ret)
CL_MAP_{READ, WRITE}, CL_MAP_WRITE_INVALIDATE_REGION R-only access

Local

[6.2] No access
T a = (T)b;
_rte to nearest even No access
T a = convert_T(b);
T a = convert_T_R(b);
T a = as_T(b);
T a = convert_T_sat_R(b);

[5.4.1]
cl_mem (cl_context context ,
errcode_ret)

CL_MEM_READ_WRITE, CL_MEM_HOST_NO_ACCESS

(cl_mem memobj) [5.4.2]


(cl_mem pipe param_name ,
(cl_mem memobj) param_value )
(cl_mem memobj,
) CL_PIPE_PACKET_SIZE, CL_PIPE_MAX_PACKETS
(cl_mem memobj ),
)
(cl_command_queue command_queue,
cl_mem memobj mapped_ptr ,
event)
[5.6.1]
[5.5.4] (cl_context context ,
(cl_command_queue command_queue, )
,
, CL_MEM_READ_WRITE, CL_MEM_{WRITE, READ}_ONLY,
event) CL_MEM_SVM_FINE_GRAIN_BUFFER, CL_MEM_SVM_ATOMICS
CL_MIGRATE_MEM_OBJECT_HOST,
CL_MIGRATE_MEM_OBJECT_CONTENT_UNDEFINED (cl_context context )
[5.6.2]
[5.5.5]
(
(cl_mem memobj param_name, cl_command_queue command_queue,
param_value ) [],
CL_MEM_{TYPE, FLAGS, SIZE, HOST_PTR}, CL_MEM_OFFSET, )(
CL_MEM_{MAP, REFERENCE}_COUNT, CL_MEM_ASSOCIATED_MEMOBJECT, cl_command_queue command_queue,
CL_MEM_CONTEXT, CL_MEM_USES_SVM_ POINTER, ,
),
, cl_u ,
event)

©2013 Khronos Group - Rev. 0713 www.khronos.org/opencl


OpenCL 2.0 Reference Card Page 3
cl_program (cl_context context,
,
( ,
cl_command_queue command_queue, ,
cl_bool , )
, [5.8.1] (cl_program ),
, errcode_ret)
cl_program (
event) cl_context context count,
, [5.8.6]
( errcode_ret) (
cl_command_queue command_queue, )
, cl_program (
, cl_context context ,
, [5.8.7]
,
event) (cl_program ,
errcode_ret) param_name,
( param_value,
cl_command_queue command_queue, cl_program ( )
cl_bool , cl_context context , CL_PROGRAM_REFERENCE_COUNT,
, , CL_PROGRAM_{CONTEXT, NUM_DEVICES, DEVICES},
, errcode_ret) CL_PROGRAM_{SOURCE, BINARY_SIZES, BINARIES},
event) CL_PROGRAM_{NUM_KERNELS, KERNEL_NAMES}
(cl_program )
( (
cl_command_queue command_queue, (cl_program )
cl_program device,
, param_name,
event) [5.8.2]
param_value,
(cl_program , )
,
)
(cl_program ), CL_PROGRAM_BINARY_TYPE,
) CL_PROGRAM_BUILD_{STATUS, OPTIONS, LOG},
CL_PROGRAM_BUILD_GLOBAL_VARIABLE_TOTAL_SIZE
[5.8.3]
[5.8.4]
(cl_program ,
, Preproce : clBuildProgram
[5.9.1] , clCompileProgram)
cl_kernel (cl_program , , -D name -D name=
kernel_name errcode_ret) ,
)
(cl_program , (cl_program ),
, )
)
(cl_kernel kernel)
(cl_kernel kernel) (cl_kernel kernel device,
param_name,
input_value,
param_value, -w -Werror
(cl_kernel kernel, )
, Control
) param_name:
CL_KERNEL_MAX_SUB_GROUP_SIZE_FOR_NDRANGE,
(cl_kernel kernel, CL_KERNEL_SUB_GROUP_COUNT_FOR_NDRANGE
)
[5.10]
(cl_kernel kernel, clEnque (
param_name, cl_command_queue command_queue,
param_value) cl_kernel kernel ,
,
CL_KERNEL_EXEC_INFO_SVM_PTRS, ,
CL_KERNEL_EXEC_INFO_SVM_FINE_GRAIN_SYSTEM ,
, :
(cl_kernel kernel, event) 1.0
param_name,
param_value, ( [5.8.5]
) cl_command_queue command_queue,
cl_kernel kernel ,
CL_KERNEL_FUNCTION_NAME, event)
CL_KERNEL_NUM_ARGS,
CL_KERNEL_REFERENCE_COUNT, (
CL_KERNEL_{ATTRIBUTES, CONTEXT, PROGRAM} cl_command_queue command_queue,
,
(cl_kernel kernel, ,
device, ,
param_name, ,
param_value, event_ event)
)
CL_KERNEL_GLOBAL_WORK_SIZE, [5.15] (cl_event event,
CL_KERNEL_[COMPILE_]WORK_GROUP_SIZE, )
CL_KERNEL_{LOCAL, PRIVATE}_MEM_SIZE, (cl_command_queue command_queue)
CL_KERNEL_PREFERRED_WORK_GROUP_SIZE_- (cl_command_queue command_queue) ,
MULTIPLE )
(cl_kernel kernel, (cl_event event,
param_name, param_name ,
param_value, param_value )
)
CL_EVENT_COMMAND_{QUEUE, TYPE},
CL_KERNEL_ARG_{ACCESS, ADDRESS}_QUALIFIER, CL_EVENT_{CONTEXT, REFERENCE_COUNT},
CL_KERNEL_ARG_NAME, CL_EVENT_COMMAND_EXECUTION_STATUS
[5.11]
CL_KERNEL_ARG_TYPE_{NAME, NAME_QUALIFIER}
cl_event (cl_context context, (cl_event event)
errcode_ret)

©2013 Khronos Group - Rev. 0713 www.khronos.org/opencl


OpenCL 2.0 Reference Card Page 4
[5.12] [5.14]
( (cl_event event,
(cl_event event) cl_command_queue command_queue, param_name,
, param_value,
(cl_event event, event) )
,
) CL_PROFILING_COMMAND_QUEUED,
( CL_PROFILING_COMMAND_ COMPLETE,
(cl_event event , cl_command_queue command_queue,
) CL_PROFILING_COMMAND_{SUBMIT, START, END}
,
event)

[6.1.2] OPTIONAL
OPTIONAL
charn cl_charn [msaa_]depth_t
ucharn cl_ucharn [msaa_]depth_t
[6.1.1] sampler_t OPTIONAL sampler handle
shortn cl_shortn
ushortn cl_ushortn queue_t
bool -- ndrange_t
n n
char cl_char clk_event_t
n n
cl_uchar
longn cl_longn event_t event handle
short cl_short
ulongn cl_ulongn
cl_ushort [6.1.4]
n n
doublen OPTIONAL cl_doublen
booln boolean vector
halfn
long cl_long halfn
cl_ulong [6.1.3] quad, quadn
The OPTIONAL complex half, complex halfn
n
double OPTIONAL cl_double
n
half cl_half n
-- complex double, complex doublen
-- [msaa_]t OPTIONAL
n
-- complex quad, complex quadn
OPTIONAL
n
-- [msaa_]t OPTIONAL nxm n m
OPTIONAL doublenxm n m

[6.1.7] [6.10]
#pragma OPENCL FP_CONTRACT
0 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 ON, OFF, DEFAULT
__FILE__
__func__
__LINE__
__OPENCL_VERSION__

__OPENCL_C_VERSION__
__ENDIAN_LITTLE__
__IMAGE_SUPPORT__
__FAST_RELAXED_MATH__ d-math

__CL_DEVICE_MAX_
GLOBAL_VARIABLE_SIZE__
FP_FAST_FMA
[6.5] FP_FAST_FMAF
[6.3] __global, global __local, local
FP_FAST_FMA_HALF
__kernel_exec(X, ) Same as:
[6.7] or X
+ - % -- t )))
__kernel, kernel
++ == != & ~ ^
)))
> < >= <= | !
&& || ?: >> << = [6.13.1]
X, Y, Z)))
, op= X, Y, Z))) , and global and local

[6.12]
()

dimindx)
int (^myBlock)(int) =
dimindx)
^(int num) {return num * multiplier;
}; dimindx)

©2013 Khronos Group - Rev. 0713 www.khronos.org/opencl


OpenCL 2.0 Reference Card Page 5
[6.11]
()
global ID
dimindx)
()
dimindx) local ID n

Number of work-groups ()
dimindx) subgroup
()
Work-group ID () Number of subgroups
dimindx)
() Sub-group ID
dimindx) () )))

[6.13.2] [9.4.2] T ( ) ex
T (T) Absolute value
Tn x
of , where n T and Tn may T (T x, T ) and
T (T)
T (T a, T b, T c)
n T (T x, ) Return x< , n)))
Prototypes Tn (Tn x, ) x
T (T x, ) Return < x,
n Tn (Tn x, ) x T (T x, T ) x
T (T) x
T (T x, T )
T (T) (x ) T pow (T x, T ) Compute x to the power of
T (T x) acos (x T (T x, iptr) x pown (T x ) Compute x , where
T (T) (T x, exp) Tn pown (T x n )
Tn (T x, exp) T powr (T x, T ) Compute x , where x
T (T)
T (T x) x T (T x, T ) Square root of x2 + 2
T ( ) x
T atan (T ) Arc tangent n] (T x) T ( ) (T n)
value
T atan2 (T , T x) Arc tangent of x T (T x, T )
(T x ) n
T atanh (T) x (T x, T , *quo)
Tn (T x )
T (T x) atan (x Tn (T x, T , n *quo)
T (T x)
T (T x, T ) atan2 ( , x T (T)
(T x, )
T (T) Cube root Tn (T x, n ) rootn (T x ) Compute x
Tn rootn (T x n )
T (T) T log (T)
T (T x) Integral value nearest to x
T log2 (T)
T (T x, T ) x
T log10 (T) T (T) Inverse square root
T (T)
T log1p (T x) x) T (T)
T (T)
T (T x) x) T (T x) Exponent of x T (T x, ) x
T (T a, T b, T c) a b+c T (T)
T (T ) x T (T x, T ) x and T (T x) x)
T (T ) (T n)
T (T x, T ) x and T (T) Square root
T (T)
T (T x, iptr) T tan (T) Tangent
T (T) T number
T tanh (T)
T (T x) n] nan n] nancode) NaN T (T x) x)
T (T) half[n] nan (ushort[n] nancode) nancode T (T)
double[n] nan (ulong[n] nancode) ar) T trunc (T)
T (T)

[6.13.2] [9.4.2] [6.13.3] n] (


short[n] , ushort[n] ) result[i hi[i lo[i]
The valu T n, uchar, ucharn, short, shortn,
ushort, ushortn n n, long, longn, n] ( result[i hi[i lo[i]
ulong, or ulong where n Tu ushort[n] , ushort[n] )
MAXFLOAT T. T. long[n] ( result[i]=((long)hi[i lo[i]
Tu (T x) |x| n] n] )
HUGE_VALF
Tu (T x, T ) |x ulong[n] ( result[i]=((ulong)hi[i lo[i]
HUGE_VAL n] n] )
OPTIONAL T (T x, T ) x + and saturates the result
T (T x, T ) (x +
INFINITY T
T (T x, T ) (x +
n n,where or 16
T (T x, T min, T max) x, ), )
NAN T (T x, min, max) add
T ( )
T (T x) x
When T ( ) x and
T (T x) x
the macro name,
d T (T a, T b, T c) a, b) + c
M_E_F Value of e T (T a, T b, T c) a b + c and saturates the result [6.13.4] [9.4.3]
T (T x, T ) x< x
M_LOG2E_F Value of log2e T (T x, )
Value of log e T (T x, T ) <x x double, Tn
M_LN2_F Value of loge2 T (T x, ) form of , where n
Value of loge T (T x, T ) x and T and
M_PI_F T rotate (T v, T i) result[indx] = v[indx] << i[indx]
T (T x, T ) x - and saturates the result T (T x, T min, T max) Clamp x
M_PI_2_F Tn (Tn x, min, max) min, max
M_PI_4_F T popcount (T x) x
T ( ) to degrees
upsample
T (T x, T )
M_2_PI_F short[n] ( Max of x and
result[i]= ((short)hi[i]<< 8)|lo[i] Tn (Tn x, )
M_2_SQRTPI_F char[n] , uchar[n] )
T (T x, T ) x and
M_SQRT2_F ushort[n] ( result[i]=((ushort)hi[i]<< 8)|lo[i] Tn (Tn x, )
uchar[n] , uchar[n] )

©2013 Khronos Group - Rev. 0713 www.khronos.org/opencl


OpenCL 2.0 Reference Card Page 6
[6.13.5] [9.4.4] length (T p) Vector length
T (T x, T , T a) Ts half Normal vector
Tn (Tn x, Tn , a) x and T Ts T (T p)
T (T ) vector forms of Ts p0 p1)
T (T , T x) p0 p1) n p0 n p1)
( , Tn x) x<
p0 p1) Cross product p)
T (T ,T , T x) Vector length
p0 p1) n p)
T ( , , T x) (T p0, T p1) p) Normal vector
T (T x) x (T p0, T p1) Dot product n n p)

[6.13.6] x ) (double)
n ) Compare of x < y longn (doublen)
Test for a NaN
T (double x, double ) (half)
n, char, charn, uchar, ucharn, short, shortn, longn (double , double ) shortn (halfn)
ushort, ushortn n n, long, longn, ulong, (half x, half ) Compare of x < y
ulong n Ti n, n n) Test for a normal
shortn (half , half ) value
short, shortn n, long, or longn Tu n, x ) (double)
ushort, ushortn n, ulong, or ulongn n n ) longn (doublen)
half and halfn (half) Test for a normal
(double x, double ) value
x ) Compare of x <= y shortn (halfn)
longn (double , double )
n ) (half x, half ) x )
(double x, double ) Compare of shortn (half , half ) n )
longn (double , double ) x == y x ) (double x, double )
(half x, half ) n ) longn (double , double ) ordered
shortn (half , half ) (double x, double ) (half x, half )
Compare of
x ) longn (double , double ) (x < y) || (x > y) shortn (half , half )
n ) )
(half x, half )
(double x, double ) n )
Compare of x != y shortn (half , half )
longn (double , double ) (double x, double )
(half x, half ) longn (double , double ) unordered
n n) (half x, half )
shortn (half , half ) (double)
x ) shortn (half , half )
longn (doublen) value
n ) (half)
(double x, double ) n n)
Compare of shortn (halfn)
x>y (double)
longn (double , double )
longn (doublen)
(half x, half )
n n) (half)
shortn (half , half )
(double) Test for + or shortn (halfn)
x )
Compare of longn (doublen)
n ) x >= y (Ti x) component of x
(half)
(double x, double )
shortn (halfn)
longn (double , double )
(half x, half ) Compare of all (Ti x) components of x are
x >= y Test for a NaN
shortn (half , half ) n n)
T (T )
half (half half half ) a
[6.13.7] [9.4.6] _R (double data, halfn (halfn half half ) of c
T ,Q p) (p + )
or half and halfn T (T )
n n data, For each component
Tn refers to the vector form of T (T ) of a vector type,
type T, where n Q ,Q p) halfn (half half short ) result[
6.5 n_R n data, half (half half short c) of c[ b[ ] :
Q R ,Q p) a[ ] For scalar type,
6.2.3.2 halfn (half half ushort )
n (doublen data, address (p + ( n)) result = c ? b : a
half (half half ushort )
Tn n , Read vector data from ,Q p)
const p) address (p + ( n)) n_R (doublen
data ,Q p) [6.13.10] [9.4.7]
n( , T n, uchar, ucharn, short, shortn, ushort,
, Read
,Q p) (p + ( n) half vector data from
n n ushortn n n, long, longn, ulong, ulongn,
(p + ( n
, Read a half from address const Q p) n n, or half or halfn
read from (p + ( 4
const Q p) (p + )
n n , Read a halfn from address n n data,
,Q p) event_t (
const Q p) (p + ( n)) __local T , const __global T ,
n_R n data, , event_t event)
data, ,Q p) p+ T
,Q p) ( n event_t ( elements from
_R data, n (doublen data, to (p + ( 4 to
,Q p) __global T , const __local ,
,Q p) (p + ) , event_t event)
(double data, n_R (doublen
,Q p) data ,Q p) event_t (
__local T , const __global T ,
,
event_t event) T
[6.13.8] event_t ( elements from
__global T , const __local , to
X_MEM_FENCE where X may be LOCAL, ,
Sub- , event_t event)

( to
[, memory_scope ]) ) complete
[, memory_scope ]) Prefetch
a kernel
(const __global T p,
) ) T
global cache

©2013 Khronos Group - Rev. 0713 www.khronos.org/opencl


OpenCL 2.0 Reference Card Page 7
[6.13.11] [6.13.9]

ptr
A C
M M C. ptr
M bool ptr) global address space
bool ptr) local address space
bool ptr)
Memory fence value:
obj, C value) obj to the value value, CLK_GLOBAL_MEM_FENCE,
obj, C value) ptr)
CLK_LOCAL_MEM_FENCE
obj, C value)
(memory_order order)
(memory_order order, [6.13.13]
memory_scope ) order
,
memory_order order[ , memory_scope ])
object, C )
object
object, order
C , memory_order order[ , memory_scope ]) calls
C object)
object
C object, order
memory_order order[ , memory_scope ])
C object, C )
object
C object, order %[ ][ ][vector][ ]
C , memory_order order[ , memory_scope ])
bool object,
expected, C )
bool ( object
object expected, C , expected
memory_order , memory_order object ired expected
[ , memory_scope ]) object
bool object,
expected, C )
bool (
object expected, C ,
memory_order , memory_order
[ , memory_scope ])

C <key> object, M operand) object


object and
C <key> object, operand Output:
M operand, memory_order order[ , memory_scope ]) order
bool object)
object
bool ( order
object, memory_order
order[ , memory_scope ]) [6.13.15] [9.17.3.4]
T
object) object
( argument shall not be nor Double
object, memory_order
order[ , memory_scope ]) value of order
predicate
or sub-group
predicate)
predicate)
memory_order predicate)
memory_order_release memory_order_ acq_rel predicate)
memory_order_seq_cst
memory_scope memory_scope_work_group Broadcast the value of a or
memory_scope_sub_group sub_group local_id
n
take a memory_scope argument) T (T a local_id)
T n (T a local_id[n])
T (T a local_id)

op> for all


values of x or sub_group

T op (T x)
T op (T x)
value) E
value <op or
sub-group

T op (T x)
[9.3]
T op (T x)
The : atom_add, atom_sub, T op (T x)
T op (T x)
The :
atom_and, atom_or, atom_xor
©2013 Khronos Group - Rev. 0713 www.khronos.org/opencl
OpenCL 2.0 Reference Card Page 8
[6.13.16.2-4] [6.13.12]
T Tm and Tn are type charn, ucharn, shortn, ushortn,
n n, longn, ulongn n n, or
halfn , where n
TUn
Read packet from p ( n, ushortn n, or ulongn
T p, T ptr) ptr Reserve
Tp )
T p, Read packet from reserved ( p
, Tp )
( )
index, T ptr) and index ptr T p,
) ( )
T p, T p,
const T ptr) ptr to p )
T p, Tn
, by ptr to reserved area ( Tn
index, const T ptr) and index T p) p
( Returns the number of (
T p) p )
[6.13.17.8]
Tp ) T
Tp ) double,
to
Tp ) ( Increments event reference
Tp ) clk_event_t event)
Tp ) Reserve ( Decrements event
Tp ) p clk_event_t event)
Tp )
clk_event_t ()
Tp )

(
[6.13.17] [9.17.3.6] clk_event_t event ) : CL_COMPLETE or a

(clk_event_t event,
name, event
(queue_t queue , const ndrange_t block) value)

(queue_t queue , const ndrange_t ,


event_ret, enqueue a block for
block queue [6.13.17.9]
(queue_t queue , const ndrange_t block) Default
queue_t
(queue_t queue , const ndrange_t ,
event_ret, ndrange_t )
block
ndrange_t ,
block )
ND-range
block ndrange_t (
,
block Returns the preferred
)
block
ndrange_t n (
(queue_t queue , Enqueue a marker [n])
event_ret) command to queue
ndrange_t n ,
(const ndrange_t block Returns number of [n])
(const ndrange_t block ndrange_t n ( n may be 2
(const ndrange_t block ,
,
(const ndrange_t block
[n])

[5.3.4] (
( cl_command_queue command_queue,
cl_command_queue command_queue, cl_mem , cl_mem ,
cl_mem , cl_bool , ,
[5.3.1] , ,
cl_mem (cl_context context, ptr, event)
, , [5.3.5]
, event)
, (
errcode_ret) ( cl_command_queue command_queue,
cl_command_queue command_queue, cl_mem , cl_mem ,
: See cl_mem , cl_bool , ,
[5.3.2]
, ,
, event)
( ptr ,
cl_context context , event)
cl_mem_object_type , (
, ( cl_command_queue command_queue,
) cl_command_queue command_queue, cl_mem , cl_mem ,
: See cl_mem , ,
, ,
, ,
, event)
event)

©2013 Khronos Group - Rev. 0713 www.khronos.org/opencl


OpenCL 2.0 Reference Card Page 9
[5.3.1.1]
[5.3.6] CL_R, CL_A
(
cl_command_queue command_queue,
cl_mem , cl_bool ,
, CL_HALF_FLOAT, CL_FLOAT, : CL_HALF_FLOAT, CL_FLOAT,
,
,
,
event,
errcode_ret) channel data type = CL_UNORM_INT24 or CL_FLOAT
CL_FLOAT,
Also see [5.4.5] CL_UNORM_INT24

[5.3.7]
CL_HALF_FLOAT, CL_FLOAT, CL_RG, CL_RA: CL_HALF_FLOAT, CL_FLOAT,
(cl_mem ,
param_name,
param_value,
) CL_HALF_FLOAT, CL_FLOAT, CL_RGB
CL_IMAGE_{ARRAY, ELEMENT}_SIZE,
CL_IMAGE_{ROW, SLICE}_PITCH,
CL_IMAGE_{FORMAT, BUFFER}, CL_ARGB: CL_UNORM_INT8, CL_SIGNED_INT8,
CL_IMAGE_{HEIGHT, WIDTH, DEPTH}, : CL_UNORM_INT8 CL_UNSIGNED_INT8, CL_SNORM_INT8
CL_IMAGE_NUM_{SAMPLES, MIP_LEVELS},
: CL_UNORM_INT8 CL_BGRA: CL_{SIGNED, UNSIGNED}_INT8, CL_SNORM_INT8

[6.13.14] coord color) half4 ,


sampler_t coord)
coord,
color) half4 e2d_array_t coord)

coord,
color)
and 2d_t coord color)
coord, half4 color)
coord,
coord, color)
half4 color)
2d_depth_t coord,
coord, depth)
half4 color)
2d_array_depth_t coord,
coord color) depth)
, sampler_t , coord,
coord) color)
coord) coord, coord color)
color)
, coord,
sampler_t coord) color)
coord) coord color)
coord) coord,
color)
, sampler_t , age2d_t , sampler_t ,
coord) coord, half4 color)
coord)
coord) 2d_array_t coord,
coord) half4 color)
, sampler_t , ,
coord) sampler_t coord)
coord) coord)
coord) , sampler_t ,
, sampler_t , coord)
coord) , sampler_t ,
, coord)
coord) sampler_t coord)
coord)
, coord)
, sampler_t ,
sampler_t coord) coord) coord)
coord) , sampler_t , coord)
coord) coord)
coord) , sampler_t ,
half4 , sampler_t , coord)
coord) , sampler_t , coord)
coord)
half4 coord) half4 , sampler_t ,
coord) coord)
half4 ,
sampler_t coord) , sampler_t , half4 coord)
half4 coord) coord)
coord color)
half4 coord) coord)
coord color)
,
coord color) sampler_t coord) coord color)
coord) coord, half4 color)
coord,
color) half4 , sampler_t ,
coord, coord)
color) half4 coord)

©2013 Khronos Group - Rev. 0713 www.khronos.org/opencl


OpenCL 2.0 Reference Card Page 10
, sampler_t , [6.13.14.5] [9.12]
coord )
[9.18.2.1]
, sampler_t ,
coord )
, sampler_t ,
, coord )
sampler_t coord lod) )
, )
, sampler_t , sampler_t coord lod)
coord lod) )
, sampler_t , )
, sampler_t , coord lod)
coord lod) )
,
, sampler_t coord lod)
sampler_t coord , )
) , t )
sampler_t coord ,
, sampler_t , ) )
coord ) )
, sampler_t ,
, sampler_t , coord ) )
coord )
, sampler_t
, sampler_t , coord ) )
coord lod)
coord, )
, sampler_t , lod color)
coord lod)
coord lod,
, sampler_t , color) )
coord lod)
coord lod, )
, sampler_t , color) )
coord ) coord lod color) )
, sampler_t , coord lod color)
coord )
coord lod color)
, sampler_t , )
coord ) coord lod,
color) )
, sampler_t ,
coord lod) coord lod, )
color) )
, sampler_t ,
coord lod) coord lod, )
color)
, sampler_t , )
coord lod) coord,
lod color)
, sampler_t , coord lod,
coord ) ge )
color)
, sampler_t , )
coord lod,
coord ) color) )
, sampler_t , coord lod,
coord ) coord) )
, sampler_t , coord lod, (
coord lod) color) )
, sampler_t , coord lod, (
coord lod) color) )
, sampler_t , get )
coord lod) )
[9.12.3]
get_ )

, )
[5.7] coord ) )
, (
coord ) )
cl_sampler ( , [9.18.2.1]
cl_context context, cl_bool , coord )
,
errcode_ret) ,
coord ) )
CL_ADDRESS_[MIRRORED_]REPEAT,
CL_ADDRESS_CLAMP[_TO_EDGE], )
CL_ADDRESS_NONE )
CL_SAMPLER_{CONTEXT, FILTER_MODE},
CL_FILTER_{NEAREST, LINEAR} CL_SAMPLER_ADDRESSING_MODE, )
CL_SAMPLER_NORMALIZED_COORDS (
cl_sampler ( )
cl_context context,
[6.13.14.1] (
,
errcode_ret) The sampler can be passed as an argument to the kernel )
: (
CL_SAMPLER_NORMALIZED_COORDS, )
CL_SAMPLER_{ADDRESSING, FILTER}_MODE,
CL_SAMPLER_MIP_FILTER_MODE, const sampler_t < >=
CL_SAMPLER_LOD_{MIN, MAX} < >|< >|< > [6.6]

(cl_sampler ) CLK_NORMALIZED_COORDS_{TRUE, FALSE}


(cl_sampler ) __read_only, read_only
CLK_ADDRESS_{REPEAT, CLAMP, NONE},
(cl_sampler , CLK_ADDRESS_{CLAMP_TO_EDGE},
param_name, CLK_ADDRESS_{MIRRORED_REPEAT}
param_value,
) CLK_FILTER_NEAREST, CLK_FILTER_LINEAR
param_name: CL_SAMPLER_REFERENCE_COUNT,

©2013 Khronos Group - Rev. 0713 www.khronos.org/opencl


OpenCL 2.0 Reference Card Page 11

[9] cl_khr_context_abort

#pragma OPENCL EXTENSION

or cl_khr_egl_event

cl_khr_gl_event

cl_khr_subgroups
[9.5 - 9.7]

[9.6.4] [9.8.7]
[9.5.5] cl_mem (
( cl_context context ,
, errcode_ret) (
param_name, See ,
param_value, ,
) [9.6.5] ,
CL_DEVICES_FOR_GL_CONTEXT_KHR, (cl_mem memobj,
CL_CURRENT_DEVICE_FOR_GL_CONTEXT_KHR cl_gl_object_ , ,
) )
[9.6.2] returns:
cl_mem (cl_context context, CL_GL_OBJECT_TEXTURE_BUFFER,
errcode_ret)
CL_MEM_{READ_ONLY, WRITE_ONLY, READ_WRITE}
CL_GL_OBJECT_{BUFFER, RENDERBUFFER}
[9.6.3] cl_mem (
cl_mem (cl_context context, (cl_mem memobj, cl_context context ,
, GLenum , param_name, errcode_ret)
miplevel texture errcode_ret) param_value, See
)
See cl_mem (
CL_GL_{TEXTURE_TARGET, MIPMAP_LEVEL}, cl_context context ,
CL_GL_NUM_SAMPLES , UINT ,
GL_TEXTURE_CUBE_MAP_POSITIVE_{X, Y, Z}, errcode_ret)
GL_TEXTURE_CUBE_MAP_NEGATIVE_{X, Y, Z}, See
[9.6.6]
( cl_mem (
cl_command_queue command_queue, cl_context context ,
, , UINT ,
[9.9] , errcode_ret)
event) See
[9.7.4] clEnqueue (
cl_event ( cl_ command_queue command_queue,
( cl_context context, GLsync , ,
, *errcode_ret) ,
, event)
,
,
,
) [9.10.7.3 - 9.10.7.6]
:
cl_mem (
cl_mem ( cl_context context ,
: CL_{ALL, PREFERRED}_DEVICES_- cl_context context ,
FOR_DXP_MEDIA_ADAPTER_KHR errcode_ret)
, See
cl_mem ( UINT errcode_ret)
cl_context context , See cl_mem (
, cl_context context ,
plane errcode_ret) ( , UINT ,
, errcode_ret)
: See
, See
,
clEnqueue ( , clEnqueue (
cl_command_queue command_queue, , cl_command_queue command_queue,
, ) ,
, ,
event) event)

[9.19] ( [9.20]
cl_command_queue command_queue,
,
cl_mem ( , cl_event (
cl_context context , , cl_context context, CLeglSyncKHR ,
CLeglImageKHR , event) errcode_ret)
,
errcode_ret)
©2013 Khronos Group - Rev. 0713 www.khronos.org/opencl
OpenCL 2.0 Reference Card Page 12

2
A M
Map and Unmap Image Objects
clEnqueueNDRangeKernel 2
4
5
clEnqueueReadImage 2 Math Constants 5
5

B Memory Objects 2
Blocks 4 clSetEventCallback 4 2
clEnqueueReleaseEGLObjectsKHR clSetKernelArg O
clEnqueueReleaseGLObjects 2
C clEnqueueSVM[Un]Map clSetKernelExecInfo
ClEnqueueSVMFree 2 clSetMemObjectDestructorCallback 2
clSetUserEventStatus
Operators 4
clEnqueueTask clSVMAlloc 2
clCreateCommandQueue clEnqueueUnmapMemObject 2 clSVMFree 2
2 P
clCreateContext 2
8
clCreateContextFromType
Command Queues 2
clCreateEventFromEGLsyncKHR
Preprocessor
clCreateEventFromGLsyncKHR clFlush
4
clGetCommandQueueInfo
clGetContextInfo const sampler_t
4
Contexts

Program Objects
2
Q
Create Program Objects 4
clCreateFromEGLImageKHR clGetEventInfo Query Image Objects
D
4
2
clCreateFromGLTexture clGetGLContextInfoKHR
Query Memory Object 2
clCreateImage clGetGLObjectInfo
Query Program Objects
clCreateKernel clGetGLTextureInfo
clCreateKernelsInProgram clGetImageInfo
E
2 clGetKernelArgInfo R
clGetKernelInfo 8
clGetKernelSubGroupInfoKHR 2
clGetKernelWorkGroupInfo 8
clCreateSampler clGetMemObjectInfo 2 Event Objects S
clGetMemObjectInfo Execute Kernels
2 Sampler Objects
G-H

clCreateUserEvent Share Objects

8
clGetProgramInfo
clGetSamplerInfo I Supported Data Types 4
clGetSupportedImageFormats Image Formats 2
Image Objects
4 U-V
2 clReleaseCommandQueue
clEnqueueCopyImage clReleaseContext 5 4
K
2 clReleaseEvent 4 8
clReleaseKernel Kernel Objects
W
2 clReleaseMemObject 2 L
clEnqueueMapImage clReleaseProgram
4 clReleaseSampler 4-5

©2013 Khronos Group - Rev. 0713 Reference & www.khronos.org/opencl

You might also like