VK-HOST-AT-ALIASING: pass byte length to BufferVaIndex::find in host_at #488
No reviewers
Labels
No labels
accessibility
bug
documentation
duplicate
enhancement
good first issue
help wanted
invalid
missing claim
needs rebase
question
wontfix
No milestone
No assignees
1 participant
Notifications
Due date
No due date set.
Dependencies
No dependencies set
Reference
github/ubiquitarianism--leonida!488
Loading…
Reference in a new issue
No description provided.
Delete branch "gh-pr/488/head"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
@xroneyaa on GitHub · 2026-11-24 06:13 UTC · original
xroneyaa:fix/vulkan-host-at-aliasing→main· +270 −1 · 3 files · 1 commits · merged 2026-11-24 16:25 UTCClaimed in the coordination issue as: VK-HOST-AT-ALIASING
What and why
In
runtime/src/vulkan_backend.h,VulkanContext'sreplay_.buffer_atcallsbuffer_vas_.find(va, hit, size)so placed buffers aliasing the same virtual address resolve to a buffer that holds the entire requested range[va, va + size). Its companionreplay_.host_atomitted thebytesargument (buffer_vas_.find(va, hit), defaultingbytes = 1). When a smaller placed buffer aliases a larger CPU-mapped buffer at or inside that VA,findpicks the closest smaller range andhost_atthen fails thebytes > b->size - offsetcheck withHostReadStatus::absent.This passes
bytestobuffer_vas_.find(va, hit, bytes)insidereplay_.host_atand adds the CPU-only mock-Vulkan testruntime/test/vk_host_at_aliasing_test.cpp(registered asvk_host_at_aliasing) exercising tied-start aliasing, offset aliasing, oversized reads, and GPU-only (host == nullptr) refusals through KHR TLAS array-of-pointers staging.Tested
vk_host_at_aliasing_test,vk_buffer_registration_oom_test, andbuffer_va_index_testwith MSVC 19.50 / Ninja (0 warnings under/W4)ctest --test-dir runtime/build --output-on-failure -R "^(vk_host_at_aliasing|vk_buffer_registration_oom|buffer_va_index)$"-> 3/3 Passed (buffer_va_index0.50 s,vk_buffer_registration_oom0.02 s,vk_host_at_aliasing0.02 s)python -I scripts/check_no_game_data.py runtime/src/vulkan_backend.h runtime/test/vk_host_at_aliasing_test.cpp runtime/CMakeLists.txt-> exit 0GPUs tested: n/a (
vk_host_at_aliasingruns CPU-only with a mock Vulkan dispatch table)AI-assisted: yes
Checklist
mainand merges cleanly (a conflicting pull request is labeledneeds rebase).docs/design.md, with how it was confirmed (n/a — no translator rule added).@moffington on GitHub · 2026-11-24 06:22 UTC · original
Tested
5a67c51aon Linux. vk_host_at_aliasing, buffer_va_index, and vk_buffer_registration_oom all passed.The same aliasing test failed on the merge base (
8f481cf1) in both the tied-start and offset cases. With the fix, both cases staged the expected instance addresses. This was a CPU-only run with mocked Vulkan calls.@QemmHD on GitHub · 2026-11-24 16:25 UTC · original
Merging.
Why merged: host_at passes the byte length to BufferVaIndex::find, so aliasing placed buffers resolve over the full range rather than at the start address only. The CMake change only adds the new test target.
Why it's good: vk_host_at_aliasing, buffer_va_index and vk_buffer_registration_oom all pass both plain and under validation.
Tested on Windows 11 / RTX 4070 SUPER (NVIDIA 621.24), VS 2022 + Ninja RelWithDebInfo, Vulkan SDK 1.4.363.0. Alone on main, its tests passed both plain and with LEONIDA_VK_VALIDATION=1. Cumulative: #388, #418, #421, #434, #470, #484, #485, #486 and #488 merged onto main
1504c1af6(a225e593e). There the repo-consistency set gives 566 passed / 5 skipped / 0 failed, compileall is clean, and full ctest is 306/308. The 2 failures are the same pre-existing ones as main (d3d12_execute_indirect_validation, d3d12_depth_resolve), with the same skip set. git merge-tree against current main98a977b4b: no conflicts. Security read of the three-dot diff: no binaries, game data, downloads, network calls or CI changes.AI-assisted (Claude Code, Claude Opus 5.5).