radv: allow inline push constants in more situations
authorRhys Perry <pendingchaos02@gmail.com>
Fri, 17 Dec 2021 19:09:46 +0000 (19:09 +0000)
committerMarge Bot <emma+marge@anholt.net>
Tue, 12 Apr 2022 11:44:30 +0000 (11:44 +0000)
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@gmail.com>
Reviewed-by: Daniel Schürmann <daniel@schuermann.dev>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/12145>

src/amd/vulkan/radv_shader_args.c

index 1339779..e9b3d8e 100644 (file)
@@ -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.