decomp(tmc_jpeg): match YUV411toRGBA8 and link Texture_MCUtoRGBA8 #1284
@@ -1217,7 +1217,7 @@ config.libs = [
|
||||
|
||||
Object(Matching, "texturecvtr/Texture_MCUtoY8U8V8.c"),
|
||||
Object(Matching, "texturecvtr/Texture_MCUtoRGB565.c"),
|
||||
Object(NonMatching, "texturecvtr/Texture_MCUtoRGBA8.c"),
|
||||
Object(Matching, "texturecvtr/Texture_MCUtoRGBA8.c"),
|
||||
|
||||
Object(Matching, "b65/iqdec_b65_frv32.c"),
|
||||
]
|
||||
|
||||
@@ -189,121 +189,113 @@ s32 TMCJPEGDEC_set_converterRGBA8(TMCCJPEGDecWork* work) {
|
||||
#pragma pop
|
||||
|
||||
static void TMCJPEGDEC_converterYUV411toRGBA8(TMCCJPEGDecWork* work, s32 x, s32 y) {
|
||||
u16* output;
|
||||
s32 tileRow;
|
||||
s32 secondGreen;
|
||||
s32 thirdGreen;
|
||||
s32 fourthBlue;
|
||||
s32 columnInTile;
|
||||
s32 secondColumnInTile;
|
||||
s32 thirdColumnInTile;
|
||||
s32 fourthColumnInTile;
|
||||
s32 red;
|
||||
s32 secondBlue;
|
||||
s32 thirdBlue;
|
||||
s32 fourthGreen;
|
||||
s32 green;
|
||||
s32 secondRed;
|
||||
s32 thirdRed;
|
||||
s32 fourthRed;
|
||||
u8* texture;
|
||||
u8* luminance;
|
||||
u8* cb;
|
||||
u8* cr;
|
||||
TMCCJPEGDecState* state;
|
||||
u8* texture;
|
||||
s32 height;
|
||||
s32 column;
|
||||
s32 xEnd;
|
||||
s32 green;
|
||||
s32 yEnd;
|
||||
s32 tileWidth;
|
||||
s32 blueOffset;
|
||||
s32 greenOffset;
|
||||
s32 tileRow;
|
||||
s32 lumaSkip;
|
||||
s8 crValue;
|
||||
s32 chromaSkip;
|
||||
s32 width;
|
||||
s32 cbValue;
|
||||
u8 value;
|
||||
s32 row;
|
||||
u16* output;
|
||||
s32 redOffset;
|
||||
s32 greenOffset;
|
||||
s32 blueOffset;
|
||||
s32 blue;
|
||||
s32 value;
|
||||
TMCCJPEGDecState* state;
|
||||
s32 width;
|
||||
s32 height;
|
||||
s8 crValue;
|
||||
s32 cbValue;
|
||||
|
||||
luminance = work->convBuf + 4;
|
||||
cb = work->convBuf + 260;
|
||||
cr = work->convBuf + 324;
|
||||
cb = &work->convBuf[260];
|
||||
cr = &work->convBuf[324];
|
||||
state = work->pState;
|
||||
tileWidth = (state->convWidth >> 2) << 1;
|
||||
texture = state->pTexBuffer;
|
||||
|
||||
width = 32 / state->scaleFactor;
|
||||
height = 8 / state->scaleFactor;
|
||||
{
|
||||
yEnd = y + height;
|
||||
xEnd = x + width;
|
||||
lumaSkip = 32 - width;
|
||||
chromaSkip = lumaSkip >> 2;
|
||||
for (row = y; row < yEnd; row++) {
|
||||
output = (u16*)(texture + ((row & 3) << 3));
|
||||
tileRow = (row >> 2) * tileWidth;
|
||||
|
||||
for (column = x; column < xEnd; column += 4) {
|
||||
|
||||
{
|
||||
cbValue = (s8)*cb++;
|
||||
crValue = (s8)*cr++;
|
||||
redOffset = (crValue * 359) >> 8;
|
||||
greenOffset = -(crValue * 183 + cbValue * 88) >> 8;
|
||||
blueOffset = (cbValue * 454) >> 8;
|
||||
}
|
||||
{
|
||||
value = *luminance++;
|
||||
green = value + greenOffset;
|
||||
red = value + redOffset;
|
||||
blue = value + blueOffset;
|
||||
if ((red | green | blue) >> 8) {
|
||||
blue = blue > 255 ? 255 : blue < 0 ? 0 : blue;
|
||||
green = green > 255 ? 255 : green < 0 ? 0 : green;
|
||||
red = red > 255 ? 255 : red < 0 ? 0 : red;
|
||||
}
|
||||
red = (u8)red + 0x10000 - 0x100;
|
||||
output[(column & 3) + (((((column) >> 2) << 1) + tileRow) << 4)] = red;
|
||||
output[(column & 3) + (((((column) >> 2) << 1) + tileRow + 1) << 4)] = ((green & 255) << 8) + (blue & 255);
|
||||
}
|
||||
{
|
||||
value = *luminance++;
|
||||
green = value + greenOffset;
|
||||
red = value + redOffset;
|
||||
blue = value + blueOffset;
|
||||
if ((red | green | blue) >> 8) {
|
||||
blue = blue > 255 ? 255 : blue < 0 ? 0 : blue;
|
||||
green = green > 255 ? 255 : green < 0 ? 0 : green;
|
||||
red = red > 255 ? 255 : red < 0 ? 0 : red;
|
||||
}
|
||||
red = (u8)red + 0x10000 - 0x100;
|
||||
output[(column + 1 & 3) + (((((column + 1) >> 2) << 1) + tileRow) << 4)] = red;
|
||||
output[(column + 1 & 3) + (((((column + 1) >> 2) << 1) + tileRow + 1) << 4)] = ((green & 255) << 8) + (blue & 255);
|
||||
}
|
||||
{
|
||||
value = *luminance++;
|
||||
green = value + greenOffset;
|
||||
red = value + redOffset;
|
||||
blue = value + blueOffset;
|
||||
if ((red | green | blue) >> 8) {
|
||||
blue = blue > 255 ? 255 : blue < 0 ? 0 : blue;
|
||||
green = green > 255 ? 255 : green < 0 ? 0 : green;
|
||||
red = red > 255 ? 255 : red < 0 ? 0 : red;
|
||||
}
|
||||
red = (u8)red + 0x10000 - 0x100;
|
||||
output[(column + 2 & 3) + (((((column + 2) >> 2) << 1) + tileRow) << 4)] = red;
|
||||
output[(column + 2 & 3) + (((((column + 2) >> 2) << 1) + tileRow + 1) << 4)] = ((green & 255) << 8) + (blue & 255);
|
||||
}
|
||||
{
|
||||
value = *luminance++;
|
||||
green = value + greenOffset;
|
||||
red = value + redOffset;
|
||||
blue = value + blueOffset;
|
||||
if ((red | green | blue) >> 8) {
|
||||
blue = blue > 255 ? 255 : blue < 0 ? 0 : blue;
|
||||
green = green > 255 ? 255 : green < 0 ? 0 : green;
|
||||
red = red > 255 ? 255 : red < 0 ? 0 : red;
|
||||
}
|
||||
red = (u8)red + 0x10000 - 0x100;
|
||||
output[(column + 3 & 3) + (((((column + 3) >> 2) << 1) + tileRow) << 4)] = red;
|
||||
output[(column + 3 & 3) + (((((column + 3) >> 2) << 1) + tileRow + 1) << 4)] = ((green & 255) << 8) + (blue & 255);
|
||||
}
|
||||
|
||||
xEnd = x + width;
|
||||
yEnd = y + height;
|
||||
for (; y < yEnd; y++) {
|
||||
for (column = x; column < xEnd; column += 4) {
|
||||
cbValue = (s8)*cb++;
|
||||
crValue = (s8)*cr++;
|
||||
redOffset = (crValue * 359) >> 8;
|
||||
greenOffset = -(cbValue * 88 + crValue * 183) >> 8;
|
||||
blueOffset = (cbValue * 454) >> 8;
|
||||
value = *luminance++;
|
||||
green = value + greenOffset;
|
||||
red = value + redOffset;
|
||||
blue = value + blueOffset;
|
||||
if ((red | green | blue) >> 8) {
|
||||
blue = blue > 255 ? 255 : blue < 0 ? 0 : blue;
|
||||
green = green > 255 ? 255 : green < 0 ? 0 : green;
|
||||
red = red > 255 ? 255 : red < 0 ? 0 : red;
|
||||
}
|
||||
luminance += lumaSkip;
|
||||
cb += chromaSkip;
|
||||
cr += chromaSkip;
|
||||
columnInTile = column & 3;
|
||||
(output = (u16*)(texture + ((y & 3) << 3)))[
|
||||
columnInTile + ((((column >> 2) << 1) +
|
||||
(tileRow = (y >> 2) * tileWidth)) << 4)] = (u8)red + 0x10000 - 0x100;
|
||||
output[columnInTile + ((((column >> 2) << 1) + (tileRow + 1)) << 4)] = ((green & 255) << 8) + (blue & 255);
|
||||
value = *luminance++;
|
||||
secondGreen = value + greenOffset;
|
||||
secondRed = value + redOffset;
|
||||
secondBlue = value + blueOffset;
|
||||
if ((secondRed | secondGreen | secondBlue) >> 8) {
|
||||
secondBlue = secondBlue > 255 ? 255 : secondBlue < 0 ? 0 : secondBlue;
|
||||
secondGreen = secondGreen > 255 ? 255 : secondGreen < 0 ? 0 : secondGreen;
|
||||
secondRed = secondRed > 255 ? 255 : secondRed < 0 ? 0 : secondRed;
|
||||
}
|
||||
secondColumnInTile = (column + 1) & 3;
|
||||
output[secondColumnInTile + (((((column + 1) >> 2) << 1) + tileRow) << 4)] = (u8)secondRed + 0x10000 - 0x100;
|
||||
output[secondColumnInTile + (((((column + 1) >> 2) << 1) + (tileRow + 1)) << 4)] = ((secondGreen & 255) << 8) + (secondBlue & 255);
|
||||
value = *luminance++;
|
||||
thirdGreen = value + greenOffset;
|
||||
thirdRed = value + redOffset;
|
||||
thirdBlue = value + blueOffset;
|
||||
if ((thirdRed | thirdGreen | thirdBlue) >> 8) {
|
||||
thirdBlue = thirdBlue > 255 ? 255 : thirdBlue < 0 ? 0 : thirdBlue;
|
||||
thirdGreen = thirdGreen > 255 ? 255 : thirdGreen < 0 ? 0 : thirdGreen;
|
||||
thirdRed = thirdRed > 255 ? 255 : thirdRed < 0 ? 0 : thirdRed;
|
||||
}
|
||||
thirdColumnInTile = (column + 2) & 3;
|
||||
output[thirdColumnInTile + (((((column + 2) >> 2) << 1) + tileRow) << 4)] = (u8)thirdRed + 0x10000 - 0x100;
|
||||
output[thirdColumnInTile + (((((column + 2) >> 2) << 1) + (tileRow + 1)) << 4)] = ((thirdGreen & 255) << 8) + (thirdBlue & 255);
|
||||
value = *luminance++;
|
||||
fourthGreen = value + greenOffset;
|
||||
fourthRed = value + redOffset;
|
||||
fourthBlue = value + blueOffset;
|
||||
if ((fourthRed | fourthGreen | fourthBlue) >> 8) {
|
||||
fourthBlue = fourthBlue > 255 ? 255 : fourthBlue < 0 ? 0 : fourthBlue;
|
||||
fourthGreen = fourthGreen > 255 ? 255 : fourthGreen < 0 ? 0 : fourthGreen;
|
||||
fourthRed = fourthRed > 255 ? 255 : fourthRed < 0 ? 0 : fourthRed;
|
||||
}
|
||||
fourthColumnInTile = (column + 3) & 3;
|
||||
output[fourthColumnInTile + (((((column + 3) >> 2) << 1) + tileRow) << 4)] = (u8)fourthRed + 0x10000 - 0x100;
|
||||
output[fourthColumnInTile + (((((column + 3) >> 2) << 1) + (tileRow + 1)) << 4)] = ((fourthGreen & 255) << 8) + (fourthBlue & 255);
|
||||
}
|
||||
luminance += (32 - width);
|
||||
cb += ((32 - width) >> 2);
|
||||
cr += ((32 - width) >> 2);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
122
tools/decomp-assist/sol-r9.attempts.md
Normal file
122
tools/decomp-assist/sol-r9.attempts.md
Normal file
@@ -0,0 +1,122 @@
|
||||
# sol-r9 YUV411 RGBA8 attempts
|
||||
|
||||
Scope: TMCJPEGDEC_converterYUV411toRGBA8 in Texture_MCUtoRGBA8.c, branch agent/w1009/yuv-r, HEAD and fetched origin/main b1e91180. Existing untracked rx4/rx59/rx70 artifacts are outside this task and remain untouched. Initial full default Ninja build passed. DOL SHA1 26116613f624061ba99c8d1a299aaa6efa85670d. Baseline has 12/13 exact functions; owned function is 242/242 instructions with 153 differing.
|
||||
|
||||
Read sol-common.md fully before work, brief-v2.md, levers 1-32, worktree AGENTS.md, unslop, and writing-for-agents. History collected from effort-policy.txt lines 744/750, prior tex1/tmc-jpeg/rx13/rx13b/rx13c/fz20/sol-x7/agg/opus-art and fixed-neighbor logs, plus git dd98b5bd and ceb6c912 tools/decomp-assist/sol-y1.attempts.md. The latter logs are no longer present as files but remain accessible through their commits. Complete copies are /tmp/sol-r9-history-dd98b5bd.md and /tmp/sol-r9-history-ceb6c912.md; older relevant records are /tmp/sol-r9-history.txt.
|
||||
|
||||
Earlier attempts excluded: optimizer/compiler sweeps, row/output swaps, inline row/output identity helpers, scalar narrowing, declaration-only random search, explicit tile-column induction, count-loop rewrites, wholly uncached row/pointer expressions without fixing their value identities, AR/GB packing rewrites, unrelated carrier objects, and repeated 1375-trial spelling search. Round 1 compiled 93 distinct manual bodies and 167 distinct search snapshots; round 2 compiled 64 distinct bodies. Source helpers and inlining must implement a real operation; every candidate preserves twelve exact siblings. No new subagents, push, PR, merge, rebase, or edits in other worktrees.
|
||||
|
||||
Newest saved sol-y1.Texture_MCUtoRGBA8.diff applied successfully and rebuilt. Empty pools identical. Five differences remain at instruction indices 19/21/23/26/27, all in B2, with 242/242 instructions. This is the starting candidate, not a match.
|
||||
|
||||
## Compiler evidence
|
||||
|
||||
Fresh mwdbg capture requested at /mnt/drive2/projects/wii-ipl-workers/_mwdbg/runs/sol-r9-best5. Earlier sol-y1-r2-best5 inspected read-only while the debugger queues. Backend B2 already has y>>2 before x>>2 and shifts the loop count before adding the output pointer. Its three orders are unchanged after allocation, prologue generation, and final scheduling. Target has x>>2, count end+3, y>>2, row mask, count subtract, column copy, row multiply, output addition, count shift, doubled tile column. The first dependency to reconstruct is the placement of the y-shift/multiply subtree relative to the column-shift subtree and CTR-count derivation.
|
||||
|
||||
## Trials
|
||||
|
||||
- Initial fresh capture was queued behind another worker. Cancelled our queued process before compiler execution and resubmitted an immutable /tmp/sol-r9-best5.c source with the identical unit compiler flags, so normal object trials can continue without racing the capture.
|
||||
- {"trial": "seed-control", "insns": [242, 242], "diffs": 5, "opdiffs": 4, "indices": [19, 21, 23, 26, 27], "exact": 12, "body_sha256": "70b3d1524a1b6f66b8d9eb2d5bea7c6cf926c72fb63967e8e21db9592a08d91c"}
|
||||
- {"trial": "row-cache-first-ar", "insns": [242, 242], "diffs": 14, "opdiffs": 0, "indices": [25, 26, 73, 86, 89, 124, 133, 135, 170, 179, 181, 217, 228, 231], "exact": 12, "body_sha256": "9e325b8d031faadb37d7f523e9ed594289b9d6278cfc612160a60d5a690c97a5"} Diagnostic first-use cache placement, preserving row and plane indices; inspect preheader ordering.
|
||||
- {"trial": "row-cache-first-gb", "insns": [242, 242], "diffs": 14, "opdiffs": 0, "indices": [25, 26, 73, 86, 89, 124, 133, 135, 170, 179, 181, 217, 228, 231], "exact": 12, "body_sha256": "cf5c22fbfe5226da1f09818b674afccc46d3e997b6b85890bd66e6e1d38f5f51"} Diagnostic first-use cache placement, preserving row and plane indices; inspect preheader ordering.
|
||||
- {"trial": "row-cache-all-first", "insns": [243, 242], "diffs": 225, "opdiffs": 211, "indices": [18, 19, 20, 21, 22, 23, 24, 25, 26, 27, 28, 29, 30, 31, 32], "exact": 12, "body_sha256": "5bde03a43f95917dd7d38e1b24b908cdf1d9b00a04c8efbfdb651f13c15bc575"} Diagnostic first-use cache placement, preserving row and plane indices; inspect preheader ordering.
|
||||
- {"trial": "row-cache-ar-all", "insns": [242, 242], "diffs": 14, "opdiffs": 0, "indices": [25, 26, 73, 86, 89, 124, 133, 135, 170, 179, 181, 217, 228, 231], "exact": 12, "body_sha256": "5d949007e99861021975c34881df12b8bbdcffba7dab77f8569e9a5b7ef4f78a"} Diagnostic first-use cache placement, preserving row and plane indices; inspect preheader ordering.
|
||||
- {"trial": "row-cache-gb-all", "insns": [243, 242], "diffs": 242, "opdiffs": 204, "indices": [1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15], "exact": 12, "body_sha256": "3457305c2c87ba3493159842ac6294fc2cfa9981a34f43d8226b816bab1dcb29"} Diagnostic first-use cache placement, preserving row and plane indices; inspect preheader ordering.
|
||||
- {"trial": "row-cache-late-second", "insns": [244, 242], "diffs": 240, "opdiffs": 210, "indices": [2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 15, 17, 18], "exact": 12, "body_sha256": "687cea6af8a3faf7a025039608780e2e257b65bac6f351abdfff22ea0deb10fe"} Diagnostic first-use cache placement, preserving row and plane indices; inspect preheader ordering.
|
||||
- {"trial": "tileRow-compound-copy-y", "insns": [242, 242], "diffs": 7, "opdiffs": 4, "indices": [19, 21, 22, 23, 25, 26, 27], "exact": 12, "body_sha256": "e85214028b97094a933aa2ed699b4740206acf8074245f36b7533cf2ea68995c"} Separate real row quotient and multiplication; tests named-value copy propagation.
|
||||
- {"trial": "tileRow-compound-quotient-y", "insns": [242, 242], "diffs": 7, "opdiffs": 4, "indices": [19, 21, 22, 23, 25, 26, 27], "exact": 12, "body_sha256": "f0314bc7bd00a65b6881dd6eedc055fbc7a0b63b7d9f479aa8b604eb84e73115"} Separate real row quotient and multiplication; tests named-value copy propagation.
|
||||
- {"trial": "tileRow-compound-copy-width", "insns": [242, 242], "diffs": 6, "opdiffs": 4, "indices": [19, 21, 23, 25, 26, 27], "exact": 12, "body_sha256": "276fb92b7463c2e433d412773c42d5d4c9214aa58dcf8622b8ee05fd4d42780e"} Separate real row quotient and multiplication; tests named-value copy propagation.
|
||||
- {"trial": "firstuse-swap-output-tileRow", "insns": [242, 242], "diffs": 14, "opdiffs": 0, "indices": [25, 26, 73, 86, 89, 124, 133, 135, 170, 179, 181, 217, 228, 231], "exact": 12, "body_sha256": "47c1edbac4502d25ad4df0b0ec37fd06e23e4fcef8c10dc6aa40c52c2d0fc54f"} Only interchange the real row offset and output pointer declarations after matching the target preheader shape.
|
||||
- {"trial": "firstuse-rowdecl-after-residues", "insns": [242, 242], "diffs": 153, "opdiffs": 26, "indices": [2, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 19], "exact": 12, "body_sha256": "76fde348b3ce7314558f31d21d3415a1a4541939c1d33360cf7e3674e2a4a836"} Move the two row-owned declarations together; pixels retain their declaration order.
|
||||
- {"trial": "firstuse-rowdecl-after-red", "insns": [242, 242], "diffs": 153, "opdiffs": 26, "indices": [2, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 19], "exact": 12, "body_sha256": "9b49e391ede29f88fb71602ab7cdf008776712967271ecbcee90552ff184587f"} Move the two row-owned declarations together; pixels retain their declaration order.
|
||||
- {"trial": "firstuse-rowdecl-before-state", "insns": [242, 242], "diffs": 101, "opdiffs": 0, "indices": [14, 16, 19, 26, 28, 36, 41, 44, 47, 48, 52, 61, 63, 65, 66], "exact": 12, "body_sha256": "2d3b6017716b1a2cbaeb4bf2f4dd3fd933007db0ae4ae7ac26ff65218ce594c1"} Move the two row-owned declarations together; pixels retain their declaration order.
|
||||
- {"trial": "firstuse-unsigned-row", "insns": [242, 242], "diffs": 14, "opdiffs": 0, "indices": [25, 26, 73, 86, 89, 124, 133, 135, 170, 179, 181, 217, 228, 231], "exact": 12, "body_sha256": "9e9f9ca4f93b82798ad673a11e3942d6928b1d595fb91e2fd51e506c4906d50a"} First-use row shape already has the exact opcode stream. Test value identity and multiplication/copy context only.
|
||||
- {"trial": "firstuse-multiply-reversed", "insns": [242, 242], "diffs": 14, "opdiffs": 0, "indices": [25, 26, 73, 86, 89, 124, 133, 135, 170, 179, 181, 217, 228, 231], "exact": 12, "body_sha256": "1ee66e4b87674df2ac6866934cec1d39a1250d0727a37636788925e23d460215"} First-use row shape already has the exact opcode stream. Test value identity and multiplication/copy context only.
|
||||
- {"trial": "firstuse-output-in-first-store", "insns": [242, 242], "diffs": 0, "opdiffs": 0, "indices": [], "exact": 13, "body_sha256": "c780385b9edb906341d988589bdc9ab3bda0e9891c68a3b76d48ce76e06c8346"} First-use row shape already has the exact opcode stream. Test value identity and multiplication/copy context only.
|
||||
- {"trial": "firstuse-output-after-tile-assignment", "insns": [242, 242], "diffs": 0, "opdiffs": 0, "indices": [], "exact": 13, "body_sha256": "dd61792f655a37d6e3f366b24d6455ea8a0df0915b49bf682c30ef66eeb75f45"} First-use row shape already has the exact opcode stream. Test value identity and multiplication/copy context only.
|
||||
- {"trial": "firstuse-tileRow-update", "insns": [242, 242], "diffs": 4, "opdiffs": 0, "indices": [21, 22, 25, 26], "exact": 12, "body_sha256": "e0823540b21f1d98e1a6cb4843a353cf8526edc4b2407959d93f3d9e1b481ff9"} First-use row shape already has the exact opcode stream. Test value identity and multiplication/copy context only.
|
||||
- {"trial": "firstuse-tileRow-width-update", "insns": [242, 242], "diffs": 4, "opdiffs": 0, "indices": [21, 22, 25, 26], "exact": 12, "body_sha256": "665ed6aeac8f5f10a0ffa6a54c5cb23cd13fb38fc8fb78669d245407235b6a29"} First-use row shape already has the exact opcode stream. Test value identity and multiplication/copy context only.
|
||||
- {"trial": "firstuse-named-tile-index-top", "insns": [242, 242], "diffs": 14, "opdiffs": 0, "indices": [25, 26, 73, 86, 89, 124, 133, 135, 170, 179, 181, 217, 228, 231], "exact": 12, "body_sha256": "afd6aa0456ea0aec22ce8526593339b9eec1007072bac3a6988efb09905fba46"} Name the actual first pixel tile index while preserving its first-use row assignment.
|
||||
- {"trial": "firstuse-named-tile-index-before-column", "insns": [242, 242], "diffs": 14, "opdiffs": 0, "indices": [25, 26, 73, 86, 89, 124, 133, 135, 170, 179, 181, 217, 228, 231], "exact": 12, "body_sha256": "a87096cd40675325f225dc38d3203aa3f09380ef837b0c305c9e71be0114b083"} Name the actual first pixel tile index while preserving its first-use row assignment.
|
||||
- {"trial": "firstuse-named-tile-index-after-value", "insns": [242, 242], "diffs": 14, "opdiffs": 0, "indices": [25, 26, 73, 86, 89, 124, 133, 135, 170, 179, 181, 217, 228, 231], "exact": 12, "body_sha256": "3f551f86ba339a3b6fa22d51bac1b681aabc4c6ab0a0f466fc88acd7dd09c3da"} Name the actual first pixel tile index while preserving its first-use row assignment.
|
||||
- {"trial": "statement-index-122", "insns": [243, 242], "diffs": 226, "opdiffs": 210, "indices": [14, 16, 18, 19, 20, 21, 22, 23, 24, 25, 26, 27, 28, 29, 30], "exact": 12, "body_sha256": "2b674018cbfa7b5391bc3619054ae57e087950a14e12cd7d322537d6ab6c8c60"} Readable first pixel index statements, with both plane offsets sharing the computed tile index.
|
||||
- {"trial": "statement-index-102", "insns": [243, 242], "diffs": 226, "opdiffs": 210, "indices": [14, 16, 18, 19, 20, 21, 22, 23, 24, 25, 26, 27, 28, 29, 30], "exact": 12, "body_sha256": "891e7d16ceeade71190ae3b8d513cbd2dcd416ed1b12c6088816dc38e8778d3c"} Readable first pixel index statements, with both plane offsets sharing the computed tile index.
|
||||
- {"trial": "clean-output-row-none-assigned", "insns": [243, 242], "diffs": 225, "opdiffs": 211, "indices": [18, 19, 20, 21, 22, 23, 24, 25, 26, 27, 28, 29, 30, 31, 32], "exact": 12, "body_sha256": "f3bbacfb80dc5afdd8a0d815134d68829998548a421c2dece8c6b22a1cef4229"} Normal row/index statements and C89 block declarations; no assignments inside subscripts.
|
||||
- {"trial": "clean-output-row-none-block-init", "insns": [243, 242], "diffs": 227, "opdiffs": 211, "indices": [14, 16, 18, 19, 20, 21, 22, 23, 24, 25, 26, 27, 28, 29, 30], "exact": 12, "body_sha256": "1b2194f1fa36a4c2cd7682b3911afa5ba5bce733a08ee9a0fa29d4c324b2caae"} Normal row/index statements and C89 block declarations; no assignments inside subscripts.
|
||||
- {"trial": "clean-output-row-quotient-assigned", "insns": [243, 242], "diffs": 225, "opdiffs": 211, "indices": [18, 19, 20, 21, 22, 23, 24, 25, 26, 27, 28, 29, 30, 31, 32], "exact": 12, "body_sha256": "0108e5ca42dce302a3fa059e9b450c35a6603e73b646cf245130552cc06dad3e"} Normal row/index statements and C89 block declarations; no assignments inside subscripts.
|
||||
- {"trial": "clean-output-row-quotient-block-init", "insns": [243, 242], "diffs": 227, "opdiffs": 211, "indices": [14, 16, 18, 19, 20, 21, 22, 23, 24, 25, 26, 27, 28, 29, 30], "exact": 12, "body_sha256": "5efccbabc1304c16a1dd9edec1c0d2b293012958f474fb11ee91b26f4fe4c671"} Normal row/index statements and C89 block declarations; no assignments inside subscripts.
|
||||
- {"trial": "clean-output-row-doubled-assigned", "insns": [243, 242], "diffs": 225, "opdiffs": 211, "indices": [18, 19, 20, 21, 22, 23, 24, 25, 26, 27, 28, 29, 30, 31, 32], "exact": 12, "body_sha256": "5d64e22aea91554013cd7d46606ae0917bf4ccf57f86aebe7fdc2bcab7fa63f9"} Normal row/index statements and C89 block declarations; no assignments inside subscripts.
|
||||
- {"trial": "clean-output-row-doubled-block-init", "insns": [243, 242], "diffs": 227, "opdiffs": 211, "indices": [14, 16, 18, 19, 20, 21, 22, 23, 24, 25, 26, 27, 28, 29, 30], "exact": 12, "body_sha256": "de5c877757872b4511ace05351ffa00bc1ae58926b8254e5b8557e072dc64710"} Normal row/index statements and C89 block declarations; no assignments inside subscripts.
|
||||
- {"trial": "clean-row-output-none-assigned", "insns": [243, 242], "diffs": 225, "opdiffs": 211, "indices": [18, 19, 20, 21, 22, 23, 24, 25, 26, 27, 28, 29, 30, 31, 32], "exact": 12, "body_sha256": "e4338d3dc1c6620fe47a438a849dc7860a6f0d818a82119a994c571c678e53ac"} Normal row/index statements and C89 block declarations; no assignments inside subscripts.
|
||||
- {"trial": "clean-row-output-none-block-init", "insns": [243, 242], "diffs": 227, "opdiffs": 211, "indices": [14, 16, 18, 19, 20, 21, 22, 23, 24, 25, 26, 27, 28, 29, 30], "exact": 12, "body_sha256": "fd2f45c3483eab660d9385aa326499a84253e455f08ef6edd65f96ec232ca88e"} Normal row/index statements and C89 block declarations; no assignments inside subscripts.
|
||||
- {"trial": "clean-row-output-quotient-assigned", "insns": [243, 242], "diffs": 225, "opdiffs": 211, "indices": [18, 19, 20, 21, 22, 23, 24, 25, 26, 27, 28, 29, 30, 31, 32], "exact": 12, "body_sha256": "e456903526cc5bd34507964d21b71efbaf97a980db04de2c58eae67e5ae06e04"} Normal row/index statements and C89 block declarations; no assignments inside subscripts.
|
||||
- {"trial": "clean-row-output-quotient-block-init", "insns": [243, 242], "diffs": 227, "opdiffs": 211, "indices": [14, 16, 18, 19, 20, 21, 22, 23, 24, 25, 26, 27, 28, 29, 30], "exact": 12, "body_sha256": "94e85dd0d4da609369b4c1a5c0b161ec3650ff4596f89accc26ce731c9cb345f"} Normal row/index statements and C89 block declarations; no assignments inside subscripts.
|
||||
- {"trial": "clean-row-output-doubled-assigned", "insns": [243, 242], "diffs": 225, "opdiffs": 211, "indices": [18, 19, 20, 21, 22, 23, 24, 25, 26, 27, 28, 29, 30, 31, 32], "exact": 12, "body_sha256": "f9f74a0fa4e7c3ae68e4fcb0aa0dfb33fff21483fe15c2c2aa0125e90a61f157"} Normal row/index statements and C89 block declarations; no assignments inside subscripts.
|
||||
- {"trial": "clean-row-output-doubled-block-init", "insns": [243, 242], "diffs": 227, "opdiffs": 211, "indices": [14, 16, 18, 19, 20, 21, 22, 23, 24, 25, 26, 27, 28, 29, 30], "exact": 12, "body_sha256": "59a94a116d01a5734b8cd0e6b7b22857f83bb3fe16bcf06904173be4430a802c"} Normal row/index statements and C89 block declarations; no assignments inside subscripts.
|
||||
- {"trial": "refine-named-index", "insns": [242, 242], "diffs": 16, "opdiffs": 0, "indices": [21, 22, 25, 26, 73, 86, 89, 124, 133, 135, 170, 179, 181, 217, 228], "exact": 12, "body_sha256": "82d3079c7322800025eb35c687b2303363a60ad4c4faabc086edddfb4ff7a2d7"} Reduce first-use expression nesting while keeping the assignment evidence. Store helpers are diagnostic only, not proposed for retention.
|
||||
- {"trial": "refine-output-statement", "insns": [243, 242], "diffs": 224, "opdiffs": 210, "indices": [18, 19, 20, 21, 22, 23, 24, 25, 26, 27, 29, 30, 31, 32, 33], "exact": 12, "body_sha256": "ece92fa05a65fe596182abffb84cf955cdf323b1e747915a513336654b42b0db"} Reduce first-use expression nesting while keeping the assignment evidence. Store helpers are diagnostic only, not proposed for retention.
|
||||
- {"trial": "refine-row-statement", "insns": [243, 242], "diffs": 225, "opdiffs": 211, "indices": [18, 19, 20, 21, 22, 23, 24, 25, 26, 27, 28, 29, 30, 31, 32], "exact": 12, "body_sha256": "02b5c6df77cba38c04d7574f245fa8eb6bf61d1c29bdac954651831e1bc3012d"} Reduce first-use expression nesting while keeping the assignment evidence. Store helpers are diagnostic only, not proposed for retention.
|
||||
- {"trial": "refine-both-statements", "insns": [243, 242], "diffs": 225, "opdiffs": 211, "indices": [18, 19, 20, 21, 22, 23, 24, 25, 26, 27, 28, 29, 30, 31, 32], "exact": 12, "body_sha256": "6b35642c4e3398427496a571e4048e39e159b8d61a8d6a8fa89914c5296993dd"} Reduce first-use expression nesting while keeping the assignment evidence. Store helpers are diagnostic only, not proposed for retention.
|
||||
- {"trial": "refine-indexed-store-helper", "insns": [242, 242], "diffs": 16, "opdiffs": 0, "indices": [21, 22, 25, 26, 73, 86, 89, 124, 133, 135, 170, 179, 181, 217, 228], "exact": 12, "body_sha256": "5da166281f0cfc5e6d3b14a0007b54b996aadc96b6912cf242303870e364a52e"} Reduce first-use expression nesting while keeping the assignment evidence. Store helpers are diagnostic only, not proposed for retention.
|
||||
- {"trial": "refine-pointer-store-helper", "insns": [242, 242], "diffs": 143, "opdiffs": 33, "indices": [4, 14, 16, 19, 22, 25, 26, 28, 32, 36, 37, 38, 39, 41, 42], "exact": 12, "body_sha256": "92661dd240c02c021d8523ce62eb44b24a234283620909a3aa26f37fa7a0c312"} Reduce first-use expression nesting while keeping the assignment evidence. Store helpers are diagnostic only, not proposed for retention.
|
||||
- {"trial": "pixelstore-row-locals-geometry-first", "insns": [243, 242], "diffs": 241, "opdiffs": 209, "indices": [1, 2, 3, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16], "exact": 12, "body_sha256": "6ad6ddf7b5232602915c5a4e9afcd3404857420e3350388eadd9a759d6ea1d6d"} Real tiled AR/GB pixel writer with normal locals and assignments; no cached values assigned inside subscripts.
|
||||
- {"trial": "pixelstore-row-locals-geometry-first", "insns": [243, 242], "diffs": 241, "opdiffs": 209, "indices": [1, 2, 3, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16], "exact": 12, "body_sha256": "bde73a819938ee1e18775a4e89b22c85985d95f32ab4986374e96b14b9ddcf18"} Real tiled AR/GB pixel writer with normal locals and assignments; no cached values assigned inside subscripts.
|
||||
- {"trial": "pixelstore-row-locals-color-first", "insns": [243, 242], "diffs": 241, "opdiffs": 209, "indices": [1, 2, 3, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16], "exact": 12, "body_sha256": "c95b7b2eed2cbe255e8ffdd16f5e6fe834d453434108c22d72a0a2a7f9b4935f"} Real tiled AR/GB pixel writer with normal locals and assignments; no cached values assigned inside subscripts.
|
||||
- {"trial": "pixelstore-complete-index-geometry-first", "insns": [243, 242], "diffs": 241, "opdiffs": 208, "indices": [1, 2, 3, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16], "exact": 12, "body_sha256": "ebbaae6fd2f9b599a3c4e1a989f70aa893a64588c589478690f1eca7c26f3949"} Real tiled AR/GB pixel writer with normal locals and assignments; no cached values assigned inside subscripts.
|
||||
- {"trial": "pixelstore-complete-index-color-first", "insns": [243, 242], "diffs": 241, "opdiffs": 208, "indices": [1, 2, 3, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16], "exact": 12, "body_sha256": "2282f635f64886d7d758cdabb7f3ba691ad594581c535c63ca26b91133714eb4"} Real tiled AR/GB pixel writer with normal locals and assignments; no cached values assigned inside subscripts.
|
||||
- {"trial": "pixelstore-direct-row-geometry-first", "insns": [243, 242], "diffs": 241, "opdiffs": 208, "indices": [1, 2, 3, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16], "exact": 12, "body_sha256": "a694eba05f6e0842b48850301c71bcad82f6c63cbc5e77c0394fb62e3e57a665"} Real tiled AR/GB pixel writer with normal locals and assignments; no cached values assigned inside subscripts.
|
||||
- {"trial": "pixelstore-direct-row-color-first", "insns": [243, 242], "diffs": 241, "opdiffs": 208, "indices": [1, 2, 3, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16], "exact": 12, "body_sha256": "e7129c0d388c2bb6ca8004754ee219a376b4170c969f41d36d2dade41d44094d"} Real tiled AR/GB pixel writer with normal locals and assignments; no cached values assigned inside subscripts.
|
||||
- {"trial": "pixelstore-direct-all-geometry-first", "insns": [242, 242], "diffs": 190, "opdiffs": 49, "indices": [1, 2, 3, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16], "exact": 12, "body_sha256": "70ba12cc859ca872c2daa8fdbb3a8a97b1fb184688b575c2423f9a327be7e70f"} Real tiled AR/GB pixel writer with normal locals and assignments; no cached values assigned inside subscripts.
|
||||
- {"trial": "pixelstore-direct-all-color-first", "insns": [242, 242], "diffs": 190, "opdiffs": 49, "indices": [1, 2, 3, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16], "exact": 12, "body_sha256": "6399f0af07fb0e27c793a7221b0bb06607254b715a03774b50945782b6c0fc2a"} Real tiled AR/GB pixel writer with normal locals and assignments; no cached values assigned inside subscripts.
|
||||
- {"trial": "comma-row-output-first", "insns": [242, 242], "diffs": 5, "opdiffs": 4, "indices": [19, 21, 23, 26, 27], "exact": 12, "body_sha256": "b690b0f2bc579e026518201b4ee190c9e9ade14d44a96993f2baf84415fe5b93"} Diagnostic full-expression boundary for the two real row geometry assignments.
|
||||
- {"trial": "comma-row-row-first", "insns": [242, 242], "diffs": 7, "opdiffs": 4, "indices": [19, 21, 22, 23, 25, 26, 27], "exact": 12, "body_sha256": "57d31ca63c78e6ed68d54d17ac9c0e563d3f8e7a5754725cad8f332aabf9bbdd"} Diagnostic full-expression boundary for the two real row geometry assignments.
|
||||
- {"trial": "comma-first-pixel-output-first", "insns": [243, 242], "diffs": 225, "opdiffs": 211, "indices": [18, 19, 20, 21, 22, 23, 24, 25, 26, 27, 28, 29, 30, 31, 32], "exact": 12, "body_sha256": "1f0d29f4ca71e471f1056d82f91da2b1690f1b477c626799941dc799ec560827"} Diagnostic full-expression boundary for the two real row geometry assignments.
|
||||
- {"trial": "comma-first-pixel-row-first", "insns": [243, 242], "diffs": 225, "opdiffs": 211, "indices": [18, 19, 20, 21, 22, 23, 24, 25, 26, 27, 28, 29, 30, 31, 32], "exact": 12, "body_sha256": "e576d9f74df0b859e3e083225296d995a105421b10321d71cfaced438208f5c4"} Diagnostic full-expression boundary for the two real row geometry assignments.
|
||||
- {"trial": "comma-output-row-store", "insns": [243, 242], "diffs": 225, "opdiffs": 211, "indices": [18, 19, 20, 21, 22, 23, 24, 25, 26, 27, 28, 29, 30, 31, 32], "exact": 12, "body_sha256": "a8defde9e41a08380691e30b6f1e2bc179ff336fd6252cdd4d4abd652ecf9868"} Diagnostic geometry and first store in one expression, preserving evaluation sequencing.
|
||||
- {"trial": "comma-row-output-store", "insns": [243, 242], "diffs": 225, "opdiffs": 211, "indices": [18, 19, 20, 21, 22, 23, 24, 25, 26, 27, 28, 29, 30, 31, 32], "exact": 12, "body_sha256": "f7553395183a6d928fea90b7cc0ec526c8a917c94c7f2593c60bcb4ba9d3064b"} Diagnostic geometry and first store in one expression, preserving evaluation sequencing.
|
||||
|
||||
## Exact candidate and source review
|
||||
|
||||
First-use cache placement produces the target preheader opcode sequence. Caching only tileRow at the first alpha/red store leaves a pure r20/r21 swap, 14 differences. Caching output at the same store removes that swap and reaches 242/242 instructions with zero differences and 13/13 exact functions. Two independent exact spellings were compiled; retained the one with one evaluation of each row geometry expression, rather than the control that spells the pointer expression twice.
|
||||
|
||||
The retained store computes and caches the actual u16 row pointer and tileRow offset in its destination expression. They keep one meaning and are consumed by the remaining seven stores. The calculations occur only on a path that writes a pixel. The two assignments modify different scalar locals, so their evaluation order is independent; neither reads the other local. No use precedes initialization. Pixel sample order, signed chroma conversions, clamping, alpha/green/blue packing, all eight tiled stores and row skips are unchanged. The first-use caches are real calculations, with no dummy values, carrier, helper out-parameters, pragma, asm, duplicate store or impossible condition.
|
||||
|
||||
Splitting these first-use assignments into separate statements adds an invariant instruction and loses exactness. Naming the first tile index leaves 16 register differences. Real pixel-packing/address helpers, block declarations and comma statements were also tested and discarded. Final source wraps the longer first store across lines; a fresh ordinary rebuild remains exact. This syntax is exposed for parent source review rather than hidden in a macro.
|
||||
|
||||
Independent local checks before Matching flip: odiff 0/242, ctxdiff 242/242 diffs 0, identical empty pools, symorder .text 13 symbols identical / ORDER OK. No allocated non-code data exists in this unit. All twelve previously exact siblings remain instruction-exact. Changed configure.py to Matching only after these checks; full link and final gate follow.
|
||||
|
||||
Fresh saved-five-diff capture completed. Its function is 242 instructions and differs from target only at the same five indices. regsim reproduces 178/178 virtual registers; the vmap-derived unambiguous want list already has 137/137 desired colors. The only ambiguous v89 mapping is the y quotient aligned positionally with the earlier target x quotient; value tracing proves y remains r17 and x remains r22. All colors already agree. B2 order is identical across backend-02, backend-03 and backend-04. Thus the five differences originate before register allocation and final scheduling, in loop-invariant ordering. Artifacts: /tmp/sol-r9-best5.vmap.txt and /tmp/sol-r9-best5.regsim.txt; full capture /mnt/drive2/projects/wii-ipl-workers/_mwdbg/runs/sol-r9-best5-frozen.
|
||||
|
||||
## Final gate
|
||||
|
||||
After the Matching flip, the full 43U link succeeds and main.dol retains SHA1 26116613f624061ba99c8d1a299aaa6efa85670d. Unit .text is 6596/6596 matched and 6596/6596 linked; all 13 functions are instruction-exact and exact-name objdiff 100.0. No allocated data sections. The final required --quick gate reports zero regressions, zero net forbidden patterns and zero readability warnings. Full output follows.
|
||||
|
||||
```text
|
||||
full build: ok
|
||||
main.dol sha1: 26116613f624061ba99c8d1a299aaa6efa85670d
|
||||
[libs/RVLMiddleware/TMC_JPEG/src/texturecvtr/Texture_MCUtoRGBA8] pool: IDENTICAL
|
||||
[libs/RVLMiddleware/TMC_JPEG/src/texturecvtr/Texture_MCUtoRGBA8] objdiff: code 6596/6596 data None/None functions 13/13 fuzzy 100.0000 linked code 6596
|
||||
[libs/RVLMiddleware/TMC_JPEG/src/texturecvtr/Texture_MCUtoRGBA8] instruction-exact functions: 13/13
|
||||
[libs/RVLMiddleware/TMC_JPEG/src/texturecvtr/Texture_MCUtoRGBA8] section .text size 6596 match 100.0
|
||||
[libs/RVLMiddleware/TMC_JPEG/src/texturecvtr/Texture_MCUtoRGBA8] baseline: code 5628/6596 data None functions 12 fuzzy 97.4621
|
||||
regressions vs baseline: 0
|
||||
global matched_code_percent: 97.95043 -> 97.98276
|
||||
global fuzzy_match_percent: 99.91234 -> 99.91794
|
||||
global complete_code_percent: 89.90470 -> 90.12492
|
||||
global matched_data_percent: 100.00000 -> 100.00000
|
||||
forbidden patterns added (net, per file): 0
|
||||
readability warnings (net, per file; must be 0 in the final result): 0
|
||||
note: config touched: configure.py (orchestrator reviews every config/symbols change)
|
||||
GATE PASS
|
||||
```
|
||||
|
||||
## Allocator handoff evidence
|
||||
|
||||
The first-use-row intermediate capture is complete at /mnt/drive2/projects/wii-ipl-workers/_mwdbg/runs/sol-r9-firstuse. regsim reproduces 178/178 virtual registers. vmap finds only two wrong colors: named v67 output is r20 but target wants r21; compiler temporary v76 @1118, the row product, is r21 but target wants r20. Backend B2 already has the complete target opcode order. A 5000-step search restricted to actual C locals reaches 137/139 requested colors, preserving the original order as best; the synthesized row temporary cannot be renumbered through C declarations. Searching output alone can give r21 but damages the other value assignments. This explains why merely swapping the output/tileRow declarations failed and why moving output into its first use changes the necessary temporary structure.
|
||||
|
||||
The unchanged five-diff source has no register disagreement. The intermediate has only the row/output swap. The retained exact source fixes both the early loop-invariant order and those two value identities. These are source expression and invariant-motion effects, not late backend scheduling ties. Full capture, vmap and simulator files remain outside the repository; no tool source was modified. /tmp/sol-r9-regsim.py only fixes want-list #id parsing and excludes compiler @ names from declaration reordering. /tmp/sol-r9-vmap.py reads the frozen capture object so it does not mis-map an older capture against a newly rebuilt worktree object.
|
||||
|
||||
58 compiled trial records were logged, including the seed control and two exact forms. The retained form was additionally rebuilt after formatting and passed every unit/full-link gate. The diagnostic helpers and declaration variants are absent from the source.
|
||||
|
||||
Final exact capture completed at /mnt/drive2/projects/wii-ipl-workers/_mwdbg/runs/sol-r9-exact. The captured function and the ordinary Ninja function are both byte/instruction exact to target, 242/242, differences 0. Every allocated section in the capture equals the ordinary object. simulator reproduces 179/179 virtual registers; best: 139/139 wanted registers. The row product is now synthesized v76 @1124 in r20 and the row output pointer is synthesized v77 @1120 in r21. Both are actual expression results created and consumed by the first store, then reused. Backend-01 B2 has the target opcode order, retained unchanged through allocation, prologue/epilogue and final scheduling. This confirms the edge belongs to invariant motion and temporary identity before allocation. Final capture source hash 5299f89a01f2066e656cbda3c4ffa60262076dbf78391cea129e5c9fe0699f65. The worktree source has the same hash.
|
||||
|
||||
Handoff ref check: shared origin/main advanced from b1e91180 to 44dea2d5 during this run, five unrelated commits. Neither Texture_MCUtoRGBA8.c nor configure.py changed in that interval. The accepted local build/gate remains on the assigned b1e91180 leaf baseline. No rebase or merge was performed; parent must independently validate on its current integration baseline. Existing seven untracked rx4/rx59/rx70 files remain untouched.
|
||||
Reference in New Issue
Block a user