aco: try to better align 8+ dword SGPR vectors

This doesn't have much of an effect, but it helps avoid a
pathological case for Assassin's Creed Valhalla and a RDR2 shader with a
future change.

fossil-db (Sienna):
Totals from 55074 (39.51% of 139391) affected shaders:
SGPRs: 3515076 -> 3567744 (+1.50%); split: -0.01%, +1.51%
CodeSize: 206942120 -> 206941868 (-0.00%); split: -0.00%, +0.00%
Instrs: 39625900 -> 39625837 (-0.00%); split: -0.00%, +0.00%
Cycles: 1640088780 -> 1640088828 (+0.00%); split: -0.00%, +0.00%

Signed-off-by: Rhys Perry <pendingchaos02@gmail.com>
Reviewed-by: Daniel Schürmann <daniel@schuermann.dev>
Closes: https://gitlab.freedesktop.org/mesa/mesa/-/issues/4070
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/8416>
This commit is contained in:
Rhys Perry
2020-08-25 19:10:52 +01:00
committed by Marge Bot
parent eb2a4a7dee
commit f8c7661eca
+10 -8
View File
@@ -632,16 +632,18 @@ std::pair<PhysReg, bool> get_reg_simple(ra_ctx& ctx,
uint32_t stride = info.rc.is_subdword() ? DIV_ROUND_UP(info.stride, 4) : info.stride;
RegClass rc = info.rc;
DefInfo new_info = info;
for (unsigned new_stride = 16; new_stride > stride; new_stride /= 2) {
if (size % new_stride)
continue;
new_info.stride = new_stride;
std::pair<PhysReg, bool> res = get_reg_simple(ctx, reg_file, new_info);
if (res.second)
return res;
}
if (stride == 1) {
info.rc = RegClass(rc.type(), size);
for (unsigned new_stride = 8; new_stride > 1; new_stride /= 2) {
if (size % new_stride)
continue;
info.stride = new_stride;
std::pair<PhysReg, bool> res = get_reg_simple(ctx, reg_file, info);
if (res.second)
return res;
}
/* best fit algorithm: find the smallest gap to fit in the variable */
unsigned best_pos = 0xFFFF;