diff options
author | Samuel Pitoiset <[email protected]> | 2018-02-01 11:35:06 +0100 |
---|---|---|
committer | Samuel Pitoiset <[email protected]> | 2018-02-07 12:42:09 +0100 |
commit | 2f54d7382db3e3a23fb1b3e61c246931828309e5 (patch) | |
tree | bc792ab53e354e94a5e67ae47881435753df07c1 /src | |
parent | 1c57a6da5e38c18926eca22b96901e4640ec430f (diff) |
ac/nir: avoid loading unused VS input components
Polaris10:
Totals from affected shaders:
SGPRS: 122840 -> 120984 (-1.51 %)
VGPRS: 78812 -> 78440 (-0.47 %)
Spilled SGPRs: 177 -> 129 (-27.12 %)
Code Size: 2950028 -> 2941276 (-0.30 %) bytes
Max Waves: 17899 -> 17976 (0.43 %)
Vega10:
Totals from affected shaders:
SGPRS: 117144 -> 115776 (-1.17 %)
VGPRS: 77580 -> 77532 (-0.06 %)
Spilled SGPRs: 0 -> 152 (0.00 %)
Code Size: 3352656 -> 3347860 (-0.14 %) bytes
Max Waves: 19756 -> 19866 (0.56 %)
This increases SGPRs spilling a bit with Talos, but I have
some other ideas that might reduce it.
Signed-off-by: Samuel Pitoiset <[email protected]>
Reviewed-by: Bas Nieuwenhuizen <[email protected]>
Diffstat (limited to 'src')
-rw-r--r-- | src/amd/common/ac_nir_to_llvm.c | 7 |
1 files changed, 6 insertions, 1 deletions
diff --git a/src/amd/common/ac_nir_to_llvm.c b/src/amd/common/ac_nir_to_llvm.c index e44afbb9b22..15d6759ced1 100644 --- a/src/amd/common/ac_nir_to_llvm.c +++ b/src/amd/common/ac_nir_to_llvm.c @@ -5317,6 +5317,9 @@ handle_vs_input_decl(struct nir_to_llvm_context *ctx, int index = variable->data.location - VERT_ATTRIB_GENERIC0; int idx = variable->data.location; unsigned attrib_count = glsl_count_attribute_slots(variable->type, true); + uint8_t input_usage_mask = + ctx->shader_info->info.vs.input_usage_mask[variable->data.location]; + unsigned num_channels = util_last_bit(input_usage_mask); variable->data.driver_location = idx * 4; @@ -5341,7 +5344,9 @@ handle_vs_input_decl(struct nir_to_llvm_context *ctx, input = ac_build_buffer_load_format(&ctx->ac, t_list, buffer_index, ctx->ac.i32_0, - 4, false, true); + num_channels, false, true); + + input = ac_build_expand_to_vec4(&ctx->ac, input, num_channels); for (unsigned chan = 0; chan < 4; chan++) { LLVMValueRef llvm_chan = LLVMConstInt(ctx->ac.i32, chan, false); |