Mesa (main): radv: increase inline push constant limit if we can inline all constants

GitLab Mirror gitlab-mirror at kemper.freedesktop.org
Tue Apr 12 12:09:12 UTC 2022


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

Author: Rhys Perry <pendingchaos02 at gmail.com>
Date:   Thu Jul 29 17:29:43 2021 +0100

radv: increase inline push constant limit if we can inline all constants

fossil-db (Sienna Cichlid):
Totals from 665 (0.49% of 134627) affected shaders:
CodeSize: 4519620 -> 4491724 (-0.62%); split: -0.62%, +0.01%
Instrs: 842745 -> 837313 (-0.64%); split: -0.66%, +0.01%
Latency: 7289925 -> 7279661 (-0.14%); split: -0.30%, +0.16%
InvThroughput: 1240770 -> 1240639 (-0.01%); split: -0.01%, +0.00%
VClause: 15799 -> 15772 (-0.17%)
SClause: 33773 -> 32604 (-3.46%); split: -3.66%, +0.20%
Copies: 67695 -> 64992 (-3.99%); split: -4.49%, +0.50%
PreSGPRs: 38597 -> 38640 (+0.11%); split: -0.14%, +0.25%

Signed-off-by: Rhys Perry <pendingchaos02 at gmail.com>
Reviewed-by: Daniel Schürmann <daniel at schuermann.dev>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/12145>

---

 src/amd/common/ac_shader_args.h   | 5 ++++-
 src/amd/llvm/ac_shader_abi.h      | 2 --
 src/amd/vulkan/radv_shader_args.c | 2 +-
 3 files changed, 5 insertions(+), 4 deletions(-)

diff --git a/src/amd/common/ac_shader_args.h b/src/amd/common/ac_shader_args.h
index e8d743cd961..62e3f48d9c7 100644
--- a/src/amd/common/ac_shader_args.h
+++ b/src/amd/common/ac_shader_args.h
@@ -27,7 +27,10 @@
 #include <stdbool.h>
 #include <stdint.h>
 
-#define AC_MAX_INLINE_PUSH_CONSTS 8
+/* Maximum dwords of inline push constants when the indirect path is still used */
+#define AC_MAX_INLINE_PUSH_CONSTS_WITH_INDIRECT 8
+/* Maximum dwords of inline push constants when the indirect path is not used */
+#define AC_MAX_INLINE_PUSH_CONSTS 32
 
 enum ac_arg_regfile
 {
diff --git a/src/amd/llvm/ac_shader_abi.h b/src/amd/llvm/ac_shader_abi.h
index 735d2cdda0a..840d33cfea0 100644
--- a/src/amd/llvm/ac_shader_abi.h
+++ b/src/amd/llvm/ac_shader_abi.h
@@ -33,8 +33,6 @@
 
 #define AC_LLVM_MAX_OUTPUTS (VARYING_SLOT_VAR31 + 1)
 
-#define AC_MAX_INLINE_PUSH_CONSTS 8
-
 /* Document the shader ABI during compilation. This is what allows radeonsi and
  * radv to share a compiler backend.
  */
diff --git a/src/amd/vulkan/radv_shader_args.c b/src/amd/vulkan/radv_shader_args.c
index 6e3c56558c5..c4c95bf4d74 100644
--- a/src/amd/vulkan/radv_shader_args.c
+++ b/src/amd/vulkan/radv_shader_args.c
@@ -134,7 +134,7 @@ allocate_inline_push_consts(const struct radv_shader_info *info,
       remaining_sgprs++;
    } else {
       /* Clamp to the maximum number of allowed inlined push constants. */
-      while (num_push_consts > MIN2(remaining_sgprs, AC_MAX_INLINE_PUSH_CONSTS)) {
+      while (num_push_consts > MIN2(remaining_sgprs, AC_MAX_INLINE_PUSH_CONSTS_WITH_INDIRECT)) {
          num_push_consts--;
          mask &= ~BITFIELD64_BIT(util_last_bit64(mask) - 1);
       }



More information about the mesa-commit mailing list