Skip to content

Performance Research G02 Exact Vertex Byte Ranges

github-actions[bot] edited this page Sep 15, 2026 · 1 revision

Exact vertex byte ranges instead of page-expanded readback triggers

G02 — Implementation and validation notes

Field Value
Evidence state Historical false-overlap/readback evidence; throughput benefit unproven here
Inspected source 322986f4c5502b3fa887a9605ac8cd88e9b2c579
First experiment Exact consumer-range guard after coarse overlap lookup
Scope Addendum dated September 15, 2026; not a current-main benchmark or implementation status

Unproven performance research · Performance research — common test protocol · Performance research — reproducible checks

Evidence and implementation reasoning

Source-backed lead. The Morrowind investigation describes two avoidable GPU-to-RAM readbacks per frame caused by page-aligned vertex upload coverage. That is a precise false-overlap hypothesis, not a claim that every readback is unnecessary. Issue #86 and linked #84/#85 work.

Implementation. Derive the complete consumed byte set from vertex formats, attributes, stride, indices, and draw bounds. Use a coarse page index to find possible surface conflicts, then an exact interval/region check before downloading. Retain a conservative fallback when the consumer set is not known.

Proof obligation. The fast path must include every byte the draw may read. Attribute sizes, the final strided element, index extrema, partial updates, and aliasing matter. Merely replacing page alignment with the nominal allocation size is not sufficient.

Expected gain. Avoid a readback's transfer, submission, and synchronization when it lies on the critical path. The existing combined probe showed wait reasons moving and no established throughput win, so the reported readback count cannot be directly converted into an FPS estimate.

Acceptance. Use just-outside/just-inside overlap pairs, partial-page surfaces, overlapping attributes, all supported index sizes, CPU writes, and exact rendered output. Retain total fence wait and guest-progress measurements.

First patch boundary

Include each attribute extent, stride, final element, index extrema and aliases. Keep conservative fallback for unknown consumer ranges.

coarse page candidate -> complete consumed byte set -> exact overlap -> required surface sync only

Locate the inspected seam before editing; names or ownership may have changed since the pinned review:

git grep -n -E 'vertex|download_surface|SURFACE_DOWN' -- hw/xbox/nv2a/pgraph/vk

Proposed focused tests

These are implementation gates to add or exercise, not claims that production tests already exist or passed. Retained standalone checks are on the checks page.

Test ID Setup / deliberate control Required oracle
G02.01 Surface and vertex data share a page but their consumed bytes are adjacent and disjoint. No false readback; rendered output matches the conservative reference.
G02.02 Move the consumer so exactly one actually-read byte overlaps a GPU-owned surface. Synchronization occurs; a too-short range fails the output/state oracle.
G02.03 Strided attributes, index extrema, partial-page surfaces and guest writes around upload. Every consumed byte is covered and ownership remains correct.

Counters and rejection criteria

Collect: coarse_overlap_hits, exact_overlaps, avoided_readbacks, readback_bytes, surface_down_ns, total_fence_ns, guest_progress. Keep exact counts separate from sampled durations; use an uninstrumented build for performance qualification.

Reject or hold: A moved wait reason or fewer readbacks alone is not a throughput gain. Stop on any missing consumed byte or ownership difference.

Follow the common protocol for source identities, previous-main/fixed-baseline controls, raw results, confidence and retail/XISO qualification. No gain becomes proven from a model, cache hit, local operation count, or shifted wait label alone.

Clone this wiki locally