Skip to content

noun: migrate lagoon jet to stateless SoftBLAS#1021

Open
sigilante wants to merge 4 commits into
developfrom
neal/lagoon-jet-fixes
Open

noun: migrate lagoon jet to stateless SoftBLAS#1021
sigilante wants to merge 4 commits into
developfrom
neal/lagoon-jet-fixes

Conversation

@sigilante

Copy link
Copy Markdown
Collaborator

Summary

Migrates the lagoon jet to the current SoftBLAS API.

  • Bump ext/softblas to 40ff4fa — the allocation-free / stateless rewrite that dropped the global softblas_roundingMode for a per-call rndMode argument (plus B1–B5 correctness fixes, NaN canonicalization). Drop the now-deleted src/softblas_state.c from the wrapper's source list.
  • Update pkg/noun/jets/i/lagoon.c for the new API: thread the active rounding mode through all 32 BLAS calls via a file-static _la_rnd (replacing the removed global), and rename the local _set_rounding_set_rounding_la so it doesn't collide with softblas.h's new inline _set_rounding.

The jet source tracks numerics canonical (lagoon/vere); see urbit/numerics#37.

Testing

Built with zig 0.15.2; add/dot/mmul/mod verified correct on a fake ~hex, and the full lagoon test suite passes (run against the matching 64-bit ml/64 build).

🤖 Generated with Claude Code

Bump ext/softblas to urbit/SoftBLAS 40ff4fa (allocation-free; dropped the
global softblas_roundingMode for a per-call rndMode arg; B1-B5 correctness
fixes) and drop the now-deleted src/softblas_state.c from the wrapper.

Update the lagoon jet for the new API: thread the active rounding mode
through all 32 BLAS calls via a file-static _la_rnd (replacing the removed
global), and rename the local _set_rounding -> _set_rounding_la to avoid
colliding with softblas.h's new inline _set_rounding.

The jet source matches numerics canonical (lagoon/vere). Built with
zig 0.15.2; add/dot/mmul/mod verified correct on a fake ~hex.

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
@sigilante sigilante requested a review from a team as a code owner May 31, 2026 12:29
Bump the vendored SoftBLAS dependency from 40ff4fa to 4e70272
(urbit/SoftBLAS HEAD).  Notable upstream changes:

- macOS SoftFloat SIGBUS fix (use GCC platform.h for the Darwin build)
  -- directly relevant to building vere on macOS.
- drotmg NaN/Inf hang fix; C1-C8 NaN/Inf/stride determinism coverage.
- new complex/integer/quad Level-1 routines and a qrot signature fix
  (float16->float128); not compiled here and not called by the lagoon
  jet, so no jet changes.

The lagoon jets call only {s,d,h,q}{dot,axpy,scal} + {s,d,h,q}gemm,
none of which changed (only their tests did), so jetted behavior is
identical.  Updated build.zig.zon hash accordingly.  Full vere build
verified (zig 0.15.2, aarch64-macos).

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
sigilante and others added 2 commits June 8, 2026 20:32
The %mod ray-op (u3qi_la_mod_i754) and mod-scalar (u3qi_la_mods_i754)
jets rounded the quotient to nearest (IEEE remainder) and returned the
dividend on a zero divisor, diverging from the Hoon +mod (C fmod:
truncate toward zero; NaN on /0 or a non-finite operand).

Truncate the quotient with softfloat_round_minMag, and on a non-finite
quotient overwrite the result with the width's qNaN.  Both functions,
all four widths.  The 64-bit variant of this fix (PR #1022) was verified
on a live ship.

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
Mirror the 64-bit fix: introduce the n word-count constant (VERE64 ? 2
: 4) and use it everywhere instead of literal 4. No behavior change on
the 32-bit build (n=4), but makes the file correct-by-construction if
c3_w widens, and keeps it in sync with the vere64 rq.c sub fix.

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
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