Skip to content

Report available shader statistics across drivers - #870

Merged
ItsNotRexed merged 1 commit into
ItsNotRexed:mainfrom
nschlaepfer:codex/report-available-shader-statistics
Nov 22, 2026
Merged

ItsNotRexed merged 1 commit into
ItsNotRexed:mainfrom
nschlaepfer:codex/report-available-shader-statistics

Conversation

@nschlaepfer

Copy link
Copy Markdown
Contributor

The executable-statistics report from #795 exits with “no shader is in both the statistics and the disasm folder” on a matched Windows RTX 5090 capture. The driver returned 27 statistic rows for five valid synthetic pipelines, and all five disassemblies were present. NVIDIA supplies names such as Register Count and Binary Size; the report accepted only rows containing the exact RADV Instructions counter. A synthetic mixed stage has three listings and a shader with 32 bytes reported scratch. The previous report counted one shader and printed zero using scratch.

Match captured shaders to listings by name and distinguish unavailable measurements from measured zero. The stage summary gives the coverage of each partially reported metric and compares VGPR usage to the same source subset. A single positive spill counter establishes a lower bound. The detail report lists additional counter names and original values for incomplete comparisons. It takes units only from the supplied name; the CSV has no separate units column.

Verification. Ran the checker on native Windows 11 with NVIDIA RTX 5090 driver 621.14: three compute, one vertex and one pixel shader, all synthetic. The unmodified CLI rejected the resulting CSV; the corrected report matches all five and retains all 27 values under the corresponding shaders. The complete RADV-shaped control kept the same output in both CLI modes. Independent checks also cover mixed stages, missing or zero counters, partial spill measurements and UINT64 precision. AI-assisted.

Coordination claim

@kotorvr

kotorvr commented Nov 22, 2026

Copy link
Copy Markdown
Contributor

Reviewed 8987269: 1 finding

  • scripts/shader_stats.py:53 (load_stats): a stats CSV whose last row is cut short still ends in a traceback. That is the likely file after a driver crash, because vk_pipeline_check fully buffers stats_out and never flushes it before fclose. A last line of ps_flat,ps gives a row whose statistic is None. If that shader also has a counter outside the known set (e.g. Code size), sorted() at :136 (--details) and :140 (summary) raises TypeError: '<' not supported between instances of 'str' and 'NoneType'. A last line of just ps_flat makes the stage None, so sorted(stats.items()) fails the same way. main also crashes on these inputs, with a float(None) TypeError, so this isn't a regression. But the PR is about keeping the report going when values are missing, and ps_flat,ps,VGPRs, (empty value) does now work. Skipping rows where name, stage or statistic is None would cover the rest.

Ran: python -I tests/test_shader_stats.py (7 pass); python -m compileall -q make_game.py tools tests (clean); a differential run of main against this PR on 200 random complete RADV-shaped CSVs (1-9 shaders, mixed stages, with and without --details): 400 of 400 outputs match byte for byte; the truncated-row inputs above against both versions. No GPU. Windows 11, Python 3.13.7.
Review was AI-assisted (Claude Code).

@ItsNotRexed
ItsNotRexed merged commit e13c9ce into ItsNotRexed:main Nov 22, 2026
10 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants