diff options
| author | Roberto0953 <131179700+Roberto0953@users.noreply.github.com> | 2026-11-23 01:13:26 +0100 |
|---|---|---|
| committer | Roberto0953 <131179700+Roberto0953@users.noreply.github.com> | 2026-11-23 01:44:11 +0100 |
| commit | e9366773651826b8edbe9ff0740ae6d9fe951f3b (patch) | |
| tree | e09f871b92be39abe3020e6cea6d3fad1cb5e2f0 /runtime/src/pe_loader.cpp | |
| parent | 03b09a086592a197db64d91655c6e65c30764d96 (diff) | |
sampler_source_census: where each sampled S# comes from; none found in a driver table (SHADER-735)
docs/d3d12_vulkan.md section 3.5 left open whether the console driver hands shaders their static samplers
through a fixed table, which the layer would then have to emulate. tools/sampler_source_census.py follows the
four SGPRs of the sampler operand of every image_sample*, image_gather4* and image_get_lod back to where their
values are made and puts the instruction in one class: held in user SGPRs, loaded through a pointer that starts
from user data, built from immediates, held in or loaded through something else (a constant address, a system
SGPR, a code-relative address: what a driver table would be), or undetermined, with the reason.
It reuses the dataflow of tools/heap_index_census.py and adds what the sampler operands needed: constants built
with s_brev_b32, SGPRs spilled to VGPRs and read back, joins that keep the sources of every path, s_getpc_b64,
and listings with embedded data words re-anchored the way the translator does. --expect-none CLASS turns the
count into a check; --jobs N runs it in parallel.
Measured on the 1.0.2.1 corpus (26,503 listings, none skipped; 366,628 sampling instructions in 14,025 shaders):
189,412 loaded through user data, 174,796 literal, 0 in user SGPRs, 0 from another base, 2,420 undetermined
(0.66%, MS and VS, plus one CS). The undetermined ones all come from one shape, an S# made or saved inside a
region that s_cbranch_execz skips when no lane is active; without the taken edge of those branches the same
analysis classes 2,419 as loaded through user data and 1 as literal. The counts, what they do not show and the
command are in docs/d3d12_vulkan.md next to the static-sampler paragraph; question 3 of section 8.2 is updated.
Tests: tests/test_sampler_source_census.py, 28 cases on hand-written RDNA2 listings, one or more per class, with
negative controls (a fixed-table read on one path or in one dword, a clobbered spill, a branch that is not an
exec-zero skip, --expect-none failing on a fixed-table shader). Also run: compileall on tools and tests,
test_text_write_line_endings, test_docs_cli_flags, test_docs_repo_paths, test_docs_links, test_tool_startup,
test_heap_index_census, scripts/check_no_game_data.py. CPU only; no GPU involved.
Co-Authored-By: Claude <noreply@anthropic.com>
Diffstat (limited to 'runtime/src/pe_loader.cpp')
0 files changed, 0 insertions, 0 deletions