Skip to content

Materialize rank-seven scalar lowerings with explicit width guards - #3078

Merged
Mister-Meeseeks merged 1 commit into
CrocSwap:mainfrom
petalas:research/20261016-rank7-primitive-lowering
Oct 16, 2026
Merged

Mister-Meeseeks merged 1 commit into
CrocSwap:mainfrom
petalas:research/20261016-rank7-primitive-lowering

Conversation

@petalas

@petalas petalas commented Oct 16, 2026

Copy link
Copy Markdown
Contributor

Summary

Close the arithmetic part of PR3060's instruction-lowering handoff. Add only research/rank7-primitive-lowering/.

Explicit scratch lowering       93,190 real instructions
Source-digit walk              83,430
Target-digit walk              83,430
Saving                          9,760 per word/orientation

Both pinned PR3042 providers, all three PR3042/3056/3060 block forms and both orientations give these counts. Source walks restore their source; target walks never write it. Their different guard contracts are explicit: up to three extra fractional source bits or three extra integer target bits. Exact affected-register lists are included.

The restore blocks themselves still tie at four unit instructions. A complete 30-instruction, three-register census through length three proves four is minimal in the stated alphabet, including one zero scratch. This does not contradict PR3060's different tariff-optimality theorem.

This is an exact real-arithmetic implementation result, not a physical runtime improvement, new κ or supplier admission. The scratch baseline is implemented here, not claimed as an existing or optimal upstream instruction compiler. Non-scalar events and the recursive paid profile are unchanged; physical costs are not treated as zero.

Proof, source pins, reproduction, evidence and open next questions. Canonical predecessor handoff: Discussion2612. Scientific base is canonical main d8e0f83f00191df62174b641e9fff055c357f641, priority revision 6.

Evidence

  • Before: PR3060 supplies a conservative compiler-bound comparison, without materialized coefficient recipes.
    After: six fresh pinned native compilations and 36 complete scalar expansions. A separate column interpreter reads the emitted bytes and checks literal registers, frames, signs, dirty-input maps, source restoration and scratch erasure. All 632 native input columns and 91 private-buffer endpoints pass the inherited compiler.
  • Fourteen behavioral groups pass normally, optimized and on Python 3.13. Tests cover all 6,643 bounded ADD input pairs under all three policies, with semantic, source, access and overwrite controls. A separate denominator-eight integer census agrees on 1,19,208,1769 cumulative states.
  • Registered Python3.12 replay passes. Python3.13 and optimized complete receipts are byte-equal. Formatting, correctness lint, source compilation and all 21 committed package/input byte comparisons pass. Registered local replay took about 42 seconds on the recorded host. Hosted CI is separate.
TMPDIR="$RUN/tmp" python3.12 -B scripts/research_package.py \
  --package research/rank7-primitive-lowering

Fixed-width rounding, actual guard allocation, physical shift/copy/clear, backing/movement, fresh warp/wrapper, ownership/admission and outer release remain unrun. The next useful task is to pay one guard contract in a literal physical caller. No independent human or formal-kernel review is claimed. Development used substantial automated assistance.

Credit PR3060/3056, dcharb78/PR3042, Jeremy Kothe/PR3015, Marius-Paul Dumitrean/PR2979, Cinna Davis/PR2226, eumemic/PR411, icekylinx, Tekalign and the retained geometry/native/owner lineage. No priority is claimed for generic binary-digit arithmetic identities. Frozen inputs and original notices remain unchanged.

Merge Danger

Door: two-way. One isolated research package and opt-in replay.

Blast Radius: isolated. No shared compiler, selected source, frontier, priority or other PR changes. The arithmetic result does not discharge the physical width/access obligations.

@Mister-Meeseeks
Mister-Meeseeks merged commit 5d93a57 into CrocSwap:main Oct 16, 2026
1 check passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants