RESTRICTIONS(3clc)
โจ NAME โจ
okay so bestie, welcome to Restrictions ๐ this is the OpenCL Manual page, section 3clc, and it's basically the big "no babes, you cannot do that" list for OpenCL C. it's giving rules, rules, and more rules, and honestly every single one of them matters ๐
- the use of pointers is somewhat restricted. the following rules apply:
- arguments to
functionQualifiers(3clc)functions declared in a program that are pointers must be declared with theglobal(3clc),constant(3clc), orlocal(3clc)qualifier. - a pointer declared with the
constant(3clc),local(3clc), orglobal(3clc)qualifier can only be assigned to a pointer declared with the__constant,__local, or__globalqualifier respectively. like, match the vibe or don't bother โจ - pointers to functions are not allowed. not a thing. nope ๐
- arguments to
functionQualifiers(3clc)functions in a program cannot be declared as a pointer to a pointer(s). variables inside a function, or arguments to non-kernel functions in a program, can be declared as a pointer to a pointer(s). so that's the loophole, iykyk ๐
- arguments to
- an image type (
otherDataTypes(3clc),otherDataTypes(3clc),otherDataTypes(3clc),otherDataTypes(3clc),otherDataTypes(3clc), orotherDataTypes(3clc)) can only be used as the type of a function argument. an image function argument cannot be modified. elements of an image can only be accessed using theimageFunctions(3clc).
an image type cannot be used to declare a variable, a structure or union field, an array of images, a pointer to an image, or the return type of a function. an image type cannot be used with the private(3clc), local(3clc) and constant(3clc) address space qualifiers. the otherDataTypes(3clc) type cannot be used with the __write_only access qualifier unless the cl_khr_3d_image_writes(3clc) extension is enabled. an image type cannot be used with the accessQualifiers(3clc) access qualifer which is reserved for future use. ๐ฎ
the sampler type (sampler_t(3clc)) can only be used as the type of a function argument or a variable declared in the program scope or the outermost scope of a kernel function. the behavior of a sampler variable declared in a non-outermost scope of a kernel function is implementation-defined. a sampler argument or variable cannot be modified.
the sampler type cannot be used to declare a structure or union field, an array of samplers, a ponter to a sampler, or the return type of a function. the sampler type cannot be used with the __local and __global address space qualifiers.
- bit-fields struct members are currently not supported. rip ๐ชฆ
- variable length arrays and structures with flexible (or unsized) arrays are not supported.
- variadic macros and functions are not supported. no
...shenanigans bestie ๐ซ - the library functions defined in the C99 standard headers
assert.h,ctype.h,complex.h,errno.h,fenv.h,float.h,inttypes.h,limits.h,locale.h,setjmp.h,signal.h,stdarg.h,stdio.h,stdlib.h,string.h,tgmath.h,time.h,wchar.h, andwctype.hare not available and cannot be included by a program. yes, that whole list. all of them. gone ๐ - the
autoandregisterstorage-class specifiers are not supported. - recursion is not supported. she cannot call herself, periodt ๐
- the function using the
functionQualifiers(3clc)qualifier can only have return typevoidin the source code. - arguments to kernel functions in a program cannot be declared with the built-in scalar types
bool,half,size_t,ptrdiff_t,intptr_t, anduintptr_t, or a struct and/or union that contain fields declared to be one of these built-in scalar types. the size in bytes of these types excepthalfare implementation-defined, and in addition can also be different for the OpenCL device and the host processor, making it difficult to allocate buffer objects to be passed as arguments to a kernel declared as pointer to these types.halfis not supported ashalfcan be used as a storage format only (unless thecl_khr_fp16(3clc)extension is supported) and is not a data type on which floating-point arithmetic can be performed. so like... don't try to do math on it, she's decorative ๐ญ - whether or not irreducible control flow is illegal is implementation defined. shrug, it depends ๐ฆ
- arguments to kernel functions in a program cannot be declared to be of type
otherDataTypes(3clc). - elements of a struct or union must belong to the same address space. declaring a struct or union whose elements are in different address spaces is illegal. one space, one family, no mixing ๐ซถ
- arguments to kernel functions that are declared to be a struct or union do not allow OpenCL objects to be passed as elements of the struct or union.
- the type qualifiers
const,restrict, andvolatileas defined by the C99 specification are supported. these qualifiers cannot be used withotherDataTypes(3clc),otherDataTypes(3clc),otherDataTypes(3clc),otherDataTypes(3clc),otherDataTypes(3clc), andotherDataTypes(3clc)types. types other than pointer types shall not use therestrictqualifier. - the event type (
otherDataTypes(3clc)) cannot be used as the type of a kernel function argument. the event type cannot be used to declare a program scope variable. the event type cannot be used to declare a structure or union field. the event type cannot be used with thelocal(3clc),constant(3clc), andglobal(3clc)address space qualifiers. so many no's for one little type, iconic honestly โจ
๐ SPECIFICATION ๐
OpenCL Specification[1]
๐ SEE ALSO ๐
imageFunctions(3clc), functionQualifiers(3clc)
๐ซถ AUTHORS ๐ซถ
The Khronos Group
ยฉ๏ธ COPYRIGHT ยฉ๏ธ
Copyright ยฉ 2007-2011 The Khronos Group Inc.
Permission is hereby granted, free of charge, to any person obtaining a copy of this software and/or associated documentation files (the "Materials"), to deal in the Materials without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Materials, and to permit persons to whom the Materials are furnished to do so, subject to the condition that this copyright notice and permission notice shall be included in all copies or substantial portions of the Materials.
๐ NOTES ๐
- OpenCL Specification page 231, section 6.9 - Restrictions
and that's the whole page bestie, no cap ๐ shoutout to The Khronos Group for writing it and for the date stamp 01/14/2021 โ this is RESTRICTIONS(3clc), signing off, slay ๐ธ
๐ฆ where this page comes from
- ubuntu jammy: opencl-1.2-man-doc 1.0~svn33624-5 ยท other
- ubuntu noble: opencl-1.2-man-doc 1.0~svn33624-5 ยท other
- ๐ girlified by deepseek-ai/DeepSeek-V4.1-Flash on : a language model's rewrite of the original, under its terms