[OpenCL] __generic address space for CL2.0
Sahasrabuddhe, Sameer
sameer.sahasrabuddhe at amd.com
Fri Nov 21 00:18:39 PST 2014
Hello Anastasia,
Some comments below on the latest patch. Only a couple of nitpicks, really!
> diff --git a/include/clang/Basic/AttrDocs.td
b/include/clang/Basic/AttrDocs.td
<snip>
> +def OpenCLAddressSpaceGenericDocs : Documentation {
> + let Category = DocOpenCLAddressSpaces;
> + let Heading = "__generic(generic)";
> + let Content = [{
> +The generic address space attribute is only available with OpenCL
v2.0 and later.
> +It can be used with pointer types. Only local variables and function
parameters
> +in non-kernel functions can have generic address space type
attributes. It is
It can be used *only* with pointer types. Is it not okay to declare
(pointer) variables in program scope with a generic type attribute?
Also, the sentence should use singular "attribute".
> +intended to be a placeholder for any other address space except for
'__constant'
> +in OpenCL code which can be used with multiple address spaces.
> + }];
> +}
<snip>
> +def OpenCLAddressSpaceLocalDocs : Documentation {
> + let Category = DocOpenCLAddressSpaces;
> + let Heading = "__local(local)";
> + let Content = [{
> +The local address space specifies that an object is allocated in the
local (work
> +group) memory area, which is accessible to all work items in the
same work
> +group. The content stored in this memory region is not accessible
after the kernel
> +execution ends. Pointer types to local address space are allowed as
function
> +parameters. In a kernel function scope any variable can be in the
local address
> +space. Local address space variables cannot have an initializer.
> + }];
> +}
Variables declared in the local address space can only occur at kernel
function scope. Only pointers to local address space can be declared in
other places. I am not sure if a pointer to local address space can be
declared at program scope. It doesn't sound very useful, but can't
confirm if the spec disallows it.
> +def OpenCLAddressSpacePrivateDocs : Documentation {
> + let Category = DocOpenCLAddressSpaces;
> + let Heading = "__private(private)";
> + let Content = [{
> +The private address space specifies that an object is allocated in
the private
> +(work item) memory . Other work items cannot access the same memory
area and
> +its content is destroyed after work item execution ends. Local
variables and
> +function arguments can be in private address space. Kernel function
arguments
> +declared to be a pointer or an array type cannot point to the
private address
> +space.
> + }];
Function arguments are always in the private address space (stronger
than just "can be").
Sameer.
More information about the cfe-commits
mailing list