mirror of
https://gitlab.freedesktop.org/mesa/mesa.git
synced 2026-03-19 10:00:37 +01:00
nir/opt_load_store_vectorize: fix wrap check for scaled offsets
Hardware will typically do bounds checking on the final scaled address so the wrap check should do the same. Signed-off-by: Job Noorman <jnoorman@igalia.com> Reviewed-by: Emma Anholt <emma@anholt.net> Reviewed-by: Rhys Perry <pendingchaos02@gmail.com> Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/35092>
This commit is contained in:
parent
cb773dec8c
commit
b0bc97cb43
1 changed files with 2 additions and 4 deletions
|
|
@ -1231,14 +1231,12 @@ check_for_robustness(struct vectorize_ctx *ctx, struct entry *low, uint64_t high
|
|||
if (!(mode & ctx->options->robust_modes))
|
||||
return false;
|
||||
|
||||
unsigned scale = get_offset_scale(low);
|
||||
|
||||
/* First, try to use alignment information in case the application provided some. If the addition
|
||||
* of the maximum offset of the low load and "high_offset" wraps around, we can't combine the low
|
||||
* and high loads.
|
||||
*/
|
||||
uint64_t max_low = round_down(UINT64_MAX, low->align_mul) + low->align_offset;
|
||||
if (!addition_wraps(max_low / scale, high_offset / scale, 64))
|
||||
if (!addition_wraps(max_low, high_offset, 64))
|
||||
return false;
|
||||
|
||||
/* We can't obtain addition_bits */
|
||||
|
|
@ -1257,7 +1255,7 @@ check_for_robustness(struct vectorize_ctx *ctx, struct entry *low, uint64_t high
|
|||
max_low = low->offset;
|
||||
if (stride)
|
||||
max_low = round_down(BITFIELD64_MASK(addition_bits), stride) + (low->offset % stride);
|
||||
return addition_wraps(max_low / scale, high_offset / scale, addition_bits);
|
||||
return addition_wraps(max_low, high_offset, addition_bits);
|
||||
}
|
||||
|
||||
static bool
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue