Module: Mesa Branch: staging/22.3 Commit: c3bf884f0dd2a9362a97609b5a7d5624d9a15e35 URL: http://cgit.freedesktop.org/mesa/mesa/commit/?id=c3bf884f0dd2a9362a97609b5a7d5624d9a15e35
Author: Lionel Landwerlin <[email protected]> Date: Tue Jan 17 23:42:03 2023 +0200 nir/lower_io: fix bounds checking for 64bit_bounded_global If the offset is negative like it's the case in dEQP-VK.robustness.robustness2.bind.notemplate.r32i.unroll.volatile.storage_buffer_dynamic.readwrite.no_fmt_qual.len_256.samples_1.1d.comp we end up passing the bounds checking condition because it's using signed integers. Signed-off-by: Lionel Landwerlin <[email protected]> Suggested-by: Jason Ekstrand <[email protected]> Cc: mesa-stable Reviewed-by: Alyssa Rosenzweig <[email protected]> Reviewed-by: Reviewed-by: Emma Anholt <[email protected]> Reviewed-by: Jason Ekstrand <[email protected]> Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/20762> (cherry picked from commit ff34e96701ef8f6e52755685a5ef9425c0229cfd) --- .pick_status.json | 2 +- src/compiler/nir/nir_lower_io.c | 5 +++-- 2 files changed, 4 insertions(+), 3 deletions(-) diff --git a/.pick_status.json b/.pick_status.json index 638ffcbad10..5fb9dd15af9 100644 --- a/.pick_status.json +++ b/.pick_status.json @@ -40,7 +40,7 @@ "description": "nir/lower_io: fix bounds checking for 64bit_bounded_global", "nominated": true, "nomination_type": 0, - "resolution": 0, + "resolution": 1, "main_sha": null, "because_sha": null }, diff --git a/src/compiler/nir/nir_lower_io.c b/src/compiler/nir/nir_lower_io.c index e0347469e8b..423a153e4e2 100644 --- a/src/compiler/nir/nir_lower_io.c +++ b/src/compiler/nir/nir_lower_io.c @@ -1184,8 +1184,9 @@ addr_is_in_bounds(nir_builder *b, nir_ssa_def *addr, { assert(addr_format == nir_address_format_64bit_bounded_global); assert(addr->num_components == 4); - return nir_ige(b, nir_channel(b, addr, 2), - nir_iadd_imm(b, nir_channel(b, addr, 3), size)); + assert(size > 0); + return nir_ult(b, nir_iadd_imm(b, nir_channel(b, addr, 3), size - 1), + nir_channel(b, addr, 2)); } static void
