Mesa (master): aco: try to always find a register with stride for even sizes

GitLab Mirror gitlab-mirror at kemper.freedesktop.org
Wed Apr 22 18:36:13 UTC 2020


Module: Mesa
Branch: master
Commit: d666d83be2fa03210f38b06e72410e8d8221b184
URL:    http://cgit.freedesktop.org/mesa/mesa/commit/?id=d666d83be2fa03210f38b06e72410e8d8221b184

Author: Daniel Schürmann <daniel at schuermann.dev>
Date:   Wed Apr 15 11:00:45 2020 +0100

aco: try to always find a register with stride for even sizes

Totals from affected shaders:
SGPRS: 1162400 -> 1162400 (0.00 %)
VGPRS: 947364 -> 946960 (-0.04 %)
Code Size: 98399300 -> 98399004 (-0.00 %) bytes
Max Waves: 74665 -> 74682 (0.02 %)

Reviewed-by: Rhys Perry <pendingchaos02 at gmail.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/4573>

---

 src/amd/compiler/aco_register_allocation.cpp | 6 ++++--
 1 file changed, 4 insertions(+), 2 deletions(-)

diff --git a/src/amd/compiler/aco_register_allocation.cpp b/src/amd/compiler/aco_register_allocation.cpp
index 9a36019ff37..eae3822e61c 100644
--- a/src/amd/compiler/aco_register_allocation.cpp
+++ b/src/amd/compiler/aco_register_allocation.cpp
@@ -395,8 +395,10 @@ std::pair<PhysReg, bool> get_reg_simple(ra_ctx& ctx,
 
    if (stride == 1) {
 
-      if (rc.type() == RegType::vgpr && (size == 4 || size == 8)) {
-         info.stride = 4;
+      for (unsigned stride = 8; stride > 1; stride /= 2) {
+         if (size % stride)
+            continue;
+         info.stride = stride;
          std::pair<PhysReg, bool> res = get_reg_simple(ctx, reg_file, info);
          if (res.second)
             return res;



More information about the mesa-commit mailing list