[all-commits] [llvm/llvm-project] 04317d: [AMDGPU][GISel] Add inverse ballot intrinsic

Jessica Del via All-commits all-commits at lists.llvm.org
Wed Apr 5 22:47:03 PDT 2023


  Branch: refs/heads/main
  Home:   https://github.com/llvm/llvm-project
  Commit: 04317d4da78e4d444f59d182b8b7c63ae3608eb6
      https://github.com/llvm/llvm-project/commit/04317d4da78e4d444f59d182b8b7c63ae3608eb6
  Author: Jessica Del <Jessica.Del at amd.com>
  Date:   2023-04-06 (Thu, 06 Apr 2023)

  Changed paths:
    M llvm/include/llvm/IR/IntrinsicsAMDGPU.td
    M llvm/lib/Target/AMDGPU/AMDGPUISelDAGToDAG.cpp
    M llvm/lib/Target/AMDGPU/AMDGPUInstructionSelector.cpp
    M llvm/lib/Target/AMDGPU/AMDGPUInstructionSelector.h
    M llvm/lib/Target/AMDGPU/AMDGPURegisterBankInfo.cpp
    M llvm/lib/Target/AMDGPU/AMDGPUSearchableTables.td
    M llvm/lib/Target/AMDGPU/SIISelLowering.cpp
    M llvm/lib/Target/AMDGPU/SIInstructions.td
    A llvm/test/CodeGen/AMDGPU/llvm.amdgcn.inverse.ballot.i32.ll
    A llvm/test/CodeGen/AMDGPU/llvm.amdgcn.inverse.ballot.i64.ll

  Log Message:
  -----------
  [AMDGPU][GISel] Add inverse ballot intrinsic

The inverse ballot intrinsic takes in a boolean mask for all lanes and
returns the boolean for the current lane. See SPIR-V's
`subgroupInverseBallot()` in the [[ https://github.com/KhronosGroup/GLSL/blob/master/extensions/khr/GL_KHR_shader_subgroup.txt | GL_KHR_shader_subgroup extension ]].
This allows decision making via branch and select instructions with a manually
manipulated mask.

Implemented in GlobalISel and SelectionDAG, since currently both are supported.
The SelectionDAG required pseudo instructions to use the custom inserter.

The boolean mask needs to be uniform for all lanes.
Therefore we expect SGPR input. In case the source is in a
VGPR, we insert one or more `v_readfirstlane` instructions.

Reviewed By: nhaehnle

Differential Revision: https://reviews.llvm.org/D146287




More information about the All-commits mailing list