gpu(native): show nothing for a buffer view of memory in no pool #105
Loading…
Reference in a new issue
No description provided.
Delete branch "upstream-pr/105"
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?
Imported from LakshanSivakumar/Native-Victory-macOS. Originally posted by Olima34 on 2026-11-26T15:53:17Z.
What this changes
Refs #15, point 2 of my last comment there.
NativeHost::mirrorreturned beforewrite_bufferwhen a buffer view's address resolved to no pool ("Stale or unsupported views leave the entry as it was"). If the title reuses a descriptor slot for such a buffer, the Metal entry kept the buffer an earlier view named there. The title may have given that memory to something else since, and shaders went on reading and writing it, silently: the kind of corruption whose crash site moves between runs.write_pairsalready uses for pair 0): reads give 0 and writes are dropped. The error is still returned, so the log line stays. The entry is not marked mirrored, so a latermirrorof that slot writes the real view.null_view()makes the null page at first use and borrows the contract only for the call.write_pairsnow takes it first and borrows the contract read-only. I checked thatremirror_tablesand thegluecallers hold no borrow of the contract when they callmirror.Known limit:
remirror_tablestries each record once, whatever the result. A slot left null at submission is written again only when its record changes, or by a title call that mirrors it. Before, that same slot stayed stale.How it was tested
a_view_of_unmapped_memory_no_longer_shows_the_previous_buffer(native, Metal). A shader writes buffer A through a descriptor table. The slot is then rewritten to0x10_0000_0000(no pool), andmirrorerrs. The same dispatch runs again, and A must be unchanged. Finally the slot is pointed back at A, and the dispatch writes A again. Withmain'smirror, step 3 fails: A still gets[1, 4, 7, …]through the stale entry.victory-gpuon arm64 with the Metal Shader Converter, 167 tests, 3 passes; arm64cargo test --workspace(691)cargo clippy --workspace --all-targets --locked --target x86_64-pc-windows-gnullvm -- -D warnings, also with--all-featurescargo xtask policy; it merges cleanly with #100 and #102Checklist
Imported from LakshanSivakumar/Native-Victory-macOS. Originally posted by LakshanSivakumar on 2026-11-26T15:55:39Z.
Review: COMMENTED
Giving a buffer view of memory in no pool the null view (size 0) instead of leaving the previous buffer in the Metal entry is the right call for stale-descriptor corruption, and the test covers it. macos-scripts passes, main check still pending. I will approve once it is green. Relevant to the prologue crash: this closes one way a shader can touch memory the title has since reused, but it will not explain pages owned twice in xmem_posix, so keep #15 open after it lands.
Imported from LakshanSivakumar/Native-Victory-macOS. Originally posted by Olima34 on 2026-11-26T15:57:53Z.
The failing
checkisn't this change: it'svictory-platform'sa_page_pool_maps_at_several_addresses(tests/conformance.rs:102, Windows error 487, "Attempt to access invalid address"). That test releases a reservation and then maps at its address, and its own comment says this races the other tests for the address. This PR only touchesvictory-gpu/src/native, which isn't built on Windows. Could you rerun the failed job? I can't rerun it from a fork. If that test keeps flaking on other PRs, I can send a separate fix that retries the mapping at a fresh reservation when it hits 487.Imported from LakshanSivakumar/Native-Victory-macOS. Originally posted by LakshanSivakumar on 2026-11-26T16:04:10Z.
Review: CHANGES_REQUESTED
The main CI check has now failed on this PR (macos-scripts passes). Please look at the failure and fix or explain it; I could not tell from the diff alone whether it comes from this change. The change itself still looks right.
Imported from LakshanSivakumar/Native-Victory-macOS. Originally posted by Olima34 on 2026-11-26T16:27:27Z.
Rebased on
mainto rerun CI; the change is the same (167 victory-gpu tests pass on Metal). The failure was invictory-platform'sa_page_pool_maps_at_several_addresses(Windows 487, "Attempt to access invalid address"). That test releases a reservation, then maps at its address, and its own comment notes it races the other tests for that address. This PR doesn't touchvictory-platformor any Windows code.Imported from LakshanSivakumar/Native-Victory-macOS. Originally posted by LakshanSivakumar on 2026-11-26T16:37:27Z.
Review: APPROVED
Checked the diff: a buffer view of memory in no pool now writes the null view, the new test covers the stale entry and the recovery. Merged onto main, native tests, windows clippy and xtask policy are clean, CI is green.