audit-performance
Audit GPU/CPU performance — hot paths, allocations, draw batching, GPU memory pressure, SSBO sizing, telemetry
- License 许可
- MIT
- 最近更新
- 2026-11-15
- Stars
- ★ 40
- Forks
- 6
01 前言 Front Matter
- description
- Audit GPU/CPU performance — hot paths, allocations, draw batching, GPU memory pressure, SSBO sizing, telemetry
- argument-hint
- --focus <dimensions> --depth shallow|deep
03 SKILL.md 正文
Performance Audit
Read .claude/commands/_audit-common.md and .claude/commands/_audit-severity.md for shared protocol (layout, methodology, dedup, context rules, path-reference convention, finding format, hot-path hashing rule).
Audit ByroRedux for CPU hot-path inefficiency, per-frame allocation churn, draw/instancing waste, GPU memory pressure + eviction thrash, SSBO sizing/upload cost, pass cost and streaming stalls. Do not re-derive memory ceilings — docs/engine/memory-budget.md owns every size, threshold, reserve floor and VRAM budget; cite it.
Architecture: Orchestrator. Each dimension runs as a Task agent (max 3 concurrent), with the model _audit-common.md § Delta-first scoping step 5 sets.
Hardware target: RTX 4070 Ti (12 GB) + Ryzen 7950X (16c/32t); RT VRAM minimum 6 GB. A CPU bottleneck here is a bug, not a tuning gap — dimensions are ordered by per-frame impact.
Parameters
--focus <dimensions>: comma-separated numbers (e.g.1,3,5). Default all 8.--depth shallow|deep: pattern scan vs traced + quantified. Defaultdeep.
Extra Per-Finding Fields
- Dimension: CPU Hot Paths | Draw & Instancing | GPU Memory Pressure | SSBO Sizing & Upload | GPU Pipeline | Skinning & BLAS | Streaming & Cells | NIF Parse | Telemetry & Origin Cost
Bench discipline (never hard-code numbers)
- ROADMAP.md carries the live Bench-of-record (
scripts/fsr-bench-matrix.sh 3 300,renderer-stepped, five scenes × TAA/FSR presets, with a same-machine control of the outgoing record): read it, its open regressions (R6a-regress-22: the "FO4 frame time doubled inside4c9a5b36..99933f87b" reading wasb9e961eebmoving the bench camera's spawn origin into the room, not code — #5128's pinned-pose control; the known-open residual is ≈ +0.7 ms / fence +2.6 ms from the old pose, the top-of-frame all-slots fence wait tracked as #5365. Before comparing two bench records, check theircamera_poscolumns match; and R6a-regress-23: the live record isd9a201c71(2026-10-22, controlled againsta3a7a43b0), and HEAD reads 1–9% slower than that control on every scene — Cornell, the content-identical one, +0.99 ms TAA; the SVGF bracket is +0.22–0.35 ms (thegpu_shadow_filterbracket inside it) and gpu_main +0.5–1.2 ms on Cornell / Whiterun / MedTek is unattributed) and the compat table; report observed-vs-ROADMAP deltas — a regression is a delta. Scenes: Cornell (redistributable control), Prospector (FNV), WhiterunBanneredMare (Skyrim), MedTekResearch01 + Dugout Inn (FO4). - Run shape:
--bench-frames N [--bench-hold] [--bench-mode renderer-static|renderer-stepped|system-live]. Compare only within one mode (baseline TSVs in.claude/audit-baselines/runtime/are renderer-static; the record is renderer-stepped); the mode owns delta-time, so never setBYROREDUX_FIXED_DT. PointBYROREDUX_SETTINGS_PATHat a fresh file and pass--upscalerexplicitly, or a persistedrender.upscalerchanges the run (#4947); thebench:line reportsupscaler=/render_extent=/output_extent=. Measure the noise floor first (scripts/bench-variability-envelope.sh); a delta inside it is not a finding.--bench-capture-every N --bench-capture-dir DIR(bench_capture.rs,f7194719f) is a capture mode: every screenshot stalls its frame, so take timings from a separate run without it. - Harness byte-stability.
scripts/fsr-bench-matrix.sh+scripts/fsr_bench_report.pymust stay byte-stable across commits or cross-commit comparisons mean nothing. Never assert it from memory (#4024): runscripts/check-bench-harness-provenance.sh [--strict] [<record-commit>](full history required) and quote the verdict; a DIVERGED verdict → re-bench both sides. An edit to either file that was not itself re-benched is a finding (against the lived9a201c71record the verdict reads DIVERGED with one edit,e7d7af3c9(M-LIGHT Phase 1b), which moved the scene table (scene_dir,scene_entity_floor,run_scene_args) verbatim into the sourcedscripts/bench-scenes.sh— recorded as measurement-neutral by inspection (0be5f6c83, #6598: no run arguments, gates or arithmetic changed), so re-run the check before trusting a cross-commit delta rather than assuming byte-stability;fc83608d3'sgpu_shadow_filterand994620123'sgpu_cloud_shadowcolumn appends predate it; thea3a7a43b0record reads DIVERGED with three edits, those two (#5959; #6316, its disposition landed with #6336,a74c2bdf0) pluse7d7af3c9, each carrying a recorded disposition; the oldera37fcba3crecord reads DIVERGED with five, each carrying a recorded disposition the script prints — #5451, fixed in4b9472909: the ProspectorUpdate.bsamount was shown measurement-neutral by a same-session interleaved control, thecamera_posandgpu_shadow_filtercolumns are append-only. Without--stricta DIVERGED verdict still exits 0; dispositions annotate only, the verdict, exit code and--strictare unchanged). - Adaptive ray budget: the RT quality tier follows GPU time (
AdaptiveRayBudget), so a lighting-cost delta is uninterpretable without it — pin with--rt-test-ray-quality-tier Nfor A/B, else report the tier. - Hooks (
byro-dbgafter--bench-hold; nobench-statscommand exists): the once-a-secondgpu_ms:/cpu_ms:lines,MetricsSnapshot(over the wireMetricsPayloadcarriesgpu_pass_ms,cpu_pass_msandtop_systems_ms, sobyro-dbgcan name the slow system and the slow CPU bucket without log scraping; #6278,05d94dd61), consolectx.scratch,skin.coverage,rt.integrity,depth.stats. Cite a timer, not a guess.
Regression-guard posture
Each dimension lists landed fixes as Guard: lines — verify the symbol/test still exists and holds; never re-propose a landed fix (noise); an eroded guard is a real finding, reported apart from new issues. Std HashMap/HashSet on a per-frame per-entity keyspace is a fresh regression (the Fx conversion is finished). Falsified by measurement, re-propose only with new numbers: decorate-sort-undecorate for the raster sort (#4194, manual_bench_draw_sort_decorate_sort_undecorate, render/draw_sort_key_tests.rs).
Alloc coverage: NIF parse/import allocation is dhat-testable (dhat-heap feature; bounds in crates/nif/tests/heap_allocation_bounds*.rs) — propose a bound, don't estimate. Per-frame render/ECS paths have NO dhat coverage: flag "no quantitative guard exists for this site".
Per-frame pass inventory (verify against code; a pass missing here is itself a finding)
Command-buffer order (draw_frame phases, vulkan/context/). Timer = GpuTimerSnapshot field (31 brackets: 26 named + 5 main-render sub-phases); a new named pass is a TimerPass variant + const row in gpu_timers.rs (#6358, 0288f468d; cmd_start / cmd_end take the row, no per-pass methods, every_named_bracket_has_exactly_one_pass_row) and needs a bracket, a row here and a memory-budget.md row. Nested brackets (main_opaque_ms / main_blended_ms / main_water_ms / groundcover_model_draw_ms / groundcover_blade_draw_ms inside main_render_ms; volumetrics_inject_ms / volumetrics_integrate_ms / volumetrics_local_sim_ms inside volumetrics_ms, #6533; shadow_filter_ms inside svgf_ms, #5959; cloud_shadow_ms inside sky_cube_ms, #6316) are never summed with their parent.
| Pass | Where | Runs when | Scales with | Timer |
|---|---|---|---|---|
| Static-BLAS recovery | restore_missing_static_blas_for_draws via step_static_blas_restore (app_step.rs), between frames |
missing rigid BLAS; deadline-bounded chunks; skipped if the set cannot fit the budget | missing meshes (~0.2–0.5 ms each, blocking) | CPU only |
| Dynamic-RGBA copies, reservoir clear | begin_frame_recording (texture_registry/dynamic_rgba.rs, ReservoirBuffers::begin_frame) |
pending same-size RGBA updates; every frame | changed textures; pixels | none |
| Instance/material/light upload | build_and_upload_instances.rs, scene_buffer/upload.rs |
every frame; hash dirty gates | live draws, unique materials | ssbo_build, parameter_upload (CPU) |
| Skin palette | skin_palette.comp via plan_palette_dispatch (dispatch_skin_and_cluster.rs) |
dirty slot runs only | changed bone slots | skin_palette_ms |
| Skin vertices | skin_vertices.comp per entity |
pose-hash dirty gate | dirty entities × verts | skin_dispatch_ms |
| Skinned BLAS refit | record_skinned_blas_refit |
dirty gate; rebuild after 600 + jitter refits | dirty entities; shared scratch serializes | skin_blas_refit_ms |
| TLAS build/refit | build_tlas |
every frame; UPDATE vs BUILD by address sequence | instances | tlas_build_ms |
| Cluster cull | cluster_cull.comp |
every frame | lights × clusters | cluster_cull_ms |
| Ground-cover scatter | groundcover_interaction.comp + groundcover_scatter.comp (TLAS ray query per candidate); dev bench: groundcover_bench_ms |
chunks resident (exterior) | chunks × candidate budget | groundcover_scatter_ms |
| Sky-cube bake | SkyCubePipeline::record_bake: sky_cube.comp (6×128², cloud march) + prefilter mips + SH, then record_cloud_shadow: the cloud-shadow map (cloud_shadow.comp, CLOUD_SHADOW_MAP_SIZE² × CLOUD_SHADOW_STEPS march, vulkan/sky_cube/cloud_shadow.rs; its camera-column readback is read in begin_frame_recording after the slot's fence, never stalling) |
every frame the pipeline exists (interiors too) | fixed | sky_cube_ms (inclusive), cloud_shadow_ms nested (#6316) |
| Ground-cover model tier | groundcover_models.comp via record_groundcover_models (PLACE/LAYOUT/EMIT into the instance tail) |
exterior, chunks resident | candidates | groundcover_models_ms |
| Main geometry pass | triangle.vert/frag + early-depth triangle_early.frag.spv for opaque draws that allow it (RT shadows/reflection/GI/glass), water, ground-cover models + blades |
every frame | pixels × lights × rays (adaptive tier) | main_render_ms (+ 5 sub-phases) |
| Depth-history copy | copy_depth_to_history |
only if scene_has_effect_soft_material (cached, SceneEffectSoftCache) |
pixels | depth_history_copy_ms |
| SVGF + shadow filter | temporal + 3 à-trous dispatches; then the direct-shadow filter (shadow_filter.comp, 2 à-trous iterations over the ReSTIR shadow ratio, vulkan/shadow_filter.rs) |
every frame; the filter also runs when SVGF is absent or latched off | pixels | svgf_ms (inclusive of the filter) + nested shadow_filter_ms, which also brackets the SVGF-absent fallback (record_shadow_filter, post_passes.rs) |
| Caustic splat | caustic_splat.comp |
caustic sources present | refractive pixels | caustic_splat_ms |
| Volumetrics | inject + integrate, combustion-moment readback (one frame behind); the world-space combustion local grid (volumetrics/local_grid.rs, volumetrics_local_sim.comp over up to LOCAL_GRID_MAX_BOXES cubic-cell boxes within LOCAL_GRID_REACH_METERS of the camera, #6533; its state hash is read back a frame behind); host fog_cluster prep |
requires_dispatch (fog / emitters / combustion live) and TLAS, cluster-light and boundary-geometry inputs present (post_passes.rs); VOLUMETRIC_OUTPUT_CONSUMED is permanently true |
froxels (resolution-derived) × rays per froxel (fogRayQualityTier); local sim: live boxes × LOCAL_GRID_DIM³ cells (no live box ⇒ inactive, volumetrics_local_sim_ms == 0) |
volumetrics_ms (+ inject/integrate/local sim) |
| SSAO, composite | ssao.comp; composite.frag (linear HDR; when submerged, also a 24-step per-pixel underwater god-ray march, underwaterGodRays, gated on the submersion extinction and reading view_proj from the composite UBO, not a per-pixel inverse(), #6486 fa9ada406 (issue stays open for the unmeasured 24-step x 6-tap depth-fetch half: no submerged composite_ms measurement exists); when local-grid boxes are live, also the local fire ray-march, built as two pipelines on the LOCAL_FIRE_SUNLIT specialization constant so a sun-less frame binds the variant with the sun-lit species-phase path folded out, 15a4ecf10 — 96 vs 126 registers per thread, docs/engine/fire-volumetrics-plan.md) |
every frame; the god-ray march only underwater, the fire march only with live boxes | render pixels | ssao_ms, composite_ms (the god-ray march is unmeasured — quantify with composite_ms below the surface before filing; the fire march is costed per scene in the plan doc: composite 0.36–0.89 ms on its lab scenes, interleaved medians) |
| Bloom | down/up chain + bloom_apply.comp |
skipped under raw debug views | pixels | bloom_ms |
| TAA | taa.comp |
only --upscaler taa |
pixels | taa_ms |
| Exposure meter | exposure_meter.comp via record_exposure_meter_pass (one workgroup; fixed mode writes a constant, auto mode does 4,096 scattered fetches); skipped on raw-debug views |
every frame | fixed | exposure_meter_ms |
| Upscale, presentation | FSR 3.1 or native blit; tone-map (ACES / AgX) × exposure texel (+ UI quad) | every frame | output pixels (presentation does not shrink with FSR presets) | upscale_ms, presentation_ms |
Outside the loop: lazy blend-pipeline variant compilation (seconds each on a cold driver cache; CPU span pipeline_compile), the post-present scratch shrink (shrink_frame_scratch.rs, CPU span post_present) and the streaming/teardown paths (Dim 7).
Phase 1: Setup
- Parse
$ARGUMENTS.mkdir -p /tmp/audit/performance. - Dedup baseline:
gh issue list --repo matiaszanolli/ByroRedux --limit 200 --json number,title,state,labels > /tmp/audit/performance/issues.json. - Read ROADMAP.md Bench-of-record + compat table, and the newest
docs/audits/AUDIT_PERFORMANCE_*.md. - Delta scoping: run each dimension's
First step:with--since=<last report date>; untouched Paths get a guard check + skim.
Phase 2: Dimensions
Dimension 1: CPU per-frame allocations & hot paths
The highest-yield surface: a 16-core Ryzen must never be the bottleneck.
Paths: byroredux/src/systems/{animation,bounds,billboard,particle,cinematic,locomotion,sandbox,wander,travel,follow,escort,guard,patrol,walk_anim,combat_ai,restoration,eat_sleep,forcegreet,story_events,npc_dialogue,dialogue_voice,archetype_idle,trap_hits}.rs, byroredux/src/npc_spawn/ai_package.rs (ambient_ai_package_system), crates/core/src/ecs/systems.rs (make_transform_propagation_system), crates/core/src/ecs/packed.rs, byroredux/src/render/{mod,particles,lights,static_meshes,skinned}.rs, crates/core/src/ecs/resources/skin_slot_pool.rs, crates/core/src/form_id.rs (FormIdPool::entity_with_local), byroredux/src/systems/pass_clock.rs, byroredux/src/texture_streamer.rs (update_wanted, M39).
First step: git log --since=… --format='%h %s' -- byroredux/src/systems byroredux/src/render crates/core/src/ecs crates/core/src/form_id.rs; scheduler timings in MetricsSnapshot name the slow system. Measured (#6718, db8cfde6a, record .claude/issues/6718/PROFILE.md, BYRO_PROFILE=1, release, 900 frames): all systems together cost 1.5 / 4.8 / 3.3 ms a frame on FNV Prospector Saloon / Skyrim Whiterun / FO4 Shamrock Taphouse (4–12 % of a 34–40 ms Xvfb wall, which is submit-dominated and unrepresentative); the only system over 0.5 ms is physics_sync_system (Whiterun mean 2.2 ms, max 9.7), already parallel-registered and alone in its Physics stage, so parallel promotion of the others buys nothing. Do not re-file "promote more systems to parallel" without a scene showing systems_ms above ~8 ms on a real display or a CPU-bound frame; the record notes interaction_system and the animation / dialogue / trigger systems were judged on cost, not access_report().
Method: per-frame Vec/HashMap/String allocation that should be a persistent scratch; collect() where clear()+extend works; mem::take capacity churn (0→N regrowth); per-entity allocation or component deep-clone inside a per-frame loop; whole-world scans with no change-detection key; sparse-set probes repeated per entity. Ambient locomotion/AI/cinematic systems run every frame on every NPC: no component clones (NavPath and ScenePlayer clones were real findings), persistent scratch not fresh Vecs. Regression guards, fixed (do not re-file): story_change_location_system early-outs on an empty/absent SmTree and hashes the typed LCTN/grid fields without format! (#5447, 7bba019e1), and derives the cell kind, LCTN and CLOC key once per cell context through StoryLocationMemo (an allocation-free Fx key over the contexts it reads; a per-frame resolve_current_lctn, which lowercases an interior's editor id into a fresh String, is the regression — #6335, 80471eb78, the_location_is_derived_once_per_context_not_per_frame); archetype_idle_system skips its walk while the membership generations of AnimationTarget / AnimationPlayer / ArchetypeIdle, the Dead count and the player entity are unchanged (PassKey, actor list a persistent scratch on ArchetypeIdleSeen; the pass's own inserts move the key once, so it repeats once and settles — #6334, 86ac93e0c, a_settled_pass_skips_the_walk_until_an_actor_appears); the trap -> scripted-owner map in trap_hits.rs is rebuilt only when owner_key (the structural generations of its six storages) moves and its per-tick body/contact sets are Fx (#6312, 9290248d6, the_cached_owner_map_follows_script_and_parent_changes) — a per-tick rebuild or a SipHash set there is the regression; ambient_ai_package_system reads BYRO_M42_DEBUG once through a OnceLock and builds its due list without a per-frame Vec (#5448, 9cc748ef2); make_eat_sleep_system keeps a persistent scratch — a per-actor SEAT_RETRY_SECS retry clock, one shared sit/sleep marker gather per frame (#5449, 35a009431), an ANCHOR_RETRY_SECS clock for an unresolved In-Cell anchor and one query pass per storage for the walk leg (#5527, 959b76f55), and its actor list and retry-map membership set (EatSleepScratch.actors / live) are reused with seated sleepers skipped at the gather and the retry maps FxHashMaps pruned against that set, not three O(retry × actors) retain(any()) sweeps (#5707, a08156579, seated_actor_is_not_gathered_and_its_clocks_are_pruned). A per-frame whole-world Furniture walk, a per-frame rebuilt actor Vec or a per-actor world.get round-trip in these systems is the regression. find_package_system memoises each candidate row's item kind per base for the current LoadedCellIndex (Fx map), staggers each actor's first search across the period by entity id, keeps its behaviour snapshot as persistent scratch, recomputes the arrival class when the target changes and about once a second after, and prunes search_clock / stuck / the arrival cache to the live Find actors (#6339, f8c3c5ae3, the_item_kind_memo_classifies_each_base_once_per_index, first_searches_are_staggered_across_the_period, the_arrival_class_is_cached_for_the_walk); jail_bed_system reads ActivateEvent first and tests only the player's activation targets with is_bed, not a per-frame Vec of every bed (#6340, 199714b75, is_bed_agrees_with_the_bulk_bed_gather). Global-FormID resolution is a hash lookup: resolve_entity_by_global_form_id answers from FormIdPool::entity_with_local, a lazily rebuilt local→entity index keyed on FormIdComponent's structural generation plus the pool length, so Flee / UseWeapon / find_package / travel / follow no longer scan every FormIdComponent per actor per frame (4 µs at 2 k entities, 65–131 µs at 30–60 k; a miss paid the full scan each frame) — a per-call iter().find over FormIdComponent is the regression (#6338, ab3a604bf, entity_with_local_reuses_its_build_until_the_membership_moves, the_index_follows_spawns_and_despawns, a_duplicate_id_resolves_to_the_first_entity). The physics water pass keeps its per-wet-body latches (rest_depth, water_force_targets, the settled-collider set) on the Fx hasher (#5709, 5f01d1a7f, water_scan_latches_are_not_siphash in crates/physics/src/water.rs) — a std HashMap/HashSet there is the regression. The Papyrus VM's serial main-thread cost is bounded per frame: VmFrameBudget (DEFAULT_FRAME_BUDGET 10 000 statements, renewed by event_cleanup_system; fragment/budget.rs) defers un-started runs (a hit it cannot start is deferred onto the continuation queue, not dropped — #5987, 746214f29) and yields a run in progress, and ReferenceScriptIndex (fragment/reference.rs) answers FormID → entity in one hash lookup instead of a per-frame rebuild over every attached script (#5763, 195e3b4ef) — an unbudgeted exclusive interpreter system or a per-call index rebuild is the regression. collect_deliveries returns before walking the attached-script entities when the frame raised no marker or watched change (11685934d, part of #5764: idle ref_events flat at ~1.3 µs from 0 to 20 000 references, docs/audits/BENCH_vm-cost_after-5764.txt), so neither reference_script_event_system nor the OnHit pass #5991 (e4810c125) split into reference_script_hit_system walks on a quiet frame — an idle-frame walk, or a third pass over the entities on an event frame, is the regression. Known-open under #5764: deferral costs ~0.8 µs a delivery (needs a compact saved record) and a value-called function or array-holding frame cannot suspend; quantify against it before filing.
Guard: drain_dirty_into_preserves_storage_capacity (packed.rs; take_dirty zero-capacities — its use in a per-frame system is the regression); make_animation_system persistent scratches (entities_scratch, playback_scratch); make_billboard_system skips its loop when last_cam is unchanged (re-arming GlobalTransform TRACK_CHANGES every frame defeats incremental bounds); make_transform_propagation_system change-detection fast path (skips when roots, Parent/Children generations and Transform dirty are unchanged); build_debug_ui_snapshot clone gated on debug UI visible; SkinSlotPool free_list contraction so max_used_slot() shrinks after a high-NPC unload; bone_world not .clear()ed per frame (identity-fills new tail slots only); emit_particles takes no dead GlobalTransform query; scene_has_effect_soft_material served from SceneEffectSoftCache while storages are structurally unchanged; compute_wanted (texture_streamer.rs, runs every frame once render.texture_streaming is on, off by default) resolves a draw's texture-slot widths through a dense handle-indexed table and Fx per-frame maps — it was 1.50 ms on FO4 MedTekResearch01 (8 000 draws × 8 slots of SipHash lookups) and is 0.52 ms there, 0.14 ms on FNV Prospector (dd2cd84e9, docs/engine/texture-streaming.md §12.4): a std-hasher lookup per draw-slot is the regression; the periodic gameplay systems share one PassClock::due (non-finite dt adds nothing, a_non_finite_or_negative_dt_adds_nothing) and one living_actors roster instead of per-system accumulators and per-system CombatDisposition sweeps (#6579, 00d53e659, living_actors_are_the_stamped_actors_that_are_not_dead).
Output: /tmp/audit/performance/dim_1.md
Dimension 2: Draw-call & instancing efficiency
Paths: byroredux/src/render/{mod,static_meshes,visibility}.rs (build_render_data, draw_sort_key, sort_draw_commands, raster_visible), crates/renderer/src/vulkan/context/{build_and_upload_instances,draw,frame_params}.rs (batching; group_state / should_use_indirect_draws live in frame_params.rs since #5087).
First step: git log --since=… --format='%h %s' -- byroredux/src/render crates/renderer/src/vulkan/context/draw.rs; cargo test -p byroredux draw_sort_key.
Guard: render/draw_sort_key_tests.rs, render/sort_key_tests.rs.
Checklist:
draw_sort_keyis a 12-tuple(u8×4, u32×8): slot 0rt_only(off-frustum RT occluders last, so theMAX_INSTANCEScap drops them before raster), 1 composition phase, 2 blend class, 3no_sorter(true alpha-over only; opaque/additive write 0 — #4191), then state/mesh/depth. The opaque depth slot isopaque_depth_bucket(raw depth = camera-driven sort churn that defeats the SSBO dirty-gate hashes, #3663). Sorted alpha-over is depth-primary on purpose: its higherbench_draws_*counts are accepted cost. EveryPipelineKeyaxis needs a sort slot (blend_pipeline_slot,pack_depth_state).- Verify the sort minimizes pipeline/descriptor rebinds; draw count vs entity count (compat table reports both); same-mesh instances collapse to one indirect draw; no per-draw state churn (
cmd_set_depth_bias). R6a-regress-22's apparent batch-merge collapse (Dugout1935/326b/12c→2367/659b/43c) was a camera move (#5128): pinned to one pose,99933f87bmerges more (330b → 168b), so a batching finding must compare same-pose captures. DRAW_SORT_PARALLEL_THRESHOLD= 3000 (sort_draw_commands; measured crossover 2750–3000;manual_bench_draw_sort_serial_vs_parallelasserts the two sorts agree before it times them, #6186,353b12145). Check it against thebench_draws_raster_cmdscolumn of the baseline TSVs —bench_draws_cmdsalso counts RT-only occluders that never enter the sorter; a row withbench_draws_batches > bench_draws_raster_cmdscannot come from one capture.- Static-mesh loop probes
GlobalTransformbefore the visibility/bounds siblings (#1377);build_instance_mapreuses a caller scratch (#4193). needs_two_sided_blend_split=is_blend && two_sided && order_dependent_glass(noz_writelimb); structurally dormant for engine-classified glass (collect_static_mesh_drawsclearstwo_sidedforMATERIAL_KIND_GLASS), so split items cannot explain batch-count movement (#2691); a split on non-glass batches is the regression. The indirect group key carries split eligibility (needs_two_sided_blend_split), not the raw glass flag, so opaque glass runs merge (#2764,opaque_glass_flag_does_not_split_groups; #2165'sblended_glass_flag_still_splits_groupsstill holds). Output:/tmp/audit/performance/dim_2.md
Dimension 3: GPU memory pressure & eviction thrash
Paths: crates/renderer/src/vulkan/acceleration/{predicates,blas_static,constants}.rs, context/resources.rs, crates/renderer/src/texture_registry/, crates/renderer/src/mesh.rs, byroredux/src/streaming_helpers.rs (exterior_pool_reserve, defer_geometry_rebuild), crates/renderer/src/mesh/pool_limits.rs, crates/renderer/src/texture_registry/budget.rs, byroredux/src/asset_provider/material/{provider,cdb,loose_mat}.rs, crates/sfmaterial/src/index.rs (the Phase-2 MaterialIndex), crates/renderer/src/deferred_destroy.rs.
First step: git log --since=… --format='%h %s' -- crates/renderer/src/vulkan/acceleration crates/renderer/src/texture_registry crates/renderer/src/vulkan/context/resources.rs; rt.integrity shows BLAS residency, missing/evicted counts and pending-destroy backlog.
Guard: cargo test -p byroredux-renderer --lib acceleration (admission/eviction/residency tests), static_blas_recovery_covers_both_sources_and_protects_current_draws (resources.rs), bin static_blas_recovery_runs_between_frames_not_in_the_render_driver (app_step.rs); has_any_view_of_path_finds_every_key_variant (#5053: the prefetch planner's residency probe rewrites one reused key buffer, never 16 Strings per probe).
Checklist (ceilings: memory-budget.md):
- BLAS budget is dynamic:
blas_budget_for_heap= (DEVICE_LOCAL heap −screen_scaled_reservation_bytes) / 3, clamped to [MIN_BLAS_BUDGET_BYTES256 MB,MAX_BLAS_BUDGET_BYTES1 GB]; the reservation (render_extent_bytes_per_pixel_x1024) bills every render-extent pass — including ReSTIR'sRESERVOIR_BYTES_PER_PIXEL_PER_SLOTandSHADOW_FILTER_BYTES_PER_PIXELper frame in flight (#6035,9762d9fa2) — the upscaler's output-extent images and FSR SDK bytes and is re-derived on resize/upscaler switch; a new screen-sized allocation missing from it starts eviction late. Eviction runs pre- and mid-batch (blas_over_budgetcounts the batch'spending_bytes;BATCH_EVICTION_CHECK_INTERVAL= 64); admission is bounded on resident bytes (admit_next_static_blas,blas_admission_exhausted) — allocating past residency, or evicting against bytes still inpending_destroy_blas, is the regression. LRU must not rebuild-thrash during streaming. - Static-BLAS recovery stays a deadline-bounded between-frames step;
plan_static_blas_restoremust still skip a set that cannot fit the budget (else evict→rebuild never converges — the ~95 k-draw Starfield city). Current-frame BLAS ownership isStaticBlasWorkingSet(acceleration/static_working_set.rs: dense handle-indexed generation stamps, no per-frame hashing, #4804). Documented ceilings, quantify first:--gridfalse-evict burst, shared-scratch serialization (/audit-rendererDim 1). - Scratch high-water:
shrink_blas_scratch_to_fit(cell unload, resize),shrink_tlas_to_fit/shrink_tlas_scratch_to_fit(draw_frametail, on the next slot) respect the reserve floors (MIN_TLAS_INSTANCE_RESERVE=WORKING_SET_FLOOR= 8192). check_pool_growth()warns/errors on vertex/index pool caps per upload. The caps are 7 M vertices / 28 M indices (VERTEX_POOL_HARD_CAP/INDEX_POOL_HARD_CAP,mesh/pool_limits.rssince #6520cd78f9efe; raised 4 M/16 M → 5 M/20 M → 7 M/28 M by3929a406candbb97be77c, ≈ 840 MB at the caps,memory-budget.mdmesh-registry row — re-derive from the constants, never copy). Admission is three-tier (GeometryAdmissionClass,ab9d46d18→22d6e1a80):Essential(terrain, water, terrain LOD) gets the full cap and the global latch;Actor(the player and NPC bodies,with_admission_classinscene/nif_loader.rs) the cap less the ground reserve;Prop(placed statics, object / tree / placement LOD) the cap less ground + actor reserves. A refusal latches only its own tier (prop_geometry_admission_open,actor_geometry_admission_open,scene_geometry_admission_open), so a full pool refuses distant props before people and people before the ground; every latch reopens with the compaction a cell unload triggers. The reserve is sized for the streaming radius, not a flat percentage —set_pool_reserve(exterior_pool_reserve(radius_unload))runs inassemble_exterior_streaming(a fixed 5 % starved 178 terrain cells at FO4 radius 12;the_exterior_pool_reserve_scales_with_the_radius,radius_4_still_leaves_props_what_they_were_measured_to_need), and the 3 % ground / 2 % actor defaults apply only before that call;the_tiers_stop_in_priority_order_and_latch_separatelypins the order. A new upload site must pick its class — a prop-sized upload leftEssentialeats the ground's headroom, and a ground upload wrapped inPropis refused first. The deferred geometry rebuild is bounded:defer_geometry_rebuildstops deferring afterGEOMETRY_REBUILD_MAX_DEFER(15 s) of continuous dirt, or a radius-12 load masks ground and water for its whole duration (the_geometry_rebuild_deferral_is_bounded;geometry_deferred_sinceinapp_frame.rs) — an unbounded deferral is the regression. Exact-content geometry sharing (mesh/geometry_sharing.rs, fingerprint reused for batch dedup and registration, #4803) and the live-budget-gated chunked geometry rebuild (geometry_rebuild_needs_idle) keep pool growth O(unique geometry). A LOD ring whose uploads the full pool refuses reports Starved and stops reconciling (scene_geometry_admission_rejections, #6054,a5958adf3) — re-decoding and re-rejecting every idle frame is the regression. Since #6092 (635330d08) every ring checks its tier's admission query before an attempt (prop_geometry_admission_open()for object / tree / placement LOD,scene_geometry_admission_open()for terrain LOD; skipping the archive read and decode for a certain refusal), a refused quad is held back with no cache entry (never cached as a "no asset" miss) and retried the frame the pool reopens — the re-arm edge inapp_step.rswaits on the stricter prop query, or props starving under the reserve while the essential tier is open would restart every frame (every_lod_ring_gates_on_admission_and_never_caches_a_refusal,starvation_rearms_only_once_admission_reopens,lod_support.rs); Starved closes the boundary as its own terminal state (starve_lod,lod_starvedon the bench line, #6093). A multi-sub-mesh quad or cell the pool refuses part-way is taken back out withMeshRegistry::abandon_scene_geometry_group(truncates the pool tails, leaving no hole) rather thandrop_meshes, whose stranded spans let the next geometry rebuild reopen admission and retry the same group every cycle (#6332,021e1b824,an_abandoned_group_leaves_no_hole_and_admission_stays_closed). Texture staging is bounded by a byte budget (DEFAULT_STAGING_BUDGET_BYTES), not a texture count. BGSM/BGEM cache half-evicts (a full flush reintroduces the cold-restart herd).NifImportRegistryLRU (BYRO_NIF_CACHE_MAX, 2048): per-cell FO4_oc.nifprecombine entries are the preferred victims and the first shared-model eviction logs once (lru_evicts_per_cell_precombine_entries_before_shared_models); the FO4 peak's shared statics alone (~9.7 k) exceed the cap, so eviction is held off while a streaming batch is in flight:step_streamingrunssync_nif_cache_eviction(app_step.rs) after every step,WorldStreamingState::cell_load_in_progressraisesNifImportRegistry::set_eviction_deferred, the registry may hold up toDEFERRED_EVICTION_HEADROOM(8) x the cap, and it trims back to the cap (releasing clip handles) when the batch settles, in one pass:evict_over_capranks victims once by a(tier, tick)key (precombine without a clip handle, then any handle-less entry, then animated; oldest first; a min scan for the single steady-state eviction,select_nth_unstableplus a sort for a bulk trim), not up to three O(N) sweeps per victim, which cost ~1 s at the FO4 working set (#6590,ec5068b40; a per-victim sweep in the trim is the regression) — the worker's "already cached" skip (request snapshot, dispatch-batch memo) no longer turns into a main-thread re-parse (#6114,304f3b587,deferred_eviction_keeps_the_batch_resident_then_trims_to_the_cap,deferred_eviction_is_bounded_by_the_headroom,deferral_does_not_cap_an_unlimited_registry); per-entry RAM at the deferred peak is unmeasured (memory-budget.md), so quantify with an FO4 boot before calling the 8x headroom wrong. A full-detail slice whose geometry uploads the pool refuses is counted (full_detail_refusals=on the bench line) but never retried (#6106, open — needs compaction before the crossing's loads). The Starfield CDBMaterialIndexbuilds on a named background thread started atdiscover_starfield_cdbs, single-flight per CDB (CdbIndexSlot=Arc<OnceLock<…>>) and serialised process-wide so N CDBs never stack N peaks — a first.matlookup that builds inline on the main thread is the regression, and so is a panicking build re-run per lookup (contain_cdb_build_panicmemoises the failure inside the slot initializer, #5665,988402d25,a_panicking_cdb_build_is_memoised_and_runs_once) (#5291, fixed indd759b762; re-measured 1.6 s / 247 MB peak / ~115 MB resident per CDB,memory-budget.md"Material index" row; #5277's per-objecteffect_blendStringmap is part of that footprint). Archive handles are shared process-wide (Archive::open_shared(asset_provider/archive.rs), validated by anArchiveStamp: length + mtime, plus (dev, ino, ctime) on Unix so a same-length rewrite that restores the mtime reopens instead of serving another entry's bytes asOk, #5663,04036a6fb,open_shared_rereads_a_same_length_rewrite_that_restores_the_mtime; the path-keyed Starfield CDB caches are process-lifetime and never re-stamped), so a provider rebuild at a door transition costs ~0.1 ms, not ~125 ms (#5288,5402b2530) — a loader re-parsing file tables is the regression (the #3637 shadow count is memoised per archive and ordered preceding pool, so a reused handle joining a different pool walks the tables once, #5664,3ad6289c2,a_reused_handle_reports_its_shadow_count_for_the_pool_it_joins). Dynamic-RGBA staging (dynamic_rgba.rs): retry cadence under a persistent host-visible failure is part of the #4889 degrade contract — #5275 scoped the warn to the episode and #5528 (e588e5e67) backs the arena growth off forRETRY_INTERVAL_FRAMES(120) after a failed attempt, unless the request shrinks (growth_retries_back_off_during_a_failure_episode,growth_gate_sits_before_the_allocation); a failingvkAllocateMemoryevery frame is the regression.- Texture streaming (M39,
render.texture_streaming, off by default until its open gates close — ROADMAP): textures upload floor-first (residency.rs:floor_first_level, mip-range uploads from a first level) and promote/demote per the wanted-mip pass (TextureStreamer::update_wanted→apply_wanted, Dim 1); the pool is capped byderive_budget(texture_registry/budget.rs:BUDGET_FRACTION_PERMILLE800 × the liveVK_EXT_memory_budgetDEVICE_LOCAL capacity − a reserve (the process's non-texture device-local bytes in use plus the static BLAS's remaining headroom under its own budget), floored atMIN_DERIVED_BUDGET_BYTES;render.texture_budget_miboverrides) and re-derived twice a second, so it shares the heap with the BLAS budget above — a pool that stops reserving the BLAS headroom, or eviction that demotes just-promoted textures inside the hysteresis window before older ones, is the regression (dd2cd84e9); promotions are reads on a streamer pool bounded byMAX_READS_IN_FLIGHT, landed byTextureStreamer::step— a main-thread archive read for a promotion is the regression. A flush batch lands at most one residency change per handle (a promotion read in flight plus a budget demotion planned against the same state used to both land), and a refused install retires its new image throughpending_destroybefore any descriptor points at it (#6738,6a4c661a8); a truncated BC DDS is refused before the floor-first and residency slices instead of panicking (#6737,b8d89bdcb). Cost and residency table:docs/engine/texture-streaming.md§12 (resident texture bytes off → on, FO4 MedTek 766 → 136 MiB; zero deficits/churn at settle); thetex-stream:bench line (tex_stream_bench_line) andtex.residencyare the telemetry — quantify before filing. - Deferred-destroy countdown =
MAX_FRAMES_IN_FLIGHT; freeing earlier writes in-flight GPU memory (CRITICAL). Backlog counters must be read byrt.integrity. Output:/tmp/audit/performance/dim_3.md
Dimension 4: SSBO sizing & per-frame upload
Paths: crates/renderer/src/vulkan/scene_buffer/{constants,upload,buffers}.rs, crates/renderer/src/vulkan/material.rs, byroredux/src/material_translate.rs, crates/core/src/ecs/components/material.rs.
First step: git log --since=… --format='%h %s' -- crates/renderer/src/vulkan/scene_buffer crates/renderer/src/vulkan/material.rs; ctx.scratch on a bench cell.
Guard: gpu_instance_is_160_bytes_std430_compatible, gpu_instance_does_not_re_expand_with_per_material_fields; the dirty-gate tests {instance,indirect,light,material}_hash_tests.rs, per_frame_light_upload_does_not_use_siphash (light_history.rs); bone_world_slot_needs_copy tests (upload.rs); hash_gpu_material_fields_covers_every_gpu_material_field.
Checklist (sizes: memory-budget.md — cite its current total; it moved when instance SSBOs became grow-on-demand):
- Upload cost is O(live data), never O(capacity): instance SSBOs start at
INITIAL_INSTANCE_CAPACITYand double toMAX_INSTANCES; eagerMAX_INSTANCESallocation or a full-capacity memcpy of a near-empty buffer is the waste.MAX_MATERIALS16 384;MAX_INDIRECT_DRAWS=MAX_INSTANCES.GpuInstancecarries per-draw data only (layout drift:/audit-rendererDim 3). - Content-hash dirty gates skip copy + flush on unchanged lights (
hash_light_upload, which must also cover theLightHistory::remaptable), instances (hash_instance_slice,hash_previous_model_slice), materials and indirect draws — steady state should skip. A gate that never hits (unstable sort key or material bytes, per-frame jitter in a hashed field) or is not invalidated when buffers are replaced (grow, resize) is the finding.hash_gpu_material_fieldsis oneFxHasher::writeoverGpuMaterial::as_bytes(#4201, ~0.17 ms at 7 k draws) — check no second build/hash per draw survives (#4442). Since #5767 (24eb7dba8)fold_svgf_scene_inputsre-hashes every interned material (svgf_material_hash: animated UV/colour/alpha/emissive/shader lanes zeroed, #6247) once per frame into the SVGF history key, beside the upload gate'shash_material_slice— O(unique materials), unmeasured; quantify before filing, a per-draw hash there is the regression. The key holds only discrete inputs: the clock-driven sky/fog lanes are compared against last frame and reset history on a jump only (svgf_continuous_inputs_jumped; #6247,68ecd0819,per_frame_animated_material_lanes_do_not_rekey_history,continuous_sky_and_fog_reset_history_on_a_jump_not_on_drift) — a continuous or animated lane folded back into the key leaves a parked camera at the recovery alpha floor, a quality+perf regression. The sun reaches the key a second time aslights[0](weather_systemrewrites the cell directional every exterior frame):fold_light_rig_into_scene_keyleaves the first directional's colour and direction lanes out of the exact fold and returns them to the same jump comparison, while type, position, params, every further directional and every point/spot light stay exact (#6344,8828dc6a5,a_drifting_cell_sun_does_not_rekey_the_light_rig_but_a_jump_or_other_light_does) — a bit-exact fold of the drifting sun is the regression; the ReSTIR rig key keys on the sun direction by design (#5369). - Material dedup: N placements of one material → one
GpuMaterial; report the ratio per cell (ctx.scratch);MaterialTable::internO(1) amortized; upload O(unique) (min(table.len(), MAX_MATERIALS), notinterned_count()). - PBR is resolved ONCE at import (
Material::resolve_pbr); the draw loop must not callclassify_pbr_keyword(/audit-nifalDim 1). - The moved-surface ID list (
RESTIR_MAX_MOVED_SURFACES64, one ID per moving draw entity — every animated skinned part counts, so ~10 animated NPCs overflow it) warns once per overflow episode and re-arms under the cap (overflow_warns_once_per_episode_and_rearms_under_the_cap; submitted/kept counts onrt.integrity, #6493e778320f8, issue open for the cap itself) — a per-frame overflow warn is the regression; sizing the cap is the open question. The list is a persistentScratchBuffersscratch (taken, cleared and restored insidebuild_and_upload_instances, actx.scratchrow, shrunk at frame end), pushed once per moved draw and sorted + deduplicated once byfinish_moved_surface_idsbefore upload (also makes the over-cap truncation keep the same IDs every frame), with the uncapped unique count still reachingupload_moved_surface_idsfor the overflow counts (#6485,59e376a90) — a freshVecper build or acontains-then-pushper draw (O(movers²)) is the regression. - Bone-world upload is O(dirty slots):
upload_bone_worldstakesdirty_slot_offsetsfrompose_dirtyand stagesvk::BufferCopyonly for changed slots (bone_world_slot_states); a full-range copy is the regression. Output:/tmp/audit/performance/dim_4.md
Dimension 5: GPU pipeline & pass efficiency
Paths: the inventory table — context/{draw,geometry_pass,post_passes,dispatch_skin_and_cluster}.rs, crates/renderer/shaders/, vulkan/{volumetrics,bloom,svgf,shadow_filter,taa,composite,ssao,sky_cube,groundcover,groundcover_models,exposure_meter}.rs, vulkan/sky_cube/cloud_shadow.rs; docs/audits/PERFORMANCE_FIX_STATUS_2026-09-26.md records which perf issues are implemented-but-unmeasured.
First step: git log --since=… --format='%h %s' -- crates/renderer/shaders crates/renderer/src/vulkan/context; read gpu_ms: on a control bench and diff against ROADMAP.
Checklist:
- Every pass is O(pixels) / O(froxels) / fixed, never O(meshes). Froxels are resolution-derived (
froxel_extent;VolumetricsConfig::defaultinupscaling.rs), and per-froxel ray count is gated (sun term onsunTermLive, local rays skipped at zero scattering, rim probes above tier 0, known-empty transport slots skip history work);filter_fog_volumes_for_gridculls distant emitters before dispatch. Combustion light-moment atomics target host-visible memory over PCIe, but #5950 (closed not-planned, code unchanged) measured that traffic as free: subgroup-aggregating the global atomics ~32× leftvolumetrics_inject_msat 0.243 ms on--combustion-lab, while stubbingaccumulateCombustionLightMomentsaved ~0.06 ms — its arithmetic (fourfroxel_to_worldcell-volume reconstructions +pow/expper luminous froxel, precomputable per slice), not the PCIe atomics. Do not re-file the atomics; a profile showing that quadrature is the lead. The combustion local grid (volumetrics/local_grid.rs, #6531 / #6533, plandocs/engine/fire-volumetrics-plan.md) is bounded, not O(scene): at mostLOCAL_GRID_MAX_BOXESboxes ofLOCAL_GRID_DIM³ cells, only for transport emitters withinLOCAL_GRID_REACH_METERS(hysteresis 1.25×; farther fires stay on the froxels), with occupancy bricks (LOCAL_GRID_BRICK) letting the composite march skip empty space and a baked species phase table (combustion_phase_bake.comp, run once) instead of per-samplepowlobes — a per-frame phase evaluation, a box per emitter past the cap, or a sim dispatch on a frame with no live box is the regression. Bloom is a pure O(pixels) pyramid (2×2-box downsample + in-place apply). SVGF = 1 temporal + 3 à-trous dispatches under one bracket, which also holds the direct-shadow filter's own nestedshadow_filter_msbracket (~0.35 ms on Whiterun TAA; #5959, open, also carries an untraced +1.4 msmain_render_msWhiterun reading inside ~0.7 ms per-launch noise, and whether to accept the filter's cost). - The sky-cube bake is a fixed per-frame cost that also runs in interiors that never sample it, and ground-cover scatter traces the TLAS per candidate: quantify with
sky_cube_ms/groundcover_scatter_msbefore proposing a gate. Measured 2026-10-21 (#6316, closed byc7b3f605e; bracket added in994620123; RTX 4070 Ti):sky_cube_ms0.21-0.23 ms with its nestedcloud_shadow_ms0.034 ms, interior and exterior alike, so an interior cloud-shadow gate saves at most ~0.03 ms (a gate interacts with theexterior_sky_tint.wready flag —/audit-rendererDim 2). - Terrain parallax (
terrainParallaxDisplaceUVintriangle.frag, #6197,b81a43443) is a 6–20 step view-ray march inside the main pass, near-camera only (range 20 m default, faded from half of it; settings rideGpuTerrainTile); measured at defaults -0.04 ms meanmain_render_msover 20 area x pose rows (inside noise), <= +1.0 ms at the slider maxima — quantify withterrain.parallaxA/B before filing. - TLAS rebuild-vs-refit frequency; a missing AS build→read barrier is HIGH.
- G-buffer bandwidth: 8 colour attachments × 2 FIF; under
--upscaler taathe reactive mask is sampled by TAA (#4944) but the T&C mask is written unsampled (known cost). Opaque draws that allow early fragment tests go throughpipeline_early(triangle_early.frag.spv); eligibility admits material kinds 0..=MATERIAL_KIND_MAX_LIGHTING_SHADER(16, #5057;early_fragment_kinds_have_no_discard_or_depth_write_path) — a draw losing that eligibility pays late-Z shading. - Disney ALU is in
include/pbr.glsl— lobes must not run for fragments that never reach them. #5249's transmission shadow trace (up toMAX_TRANSMISSION_SELF_SKIPS8 self-skips, plus the glass leg of the remaining segment since #5455/#5565) is not governed by the ray tier, but #5401 measured it: a pinned-tier A/B with the trace gated off movedgpu_main_renderby at most ~3 % on FO4 InstituteConcourse/MedTekResearch01 and Skyrim WhiterunBanneredMare — inside noise, no change made. Re-open only with a worst-case view (large on-screen share of SOFT_LIGHTING/BACK_LIGHTING/TRANSLUCENCY materials, light behind) and the same A/B. Legacy WRS arrays exist only withENABLE_LEGACY_WRS(shipped 0;NUM_RESERVOIRSapplies only then) — a shippedtriangle.frag.spv/triangle_early.frag.spvbuilt with it on taxes every frame (scripts/check-shader-artifacts.shrebuilds both).inv_vpis computed once on the CPU (UBO); a shader-side per-invocationinverse()is the regression. - Depth-history copy runs only when
scene_has_effect_soft_material; an every-frame copy is the regression. A perf "win" that is only an adaptive-ray-tier drop is not a win (bench discipline). - Cold blend-variant compile is the multi-second stall: the pipeline cache must keep persisting when variants are created (
save_pipeline_cache_if_grown). - Speculative-Vulkan caveat: render-pass/barrier/pipeline findings invisible to
cargo testneed RenderDoc evidence or a revert plan — state confidence. Output:/tmp/audit/performance/dim_5.md
Dimension 6: Skinning & BLAS cost
Paths: crates/renderer/src/vulkan/skin_compute.rs, shaders/{skin_palette,skin_vertices}.comp, acceleration/blas_skinned.rs, context/{skinned_blas_refit,dispatch_skin_and_cluster}.rs, crates/core/src/ecs/resources/skin_slot_pool.rs (pose_dirty, try_mark_pose_dirty, clear_pose_dirty), byroredux/src/render/skinned.rs.
First step: git log --since=… --format='%h %s' -- crates/renderer/src/vulkan/skin_compute.rs crates/renderer/src/vulkan/context/skinned_blas_refit.rs crates/core/src/ecs/resources/skin_slot_pool.rs; skin.coverage + skin_*_ms quantify every dispatch-count claim.
Guard: bin skin_dispatch_ran_rollback_scope_tests (app_frame.rs), palette_dispatch_uses_the_dirty_plan_and_rearms_late_bind_inverses (dispatch_skin_and_cluster.rs), a_reused_plan_scratch_keeps_capacity_and_drops_the_previous_plan (skin_compute.rs), skinned_blas_stays_fx_hashed.
Checklist (landed fixes — do not re-propose):
- The palette multiply is its own pass and dispatches only dirty slot runs (
plan_palette_dispatch); a dense full-range dispatch every frame is the regression.bind_inversesis persistent, uploaded once at first sight (per-frame upload O(first-sight entities)). - Dispatch-dirty gate: skip when the bone-pose hash (FNV-1a over the bone-world slice) is unchanged;
pose_dirtyis anFxHashSetonSkinSlotPool; the gate must never skip beforeSkinSlot.has_populated_outputflips. - BLAS refit gate:
refit_skinned_blasskips onbuilt_this_frameor (has_populated_output && !is_dirty && has_skinned_blas); refit dominates, rebuild only on bone-count change or afterSKINNED_BLAS_REFIT_THRESHOLD(600) +SKINNED_BLAS_REFIT_JITTER(60) viaskinned_blas_refit_limit(entity_id)— a flat shared threshold makes every entity rebuild the same frame.SKINNED_BLAS_FLAGSisFAST_BUILDon purpose (measured; memory-budget.md). - Steady state writes 0 descriptors (
SkinSlot.descriptor_bindings[frame]match skipsvkUpdateDescriptorSets); a baileddraw_framerolls back the pose-hash commit and requeues first-sightbind_inverses(skin_dispatch_ran,bind_inverse_upload_failed,app_frame.rs); morph deltas are shared per mesh (morph_delta_cache);MorphSloteviction drains outside theskin_compute+accel_managerguard. - Known ceiling, quantify first: all skinned builds/refits share one scratch and serialize (
skin.coverage,gpu_skin_blas_refit_ms). Output:/tmp/audit/performance/dim_6.md
Dimension 7: World streaming, cell transitions & parse cost
Paths: byroredux/src/streaming/, byroredux/src/{streaming_helpers,app_step,loading_screen}.rs, byroredux/src/env_translate/, byroredux/src/cell_loader/{unload,transition,load,load_order,created,exterior,exterior/{apply_job,persistent,worldspace},work_budget,precombined,nif_import_registry,partial,water,reference_state,legacy_lod_index,lod_bands,lod_support}.rs, byroredux/src/cell_loader/references/attach.rs, byroredux/src/scene/world_setup.rs (per-frame apply_cell_weather / apply_cell_region_ambient), byroredux/src/asset_provider/texture_prefetch.rs, byroredux/src/npc_spawn/ + byroredux/src/npc_spawn/resumable/ (cooperative per-part actor assembly), crates/sfmaterial/src/reader.rs, crates/nif/src/{stream.rs,import/,blocks/}, crates/plugin/src/esm/records/{parse,index}.rs (index.rs: the load-order fold, merge_from).
First step: git log --since=… --format='%h %s' -- byroredux/src/streaming byroredux/src/cell_loader byroredux/src/scene/world_setup.rs crates/nif/src/stream.rs crates/plugin/src/esm; the cpu_ms: split classifies a stall (Dim 8).
Guard: byroredux/src/streaming_tests.rs; NIF dhat bounds (crates/nif/tests/heap_allocation_bounds*.rs, a sequential harness = false main since #5050); mid-life equip and corpse appearance share one AppearanceProviders archive set (#5061) — a loader opening its own archives on the main thread is the regression.
Checklist:
- Boundary-cross stall.
pre_parse_cellruns each fresh NIF / FO4 precombine as a pool task that extracts its own input (pre_parse_one; archive reads are lock-free positional reads) after the coordinator admits it againstSTREAM_PARSE_INPUT_BYTES(64 MiB) using the archive-declared size (mesh_declared_size) — a serial extract on the coordinator, or allocating ahead of admission, is the regression; serial fast path belowPRE_PARSE_RAYON_MIN(8). FO4 precombines are CSG-decoded on the worker (decode_precombine_csg), soPrecombinedSpawnJobonly spawns; the material merge is not on the worker —merge_precombine_materials(precombines) andmerge_external_materials(ordinary partial imports) run on the main thread infinish_partial_import(cell_loader/partial.rs; pre-existing, quantify before filing). Streamed NIFs' textures are prefetched on the stream pool (PrefetchStore,STAGED_BYTE_CAP256 MiB, cleared when the cell's apply ends); main-thread texture extraction per apply slice is the telemetry to diff. The worker's cross-requestbatch_keysmemo (recv_next_batch_request,worker_batch_duplicate_skips) prevents duplicate parses in a burst. NIF mesh/collision import runs on the worker (PartialNifImport); the main-thread drain re-interns strings (reintern_imported_meshes) and runs the material merge above — any further import work back on the main thread is the regression. - Exterior apply and the interior door path are budgeted:
STREAMING_APPLY_BUDGETseeds aFrameTimeBudgetthatload_references_budgetedyields against (placements, NPC sub-NIFs);InteriorCellApplyJobkeeps the cursor across frames and cancels viaunload_cell. Boot, save-load restore and debug loads (load_cell_with_masters) are unbudgeted by design. NPC spawn cost:npc_spawn_wallin the end-of-cell log. A door transition reuses the resident load-order parse throughSharedParseCache(cell_loader/load_order.rs, keyed by plugin paths + length + mtime; #6123,588c87bc4,a_second_transition_over_the_same_plugins_does_not_parse) — a per-transition main-thread re-parse (1.5–8 s) is the regression; no game re-parses interior→exterior any more: the landscape inheritance (needs_exterior_processing(game)) runs on every fresh shared parse, so one parse serves both session kinds (#6591,f9f3eb831,one_parse_serves_an_interior_session_and_then_an_exterior_one:apply_exterior_processingis idempotent and walks only exterior cells, so the exterior_ready flag andparse_record_indexes_shared'sexteriorparameter are gone; Oblivion, FO3/FNV, Skyrim and FO4 re-parsed at the first door out before it, FO4 + DLC 2.85 s and ~1.2 GB RSS peak, #6407,d32e2ade8; Skyrim's Use Land Data children inherit Tamriel's landscape in that same pass, #6594,d548def7d) — a re-parse at that door is the regression. - Per-crossing costs that were once per-frame or per-rebuild (regression guards):
apply_cell_weather(was apply_cell_climate_override; now resolves the cell's ownXCCMclimate, else the weather table of the regions whose polygons cover the cell, else the worldspace climate default, throughenv_translate::resolve_cell_weatherwith an 8 s cross-fade on change — #6725 Phase 1,ea5417dc7) resolves a grid cell once, success or failure (WorldStreamingState::climate_override_grid, same shape asapplied_region_ambient; #5529,2fd7ee270) — a failed XCCM re-resolving plus awarn!per frame is the regression; LOD-water recentering reuses the projection computed once inspawn_lod_water_plane(carried onLodWaterPlane) and uploads throughupload_scene_meshes_batchedwith one fence wait (#5289,310723850) and the rebuild itself waits for the ring apply to settle — one fence-waited upload per settled crossing, spaced byLOD_WATER_REBUILD_INTERVALwith aLOD_WATER_MAX_DEFER(4 s) starvation bound (lod_water_rebuild_due, #5705,eacaaa1dc,lod_water_rebuilds_once_per_settled_crossing,lod_water_rebuild_defer_is_bounded_and_spacedinstreaming_tests.rs) — a rebuild per landing cell is the regression; the precombine job treats the worker's negative cache entry as terminal (lookup_precombine_cache→PrecombineCacheLookup::KnownFailure, #5522,2ca9bc313) — a main-thread re-parse there has nocatch_unwind; stale streaming payloads salvage their parsed imports (#5512,b5ae3e5cb), queued onWorldStreamingState::stale_salvageand finished one import per budget unit bysalvage_one_queued_importso the frame-budget yield check sits between imports, not after hundreds of back-to-back NIF finishes (#5715,125a21c2b,queued_salvage_finishes_one_import_per_call);attach_vmad_scriptsdecompiles each.pexonce per script name (DecompiledPexCache, #5999,f28930504) — a per-REFR decompile is the regression; both apply jobs buildeffective_absorbed_refsonce per job, not per slice (#6127,67e724c3e), andpre_parse_cellskips a STAT/SCOL ref that a present precombine absorbs through that same set (bake_absorbed_refs; ~95% of FO4 exterior placements — a worker pre-parse of a model the cell never spawns, and the 2048-entry registry slot it takes, is the regression; a missing bake un-skips exactly its refs — #6097,88149ae26,a_present_bake_absorbs_exactly_its_own_refs; and the held-back absorbed models are parsed in a second, normally empty pass only for refs whose bake parsed with zero meshes, because the main thread skips a ref only when its bake spawned something (#5484) and a worker that never parsed those models leaves each unique one an inline extract + parse there — #6342,f72083645,drawn_absorbed_refs,a_bake_that_exists_but_draws_nothing_does_not_absorb_its_refs); the terrain-height cache answers a warm entry before decoding the source DDS (#6314,aa10b9bd6,warm_cache_hit_does_not_decode_the_source); the loose Data indexer walks each canonical directory once toMAX_LOOSE_DEPTH(32), so a symlink loop cannot multiply boot-timeread_dircalls (#6243,120b7df86,loose_tier_walks_a_symlink_loop_once);step_created_referencesruns only while a created record is unplaced or when the record counts / loaded grids / interior root change (created_work, #6125,56fc348b8,the_step_gate_changes_only_with_the_records_or_the_loaded_cells), andEsmCellIndex::locate_refranswers from a lazy reverse index cleared bymerge_from(locate_refr_uses_a_reverse_index_that_merge_from_rebuilds) — an every-frame created-record sweep or a linearPlacedRefscan is the regression. Unmeasured per-tile cost: since #6076 (ca12e5638) a tile outside thePersistentCellWindowlinearly filters the worldspace persistent CELL's refs (persistent_refs_for_tile, ~6 k on WastelandNV) at apply and again at unload (ensure_persistent_actor_stubs) — quantify before filing. - Batched teardown: a crossing unloads its ring via
unload_cells(one globalshrink_storages+shrink_blas_scratch_to_fitafter the last victim), despawning throughWorld::despawn_batch→PackedStorage::remove_entities_erased(one sorted-merge pass, in-place swap+truncate); a per-entityVec::removeloop is the quadratic regression.detach_victims_from_surviving_parentsreads every victim'sParentunder one query guard and tests membership by binary search (#5418,9bbe9304e,detach_victims_takes_one_parent_guard_for_the_whole_sweep) — a per-victimworld.get::<Parent>is the regression.UnloadPhaseTimingsis wired only on theapp_step.rsbatch path. - NIF import-cache hit rate across cells; CDB parsed once per archive load. Parse allocation (dhat-testable — propose bounds): bulk arrays via
read_pod_vec,allocate_vecresults used (#[must_use]), block counters viaentry().get_mut()/insertnotor_insert(name.to_string()), skin/SSE scratches reserved up front, emitter extraction import-time only. - ESM parse on the first-cell path:
parse_record_indexes_in_load_orderwalks each plugin (parse_esm_with_load_order, single-threaded: 1.3–2.0 s per vanilla master,SeventySix.esm4.7 s,Starfield.esm5.3 s) on the rayon pool and folds them in load order (#3813), so a whole order costs about its largest walk plus the fold (2026-09-28: FO4 + 7 DLC 3.69 → 2.85 s, Starfield 14 plugins 11.85 → 7.72 s; parse-time peak RSS + roughly the largest plugin's file size; table indocs/engine/memory-budget.md"ESM Index"). Regressions: anything order-dependent moving into the walk (slot/remap allocation,read_archive,merge_from— #3403, #3384, #3543), a walk touching shared state, or a caller installingStringsTableGuardon its own thread;load_order_parallel_testsdigests the parallel index against the inline walk (synthetic chain always, real FNV/FO3/Skyrim SE/FO4 orders--ignored). Output:/tmp/audit/performance/dim_7.md
Dimension 8: Telemetry & camera-relative origin cost
Paths: crates/renderer/src/vulkan/gpu_timers.rs, crates/core/src/ecs/resources/mod.rs (ScratchTelemetry), byroredux/src/systems/{debug,metrics}.rs, byroredux/src/render/camera.rs, crates/renderer/src/vulkan/context/{build_and_upload_instances,draw,telemetry}.rs, crates/core/src/ecs/metrics.rs (MetricsSnapshot), crates/debug-protocol/src/lib.rs (MetricsPayload), crates/debug-server/src/evaluator.rs.
First step: git log --since=… --format='%h %s' -- crates/renderer/src/vulkan/gpu_timers.rs byroredux/src/systems/debug.rs byroredux/src/systems/metrics.rs crates/core/src/ecs/metrics.rs crates/debug-protocol/src/lib.rs.
Checklist:
- GPU timers: brackets read back via
read_and_resetintoGpuTimerSnapshot,MAX_FRAMES_IN_FLIGHTbehind (never stalls); readers honour the_activeflag (skipped pass ⇒_ms == 0); the documented bracket count,QUERIES_PER_FRAME(62) and the inventory table must equal the live ones (doc-count rot recurs);BENCH_GPU_KEYS(main.rs) must follow the bracket order (bench_gpu_keys_match_the_reported_bracket_order); a sum over brackets must skip nested children (#4977).BYRO_PROFILEadds a PIPELINE_STATISTICS pool (opaque_fragment_invocations). cpu_ms:(log_stats_systemviacpu_breakdown) splits the frame intofence_wait/acquire/submit_present/ssbo_build/pipeline_compile/parameter_upload/fog_cluster/post_present/geom_rebuild/tlas_build/cmd_record/rof_*/atw_pre/atw_scheduler/atw_post/between_frames(fog_clusteris subtracted fromcmd_record, #4810). Buckets nest, not sum:atw_pre/atw_scheduler/atw_postare sequential siblings, andatw_post⊇ the wholerender_one_frame(rof_pre_draw+rof_draw_call+rof_post_draw, so everydraw_framesub-bucket too; pinned byatw_bracket_nesting_tests, #4208); onlybetween_frameslies outsiderender_one_frame(compositor throttle, loop sleep). Largefence_wait⇒ GPU stuck on a prior submit; largeatw_schedulerwithfence_wait≈0⇒ pure CPU; largeatw_postwith smallrof_*⇒ post-scheduler cell-load steps / uploads (with largerof_*it is the render path); largebetween_framesalone ⇒ not the engine. Release builds for dense cells.- Wire parity: every
MetricsSnapshotfield reachesMetricsPayload— the conversion inevaluator.rsdestructures the snapshot exhaustively, so a new core field is a compile error until it is carried, andmetrics_response_mirrors_core_snapshotpins the values (cpu_pass_ms/top_systems_mswere dropped on the wire until #6278,05d94dd61; both areserde(default), so an older peer still parses,wire.rs). A telemetry field the debug CLI cannot see is a finding. ScratchTelemetry(ctx.scratch): capacity vs used vs wasted for renderer scratches (includingVolumetricsPipeline's two, shrunk at frame end — #5952,the_volumetrics_scratches_are_shrunk_through_the_pipeline) and, afterrenderer_row_count, the engine'sbuild_render_datascratches; diff for over-reserved scratch and for a scratch with no row.- Camera-relative origin: the origin snaps to the 4096-unit cell grid (
RENDER_ORIGIN_SNAP);assemble_cameraadds onelook_at_mat4(glam 0.33'smath::camera::rh::view,c6b8d4584) andrebase_model_matrixruns inside the existing O(visible-instances) loop — verify no second pass. On a grid crossingorigin_corrected_prev_view_projpreserves TAA/SVGF/FSR history (#1489); dropping history per crossing is a HIGH perf+quality regression. Output:/tmp/audit/performance/dim_8.md
Phase 3: Merge
- Read all
/tmp/audit/performance/dim_*.md. - Combine into
docs/audits/AUDIT_PERFORMANCE_<TODAY>.md: Executive Summary (findings by severity; observed-vs-ROADMAP delta, not absolute FPS) · Hot Path Analysis (per-frame CPU + per-pass GPU cost table fromgpu_timers/ScratchTelemetry, with the RT quality tier stated) · Findings (CRITICAL first, deduplicated; eroded guards separate from new issues) · Prioritized Fix Order (quick wins — scratch reuse, preallocation, gate restoration — before architectural changes) · Stale skill premises. - Remove cross-dimension duplicates.
Phase 4: Cleanup
rm -rf /tmp/audit/performance— skip when launched by/audit-suite, which reconciles the report against the scratch files. 2. Tell the user the report is ready. 3. Suggest/audit-publish docs/audits/AUDIT_PERFORMANCE_<TODAY>.md.