'\" t .\" Title: restrictions .\" Author: The Khronos Group .\" Generator: DocBook XSL Stylesheets vsnapshot .\" Date: 01/14/2021 .\" Manual: OpenCL Manual .\" Source: The Khronos Group .\" Language: English .\" .TH "RESTRICTIONS" "3clc" "01/14/2021" "The Khronos Group" "OpenCL Manual" .\" ----------------------------------------------------------------- .\" * Define some portability stuff .\" ----------------------------------------------------------------- .\" ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ .\" http://bugs.debian.org/507673 .\" http://lists.gnu.org/archive/html/groff/2009-02/msg00013.html .\" ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ .ie \n(.g .ds Aq \(aq .el .ds Aq ' .\" ----------------------------------------------------------------- .\" * set default formatting .\" ----------------------------------------------------------------- .\" disable hyphenation .nh .\" disable justification (adjust text to left margin only) .ad l .\" ----------------------------------------------------------------- .\" * MAIN CONTENT STARTS HERE * .\" ----------------------------------------------------------------- .SH "NAME" Restrictions .SH "" .sp .RS 4 .ie n \{\ \h'-04'\(bu\h'+03'\c .\} .el \{\ .sp -1 .IP \(bu 2.3 .\} The use of pointers is somewhat restricted\&. The following rules apply: .sp .RS 4 .ie n \{\ \h'-04'\(bu\h'+03'\c .\} .el \{\ .sp -1 .IP \(bu 2.3 .\} Arguments to \fBfunctionQualifiers\fR(3clc) functions declared in a program that are pointers must be declared with the \fBglobal\fR(3clc), \fBconstant\fR(3clc), or \fBlocal\fR(3clc) qualifier\&. .RE .sp .RS 4 .ie n \{\ \h'-04'\(bu\h'+03'\c .\} .el \{\ .sp -1 .IP \(bu 2.3 .\} A pointer declared with the \fBconstant\fR(3clc), \fBlocal\fR(3clc), or \fBglobal\fR(3clc) qualifier can only be assigned to a pointer declared with the __constant, __local, or __global qualifier respectively\&. .RE .sp .RS 4 .ie n \{\ \h'-04'\(bu\h'+03'\c .\} .el \{\ .sp -1 .IP \(bu 2.3 .\} Pointers to functions are not allowed\&. .RE .sp .RS 4 .ie n \{\ \h'-04'\(bu\h'+03'\c .\} .el \{\ .sp -1 .IP \(bu 2.3 .\} Arguments to \fBfunctionQualifiers\fR(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)\&. .RE .RE .sp .RS 4 .ie n \{\ \h'-04'\(bu\h'+03'\c .\} .el \{\ .sp -1 .IP \(bu 2.3 .\} An image type ( \fBotherDataTypes\fR(3clc), \fBotherDataTypes\fR(3clc), \fBotherDataTypes\fR(3clc), \fBotherDataTypes\fR(3clc), \fBotherDataTypes\fR(3clc), or \fBotherDataTypes\fR(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 the \fBimageFunctions\fR(3clc)\&. .sp 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 \fBprivate\fR(3clc), \fBlocal\fR(3clc) and \fBconstant\fR(3clc) address space qualifiers\&. The \fBotherDataTypes\fR(3clc) type cannot be used with the __write_only access qualifier unless the \fBcl_khr_3d_image_writes\fR(3clc) extension is enabled\&. An image type cannot be used with the \fBaccessQualifiers\fR(3clc) access qualifer which is reserved for future use\&. .sp The sampler type (\fBsampler_t\fR(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\&. .sp 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\&. .RE .sp .RS 4 .ie n \{\ \h'-04'\(bu\h'+03'\c .\} .el \{\ .sp -1 .IP \(bu 2.3 .\} Bit\-fields struct members are currently not supported\&. .RE .sp .RS 4 .ie n \{\ \h'-04'\(bu\h'+03'\c .\} .el \{\ .sp -1 .IP \(bu 2.3 .\} Variable length arrays and structures with flexible (or unsized) arrays are not supported\&. .RE .sp .RS 4 .ie n \{\ \h'-04'\(bu\h'+03'\c .\} .el \{\ .sp -1 .IP \(bu 2.3 .\} Variadic macros and functions are not supported\&. .RE .sp .RS 4 .ie n \{\ \h'-04'\(bu\h'+03'\c .\} .el \{\ .sp -1 .IP \(bu 2.3 .\} 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, and wctype\&.h are not available and cannot be included by a program\&. .RE .sp .RS 4 .ie n \{\ \h'-04'\(bu\h'+03'\c .\} .el \{\ .sp -1 .IP \(bu 2.3 .\} The auto and register storage\-class specifiers are not supported\&. .RE .sp .RS 4 .ie n \{\ \h'-04'\(bu\h'+03'\c .\} .el \{\ .sp -1 .IP \(bu 2.3 .\} Recursion is not supported\&. .RE .sp .RS 4 .ie n \{\ \h'-04'\(bu\h'+03'\c .\} .el \{\ .sp -1 .IP \(bu 2.3 .\} The function using the \fBfunctionQualifiers\fR(3clc) qualifier can only have return type \fBvoid\fR in the source code\&. .RE .sp .RS 4 .ie n \{\ \h'-04'\(bu\h'+03'\c .\} .el \{\ .sp -1 .IP \(bu 2.3 .\} Arguments to kernel functions in a program cannot be declared with the built\-in scalar types \fBbool\fR, \fBhalf\fR, \fBsize_t\fR, \fBptrdiff_t\fR, \fBintptr_t\fR, and \fBuintptr_t\fR, 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 except \fBhalf\fR are 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\&. \fBhalf\fR is not supported as \fBhalf\fR can be used as a storage format only (unless the \fBcl_khr_fp16\fR(3clc) extension is supported) and is not a data type on which floating\-point arithmetic can be performed\&. .RE .sp .RS 4 .ie n \{\ \h'-04'\(bu\h'+03'\c .\} .el \{\ .sp -1 .IP \(bu 2.3 .\} Whether or not irreducible control flow is illegal is implementation defined\&. .RE .sp .RS 4 .ie n \{\ \h'-04'\(bu\h'+03'\c .\} .el \{\ .sp -1 .IP \(bu 2.3 .\} Arguments to kernel functions in a program cannot be declared to be of type \fBotherDataTypes\fR(3clc)\&. .RE .sp .RS 4 .ie n \{\ \h'-04'\(bu\h'+03'\c .\} .el \{\ .sp -1 .IP \(bu 2.3 .\} 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\&. .RE .sp .RS 4 .ie n \{\ \h'-04'\(bu\h'+03'\c .\} .el \{\ .sp -1 .IP \(bu 2.3 .\} 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\&. .RE .sp .RS 4 .ie n \{\ \h'-04'\(bu\h'+03'\c .\} .el \{\ .sp -1 .IP \(bu 2.3 .\} The type qualifiers const, restrict, and volatile as defined by the C99 specification are supported\&. These qualifiers cannot be used with \fBotherDataTypes\fR(3clc), \fBotherDataTypes\fR(3clc), \fBotherDataTypes\fR(3clc), \fBotherDataTypes\fR(3clc), \fBotherDataTypes\fR(3clc), and \fBotherDataTypes\fR(3clc) types\&. Types other than pointer types shall not use the restrict qualifier\&. .RE .sp .RS 4 .ie n \{\ \h'-04'\(bu\h'+03'\c .\} .el \{\ .sp -1 .IP \(bu 2.3 .\} The event type (\fBotherDataTypes\fR(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 the \fBlocal\fR(3clc), \fBconstant\fR(3clc), and \fBglobal\fR(3clc) address space qualifiers\&. .RE .SH "SPECIFICATION" .PP \m[blue]\fBOpenCL Specification\fR\m[]\&\s-2\u[1]\d\s+2 .SH "SEE ALSO" .PP \fBimageFunctions\fR(3clc), \fBfunctionQualifiers\fR(3clc) .SH "AUTHORS" .PP \fBThe Khronos Group\fR .SH "COPYRIGHT" .br Copyright \(co 2007-2011 The Khronos Group Inc. .br 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. .sp .SH "NOTES" .IP " 1." 4 OpenCL Specification .RS 4 \%page 231, section 6.9 - Restrictions .RE