Mesa (master): aco: move attempt to find strided register into get_reg_simple()
GitLab Mirror
gitlab-mirror at kemper.freedesktop.org
Wed Apr 22 18:36:13 UTC 2020
Module: Mesa
Branch: master
Commit: 97a870cf88a551cca9a1fd0773d183cddc4b2561
URL: http://cgit.freedesktop.org/mesa/mesa/commit/?id=97a870cf88a551cca9a1fd0773d183cddc4b2561
Author: Daniel Schürmann <daniel at schuermann.dev>
Date: Mon Apr 13 13:16:00 2020 +0100
aco: move attempt to find strided register into get_reg_simple()
This simplifies code and helps some shaders
Totals from affected shaders:
Code Size: 51227172 -> 51202216 (-0.05 %) bytes
Max Waves: 19955 -> 19948 (-0.04 %)
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 | 17 +++++++++--------
1 file changed, 9 insertions(+), 8 deletions(-)
diff --git a/src/amd/compiler/aco_register_allocation.cpp b/src/amd/compiler/aco_register_allocation.cpp
index 4eaf9b1742a..0857084a486 100644
--- a/src/amd/compiler/aco_register_allocation.cpp
+++ b/src/amd/compiler/aco_register_allocation.cpp
@@ -395,6 +395,14 @@ std::pair<PhysReg, bool> get_reg_simple(ra_ctx& ctx,
/* best fit algorithm: find the smallest gap to fit in the variable */
if (stride == 1) {
+
+ if (rc.type() == RegType::vgpr && (size == 4 || size == 8)) {
+ info.stride = 4;
+ std::pair<PhysReg, bool> res = get_reg_simple(ctx, reg_file, info);
+ if (res.second)
+ return res;
+ }
+
unsigned best_pos = 0xFFFF;
unsigned gap_size = 0xFFFF;
unsigned next_pos = 0xFFFF;
@@ -935,14 +943,7 @@ PhysReg get_reg(ra_ctx& ctx,
DefInfo info(ctx, instr, temp.regClass());
/* try to find space without live-range splits */
- std::pair<PhysReg, bool> res;
- if (info.rc.type() == RegType::vgpr && (info.size == 4 || info.size == 8)) {
- DefInfo info_strided = {info.lb, info.ub, info.size, 4, info.rc};
- std::pair<PhysReg, bool> res = get_reg_simple(ctx, reg_file, info_strided);
- }
- if (!res.second)
- res = get_reg_simple(ctx, reg_file, info);
-
+ std::pair<PhysReg, bool> res = get_reg_simple(ctx, reg_file, info);
if (res.second)
return res.first;
More information about the mesa-commit
mailing list