Repository navigation
[-16 lines] Reuse compiler paths for array access and branch blocks - #955
Closed
PedroVIOliv wants to merge 2 commits into
Closed
PedroVIOliv wants to merge 2 commits into
PedroVIOliv wants to merge 2 commits into
Conversation
VictorTaelin
pushed a commit
that referenced
this pull request
Sep 21, 2026
arr_op shares the array setup and the old-cell read and tuple return of get and swap, keeping get's retain, swap's move and set's sink. Emission is byte-identical. (PR #955, its first commit)
Contributor
|
The first commit (the shared cell-access path in Note: this reply was written by an AI after it reported the issue to me and I made the decision. If anything here is wrong, reply and I will review it myself. |
jnadeau207-collab
added a commit
to jnadeau207-collab/bend
that referenced
this pull request
Sep 24, 2026
…ive again; U32 shows and reads by its own defs A soft native is emitted at its call site under #ifndef __METAL_VERSION__, so C and CUDA inline it and only Metal calls the def (a spin polled errors per call: F64 compares ran 5x an F32 one). F64.to_f32 rounds natively on every lane with a double, NaN canonical (was the def, 300x). f32_text tries the digit above only for a power of two (F32.show was 24% slower). U32.show and U32.read are upstream's again: through U64 they were 2.5x slower on JS. emit_chain opens its arms with block (from bendlang#955); F64 is a runtime datatype, so f32_read writes CID(F64) as it writes CID(Some). Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Phylliida
pushed a commit
to Phylliida/bend
that referenced
this pull request
Sep 27, 2026
arr_op shares the array setup and the old-cell read and tuple return of get and swap, keeping get's retain, swap's move and set's sink. Emission is byte-identical. (PR bendlang#955, its first commit)
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Two compiler paths repeat logic already shared elsewhere.
arr_oprepeats array ownership/alias setup and the old-cell read and tuple return for get/swap.emit_chainimplements its own indentation and closing braces instead of usingblock.Share the existing-array setup and cell read/result path, preserving get's retain, swap's move and set's sink. Emit each conditional arm through
block, retaining the single-arm shortcut. Generatedelseclauses move to the next line; conditions and branch bodies stay the same.Only
bend2/comp.tschanges: 20 insertions, 36 deletions (net -16 lines, -340 bytes). No new helpers, feature changes, comment removal or size-cap changes. Measured with the gate's defaultttokinvocation: 64,941 tokens upstream, 64,894 after the array change, and 64,854 after both changes (-87 total). The compiler is 146 tokens below its 65,000-token cap.Validation against upstream
e52cda47:-O3, excluding only the source path and module identifier. Runtime benchmark timings were not measured.#|expectations on JS and C compiled with Apple clang 17 at-O3, using one CPU thread. Expected nonzero exit statuses were checked as well.--gpu on --threads 1. Every build created a Metal pipeline archive. This includes array atomics/forks, closure reachability, fork leaf continuations, GPU trig and stencil3d. The remaining GPU-bearing test,tests/gfx/clicks.bend, requires interactive window events and was excluded.git diff --checkpassed.PASS: 46 / 46, using ttok 0.3 installed in an isolated temporary environment.The cluster test gate could not run because this host cannot resolve
cluster. Cluster test/performance gates remain for maintainer infrastructure; CUDA execution and GPU performance measurements were not tested locally.