Mesa (master): aco: try to better align 8+ dword SGPR vectors
GitLab Mirror
gitlab-mirror at kemper.freedesktop.org
Mon Jan 11 16:44:23 UTC 2021
Module: Mesa
Branch: master
Commit: f8c7661ecaa782fdde105a4bf756023eb88ea780
URL: http://cgit.freedesktop.org/mesa/mesa/commit/?id=f8c7661ecaa782fdde105a4bf756023eb88ea780
Author: Rhys Perry <pendingchaos02 at gmail.com>
Date: Tue Aug 25 19:10:52 2020 +0100
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 at gmail.com>
Reviewed-by: Daniel Schürmann <daniel at schuermann.dev>
Closes: https://gitlab.freedesktop.org/mesa/mesa/-/issues/4070
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/8416>
---
src/amd/compiler/aco_register_allocation.cpp | 18 ++++++++++--------
1 file changed, 10 insertions(+), 8 deletions(-)
diff --git a/src/amd/compiler/aco_register_allocation.cpp b/src/amd/compiler/aco_register_allocation.cpp
index 3f0f44b6bf6..2fadcef4a72 100644
--- a/src/amd/compiler/aco_register_allocation.cpp
+++ b/src/amd/compiler/aco_register_allocation.cpp
@@ -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;
More information about the mesa-commit
mailing list