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>
This commit is contained in:
@@ -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));
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user