[PATCH] D27586: AMDGPU/SI: Add llvm.amdgcn.s.buffer.load intrinsic

Tom Stellard via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Wed Feb 1 09:59:14 PST 2017


tstellarAMD added a comment.

In https://reviews.llvm.org/D27586#663090, @mareko wrote:

> Would you please describe the purpose of this patch? It's not obvious why it's useful.


The main reason it is useful is because it tells the compiler that this is a load from a constant value without neededing any more analysis.  It's also useful because s_buffer_load_* instructions have a much more simplified resource descriptor, so if then do end up getting selected to MUBUF you don't have to worry about swizzled addressing.  It is true however, that you could just use a single llvm.amdgcn.buffer.load.i32 intrinsic for everything, but you may end up with worse code if you are unable to do the analysis required to select it to SMRD instructions.

> What is the behavior of the constant address space in LLVM? Note that vertex buffers and 'restrict' read-only buffers use immutable memory too, so those are also 'constant' and selecting SMEM for those is desirable if it's possible.

Constant address space just means that the memory is unchanged for the life of the program.

> OpenGL Constant buffers aren't limited to SMEM. They can be read with a VGPR offset too. LLVM doesn't have the capability to recognize a non-constant SGPR offset at ISel. If you wanna select SMEM with a non-constant offset, you also need to update moveToVALU.




https://reviews.llvm.org/D27586





More information about the llvm-commits mailing list