Make the library allocation-free; drop vendored Urbit headers#13
Merged
Conversation
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>
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.
Answers "do we strictly need the Urbit headers in SoftBLAS?" — no.
A1 — allocation-free core
The only heap allocation in the compiled library was
qasum's accumulator (which also leaked —qvec/malloc, never freed). Replaced with a stackfloat128_t. The library now does zero heap allocation.A3 — test helpers out of the public header
svec/dvec/hvec/qvec(the only othermallocusers) are test-only — never called by the library or by Vere/Lagoon. Moved them +float128_pair_tinto the test header and added NULL checks.A2 — drop the Urbit coupling
With nothing in the library allocating, the
#ifdef VEREblock (#include "noun.h",#define malloc u3a_malloc) is unnecessary. Removed it and deleted the 20 vendored Urbit runtime headers PR #1 copied intoinclude/.VEREis defined nowhere (the block was inert), and when SoftBLAS builds inside Vere, Vere's own headers are already on the include path — the copies were only a staleness liability that would drift.include/is now justsoftblas.h.If the host allocator is ever wanted, supply it via a one-line host shim, not a vendored header tree.
143/143 pass. Third of the audit-backlog PRs (after #11 test honesty, #12 correctness bugs).
🤖 Generated with Claude Code