[cfe-dev] OpenCL support - using metadata
Anton Lokhmotov
Anton.Lokhmotov at arm.com
Thu Mar 3 09:25:44 PST 2011
Hi Guy,
We like the idea of a single node for each kernel. (We tried to avoid
providing default information but I don't think we should try and save space
on this.)
> required work group size (or (0,0,0) if not defined), work group size
> hint (or (0,0,0) if not defined), vec type hint (as a string),
I think the default for vec_type_hint is "int" (6.7.2).
> kernel's signature (as a string too),
We are not sure whether this is required. It seems this information can be
obtained directly from the kernel's value?
> and the name of a named metadata
> node, that holds a list of the kernel's locals' names.
We need to discuss a bit more __local and __constant variables.
> BTW, local variables in our solution are treated much like "static" C
> variables; they are promoted to the program scope with prefixes (as you
> might see below).
We use no metadata for this at all and Clang's conversion for static
variables. So for:
kernel void foo(...) { local int i; ... }
instead of:
> !opencl_foo_locals_anchor = !{!4}
> !4 = metadata !{metadata !"opencl_foo_local_i"}
we generate something like:
@foo.i = internal addrspace(2) global i32 0, align 4
(I assume you use metadata in addition to this; otherwise, how would you be
able represent the type of individual __local variables?)
I see that with your representation one immediately gets hold of all names
for __local variables for a kernel. Do you think it is important?
Is there any benefit in using underscores over dots? (In certain cases,
underscores could lead to a name clash.)
> According to my understanding, function scope
> constant variables are prohibited, the OpenCL 1.1 spec says at 6.5.3:
> "Variables allocated in the __constant address space can only be
> defined as program scope variables and are required to be initialized."
This statement has been removed since revision 37. This statement is deemed
correct: "Variables inside a function or in program scope can also be
declared with the __constant address qualifier." (Note that it doesn't say
that a function must be a kernel function.)
Best wishes,
Anton.
More information about the cfe-dev
mailing list