heap_index_census: fix s_lshlK_add, SMEM offset:, x16/back-branch roles, and JSON I/O (HEAP-INDEX-CENSUS-DATAFLOW-AND-IO) #1551
Loading…
Reference in a new issue
No description provided.
Delete branch "upstream-pr/1551"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
Imported from ubiquitarianism/leonida. Originally posted by IlyassRS3 on 2026-11-25T04:18:09Z.
What
Fix four dataflow/role-classification bugs and harden index/JSON I/O in
tools/heap_index_census.py:s_lshlK_add_u32misclassified heap bases and shifted indices (step):s_lshlK_add_u32 d, idx, base,a[1](idx) is shifted left byKbits and is always a scaled index, while onlya[2](base) can be a base pointer.LSHL_ADD_SHIFTshared theADDSbranch,s_lshl4_add_u32 s2, s5, s8(dynamic input indexs5+ input heap bases8) saw_pointerish(ty) == Trueand droppeds2tounknown(losing bothuser s8anddynamic), whiles_lshl4_add_u32 s2, s5, 0x20misclassified the shifted indexs5as a base pointer with a static offset.LSHL_ADD_SHIFTseparately (matchingshader_meta.py): fold when both operands are constant, else propagate("off", tbase, cidx is None)whenevera[2]is pointerish, and never promote the shifted indexa[1]to a base pointer.offset:Nmodifiers were ignored (step):s_load_dwordx8 s[20:27], s[8:9], null offset:0x24carry the byte offset inins["mods"](offset:0x24), so ignoring it recorded static offset0(aligned32,max: 0) instead of0x24(other,max: 0x24).offset:Nfromins["mods"]and add it to constantsoffsetoperands (marking malformedoffset:modifiers dynamic).analyse):on_usecheckedtag[2] == 0, dropping roles for 4-dword-aligned sub-descriptors loaded at dwords 4/8/12 ofs_load_dwordx8/s_load_dwordx16(e.g. aT#ats[16:23]+S#ats[24:27]from ones_load_dwordx16). Checktag[2] % 4 == 0.on_usecheckedtag[1] in loadsduring a single PC-order pass over blocks, dropping roles whenever a consumer block lay at a lower PC than itss_load_dwordx*block (backward branch / loop). Collectusesin adefaultdict(set)and attach them toloadsafter scanning all blocks.stage_index,census,main):index.jsonwithutf-8-sigand validate its list/row schema (fileending in.dxbc, non-emptystage)..sentries to regular files and count unreadable/malformed.slistings underskipped["unreadable listing"]instead of aborting the run.--jsonpaths upfront before scanning, and write--jsonatomically via a sibling temp file (newline="\n",file_mode.published_mode,replace_retry.replace,allow_nan=False).Claimed in the coordination issue as
HEAP-INDEX-CENSUS-DATAFLOW-AND-IO— verified 0 open PRs and 0 prior claims; unable to post a comment on#14because GitHub disabled commenting once#14reached its 2,500-comment cap (and no successor"Coordinating who works on what"issue is open yet).Testing
python3 -I -W error tests/test_heap_index_census.py -v: 17/17 OK (including 4 new regression tests).python3 -I tests/test_text_write_line_endings.py: 3/3 OK.python3 -I scripts/check_no_game_data.py tools/heap_index_census.py tests/test_heap_index_census.py: clean.python3 -m compileall -q tools/heap_index_census.py tests/test_heap_index_census.py: clean.Mutation check against unpatched
main:tools/heap_index_census.py: all 4 new tests fail onmain(FAILED (failures=3, errors=1)).AI-assisted: yes
GPUs tested: none (CPU-only static shader census tests on macOS; no GPU or game files needed)
Imported from ubiquitarianism/leonida. Originally posted by copilot-pull-request-reviewer[bot] on 2026-11-25T04:18:18Z.
Review: COMMENTED
Copilot was unable to review this pull request because the user who requested the review has insufficient remaining quota. Try requesting a review at a lower effort level.
Imported from ubiquitarianism/leonida. Originally posted by MoonEyes on 2026-11-28T10:46:17Z.
Red/green: the PR's tests fail on main and pass with this PR (Linux, Python 3.13.18).
Targeted batch of 19 PRs (their tests, the tests importing the changed modules, the docs tests) on main
3ca0707: no new failure, Linux / Python 3.13.AI-assisted (Claude Code, Claude Opus 5.5)