mirror of
https://gitlab.freedesktop.org/mesa/mesa.git
synced 2026-04-28 04:20:40 +02:00
ac/nir/ngg: fix nogs culling with nuw add
We should not use "nuw" here as negative add positive may wrap around (negative is 0xffffff??). This problem can be observed with LLVM15 (I can't see when LLVM14): %.neg = mul nsw i32 %31, -4 %163 = add nuw nsw i32 %.neg, 16 %164 = lshr i32 257, %.neg %165 = lshr i32 %164, %163 LLVM just assume %.neg is possitive, so pre-shift 0x01010101 by 16. This get wrong value because we can't get back the shifted bits with a negative shift right. Fixes:75dbb40439("ac/nir: Remove byte permute from prefix sum of the repack sequence.") Reviewed-by: Timur Kristóf <timur.kristof@gmail.com> Signed-off-by: Qiang Yu <yuq825@gmail.com> Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/19718> (cherry picked from commit982b523769)
This commit is contained in:
parent
c0c5eed580
commit
af4c9789bb
2 changed files with 2 additions and 2 deletions
|
|
@ -661,7 +661,7 @@
|
|||
"description": "ac/nir/ngg: fix nogs culling with nuw add",
|
||||
"nominated": true,
|
||||
"nomination_type": 1,
|
||||
"resolution": 0,
|
||||
"resolution": 1,
|
||||
"main_sha": null,
|
||||
"because_sha": "75dbb404393a5ae99adb90a156fa5a084aa79c4d"
|
||||
},
|
||||
|
|
|
|||
|
|
@ -234,7 +234,7 @@ summarize_repack(nir_builder *b, nir_ssa_def *packed_counts, unsigned num_lds_dw
|
|||
*/
|
||||
|
||||
nir_ssa_def *lane_id = nir_load_subgroup_invocation(b);
|
||||
nir_ssa_def *shift = nir_iadd_imm_nuw(b, nir_imul_imm(b, lane_id, -4u), num_lds_dwords * 16);
|
||||
nir_ssa_def *shift = nir_iadd_imm(b, nir_imul_imm(b, lane_id, -4u), num_lds_dwords * 16);
|
||||
bool use_dot = b->shader->options->has_udot_4x8;
|
||||
|
||||
if (num_lds_dwords == 1) {
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue