Skip to content

Add Urbit headers and start adding rounding modes.#1

Merged
sigilante merged 4 commits into
masterfrom
sigilante/rounding-mode
May 30, 2026
Merged

Add Urbit headers and start adding rounding modes.#1
sigilante merged 4 commits into
masterfrom
sigilante/rounding-mode

Conversation

@sigilante
Copy link
Copy Markdown
Collaborator

No description provided.

Sigilante and others added 4 commits February 29, 2024 16:21
… add test

Completes the per-call rounding-mode redesign:

- _set_rounding(): restore the documented 'a' (round-away/near-maxMag) mode
  and make an unknown mode a no-op (leave SoftFloat's mode unchanged) rather
  than exit(1).
- Add the `const uint_fast8_t rndMode` parameter and a leading
  _set_rounding(rndMode) call to every implementation whose header prototype
  already declared rndMode (all asum/axpy/copy/dot/nrm2/scal/swap/gemv/gemm
  variants, plus the not-yet-built complex and rotation routines, kept
  consistent with the header). i*amax and sdsdot/hsdot are left unchanged to
  match their prototypes (their headers do not take rndMode).
- Update all test call sites to pass a rounding mode.
- New test_saxpy_rounding: 1.0 + 2^-24 (exactly half a ULP) rounds to 1.0
  under 'n' (ties-to-even) but up to the next float under 'u', proving the
  rndMode argument actually changes the result. Would fail if _set_rounding
  were a no-op.

The built suite compiles against the header and passes 133/133.

Note: this is a breaking API change for callers (every routine gains a
trailing rndMode argument); Vere's lagoon jets are being updated in tandem.

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
…mode

# Conflicts:
#	README.md
#	include/softblas.h
#	src/blas/level1/caxpy.c
#	src/blas/level1/ccopy.c
#	src/blas/level1/scasum.c
#	src/blas/level1/scnrm2.c
…s_state.c

The merge auto-took master's Makefile, which lists softblas_state.c (removed
in this branch's per-call rounding redesign) and the WIP complex routines
(scasum/ccopy don't compile yet). Restore this branch's intended BLAS_SRCS
(the 40 built REAL routines) and remove the resurrected softblas_state.c.

Builds and passes 140/140.

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
@sigilante sigilante marked this pull request as ready for review May 30, 2026 14:35
@sigilante sigilante merged commit 6289b58 into master May 30, 2026
1 check passed
@sigilante sigilante deleted the sigilante/rounding-mode branch May 30, 2026 14:35
sigilante added a commit that referenced this pull request May 30, 2026
SoftBLAS routines operate in place on caller-provided buffers; the only
heap allocation in the compiled library was qasum's accumulator (which
also leaked). Replace it with a stack float128_t. The library now does
zero heap allocation.

The svec/dvec/hvec/qvec helpers (the only other malloc users) are
test-only conveniences — never called by the library or by Vere/Lagoon.
Move them, with float128_pair_t, out of the public header into the test
header, and add NULL checks.

With nothing in the library allocating, the Urbit-allocator coupling is
unnecessary: remove the `#ifdef VERE` block (`#include "noun.h"`,
`#define malloc u3a_malloc`) and delete the 20 vendored Urbit runtime
headers that PR #1 copied into include/. `VERE` was defined nowhere (not
in SoftBLAS's build, not in Vere's ext/softblas build), so the block was
inert; and when SoftBLAS builds inside Vere, Vere's own headers are
already on the include path, so the copies were only a staleness
liability. include/ is now just softblas.h. If the host allocator is
ever needed it can be supplied via a one-line host shim, not a vendored
header tree.

143/143 tests pass; CI builds the same set.

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