Mesa (main): radv: allow inline push constants in more situations

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


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

Author: Rhys Perry <pendingchaos02 at gmail.com>
Date:   Fri Dec 17 19:09:46 2021 +0000

radv: allow inline push constants in more situations

We don't need to disable this path if there are indirect or 8/16/64-bit
push constant loads. We can just use the default path for them.

fossil-db (Sienna Cichlid):
Totals from 21 (0.02% of 134621) affected shaders:
CodeSize: 2028 -> 1884 (-7.10%)
Instrs: 366 -> 363 (-0.82%); split: -2.46%, +1.64%
Latency: 6630 -> 6579 (-0.77%)
InvThroughput: 26520 -> 26316 (-0.77%)
Copies: 84 -> 102 (+21.43%)
PreSGPRs: 141 -> 222 (+57.45%)

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/vulkan/radv_shader_args.c | 9 +--------
 1 file changed, 1 insertion(+), 8 deletions(-)

diff --git a/src/amd/vulkan/radv_shader_args.c b/src/amd/vulkan/radv_shader_args.c
index 13397790dc8..e9b3d8e9a0c 100644
--- a/src/amd/vulkan/radv_shader_args.c
+++ b/src/amd/vulkan/radv_shader_args.c
@@ -123,14 +123,6 @@ allocate_inline_push_consts(const struct radv_shader_info *info,
    if (info->min_push_constant_used == UINT16_MAX)
       return;
 
-   /* Only supported if shaders don't have indirect push constants. */
-   if (info->has_indirect_push_constants)
-      return;
-
-   /* Only supported for 32-bit push constants. */
-   if (!info->has_only_32bit_push_constants)
-      return;
-
    uint8_t num_push_consts =
       (info->max_push_constant_used - info->min_push_constant_used) / 4;
 
@@ -146,6 +138,7 @@ allocate_inline_push_consts(const struct radv_shader_info *info,
       user_sgpr_info->num_inline_push_consts = AC_MAX_INLINE_PUSH_CONSTS;
 
    if (user_sgpr_info->num_inline_push_consts == num_push_consts &&
+       info->has_only_32bit_push_constants && !info->has_indirect_push_constants &&
        !info->loads_dynamic_offsets) {
       /* Disable the default push constants path if all constants are
        * inlined and if shaders don't use dynamic descriptors.



More information about the mesa-commit mailing list