hwrt: bound the title's BLAS counts before a copy is allocated for them #644
No reviewers
Labels
No labels
AMD
audio
bug
confirmed
crash
cutscene
dlss
documentation
duplicate
enhancement
fixed-on-main
frame-generation
hle
input
INTEL
lighting
linux-proton
memory
MULDER
needs-info
needs-logs
needs-rebase
NVIDIA
performance
post-merge
pr-diagnostics
pr-docs
pre-merge
pr-feature
pr-fix
pr-performance
pr-refactor
pr-tests
question
RAYTRACING
relevance
high
relevance
low
relevance
medium
relevance
very-high
rendering
report
roadmap-proposal
saves
series-s
shaders
startup
status
blocked-by-rework
status
needs-test-report
status
needs-triage
status
ready-for-review
status
stale
status
superseded
status
wip
tools
ui
upstream
wontfix
No milestone
No project
No assignees
2 participants
Notifications
Due date
No due date set.
Dependencies
No dependencies set
Reference
TrustNo1/Darner!644
Loading…
Reference in a new issue
No description provided.
Delete branch "qnjk/Darner:hwrt-input-buffers"
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?
Contributor role (optional)
What it changes
The problem on main: the decoders that read the title's BLAS inputs from copies size their buffer from the title's own descriptor fields before asking whether its pages are there —
read_titledoesvec![0u8; len]and only thenhost::read_into. Those fields are read without validation (read_geometriesdoes aread_unalignedof the title's descriptors), and the lengths they produce are far past any mesh: the quant24 vertex count and stride ask for up to ~140 TB,icountfor ~17 GB, and the meshlet header'snum_packed_trisfor 5.7 GB.vec![0u8; len]on such a length is not a panic a caller can answer — the default allocator aborts the process, on the title's recording thread, where the layer's failure path never sees it. The in-place twins of the same two decoders already answer a range that is not there by dropping the geometry (title_readable), so a count read wrong should cost the mesh, not the run.This change refuses a length past
READ_MOST(256 MiB — a few times the 64 MiB a frame's builds are given, and well under the largest live BLAS budget) and makes both copy decoders answerSome(None), the "drop this geometry" answer their callers already give an unreadable buffer, so the mapped twin is not tried on a count that cannot be a mesh.How it was tested
8c7a81c(one commit onc8258f9).cargo test --locked -p darner-gpu --lib -- hwrt— 30 passed, 0 failed.hwrt::tests::copy_decoders_refuse_a_count_that_is_not_a_meshasks the two decoders for 131 TB and 5.7 GB of copies from a local buffer. Fail-before, with the bound removed: the test process aborts withmemory allocation of 131067999967273 bytes failed(0xc0000409); it passes now, with the geometry dropped.cargo clippy --locked -p darner-gpu --all-targets -- -D warningspasses.cargo clippy --workspace --all-targets --locked -- -D warnings: passes.cargo clippy --workspace --all-targets --all-features --locked -- -D warnings: passes.hwrttests are green; the whole-workspace run is not green on this machine for the pre-existingdarner-gpureasons (#224, #150), which this does not touch.READ_MOSTis a policy number chosen from the budgets, not measured from a real title's largest mesh.Checklist
main.docs/asset-policy.md(cargo xtask policy: passes).Checked for overlap
crates/darner-gpu/src/hwrt.rs; none of their descriptions mentions the copy decoders' allocation. No open or closed issue mentionsread_titleor a BLAS count that cannot be a mesh.[pr-fix][memory][RAYTRACING] hwrt: bound the title's BLAS counts before a copy is allocated for themto hwrt: bound the title's BLAS counts before a copy is allocated for themTest needed — commit
8c7a81ce; what to check:The problem on main: the decoders that read the title's BLAS inputs from copies size their buffer from the title's own descriptor fields before asking whether its pages are there —
read_titledoesvec![0u8; len]and only thenhost::read_into. Those fields are read without validation (read_geometriesdoes aread_unalignedof the title's descriptors), and the lengths they produce are far past any mesh: the quant24 vertex count and stride ask for up to ~140 TB,icountfor ~17 GB, and the meshlet header'snum_packed_trisfor 5.7 GB.vec![0u8; len]on such a length is not a panic a caller can answer — the default allocator aborts the process, on the title's recording thread, where the layer's failure path never sees it. The in-place twins of the same two decoders already answer a range that is not there by dropping the geometry (title_readable), so a count read wrong should cost the mesh, not the run.This change refuses a length past
READ_MOST(256 MiB — a few times the 64 MiB a frame's builds are given, and well under the largest live BLAS budget) and makes both copy decoders answerSome(None), the "drop this geometry" answer their callers already give an unEvidence to post: card + driver, settings, commit tested, before/after (switch off vs on, two runs each), fps median and p99, and one line saying you looked at the picture.
Reply
testingto take this run; it's free again after 24 h with no results.View command line instructions
Checkout
From your project repository, check out a new branch and test the changes.Merge
Merge the changes and update on Forgejo.Warning: The "Autodetect manual merge" setting is not enabled for this repository, you will have to mark this pull request as manually merged afterwards.