mirror of
https://github.com/ubiquitarianism/leonida.git
synced 2026-11-27 00:45:53 +01:00
[PR #1551] heap_index_census: fix s_lshlK_add, SMEM offset:, x16/back-branch roles, and JSON I/O (HEAP-INDEX-CENSUS-DATAFLOW-AND-IO) #1579
Labels
No labels
bug
pull-request
No milestone
No project
No assignees
1 participant
Notifications
Due date
No due date set.
Dependencies
No dependencies set
Reference
starred/leonida#1579
Loading…
Reference in a new issue
No description provided.
Delete branch "%!s()"
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?
📋 Pull Request Information
Original PR: https://github.com/ubiquitarianism/leonida/pull/1551
Author: @IlyassRS3
Created: 11/25/2026
Status: 🔄 Open
Base:
main← Head:fix/heap-index-census-dataflow-io📝 Commits (1)
581283eheap_index_census: fix s_lshlK_add, SMEM offset:, x16/back-branch roles, and JSON I/O📊 Changes
2 files changed (+178 additions, -25 deletions)
View changed files
📝
tests/test_heap_index_census.py(+86 -0)📝
tools/heap_index_census.py(+92 -25)📄 Description
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)
🔄 This issue represents a GitHub Pull Request. It cannot be merged through Gitea due to API limitations.