noun: Lagoon %int2 comparison + reduction array jets - #1048
Open
sigilante wants to merge 2 commits into
Open
Conversation
Extend the Lagoon array jets with %int2 cases beside %i754 for the comparison and reduction ops (no GEMM): gth/gte/lth/lte -- per-lane signed (two's-complement) compare -> 1/0 ray cumsum -- full wrapping sum -> scalar ray dot -- sum of products (wrapping) -> scalar ray min/max -- extremum by two's-complement order -> scalar ray argmin/argmax -- forward ravel-index of the first extremum Native per lane (8..128-bit, no GMP); signed compares reinterpret the lane as the matching signed C type. Scalar reductions box via +scalar-to-ray's shape (all-1s of the input rank); argmin/argmax return the bare index. Verified jet == numerics %int2 Hoon on a hoon-135 fakezod across native widths incl. 128-bit, ties, and negatives. Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
Rename the rank-correct boxing helper introduced for %int2 (_la_int2_box -> _la_scalar_box, it was already kind-neutral) and route the i754 cumsum/min/max/dot cases through it too, so their boxed scalar result matches the Hoon +scalar-to-ray (all-1s of the input rank) instead of the prior hardcoded ~[1 1] / ~[len 1] / ~[1]. Carries urbit/numerics#68 into the runtime. trace (always rank-2) keeps ~[1 1] and is unaffected. Verified on a hoon-135 fakezod: i754 min/max/cumsum/dot now match the unjetted Hoon (were mismatched on the boxed shape), and the %int2 reductions still match. Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
sigilante
force-pushed
the
sigilante/twoc-jets
branch
from
June 29, 2026 15:44
fe0cd7d to
4375784
Compare
sigilante
force-pushed
the
sigilante/twoc-int2-cmp-reduce
branch
from
June 29, 2026 15:44
e7e3fcf to
2a00167
Compare
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.
Stacked on #1047. Hoon/master side: urbit/numerics#67.
Extends the Lagoon array jets with
%int2cases beside%i754for the comparison and reduction ops (no GEMM):gth/gte/lth/lte— per-lane signed (two's-complement) compare → 1/0 ray.cumsum— full wrapping sum → scalar ray.dot— sum of products (wrapping) → scalar ray.min/max— extremum by two's-complement order → scalar ray.argmin/argmax— forward ravel-index of the first extremum (bare index).Native per lane (8…128-bit, no GMP); signed compares reinterpret the lane as the matching signed C type. Scalar reductions box via a
_la_scalar_boxhelper =+scalar-to-ray's shape (all-1s of the input rank).Also fixes the i754 reduction-jet result shape (carries urbit/numerics#68 into the runtime):
cumsum/min/max/dotshared the same_la_scalar_boxhelper, replacing the prior hardcoded~[1 1]/~[len 1]/~[1]that only matched one rank — a silent jet/Hoon mismatch on the boxed meta.trace(always rank-2) anddiag(returns a vector) are correct as-is.Verified jet == numerics Hoon on a hoon-135 fakezod across native widths incl. 128-bit, ties, and negatives — for both
%int2and (now)%i754reductions.🤖 Generated with Claude Code