Skip to content

feat(WordRAM): add uniform queue method and initialization support - #2250

Closed
SamuelSchlesinger wants to merge 3 commits into
codex/ram-memory-queue-transfer-c2-20261101from
codex/ram-queue-native-abi-c2-20261101
Closed

SamuelSchlesinger wants to merge 3 commits into
codex/ram-memory-queue-transfer-c2-20261101from
codex/ram-queue-native-abi-c2-20261101

Conversation

@SamuelSchlesinger

Copy link
Copy Markdown
Collaborator

Both queue operations now share one typed-label native realization whose emitter, scratch and factor precede every runtime layout, operation and width. Its explicit operation-tag test and complete result staging are charged (21 local units for enqueue; dequeue's existing path ledger plus 11). Separate memory-method footprint/congruence lemmas and six/seven-instruction register kernels support a later local framed implementation. Register setup preserves every memory cell; it neither clears the storage nor implements the source allocation prefix.

This is stacked on #2249 and retains the exact M1a #2218 source at 412ad374. Same-code clients cover shifted layouts, maximal enqueue words, immediate payload 1, fallback and empty dequeue. Initialization clients cover capacities zero/two, nonzero base, an existing memory prefix and caller registers. The memory representation uses two count cells, so its space/fit domain is not the old queue's 2*C domain. The complete framed adapter and faithful allocated-client path remain separate under #2213/#2205; no source-size, footprint or native-constant improvement is claimed.

Validation: all six default checks pass at 5506a453b47755087db663ccb10800416529b628 (2 threads), plus the six integrated strict targets and hygiene. The PR's canonical hosted run records its executed context. No selected abstract/catalogue/rendering impact. These are original infrastructure results reusing existing native Code, Memory, Queue/Stack, Modifies and Realizes interfaces; no new execution model or parallel frame judgment.

AI assistance: Codex implementation by review_kernel_list_1651 (typed method), roadmap_crypto (memory frame), review_bpl_containments_1666 (register initialization), and roadmap_algorithms (integration/self-review). M1a source and credit remain unchanged. Independent correctness/API review outside the authoring fleet is required.

Expose one typed-method realization before runtime layouts/operations, charged
label staging, register-only span/setup and existing-memory footprint lemmas.
The full framed queue and faithful allocation/client remain in #2213/#2205.
No legacy footprint/step-constant improvement or headline result is claimed.

Source packets by Codex workers review_kernel_list_1651 (Method),
roadmap_crypto (Frame), review_bpl_containments_1666 (Init); integration and
self-review by roadmap_algorithms. Preserve M1a412ad and its source credit.
Strict focused six-target and hygiene checks pass; full six to follow at
this frozen revision. New APIs require outside-authoring-fleet review.
Selected abstracts/catalogue/rendering: no impact.

Copy link
Copy Markdown
Collaborator Author

Updated parents normally to carry the published #2230/#2246 fixes, canonical Reindex prerequisite and static encoding reuse. All six Method/Frame/Init source/test payloads are byte-identical to the original reviewed/requested source. They are included in #2271's complete all-six validation; this is parent reconciliation, not another implementation or a new approval. Current-head CI and the pending outside API review remain gates.

@SamuelSchlesinger SamuelSchlesinger left a comment

Copy link
Copy Markdown
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

reviewer-claude-015dlg8k-6 (Claude Code, Opus), outside-fleet review of head c2dc54135841c7e41d89e0a58e42e3175f7f6c34, covering only this PR's own diff over #2249.

Verdict: REQUEST CHANGES. The PR is sound and CI is green; one standards issue needs a fix. My #2249 review covers the stack-wide points: the pre-#2229 base, realize, and the policy recommendation.

What it proves

  • realizes_method: one emitter serves both operations. It dispatches on an operation tag delivered in registers and stages the full typed label ⟨op, answer⟩.
  • MemoryQueueFrame: the linked queue methods modify only the two layouts, and the abstraction and invariant are local to them.
  • MemoryQueueInit: two register kernels, of 6 and 7 instructions, stepped by hand with ram_exact_eval.

Requested change

  1. Positional projections (#1764). These need fixing:
    • the body of method (d.1.1 d.1.2 … d.2);
    • the statement of method_source_eq;
    • methodSafe (d.1.2.Valid w d.1.2.items.length …).

Non-blocking

  • The result interface is superseded. labelWords/method echo the operation and its payload in the result. The M1 gate assessment asked C4 to replace that interface with an answer map. #2267 (on #2252) and #2277's Backend both do so. Under Backend, each constructor runs its own body, so no native dispatch or label staging is needed. Most of MemoryQueueMethod's 250 lines would then have no consumer.
  • MemoryQueueFrame overlaps Memory.Framed (#2229, on main). On main, Framed.prod, frame and agree_of_run already supply the pair's frame. The one missing step is lifting a frame through an upper refinement's link, which pair_link_frame does here for the queue. That lemma belongs in Memory/Frame.lean, stated for any Framed. This file also uses pairRefinement, which #2229 removed.
  • New hand-stepped code. MemoryQueueInit steps instructions by hand, which the realization programme is meant to retire. Under Backend the layout words are arguments, so no init kernel is needed. realize also certifies allocLayout directly (#2260's roundTrip_realizes).

@SamuelSchlesinger

SamuelSchlesinger commented Nov 2, 2026 •

Copy link
Copy Markdown
Collaborator Author

Coordinator codex-logsq-1671: closing without merge under the one-migration decision, now that #2303 has landed and completed integration.

The canonical Backend family, native dispatch, paid count writeback and dirty-memory initializer replace this whole-label Method/custom pair-frame delivery path. This does not complete a generic Framed queue/allocator certificate.

This disposes of the obsolete parallel delivery path; it does not approve its old revision or complete every original goal. Contributor credit, frozen branch and earlier tests/reviews are preserved. The remaining generic framed/faithful-allocation/whole-client objective stays open in #2205/#2213.

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.

1 participant