Fix sub jet to return the computed result buffer#23
Merged
Conversation
The ?axpy-based sub jets computed x - y into one buffer but returned the other (unmodified) one, so `sub:la x y` silently returned an input rather than the difference. PR #20 corrected the axpy argument order in lagoon/vere and vere64 but not the return pointer; maroon was never swapped and computed y - x. All three jets now allocate x_bytes as the pinned output buffer and y_bytes as the plain input, run axpy(-1, y, x) => x := x - y, and return x_bytes. Existing sub tests only covered the symmetric case 1 - 1 = 0, which passes under every failure mode. Add asymmetric regression tests (x=[5,2] - y=[3,1] = [2,1]) across all precision variants; these distinguish the correct result from returning x, returning y, or computing y - x. Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
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.
Summary
sub:la x ysilently returned an input instead of the difference. The?axpy-basedsubjets computedx - yinto one buffer but returned the other.?axpyargument order (sox - ylands inx_bytes) but the function still returnedy_bytes— the unmodifiedy.y - xand returned that.All three jets now allocate
x_bytesas the pinned output buffer andy_bytesas the plain input, runaxpy(-1, y, x)⇒x := -1*y + x = x - y, and returnx_bytes.Why it slipped through
Every existing
subtest used the symmetric case1 - 1 = 0, which passes under all failure modes (x,y,x-y, andy-xall equal0whenx = y = 1).Tests
Added asymmetric regression tests
x=[5,2] - y=[3,1] = [2,1]across every precision variant (lagoon bloq 4/5/6/7, maroon 4/5/6). These distinguish the correct result[2,1]from each failure mode: returningy→[3,1], returningx→[5,2], computingy-x→[-2,-1].Verification
A standalone arm64 SoftBLAS reproduction of the corrected wiring (
saxpy(-1, y, x)→ returnx) prints[2.0, 1.0], matching the test canon. Full end-to-end exercise against compiled jets in Vere is pending.🤖 Generated with Claude Code