Skip to content

lagoon: jet parity with urbit/vere#1057 — Hoon fixes, C ports, regression suite - #75

Merged
sigilante merged 2 commits into
mainfrom
sigilante/lagoon-jet-parity
Jul 12, 2026
Merged

lagoon: jet parity with urbit/vere#1057 — Hoon fixes, C ports, regression suite#75
sigilante merged 2 commits into
mainfrom
sigilante/lagoon-jet-parity

Conversation

@sigilante

Copy link
Copy Markdown
Collaborator

Companion to urbit/vere#1057 and urbit/urbit#7388, making this repo the canonical source for the fixed lagoon jets.

  • Hoon: +diag unflopped (natural diagonal order, matching lagoon: fix element order in +diag/+abs, result shape in bloq-4 +range urbit#7388; this desk had already unflopped +el-wise-op). Doccords corrected: bare +la rounds %z (the bunt of $rounding-mode), not %n — the range-accumulation test oracle proved this empirically.
  • C ports: the full #1057 fix set (validation/_check rewrite, refcounts, NaN-correct comparisons, kernel results — see that PR) ported into both jet lineages: lagoon/vere (32-bit, %int2/twoc preserved) and lagoon/vere64 (stateless-SoftBLAS). One deliberate divergence from upstream: %mod follows this desk's C-fmod semantics (quotient truncated %z regardless of door mode; canonical quiet NaN, not a crash, on a zero divisor or non-finite quotient), per the desk's own "Vere follow-on" note.
  • Regression suite: lagoon/desk/tests/lib/lagoon-jet-parity.hoon, 22 oracles for everything that broke (transpose/diag/trace/abs order and values, reduction ranks, argmin/argmax NaN behavior, NaN comparisons, exact scalar mod/div, desk-fmod %mod, range accumulation + bloq-4 shape, linspace n=1). A stock-semantics twin lives upstream in lagoon: fix element order in +diag/+abs, result shape in bloq-4 +range urbit#7388.
  • Maroon: all external files converted to relative symlinks (libs, sur, jet-tree overlay) — it now inherits lagoon fixes automatically; its own tinygrad-era files remain to be ported (accepted, in-progress).

Verification: suite green interpreted against the desk; green jetted on a fresh hoon-136 fakezod running a vere-ml64-based build with the ported 64-bit lagoon.c (all 22 arms, and 40×40 %i754 mmul in ~4 s vs ~25 s interpreted, confirming the jets fire). The 32-bit lineage is compile-verified; run the same recipe if a 32-bit binary is cut.

🤖 Generated with Claude Code

sigilante and others added 2 commits July 7, 2026 17:50
+diag built its result over (flop (gulf 0 (dec n))), returning the
diagonal REVERSED -- same family as the +el-wise-op flop this desk
already removed.  Matches urbit/urbit#7388 and the natural-order jets
in urbit/vere#1057.

Maroon's external files are now all relative symlinks (the style
saloon already uses) instead of copies:
* desk/lib/{lagoon,twoc,fixed,math,saloon}.hoon were symlinks with
  wrong relative bases -- broken since December -- now point into
  lagoon/ and libmath/ and saloon/ correctly
* desk/sur/lagoon.hoon was a stale pre-tail-generation copy
  (fxp/%real era); links to lagoon/desk/sur/lagoon.hoon
* vere/noun/jets/{q.h,w.h,tree.c} were stale copies of lagoon's vere
  overlay; linked (i/lagoon.c already was)

Maroon's own tinygrad files still target the old lagoon API and will
not build until ported; maroon is in-progress and that is accepted.

Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
Ports the full urbit/vere#1057 fix set (validation, refcounts, NaN
comparisons, kernel results -- see that PR) into the %int2-extended
32-bit copy and the stateless-SoftBLAS 64-bit copy, preserving the
int2/twoc code and the _la_rnd plumbing.  One deliberate divergence
from the reference: %mod here follows THIS desk's C-fmod semantics
(quotient truncated %z regardless of door mode; canonical quiet NaN,
not a crash, on a zero divisor or non-finite quotient), per the desk's
own "Vere follow-on" note.  The int2 dot case also gains the
meta-sing and consistency checks +bin-op asserts.

tests/lib/lagoon-jet-parity encodes 22 regression oracles for
everything that broke (transpose/diag/trace/abs order and values,
reduction ranks, argmin/argmax NaN behavior, NaN comparisons, exact
scalar mod/div, desk-fmod %mod, range accumulation and bloq-4 shape,
linspace n=1) -- green interpreted against this desk; running it on a
jetted numerics binary is the port's acceptance test.  A stock-
semantics twin lives upstream in urbit/urbit#7388 tests/lib/lagoon.

Also corrects the +la doccords: bare la rounds %z (the bunt of
$rounding-mode), not %n.

Co-Authored-By: Claude Fable 5 <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