[all-commits] [llvm/llvm-project] 6cf16c: AMDGPU/GlobalISel: AMDGPURegBankSelect

Petar Avramovic via All-commits all-commits at lists.llvm.org
Thu Nov 28 10:01:22 PST 2024


  Branch: refs/heads/users/petar-avramovic/new-rbs-rb-select
  Home:   https://github.com/llvm/llvm-project
  Commit: 6cf16c02ebadd60c40f0ad664dc5770f0a6d58e4
      https://github.com/llvm/llvm-project/commit/6cf16c02ebadd60c40f0ad664dc5770f0a6d58e4
  Author: Petar Avramovic <Petar.Avramovic at amd.com>
  Date:   2024-11-28 (Thu, 28 Nov 2024)

  Changed paths:
    M llvm/lib/Target/AMDGPU/AMDGPUGlobalISelUtils.cpp
    M llvm/lib/Target/AMDGPU/AMDGPUGlobalISelUtils.h
    M llvm/lib/Target/AMDGPU/AMDGPURegBankSelect.cpp
    M llvm/test/CodeGen/AMDGPU/GlobalISel/regbankselect-mui-regbanklegalize.mir
    M llvm/test/CodeGen/AMDGPU/GlobalISel/regbankselect-mui-regbankselect.mir

  Log Message:
  -----------
  AMDGPU/GlobalISel: AMDGPURegBankSelect

Assign register banks to virtual registers. Does not use generic
RegBankSelect. After register bank selection all register operand of
G_ instructions have LLT and register banks exclusively. If they had
register class, reassign appropriate register bank.

Assign register banks using machine uniformity analysis:
Sgpr - uniform values and some lane masks
Vgpr - divergent, non S1, values
Vcc  - divergent S1 values(lane masks)

AMDGPURegBankSelect does not consider available instructions and, in
some cases, G_ instructions with some register bank assignment can't be
inst-selected. This is solved in RegBankLegalize.

Exceptions when uniformity analysis does not work:
S32/S64 lane masks:
- need to end up with sgpr register class after instruction selection
- In most cases Uniformity analysis declares them as uniform
  (forced by tablegen) resulting in sgpr S32/S64 reg bank
- When Uniformity analysis declares them as divergent (some phis),
  use intrinsic lane mask analyzer to still assign sgpr register bank
temporal divergence copy:
- COPY to vgpr with implicit use of $exec inside of the cycle
- this copy is declared as uniform by uniformity analysis
- make sure that assigned bank is vgpr
Note: uniformity analysis does not consider that registers with vgpr def
are divergent (you can have uniform value in vgpr).
- TODO: implicit use of $exec could be implemented as indicator
  that instruction is divergent



To unsubscribe from these emails, change your notification settings at https://github.com/llvm/llvm-project/settings/notifications


More information about the All-commits mailing list