diff options
author | Rhys Perry <pendingchaos02@gmail.com> | 2022-12-14 17:50:24 +0000 |
---|---|---|
committer | Marge Bot <emma+marge@anholt.net> | 2022-12-15 13:30:25 +0000 |
commit | 69e55d9c1b473dd5577d0fe48998421136860598 (patch) | |
tree | 1df05b81f811ac5280f54badaec1e0da11711be0 | |
parent | ba31ec0d6fefa61b66adb133f9bab6a21d52ff37 (diff) |
ac/nir: fix ngg culling on gfx11
This subtraction can underflow.
If subgroup_id*wave_size is larger than num_live_vertices_in_workgroup,
num_es_threads_var should be zero.
fossil-db (gfx1100, nggc):
Totals from 41388 (30.75% of 134574) affected shaders:
Instrs: 25700772 -> 25783544 (+0.32%)
CodeSize: 126950072 -> 127281160 (+0.26%)
Latency: 92809233 -> 92849566 (+0.04%); split: -0.00%, +0.04%
InvThroughput: 9526675 -> 9542194 (+0.16%)
Copies: 2031078 -> 2031074 (-0.00%)
Signed-off-by: Rhys Perry <pendingchaos02@gmail.com>
Reviewed-by: Qiang Yu <yuq825@gmail.com>
Reviewed-by: Timur Kristóf <timur.kristof@gmail.com>
Reviewed-by: Marek Olšák <marek.olsak@amd.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/20321>
-rw-r--r-- | src/amd/common/ac_nir_lower_ngg.c | 4 |
1 files changed, 2 insertions, 2 deletions
diff --git a/src/amd/common/ac_nir_lower_ngg.c b/src/amd/common/ac_nir_lower_ngg.c index f6643b228d3..75519b84b61 100644 --- a/src/amd/common/ac_nir_lower_ngg.c +++ b/src/amd/common/ac_nir_lower_ngg.c @@ -1547,8 +1547,8 @@ add_deferred_attribute_culling(nir_builder *b, nir_cf_list *original_extracted_c nir_ssa_def *num_live_vertices_in_wave = num_live_vertices_in_workgroup; if (nogs_state->max_num_waves > 1) { num_live_vertices_in_wave = - nir_isub(b, num_live_vertices_in_wave, - nir_imul_imm(b, nir_load_subgroup_id(b), nogs_state->options->wave_size)); + nir_usub_sat(b, num_live_vertices_in_wave, + nir_imul_imm(b, nir_load_subgroup_id(b), nogs_state->options->wave_size)); num_live_vertices_in_wave = nir_umin(b, num_live_vertices_in_wave, nir_imm_int(b, nogs_state->options->wave_size)); } |