pco: Fix for atomic operations on an image buffer

Within the driver buffers are treated as 2D as sampling them as 1D
will run into HW restrictions on max size.

The compiler does the same however for atomic image ops the address
is manually calculated and doing this via the 2D path leads to
incorrect offsets.

The fix is to treat buffers as 1D for atomic ops which calculates
the correct offsets for the operations.

Fix deqp:
dEQP-VK.image.atomic_operations.add.buffer.*
dEQP-VK.image.atomic_operations.and.buffer.*
dEQP-VK.image.atomic_operations.compare_exchange.buffer.*
dEQP-VK.image.atomic_operations.dec.buffer.*
dEQP-VK.image.atomic_operations.exchange.buffer.*
dEQP-VK.image.atomic_operations.inc.buffer.*
dEQP-VK.image.atomic_operations.max.buffer.*
dEQP-VK.image.atomic_operations.min.buffer.*
dEQP-VK.image.atomic_operations.or.buffer.*
dEQP-VK.image.atomic_operations.sub.buffer.*
dEQP-VK.image.atomic_operations.xor.buffer.*

Fixes: 6dc5e1e109 ("pco: fully support Vulkan 1.2 image atomics")

Signed-off-by: Nick Hamilton <nick.hamilton@imgtec.com>
Reviewed-by: Simon Perretta <simon.perretta@imgtec.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/39521>
(cherry picked from commit 079377c767)
This commit is contained in:
Nick Hamilton 2026-01-22 13:32:18 +00:00 committed by Eric Engestrom
parent 6f2d97ef41
commit 28f3e82f2d
3 changed files with 2 additions and 93 deletions

View file

@ -244,7 +244,7 @@
"description": "pco: Fix for atomic operations on an image buffer",
"nominated": true,
"nomination_type": 2,
"resolution": 0,
"resolution": 1,
"main_sha": null,
"because_sha": "6dc5e1e1094554c291239b955a1dc39c6e4c017b",
"notes": null

View file

@ -26,94 +26,6 @@ dEQP-VK.binding_model.unused_invalid_descriptor.write.unused.storage_image,Crash
dEQP-VK.binding_model.unused_invalid_descriptor.write.unused.uniform_buffer,Crash
dEQP-VK.graphicsfuzz.cov-two-nested-loops-switch-case-matrix-array-increment,Fail
dEQP-VK.graphicsfuzz.stable-binarysearch-tree-false-if-discard-loop,Fail
dEQP-VK.image.atomic_operations.add.buffer.notransfer.normal_read.normal_img.r32i_end_result,Fail
dEQP-VK.image.atomic_operations.add.buffer.notransfer.normal_read.normal_img.r32i_intermediate_values,Fail
dEQP-VK.image.atomic_operations.add.buffer.notransfer.normal_read.normal_img.r32ui_end_result,Fail
dEQP-VK.image.atomic_operations.add.buffer.notransfer.normal_read.normal_img.r32ui_intermediate_values,Fail
dEQP-VK.image.atomic_operations.add.buffer.transfer.normal_read.normal_img.r32i_end_result,Fail
dEQP-VK.image.atomic_operations.add.buffer.transfer.normal_read.normal_img.r32i_intermediate_values,Fail
dEQP-VK.image.atomic_operations.add.buffer.transfer.normal_read.normal_img.r32ui_end_result,Fail
dEQP-VK.image.atomic_operations.add.buffer.transfer.normal_read.normal_img.r32ui_intermediate_values,Fail
dEQP-VK.image.atomic_operations.and.buffer.notransfer.normal_read.normal_img.r32i_end_result,Fail
dEQP-VK.image.atomic_operations.and.buffer.notransfer.normal_read.normal_img.r32i_intermediate_values,Fail
dEQP-VK.image.atomic_operations.and.buffer.notransfer.normal_read.normal_img.r32ui_end_result,Fail
dEQP-VK.image.atomic_operations.and.buffer.notransfer.normal_read.normal_img.r32ui_intermediate_values,Fail
dEQP-VK.image.atomic_operations.and.buffer.transfer.normal_read.normal_img.r32i_end_result,Fail
dEQP-VK.image.atomic_operations.and.buffer.transfer.normal_read.normal_img.r32i_intermediate_values,Fail
dEQP-VK.image.atomic_operations.and.buffer.transfer.normal_read.normal_img.r32ui_end_result,Fail
dEQP-VK.image.atomic_operations.and.buffer.transfer.normal_read.normal_img.r32ui_intermediate_values,Fail
dEQP-VK.image.atomic_operations.compare_exchange.buffer.notransfer.normal_read.normal_img.r32i_end_result,Fail
dEQP-VK.image.atomic_operations.compare_exchange.buffer.notransfer.normal_read.normal_img.r32i_intermediate_values,Fail
dEQP-VK.image.atomic_operations.compare_exchange.buffer.notransfer.normal_read.normal_img.r32ui_end_result,Fail
dEQP-VK.image.atomic_operations.compare_exchange.buffer.notransfer.normal_read.normal_img.r32ui_intermediate_values,Fail
dEQP-VK.image.atomic_operations.compare_exchange.buffer.transfer.normal_read.normal_img.r32i_end_result,Fail
dEQP-VK.image.atomic_operations.compare_exchange.buffer.transfer.normal_read.normal_img.r32i_intermediate_values,Fail
dEQP-VK.image.atomic_operations.compare_exchange.buffer.transfer.normal_read.normal_img.r32ui_end_result,Fail
dEQP-VK.image.atomic_operations.compare_exchange.buffer.transfer.normal_read.normal_img.r32ui_intermediate_values,Fail
dEQP-VK.image.atomic_operations.dec.buffer.notransfer.normal_read.normal_img.r32i_end_result,Fail
dEQP-VK.image.atomic_operations.dec.buffer.notransfer.normal_read.normal_img.r32i_intermediate_values,Fail
dEQP-VK.image.atomic_operations.dec.buffer.notransfer.normal_read.normal_img.r32ui_end_result,Fail
dEQP-VK.image.atomic_operations.dec.buffer.notransfer.normal_read.normal_img.r32ui_intermediate_values,Fail
dEQP-VK.image.atomic_operations.dec.buffer.transfer.normal_read.normal_img.r32i_end_result,Fail
dEQP-VK.image.atomic_operations.dec.buffer.transfer.normal_read.normal_img.r32i_intermediate_values,Fail
dEQP-VK.image.atomic_operations.dec.buffer.transfer.normal_read.normal_img.r32ui_end_result,Fail
dEQP-VK.image.atomic_operations.dec.buffer.transfer.normal_read.normal_img.r32ui_intermediate_values,Fail
dEQP-VK.image.atomic_operations.exchange.buffer.notransfer.normal_read.normal_img.r32i_end_result,Fail
dEQP-VK.image.atomic_operations.exchange.buffer.notransfer.normal_read.normal_img.r32i_intermediate_values,Fail
dEQP-VK.image.atomic_operations.exchange.buffer.notransfer.normal_read.normal_img.r32ui_end_result,Fail
dEQP-VK.image.atomic_operations.exchange.buffer.notransfer.normal_read.normal_img.r32ui_intermediate_values,Fail
dEQP-VK.image.atomic_operations.exchange.buffer.transfer.normal_read.normal_img.r32i_end_result,Fail
dEQP-VK.image.atomic_operations.exchange.buffer.transfer.normal_read.normal_img.r32i_intermediate_values,Fail
dEQP-VK.image.atomic_operations.exchange.buffer.transfer.normal_read.normal_img.r32ui_end_result,Fail
dEQP-VK.image.atomic_operations.exchange.buffer.transfer.normal_read.normal_img.r32ui_intermediate_values,Fail
dEQP-VK.image.atomic_operations.inc.buffer.notransfer.normal_read.normal_img.r32i_end_result,Fail
dEQP-VK.image.atomic_operations.inc.buffer.notransfer.normal_read.normal_img.r32i_intermediate_values,Fail
dEQP-VK.image.atomic_operations.inc.buffer.notransfer.normal_read.normal_img.r32ui_end_result,Fail
dEQP-VK.image.atomic_operations.inc.buffer.notransfer.normal_read.normal_img.r32ui_intermediate_values,Fail
dEQP-VK.image.atomic_operations.inc.buffer.transfer.normal_read.normal_img.r32i_end_result,Fail
dEQP-VK.image.atomic_operations.inc.buffer.transfer.normal_read.normal_img.r32i_intermediate_values,Fail
dEQP-VK.image.atomic_operations.inc.buffer.transfer.normal_read.normal_img.r32ui_end_result,Fail
dEQP-VK.image.atomic_operations.inc.buffer.transfer.normal_read.normal_img.r32ui_intermediate_values,Fail
dEQP-VK.image.atomic_operations.max.buffer.notransfer.normal_read.normal_img.r32i_end_result,Fail
dEQP-VK.image.atomic_operations.max.buffer.notransfer.normal_read.normal_img.r32i_intermediate_values,Fail
dEQP-VK.image.atomic_operations.max.buffer.notransfer.normal_read.normal_img.r32ui_end_result,Fail
dEQP-VK.image.atomic_operations.max.buffer.notransfer.normal_read.normal_img.r32ui_intermediate_values,Fail
dEQP-VK.image.atomic_operations.max.buffer.transfer.normal_read.normal_img.r32i_end_result,Fail
dEQP-VK.image.atomic_operations.max.buffer.transfer.normal_read.normal_img.r32i_intermediate_values,Fail
dEQP-VK.image.atomic_operations.max.buffer.transfer.normal_read.normal_img.r32ui_end_result,Fail
dEQP-VK.image.atomic_operations.max.buffer.transfer.normal_read.normal_img.r32ui_intermediate_values,Fail
dEQP-VK.image.atomic_operations.min.buffer.notransfer.normal_read.normal_img.r32i_end_result,Fail
dEQP-VK.image.atomic_operations.min.buffer.notransfer.normal_read.normal_img.r32i_intermediate_values,Fail
dEQP-VK.image.atomic_operations.min.buffer.notransfer.normal_read.normal_img.r32ui_end_result,Fail
dEQP-VK.image.atomic_operations.min.buffer.notransfer.normal_read.normal_img.r32ui_intermediate_values,Fail
dEQP-VK.image.atomic_operations.min.buffer.transfer.normal_read.normal_img.r32i_end_result,Fail
dEQP-VK.image.atomic_operations.min.buffer.transfer.normal_read.normal_img.r32i_intermediate_values,Fail
dEQP-VK.image.atomic_operations.min.buffer.transfer.normal_read.normal_img.r32ui_end_result,Fail
dEQP-VK.image.atomic_operations.min.buffer.transfer.normal_read.normal_img.r32ui_intermediate_values,Fail
dEQP-VK.image.atomic_operations.or.buffer.notransfer.normal_read.normal_img.r32i_end_result,Fail
dEQP-VK.image.atomic_operations.or.buffer.notransfer.normal_read.normal_img.r32i_intermediate_values,Fail
dEQP-VK.image.atomic_operations.or.buffer.notransfer.normal_read.normal_img.r32ui_end_result,Fail
dEQP-VK.image.atomic_operations.or.buffer.notransfer.normal_read.normal_img.r32ui_intermediate_values,Fail
dEQP-VK.image.atomic_operations.or.buffer.transfer.normal_read.normal_img.r32i_end_result,Fail
dEQP-VK.image.atomic_operations.or.buffer.transfer.normal_read.normal_img.r32i_intermediate_values,Fail
dEQP-VK.image.atomic_operations.or.buffer.transfer.normal_read.normal_img.r32ui_end_result,Fail
dEQP-VK.image.atomic_operations.or.buffer.transfer.normal_read.normal_img.r32ui_intermediate_values,Fail
dEQP-VK.image.atomic_operations.sub.buffer.notransfer.normal_read.normal_img.r32i_end_result,Fail
dEQP-VK.image.atomic_operations.sub.buffer.notransfer.normal_read.normal_img.r32i_intermediate_values,Fail
dEQP-VK.image.atomic_operations.sub.buffer.notransfer.normal_read.normal_img.r32ui_end_result,Fail
dEQP-VK.image.atomic_operations.sub.buffer.notransfer.normal_read.normal_img.r32ui_intermediate_values,Fail
dEQP-VK.image.atomic_operations.sub.buffer.transfer.normal_read.normal_img.r32i_end_result,Fail
dEQP-VK.image.atomic_operations.sub.buffer.transfer.normal_read.normal_img.r32i_intermediate_values,Fail
dEQP-VK.image.atomic_operations.sub.buffer.transfer.normal_read.normal_img.r32ui_end_result,Fail
dEQP-VK.image.atomic_operations.sub.buffer.transfer.normal_read.normal_img.r32ui_intermediate_values,Fail
dEQP-VK.image.atomic_operations.xor.buffer.notransfer.normal_read.normal_img.r32i_end_result,Fail
dEQP-VK.image.atomic_operations.xor.buffer.notransfer.normal_read.normal_img.r32i_intermediate_values,Fail
dEQP-VK.image.atomic_operations.xor.buffer.notransfer.normal_read.normal_img.r32ui_end_result,Fail
dEQP-VK.image.atomic_operations.xor.buffer.notransfer.normal_read.normal_img.r32ui_intermediate_values,Fail
dEQP-VK.image.atomic_operations.xor.buffer.transfer.normal_read.normal_img.r32i_end_result,Fail
dEQP-VK.image.atomic_operations.xor.buffer.transfer.normal_read.normal_img.r32i_intermediate_values,Fail
dEQP-VK.image.atomic_operations.xor.buffer.transfer.normal_read.normal_img.r32ui_end_result,Fail
dEQP-VK.image.atomic_operations.xor.buffer.transfer.normal_read.normal_img.r32ui_intermediate_values,Fail
dEQP-VK.memory.concurrent_access.shader_and_host,Crash
dEQP-VK.memory.mapping.dedicated_alloc.buffer.full.variable.implicit_unmap_map2,Timeout
dEQP-VK.memory.mapping.dedicated_alloc.buffer.full.variable.implicit_unmap,Timeout

View file

@ -1187,10 +1187,7 @@ static nir_def *lower_image(nir_builder *b, nir_instr *instr, void *cb_data)
image_dim = GLSL_SAMPLER_DIM_2D;
is_array = true;
} else if (image_dim == GLSL_SAMPLER_DIM_BUF) {
image_dim = GLSL_SAMPLER_DIM_2D;
coords = nir_vec2(b,
nir_umod_imm(b, coords, 8192),
nir_udiv_imm(b, coords, 8192));
image_dim = GLSL_SAMPLER_DIM_1D;
}
nir_def *twiddled_offset = NULL;