diff options
author | Jason Ekstrand <jason.ekstrand@collabora.com> | 2022-11-11 14:56:19 -0600 |
---|---|---|
committer | Eric Engestrom <eric@engestrom.ch> | 2022-12-14 20:47:00 +0000 |
commit | f2327830b2584615ff97a528b569a05284fb5c45 (patch) | |
tree | 3a88035dfdd332e25feee623d372d3d953058e3c | |
parent | d988e3f32bb9915167fbaf65495951ab690a074d (diff) | |
download | mesa-f2327830b2584615ff97a528b569a05284fb5c45.tar.gz |
nir: Use nir_const_value_for_int in nir_lower_subgroups
Closes: https://gitlab.freedesktop.org/mesa/mesa/-/issues/7670
Fixes: e4e79de2a420 ("nir/subgroups: Support > 1 ballot components")
Reviewed-by: Alyssa Rosenzweig <alyssa.rosenzweig@collabora.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/19689>
(cherry picked from commit e6de164e0305d517fb66c01c9fc8931c278867f6)
-rw-r--r-- | .pick_status.json | 2 | ||||
-rw-r--r-- | src/compiler/nir/nir_lower_subgroups.c | 12 |
2 files changed, 7 insertions, 7 deletions
diff --git a/.pick_status.json b/.pick_status.json index 4bf06af8bda..ffe7f899770 100644 --- a/.pick_status.json +++ b/.pick_status.json @@ -4072,7 +4072,7 @@ "description": "nir: Use nir_const_value_for_int in nir_lower_subgroups", "nominated": true, "nomination_type": 1, - "resolution": 0, + "resolution": 1, "main_sha": null, "because_sha": "e4e79de2a420128190b28b39b87f6de39b1b7060" }, diff --git a/src/compiler/nir/nir_lower_subgroups.c b/src/compiler/nir/nir_lower_subgroups.c index f54a80ac082..0c6f3a2b28c 100644 --- a/src/compiler/nir/nir_lower_subgroups.c +++ b/src/compiler/nir/nir_lower_subgroups.c @@ -420,14 +420,14 @@ build_ballot_imm_ishl(nir_builder *b, int64_t val, nir_ssa_def *shift, * answer or 0 for the first component (and something similar with the * second component). This idea is generalized here for any component count */ - nir_const_value min_shift[4] = { 0 }; + nir_const_value min_shift[4]; for (unsigned i = 0; i < options->ballot_components; i++) - min_shift[i].i32 = i * options->ballot_bit_size; + min_shift[i] = nir_const_value_for_int(i * options->ballot_bit_size, 32); nir_ssa_def *min_shift_val = nir_build_imm(b, options->ballot_components, 32, min_shift); - nir_const_value max_shift[4] = { 0 }; + nir_const_value max_shift[4]; for (unsigned i = 0; i < options->ballot_components; i++) - max_shift[i].i32 = (i + 1) * options->ballot_bit_size; + max_shift[i] = nir_const_value_for_int((i + 1) * options->ballot_bit_size, 32); nir_ssa_def *max_shift_val = nir_build_imm(b, options->ballot_components, 32, max_shift); return nir_bcsel(b, nir_ult(b, shift, max_shift_val), @@ -501,9 +501,9 @@ build_subgroup_mask(nir_builder *b, * result if we just follow (2) and then replace the first component with * "result". */ - nir_const_value min_idx[4] = { 0 }; + nir_const_value min_idx[4]; for (unsigned i = 0; i < options->ballot_components; i++) - min_idx[i].i32 = i * options->ballot_bit_size; + min_idx[i] = nir_const_value_for_int(i * options->ballot_bit_size, 32); nir_ssa_def *min_idx_val = nir_build_imm(b, options->ballot_components, 32, min_idx); nir_ssa_def *result_extended = |