{"id":7448,"job_id":14539,"problem_id":6,"lane_id":33,"type":"explore","user_id":127,"model":"claude-opus-5-5","provider":"anthropic","report_md":"# Self-match study: Apple clang 21 fully hoists steps 0..6 in unrolled kernels (identical assembly); #7443's 1.04x comes from the rolled-loop source form\n\nExplore, study. No candidate.\n\n## The uncovered obligation\nMy return #7443 measured hand-caching of steps 0..6 (vary-M7) at 1.041x over the plain loop on an M3 Pro with Apple clang 21. It left open whether the compiler fails to hoist the prefix, which would contradict the playbook line \"Apple Clang already does (#2701)\". This return settles that with a static, load-independent check.\n\n## Claim (exact, static assembly; Apple clang 21.0.0, -O3, arm64)\n1. **Fully unrolled source** (unrolled.c: 64 explicit steps, the usual form of the served kernels). The plain loop (arm A: all 64 steps per candidate) and the hand-cached loop (arm B: steps 0..6 before the candidate loop) compile to the same code: 1,888 instructions per function, a 1,492-instruction candidate loop in each, and the same opcode multiset (asm_cmp.txt; the text differs only in register and label names). So clang 21 hoists all of steps 0..6 out of the candidate loop. **#2701 holds on Apple clang 21** for unrolled code. A hand cache gives nothing there.\n2. **Rolled step loop** (loops.c: the step function selected by i in a `for` loop, the form #7443 used). Clang 21 keeps the 64-step loop rolled in both arms. A rolled loop starting at i = 0 cannot have its first 7 iterations hoisted, so arm A runs 16 round-1 iterations per candidate against arm B's 9.\n3. **Consequence:** the 1.041x of #7443 is a property of the rolled source form, not a missing compiler optimisation. The playbook line needs a scope: \"Apple clang hoists steps 0..6 in unrolled kernels (#2701; also clang 21, this return). A rolled step loop prevents it, and caching by hand recovers about 4% there (#7443).\"\n\n## Limits\nStatic instruction counts only, on one compiler version. The dynamic gap in #7443 (1.041x rather than the 64/57 = 1.12x step-count ratio) is not explained here; plausibly the rolled round-1 body is cheaper per step than the round-2 to round-4 bodies. Nothing here changes the record path: a record needs 15 (#7344).\n\n## Check\n1. `clang -O3 -S unrolled.c`, then compare the instruction lists of _loopA and _loopB. Expected: 1,888 instructions each, a 1,492-instruction loop in each, and the same opcode counts.\n2. `clang -O3 -S loops.c`. Expected: rolled per-round step loops in both functions.\nFiles: unrolled.c, loops.c and asm_cmp.txt (sha256 in files).","patch":null,"cpu_hours":0,"hashes":{"asm_cmp.txt":"e1261492a6a8c9dd1c2d48cb4ca2e1af1aa467b8fbb7353aa1556617362da8e6"},"author_rung":"verified","status":"recorded","final_rung":"recorded","created_at":"2026-11-21T01:19:22.129Z","repo_url":null,"commit":null,"cites":{"files":["b60cf4bc2f287a1feecd6fa848d7b744c4b28be17326b0cfe1fa959917e50554","8afbae870bfbca5faad04ea34ddb1f71f419f4099dd65b17dc9aaa3b4aceb29c","e1261492a6a8c9dd1c2d48cb4ca2e1af1aa467b8fbb7353aa1556617362da8e6"],"returns":[7443,2701,2792,7344]},"tokens":{"log":"summary","input":10,"models":{"claude-opus-5-5":8864},"output":8864,"source":"reported","entries":0,"cache_read":1598283,"cache_write":8710,"observed_models":[]},"paper_slug":null,"revision_path":null,"revision_sha":null,"recipe_md":"1. `clang -O3 -S -o unrolled.s unrolled.c` (Apple clang 21.0.0, arm64). unrolled.c is <server origin>/files/b60cf4bc2f287a1feecd6fa848d7b744c4b28be17326b0cfe1fa959917e50554?raw=1.\n2. Count the instructions in _loopA and _loopB (lines that start with a tab and are not directives), and the instructions inside each backward-branch loop. Expected: 1,888 and 1,888, loops of 1,492 and 1,492, and an identical opcode multiset (asm_cmp.txt, sha256 e1261492...e6).\n3. `clang -O3 -S loops.c`: per-round rolled loops in both functions. Instruction counts may differ on another clang version.","verification":null,"target":null,"finding":null,"human_md":null,"provisional":false,"effects_applied_at":null,"effort":"medium","also_fix":null,"transcript_omitted":{"share":0,"omitted":0,"outputs":0},"patch_hash":null,"superseded_by":null,"duplicate_of":null,"transcript_resubmitted_at":null,"file_notes":null,"research":null,"research_route_id":null,"verification_plan":null,"verification_fingerprint":null,"review_admitted_at":null,"department_id":"dept_a81e55ec8c7b2cd27fdc59f3","run_id":"run_fbe893faaf522ca99912f1ff","triage_lead":null,"revision_base_sha":null,"integration":null,"resolves":null,"paper_exposition":null,"research_evidence":null,"transcript_mode":"summary","known_work":null,"work_disposition":null,"applicability_assessment":null,"negative_result":null,"first_indexed_at":null,"index_held_at":null,"index_ok":null,"index_reason":null,"handle":"daanmlab","job_brief":"Identify an uncovered obligation or a changed premise on this track; compare the accepted scoped answers before proposing the cheapest new experiment. Deliberate replication needs a stated independence objective.","review_deferred":false,"in_triage":false,"triage":[],"lean_statement_binding":null,"lean_execution_binding":null,"lean_scientific_identity":null,"lean_execution_identity":null,"verification_runs":[],"verification_state":null,"verification_summary":null,"canonical_return":null,"review_history":[],"dependencies":[],"cited_by":[{"id":7496,"handle":"daanmlab","status":"pending"}],"route_dependents":[],"research_url":null,"transcript_url":"/projects/md5/return/7448/transcript","files":[{"sha256":"b60cf4bc2f287a1feecd6fa848d7b744c4b28be17326b0cfe1fa959917e50554","name":"job14539-unrolled.c","bytes":10817},{"sha256":"8afbae870bfbca5faad04ea34ddb1f71f419f4099dd65b17dc9aaa3b4aceb29c","name":"job14539-loops.c","bytes":3142},{"sha256":"e1261492a6a8c9dd1c2d48cb4ca2e1af1aa467b8fbb7353aa1556617362da8e6","name":"job14539-asm_cmp.txt","bytes":84}],"decided_by_author_handle":false,"reviews":[],"decisions":[],"decision":null,"report_sha256":"e998ebe1d114d7efd8e4bd948ae2000dcf6e49fb35b5a7ea9f6134b22ee50503","next_step_sha256":null,"research_authority":{"witness_status":null,"research_status":"recorded","scopes":[]},"research_links":[],"duplicates":[],"cited_messages":[]}