mirror of
https://gitlab.freedesktop.org/mesa/mesa.git
synced 2026-05-05 13:58:04 +02:00
anv: Don't consider nir_var_mem_global for vectorizer robustness checks
nir_opt_load_store_vectorize checks for potential address wrapping
when vectorizing two loads ("low" and "high"). It looks for cases where
"low" might have a large address, and "high" has a positive offset
which, when added together, could trigger integer wraparound. The issue
here is that if the large address of "low" was considered out-of-bounds,
adding offset could wrap around to a small address, which might actually
be in-bounds. Thus, when loaded separately, "low" will fail and trigger
robustness out-of-bound-read behavior, but "high" would read correctly.
When vectorized, the entire load would fail. This is explicitly tested
for with 32-bit SSBO addresses in the Vulkan CTS.
However, anv's 64-bit global addresses and VMA handling effectively
prevent this case. Addresses 0-4095 are a reserved page so that if
people try to use 0 as a NULL pointer, it never maps to a valid BO.
That alone guarantees that the above case where "high" gets a small
address would never be in-bounds, so we don't need to check for it.
In fact, we allocate most user allocations out of high addresses,
and have specialized allocation heaps for certain types of GPU data
structures in the lower GB of memory. For a load to wrap around and
successfully land in the right heap, it would have to load gigabytes.
Disabling this allows load vectorization and overfetching in more cases.
Reviewed-by: Lionel Landwerlin <lionel.g.landwerlin@intel.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/32315>
This commit is contained in:
parent
5712fc48a9
commit
f88eb48ff2
1 changed files with 2 additions and 2 deletions
|
|
@ -1592,9 +1592,9 @@ brw_vectorize_lower_mem_access(nir_shader *nir,
|
|||
};
|
||||
|
||||
if (robust_flags & BRW_ROBUSTNESS_UBO)
|
||||
options.robust_modes |= nir_var_mem_ubo | nir_var_mem_global;
|
||||
options.robust_modes |= nir_var_mem_ubo;
|
||||
if (robust_flags & BRW_ROBUSTNESS_SSBO)
|
||||
options.robust_modes |= nir_var_mem_ssbo | nir_var_mem_global;
|
||||
options.robust_modes |= nir_var_mem_ssbo;
|
||||
|
||||
OPT(nir_opt_load_store_vectorize, &options);
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue