[PATCH] D26157: [OpenCL] always use SPIR address spaces for kernel_arg_addr_space MD

Yaxun Liu via cfe-commits cfe-commits at lists.llvm.org
Tue Nov 8 07:29:58 PST 2016


yaxunl added a comment.

In https://reviews.llvm.org/D26157#589033, @pekka.jaaskelainen wrote:

> The uses for the OpenCL logical address spaces that I know of are:
>
> 1. to differentiate local kernel arguments as their memory allocation is different (per WG if parallel WGs)
> 2. alias analysis: as OpenCL address spaces are per definition disjoint (no overlap), it can be utilized to prove that pointers to different address spaces are not accessing the same areas, which helps e.g. vectorization and other optimizations that require code motion/parallelization
> 3. clGetKernelArgInfo() implementation
>
>   The kernel arg MD is good enough for 1) and 3) and helps in 2). Actually having the address spaces in the pointers would be much better, but is harder to maintain.


I think 2) should be done through address space of IR since the MD is only available for kernel functions. For amdgpu targets this is not an issue since they preserve the OpenCL address spaces.

> Yes. Maybe I should just add to the docs about the MD in my patch? I think this patch should go in regardless of a possible heavier work related to the logical address spaces as the current MD is clearly broken.

Agree.


Repository:
  rL LLVM

https://reviews.llvm.org/D26157





More information about the cfe-commits mailing list