Skip to content

heap_index_census: report the load provenance of all four sampler words - #5926

Open
kacper-serewis wants to merge 1 commit into
ItsNotRexed:mainfrom
kacper-serewis:feat/heap-sampler-word-census
Open

kacper-serewis wants to merge 1 commit into
ItsNotRexed:mainfrom
kacper-serewis:feat/heap-sampler-word-census

Conversation

@kacper-serewis

@kacper-serewis kacper-serewis commented Nov 23, 2026 •

Copy link
Copy Markdown
Contributor

Coordination claim 7101134159 on #5781. Based on main, with no open PR dependencies.

The existing load role uses word zero. This adds a separate per-instruction count that requires four consecutive word indices from the same static load instruction for a complete S#. It handles register copies and slices of wider loads. Conflicting known origins prove a partial or mixed operand. Inconclusive joins stay unknown. Four known constants or entry words count as non-load. The report also counts direct load tags at each word position. Existing load-role fields keep their meaning. #4268 measures the address families behind sampler words.

Private cached corpus, CPU only. Ran the census over 26,503 listings in disjoint batches. The existing embedded-data check skipped 1,473. Of 246,974 reachable sampling instructions in the remaining 25,030 listings:

Provenance Instructions
Complete 121,899
Partial or mixed 0
Non-load 99,022
Unknown 26,053

Each of the four word positions had 121,899 direct load tags. Unknown sites and skipped listings limit what can be inferred. Only aggregates are published.

Local verification. All 15 heap census tests passed, including aliases, repeated indices, a last-word overwrite from a second load or a literal, and agreeing and disagreeing branch joins. Python compileall, isolated build-script help, the three text line-ending tests, game-data guard and diff whitespace check passed on Windows. GPU and driver inapplicable, CPU only.

The translator semantic suite also passed (6,150 tests, four skips and one expected failure).

AI-assisted with Codex.

@shdann

shdann commented Nov 23, 2026

Copy link
Copy Markdown
Contributor

Tested 84956b7 on Windows 11 with CPython 3.14.7, CPU only. All 15 tests pass with py -3.14 -I tests/test_heap_index_census.py. I also ran the new tests with the parent module at 561b65a8. Both new tests detect the missing report field on the parent.

I checked a synthetic listing with three sample instructions. The first uses all four words from one load. Before the second, s_mov_b32 s28, 7 replaces the first word. An unconditional branch skips the third sample. The report counts one complete sample and one mixed sample. The loaded-word counts are [1, 2, 2, 2], as expected. The skipped sample contributes zero to every count.

AI-assisted.

@memorypressure

Copy link
Copy Markdown

Verified at your head on main 561b65a: test_heap_index_census 15/15 including the two new provenance cases (re-run), and test_sampler_source_census stays green at 30. The classifier reuses shader_meta's existing SAMPLER_IMAGE_OPS/_sgpr_slots/_slot_tag machinery, sampler_counts defaults to None so no external caller is affected, and no other tool output changes. Checks pending. AI-assisted: yes. Tested on Linux (RTX 5080 host, CPU-only run).

@shayderrr shayderrr left a comment

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Review

Reviewed change in PR #5926: heap_index_census: report the load provenance of all four sampler words.

Scope: tests/test_heap_index_census.py, tools/heap_index_census.py
Diff: +72 / -2 across 2 file(s).

The change stays inside the stated scope and the touched files line up with the description. No unrelated production paths are pulled in, and the stated behavior is directly exercised by the diff. I'm approving this one.

Reviewed by shayderrr via automated batch review.

@shayderrr

Copy link
Copy Markdown
Collaborator

Thanks @kacper-serewis - I went through heap_index_census: report the load provenance of all four sampler words and the diff around tests/test_heap_index_census.py. The change is tight, the rationale matches the code, and there's nothing here that needs another pass from my side. Approved and squash-merging it into main now. Nice work.

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.

4 participants