Skip to content

Commit 4f09b0b

Browse files
[AMDGPU] Add hot block register renaming pass
This patch introduces a post-allocation register renaming optimization pass that reduces value density in hot basic blocks. The pass helps the post-RA scheduler avoid false WAW dependencies by moving local values to unused physical registers. The pass operates after greedy register allocation but before VirtRegRewriter. It identifies hot blocks (above frequency threshold), calculates value density per physical register, and selectively moves local live ranges to free registers. Only 32-bit VGPR values that live entirely within a single basic block are moved, ensuring conservative behavior. Key features: - Respects tied operands and register allocation constraints - Honors occupancy-based VGPR limits to avoid spilling - Disabled by default (enable with -amdgpu-enable-hot-block-reg-renaming) - Includes comprehensive lit tests Performance results show up to 2% improvement on register-intensive kernels such as rocRAND MTGP32.
1 parent 80d7e59 commit 4f09b0b

File tree

7 files changed

+806
-111
lines changed

7 files changed

+806
-111
lines changed

llvm/lib/Target/AMDGPU/AMDGPU.h

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -545,6 +545,9 @@ extern char &AMDGPUExportKernelRuntimeHandlesLegacyID;
545545
void initializeGCNNSAReassignLegacyPass(PassRegistry &);
546546
extern char &GCNNSAReassignID;
547547

548+
void initializeAMDGPUHotBlockRegisterRenamingLegacyPass(PassRegistry &);
549+
extern char &AMDGPUHotBlockRegisterRenamingID;
550+
548551
void initializeGCNPreRALongBranchRegLegacyPass(PassRegistry &);
549552
extern char &GCNPreRALongBranchRegID;
550553

0 commit comments

Comments
 (0)