[AMDGPU] Introduce separate register limit bias in scheduler
authorStanislav Mekhanoshin <Stanislav.Mekhanoshin@amd.com>
Wed, 18 Jan 2023 19:58:50 +0000 (11:58 -0800)
committerStanislav Mekhanoshin <Stanislav.Mekhanoshin@amd.com>
Thu, 19 Jan 2023 18:51:40 +0000 (10:51 -0800)
commite7f080b3598d7d73456954554d173146b2744953
treeee027d9fa3a639e5570059a9df16081f2ceb4c2c
parent679c352ff42d45de6dcaca7022a7e664cd03323c
[AMDGPU] Introduce separate register limit bias in scheduler

Current implementation abuses ErrorMargin to apply an additional
bias to VGPR and SGPR limits under a high register pressure. The
ErrorMargin exists to account for inaccuracies of the RP tracker
and not to tackle an excess pressure. Introduce separate bias for
this purpose and also make it different for SGPRs and VGPRs as we
may want to use different values in the future.

This is supposed to be NFC, however there is a subtle difference
when subtracting a margin overflows the limit. Doing two subtractions
makes it less probable, although manifests only in mir tests with
an artificially small register budget.

Differential Revision: https://reviews.llvm.org/D142051
llvm/lib/Target/AMDGPU/GCNSchedStrategy.cpp
llvm/lib/Target/AMDGPU/GCNSchedStrategy.h
llvm/test/CodeGen/AMDGPU/partial-regcopy-and-spill-missed-at-regalloc.ll
llvm/test/CodeGen/AMDGPU/spill-vector-superclass.ll