hk: Use aligned vector fill in hk_CmdFillBuffer if possible

30% faster with 16KB buffers, more than twice as fast with 8MB and
larger buffers.

(cherry picked from commit 651a321ee2)

Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/40092>
This commit is contained in:
Janne Grunau 2026-01-16 11:52:50 +01:00 committed by Eric Engestrom
parent 1ce5b5b361
commit 3397d3995f
2 changed files with 7 additions and 2 deletions

View file

@ -2904,7 +2904,7 @@
"description": "hk: Use aligned vector fill in hk_CmdFillBuffer if possible",
"nominated": false,
"nomination_type": 0,
"resolution": 4,
"resolution": 1,
"main_sha": null,
"because_sha": null,
"notes": null

View file

@ -1493,7 +1493,12 @@ hk_CmdFillBuffer(VkCommandBuffer commandBuffer, VkBuffer dstBuffer,
uint64_t addr =
vk_meta_buffer_address(&dev->vk, dstBuffer, dstOffset, dstRange);
libagx_fill(cmd, agx_1d(range / 4), AGX_BARRIER_ALL, addr, data);
if (util_is_aligned(addr, 16) && util_is_aligned(range, 16)) {
libagx_fill_uint4(cmd, agx_2d(range / 16, 1), AGX_BARRIER_ALL,
addr, 0, data, data, data, data);
} else {
libagx_fill(cmd, agx_1d(range / 4), AGX_BARRIER_ALL, addr, data);
}
}
VKAPI_ATTR void VKAPI_CALL