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

Pekka Jääskeläinen via cfe-commits cfe-commits at lists.llvm.org
Mon Nov 7 22:58:53 PST 2016


pekka.jaaskelainen added a comment.

> target architecture). So if there are no memory segments, nothing can be done to optimize for this and therefore providing
>  the "fake" segment information doesn't seem to be useful? I am just trying to understand the use case.

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 am not too picky on the exact implementation details here. Perhaps well documented hard coded numbers should work too. I am just trying to see the use case for this and whether the current compilation flow is suboptimal to support it properly. But perhaps also the issue is that those MDs are OpenCL specific anyways, but the IR itself is supposed to be source language agnostic.

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.


Repository:
  rL LLVM

https://reviews.llvm.org/D26157





More information about the cfe-commits mailing list