OpenCL C "long" should always have 64 bits

Michele Scandale michele.scandale at gmail.com
Tue Sep 3 11:18:08 PDT 2013


On 09/03/2013 07:43 PM, Erik Schnetter wrote:
> On 2013-09-03, at 13:31 , Michele Scandale <michele.scandale at gmail.com> wrote:
> 
>> On 09/03/2013 07:08 PM, Tom Stellard wrote:
>>> On Tue, Sep 03, 2013 at 12:45:21PM -0400, Erik Schnetter wrote:
>>>> Unfortunately, removing the address space definitions means that overloaded functions do not use address spaces for name mangling. This is bad, because OpenCL C's run-time library defines many functions with signatures that differ only in their address spaces. Clang also contains test cases that explicitly assume that e.g. the "global" address space is number 1, and the "constant" address space is number 2.
>>>>
>>>
>>> The name mangling works fine when compiling libclc
>>> (http://libclc.llvm.org/) for the R600 target.  I'm guessing that this
>>> is because R600 defines its own address space map.  Would it work to add
>>> an address space map to whatever target you are using?  Or maybe a
>>> default address space map that targets like R600 can override.
>>
>> I'm in a quite long discussion about this topic:
>> - beginning of the discussion
>> http://lists.cs.uiuc.edu/pipermail/cfe-commits/Week-of-Mon-20130715/084011.html
>> - last part of the discussion where a small brief is reported
>> http://lists.cs.uiuc.edu/pipermail/cfe-commits/Week-of-Mon-20130819/086907.html
>> - my last patch that introduces target independent mangling with the option for
>> targets to require mangling based on the address space map
>> http://lists.cs.uiuc.edu/pipermail/cfe-commits/Week-of-Mon-20130826/087185.html
>>
>> I'd appreciate any feedback about what has been discussed.
> 
> 
> Michele
> 
> I agree with the reasoning in these threads, and with the proposed solutions. I like the patch. OpenCL would the override this setting (UseAddrSpaceMapMangling) for all targets, in the same way it already overrides e.g. sizeof(long).

Think this is not good: is not true that all targets have a proper address space
map (see X86 or ARM or other CPU targets) so it's not correct to force the use
of address space map based mangling. This option was introduced to allow a
correct mangling for SPIR target, where the mangling is an aspect explicit in
the SPIR specification.

Having by default the target independent mangling ensure to have a correct
mangling for all the target (each address space is mangled in a different way).
Each target then can prefer the other mangling but doing this implicitly require
to specify a correct target address space map (address spaces that the backend
can handle correctly).

Again, how OpenCL address space are translated in the IR is target specific, the
mangling should be target independent, but there are cases where a mangling that
reflect the address space map is required, but this is a target specific detail
and the OpenCL configuration should not enforce this detail.

We may introduce an option to override the target choice, like the fake address
space map, but it should be used only for testing purpose.

Regards,
-Michele



More information about the cfe-commits mailing list