decomp(jpeg): improve Lumi outer declaration allocation #1093

Merged
coah80 merged 1 commits from agent/bittle/lumi-outer-fuzzy-order into main 2026-10-03 11:20:06 +00:00
coah80 commented 2026-10-03 11:19:31 +00:00 (Migrated from github.com)

Focused declaration-only gain

Reorder only the 30 existing uninitialized s32 declarations at the start of TMCJPEGDEC_IdctBlock_Lumi. Preserve tmp/dst, the retained #1091 inner order, all assignments, expressions, types, scopes, accesses and every sibling source byte.

  • Lumi: 83.657585% → 86.15953%
  • Unit: 89.28833% → 90.19269%; global: 99.72798% → 99.728836%
  • 257/257 instructions; normalized positional differences 187 → 185
  • Col remains 92.47577%, body byte-identical
  • Exact functions/code remain 0/2 and 0/2844; this is a fuzzy-only gain

Bounded search and retention

One unchanged official declsearch run hit its 1,250-evaluation cap. All 1,251 actual compiler calls, including tool-final restoration, were recorded and officially scored without deduplication. Retain snapshot 1033 at 86.15953%, rather than the structural tool's final 86.08171%. Parent independently reproduced every saved-object official report and verified snapshot hashes.

Only 467/1,247 neighbors of the tool-final order and 2/1,247 of the retained fuzzy-best order were covered. Neither neighborhood is exhausted; no global optimum claimed. The inner declaration change in #1091 makes this a distinct allocator context from older outer searches.

Independent parent verification

Fresh worktree and full default build on 3dd12f63de. Tested tree c8259024c3.

  • All 1,027 units/functions checked: no regressions; only Lumi changes
  • Sibling code, allocated non-code sections, exact/data/link measures preserved
  • Pool identical; both-function literal audit has zero errors/skips
  • Separate integer scalar/alias model: 6,569 vectors / 19,707 executions, 2,208 fitting input/output overlaps, full 257-instruction coverage for candidate/original/baseline
  • Repository JPEG suite: 9,456 differential cases passes with ABI checks
  • Default build/progress, explicit 43U/ok, main/leaf and diff checks pass
  • DOL SHA1 26116613f624061ba99c8d1a299aaa6efa85670d

Bounded interpreter diagnostics are not a formal proof or hardware execution. Evidence: tools/decomp-assist/allhands-jpeg-lumi-outer-orders.attempts.md. No original binaries/disassembly uploaded. Draft for human review; no merge or auto-merge requested.

Note

Reorder local scalar declarations in TMCJPEGDEC_IdctBlock_Lumi

  • Reorders the contiguous s32 local variable declarations in the luma IDCT function in idct_block_var.c. Types, scopes, initializers, and all executable code are unchanged.
  • Adds an experiment report in allhands-jpeg-lumi-outer-orders.attempts.md documenting the declaration-order search, selected order, scoring, and validation checks.

Macroscope summarized ebf7e15.

## Focused declaration-only gain Reorder only the 30 existing uninitialized s32 declarations at the start of TMCJPEGDEC_IdctBlock_Lumi. Preserve tmp/dst, the retained #1091 inner order, all assignments, expressions, types, scopes, accesses and every sibling source byte. - Lumi: 83.657585% → 86.15953% - Unit: 89.28833% → 90.19269%; global: 99.72798% → 99.728836% - 257/257 instructions; normalized positional differences 187 → 185 - Col remains 92.47577%, body byte-identical - Exact functions/code remain 0/2 and 0/2844; this is a fuzzy-only gain ## Bounded search and retention One unchanged official declsearch run hit its 1,250-evaluation cap. All 1,251 actual compiler calls, including tool-final restoration, were recorded and officially scored without deduplication. Retain snapshot 1033 at 86.15953%, rather than the structural tool's final 86.08171%. Parent independently reproduced every saved-object official report and verified snapshot hashes. Only 467/1,247 neighbors of the tool-final order and 2/1,247 of the retained fuzzy-best order were covered. Neither neighborhood is exhausted; no global optimum claimed. The inner declaration change in #1091 makes this a distinct allocator context from older outer searches. ## Independent parent verification Fresh worktree and full default build on 3dd12f63dec6f4d10a4347b4c87c4ee1317a1dc7. Tested tree c8259024c3bd9464a7c68479e209e8b658c68456. - All 1,027 units/functions checked: no regressions; only Lumi changes - Sibling code, allocated non-code sections, exact/data/link measures preserved - Pool identical; both-function literal audit has zero errors/skips - Separate integer scalar/alias model: 6,569 vectors / 19,707 executions, 2,208 fitting input/output overlaps, full 257-instruction coverage for candidate/original/baseline - Repository JPEG suite: 9,456 differential cases passes with ABI checks - Default build/progress, explicit 43U/ok, main/leaf and diff checks pass - DOL SHA1 26116613f624061ba99c8d1a299aaa6efa85670d Bounded interpreter diagnostics are not a formal proof or hardware execution. Evidence: tools/decomp-assist/allhands-jpeg-lumi-outer-orders.attempts.md. No original binaries/disassembly uploaded. Draft for human review; no merge or auto-merge requested. <!-- Macroscope's pull request summary starts here --> <!-- Macroscope will only edit the content between these invisible markers, and the markers themselves will not be visible in the GitHub rendered markdown. --> <!-- If you delete either of the start / end markers from your PR's description, Macroscope will append its summary at the bottom of the description. --> > [!NOTE] > ### Reorder local scalar declarations in `TMCJPEGDEC_IdctBlock_Lumi` > - Reorders the contiguous `s32` local variable declarations in the luma IDCT function in [idct_block_var.c](https://github.com/coah80/wii-ipl/pull/1093/files#diff-a274164d13198c046348fb647cba8dc885eaf013132027c97c324a7004d5242a). Types, scopes, initializers, and all executable code are unchanged. > - Adds an experiment report in [allhands-jpeg-lumi-outer-orders.attempts.md](https://github.com/coah80/wii-ipl/pull/1093/files#diff-163ac6ca695fe84c4c220bd47eccfec3f852ee25037436e1ebe9607255d5008c) documenting the declaration-order search, selected order, scoring, and validation checks. > > <!-- Macroscope's review summary starts here --> > > <sup><a href="https://app.macroscope.com">Macroscope</a> summarized ebf7e15.</sup> > <!-- Macroscope's review summary ends here --> > <!-- Macroscope's pull request summary ends here -->
coah80 commented 2026-10-03 11:20:04 +00:00 (Migrated from github.com)

Reviewed and merged: rebased on main, full build ok, DOL sha1 26116613f624061ba99c8d1a299aaa6efa85670d, 0 regressions, 0 forbidden patterns.

Reviewed and merged: rebased on main, full build ok, DOL sha1 26116613f624061ba99c8d1a299aaa6efa85670d, 0 regressions, 0 forbidden patterns.
Sign in to join this conversation.