[PATCH] D89525: [amdgpu] Enhance AMDGPU AA.

Tony Tye via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Mon Oct 19 23:49:31 PDT 2020


t-tye added a comment.

In D89525#2339241 <https://reviews.llvm.org/D89525#2339241>, @nhaehnle wrote:

> This is fine for graphics.

Right, graphics shaders manage LDS such that it is used to pass arguments between certain shader kinds. But that is not the case for compute.



================
Comment at: llvm/lib/Target/AMDGPU/AMDGPUAliasAnalysis.cpp:114
+      case CallingConv::AMDGPU_KERNEL:
+        // In the kernel function, kernel arguments won't alias to (local)
+        // variables in shared or private address space.
----------------
hliao wrote:
> rampitec wrote:
> > hliao wrote:
> > > rampitec wrote:
> > > > hliao wrote:
> > > > > rampitec wrote:
> > > > > > What is we pass a pointer to LDS allocated on the host side?
> > > > > No LDS pointer is passed through constant variables in user code. So far, LDS is allocated and assigned during codegen. Late, as LDS could be assigned per kernel and from 0, we could choose clone sub-function (called by more than one kernel functions) so that assignment could be done within linker, or add GOT like relocation if sub-function is not cloned. The late needs to prepare GOT entries on the host side but that load from GOT could be easily distinguished in the backend as it needs to use PseuodSource in MMO.
> > > > But that's not constant, it is just Argument?
> > > In HIP, LDS pointer cannot be passed as an argument to a kernel.
> > In OpenCL it is legal.
> But, OpenCL doesn't allow generic pointer as kernel function arguments. We won't have generic pointer arguments for OpenCL
It is not legal in OpenCL. In OpenCL you actually pass in a byte size that causes the driver to cause that much LDS to be allocated and the pointer to it passed to the kernel. So the host is not passing an LDS pointer, it is passing a dynamic size for and LDS allocation.

As mentioned above, passing a generic pointer to OpenCL also cannot pass a pointer to LDS that the kernel can access. LDS is allocated by waves as they are created, so it is not possible to pass in a pointer to something that does not yet exist.


Repository:
  rG LLVM Github Monorepo

CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D89525/new/

https://reviews.llvm.org/D89525



More information about the llvm-commits mailing list