[Libclc-dev] [PATCH 2/3] Implement async_work_group_copy builtin

Matt Arsenault Matthew.Arsenault at amd.com
Fri Aug 8 15:54:58 PDT 2014


On 08/08/2014 02:40 PM, Tom Stellard wrote:
> +    __CLC_DST_ADDR_SPACE __CLC_GENTYPE *dst,
> +    const __CLC_SRC_ADDR_SPACE __CLC_GENTYPE *src,
> +    size_t num_gentypes,
> +    event_t event) {
> +
> +  // __builtin_memcpy doesn't work with address spaces, so we need to
> +  // implement the copy using a loop.
> +
> +  unsigned i;
> +  for (i = 0; i < num_gentypes; ++i) {
> +    dst[i] = src[i];
> +  }
> +
> +  return event;

This should use size_t instead of unsigned to match the bound type.

The __builtins not really working with address spaces is a general 
problem that keeps coming up. How should it be fixed? I looked into 
fixing this for the __builtin_nanf problem. The problem seems to be 
clang conflates address space 0 with the lack of an address space in 
some places, and not others. The builtins all have no address space 
specified for their types, which is de factor considered to be 0, 
although Qualifiers/QualType can distinguish between having a specified 
address space 0 and not having an address space set. I think clang needs 
to move to considering the private address space as a distinct address 
space like the others, and address space checks should consistently 
check if there is an explicitly set address space before checking if 
they match.




More information about the Libclc-dev mailing list