[PATCH] D119762: AMDGPU: Set up User SGPRs for queue_ptr only when necessary

Changpeng Fang via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Mon Feb 14 12:00:06 PST 2022


cfang created this revision.
cfang added reviewers: t-tye, b-sumner, arsenm, sameerds, bcahoon.
Herald added subscribers: foad, okura, kuter, kerbowa, hiraditya, tpr, dstuttard, yaxunl, nhaehnle, jvesely, kzhuravl.
cfang requested review of this revision.
Herald added a subscriber: wdng.
Herald added a reviewer: jdoerfert.
Herald added a reviewer: sstefan1.
Herald added a reviewer: baziotis.
Herald added a project: LLVM.

In general, we need queue_ptr for aperture bases and trap handling, and

  user SGPRs have to be set up to hold queue_ptr.  In current 
  implementation, user SGPRs are set up unnecessarily for some cases. 
  If the target has aperture registers, queue_ptr is not needed to 
  reference aperture bases. For trap handling, if target suppots
  getDoorbellID, queue_ptr is also not necessary. Futher, code object
  version 5 introduces new kernel ABI which passes queue_ptr as an
  implicit kernel argument, so user SGPRs are no longer necessary
  for queue_ptr.
  
  Based on the trap handling document:
  https://llvm.org/docs/AMDGPUUsage.html#amdgpu-trap-handler-for-amdhsa-os-v4-onwards-table,
  llvm.debugtrap does not need queue_ptr, we remove queue_ptr suport for llvm.debugtrap in
  the backend.


https://reviews.llvm.org/D119762

Files:
  llvm/lib/Target/AMDGPU/AMDGPUAsmPrinter.cpp
  llvm/lib/Target/AMDGPU/AMDGPUAttributor.cpp
  llvm/lib/Target/AMDGPU/AMDGPUCallLowering.cpp
  llvm/lib/Target/AMDGPU/AMDGPUHSAMetadataStreamer.cpp
  llvm/lib/Target/AMDGPU/SIISelLowering.cpp
  llvm/lib/Target/AMDGPU/SIMachineFunctionInfo.h
  llvm/lib/Target/AMDGPU/Utils/AMDGPUBaseInfo.cpp
  llvm/lib/Target/AMDGPU/Utils/AMDGPUBaseInfo.h
  llvm/test/CodeGen/AMDGPU/GlobalISel/llvm.amdgcn.is.private.ll
  llvm/test/CodeGen/AMDGPU/GlobalISel/llvm.amdgcn.is.shared.ll
  llvm/test/CodeGen/AMDGPU/hsa-metadata-hidden-args-v5.ll
  llvm/test/CodeGen/AMDGPU/hsa-metadata-queue-ptr-v5.ll
  llvm/test/CodeGen/AMDGPU/kernarg-size.ll
  llvm/test/CodeGen/AMDGPU/llvm.amdgcn.is.private.ll
  llvm/test/CodeGen/AMDGPU/llvm.amdgcn.is.shared.ll
  llvm/test/CodeGen/AMDGPU/trap-abis.ll
  llvm/test/CodeGen/AMDGPU/trap.ll

-------------- next part --------------
A non-text attachment was scrubbed...
Name: D119762.408540.patch
Type: text/x-patch
Size: 30906 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20220214/06f0c277/attachment.bin>


More information about the llvm-commits mailing list