AMDGPU/SI: Use flat for global load/store when targeting HSA
authorChangpeng Fang <changpeng.fang@gmail.com>
Tue, 22 Dec 2015 20:55:23 +0000 (20:55 +0000)
committerChangpeng Fang <changpeng.fang@gmail.com>
Tue, 22 Dec 2015 20:55:23 +0000 (20:55 +0000)
commit89e60598f6b69b1b67d3056b27d207e07eefde40
treea0061c5c7ae4ac4888eb62f73f8193e6b30dcaf0
parent86e3cfb9dc8b5dbcc83aea735b5bdd9d8b644c9a
 AMDGPU/SI: Use flat for global load/store when targeting HSA

Summary:
  For some reason doing executing an MUBUF instruction with the addr64
  bit set and a zero base pointer in the resource descriptor causes
  the memory operation to be dropped when the shader is executed using
  the HSA runtime.

  This kind of MUBUF instruction is commonly used when the pointer is
  stored in VGPRs.  The base pointer field in the resource descriptor
  is set to zero and and the pointer is stored in the vaddr field.

  This patch resolves the issue by only using flat instructions for
  global memory operations when targeting HSA. This is an overly
  conservative fix as all other configurations of MUBUF instructions
  appear to work.

  NOTE: re-commit by fixing a failure in Codegen/AMDGPU/llvm.dbg.value.ll

Reviewers: tstellarAMD

Subscribers: arsenm, llvm-commits

Differential Revision: http://reviews.llvm.org/D15543

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@256282 91177308-0d34-0410-b5e6-96231b3b80d8
13 files changed:
lib/Target/AMDGPU/AMDGPU.td
lib/Target/AMDGPU/AMDGPUISelDAGToDAG.cpp
lib/Target/AMDGPU/AMDGPUSubtarget.cpp
lib/Target/AMDGPU/AMDGPUSubtarget.h
lib/Target/AMDGPU/CIInstructions.td
lib/Target/AMDGPU/VIInstructions.td
test/CodeGen/AMDGPU/ci-use-flat-for-global.ll [new file with mode: 0644]
test/CodeGen/AMDGPU/hsa.ll
test/CodeGen/AMDGPU/large-alloca-compute.ll
test/CodeGen/AMDGPU/llvm.dbg.value.ll
test/CodeGen/AMDGPU/move-addr64-rsrc-dead-subreg-writes.ll
test/CodeGen/AMDGPU/register-count-comments.ll
test/CodeGen/AMDGPU/work-item-intrinsics.ll