template <typename handle_type_,
void(*)(handle_type_) free_>
class owner Every output whose length only the call knows, the embeddings, the states and their offsets, lands in an arena_t you pass, and the verb answers views over it without copying. arena_t::make({.executor = executor.handle()}) places it where that executor computes, decided once, and arena_t::make() makes host pages for the calling thread.
Each call rewinds its arena, so the previous call’s views die and a steady loop allocates once.
To keep a result past the next call, pass that call another arena; an arena serves one call at a time, so each deferred call needs its own.
An arena from a VRAM executor holds device memory, which describe() reports as uform_residency_vram_k and host code must not read, while view.data still hands the rows to another library, such as a USearch VRAM index.
Views are plain spans that nothing invalidates, so check describe().host_access before host code reads one, and copy what you keep instead of holding a span across calls.
auto [arena, arena_status] = uf::arena_t::make({.executor = executor.handle()});
for (uf::tape_view<char> const batch : batches) {
auto [encoded, status] = model.on(executor).text_encode(batch, uf::encode_outputs_t::embeddings_k, uform_scalar_f32_k, arena);
consume(encoded.embeddings); // rewinds next iteration
}Destroying an arena waits for the calls writing into it, and a call naming an arena that serves another call finishes with status_code_t::contended_k.
An arena never outlives the executor that made it, so declare the executor before the arena and scope exit destroys the arena first, and an arena from arena_t::make() lives until it is destroyed.
API
Types
ownerOwns one handle of handle_type_, which free_ releases, moving it and never copying it.
owningA handle owned, moved and never copied, whose verbs block on the calling thread.
template <typename handle_type_,
void(*)(handle_type_) free_>
struct owning Fields
completion | uform_completion_t |
|---|
caller_ownedA handle the caller owns and the executor its verbs run on, completing as completion_ says.
template <typename handle_type_,
uform_completion_t completion_>
struct caller_owned Fields
completion | uform_completion_t |
|---|
Classarena_tOwns one arena; every call writing outputs into it rewinds it first, ending the previous call's views.3
class arena_t It must not outlive the executor that made it, so declare that executor first; one made with no executor lives until it is destroyed. It must outlive every export opened on its outputs: a free those refuse leaves the arena allocated with no owner left to free it.
handleThe C handle, for uform_arena_export_open among others; close every export opened through it before this owner dies.
uform_arena_t handle() const noexcept; describeReports where the arena's outputs live, which decides whether host code may read them.
expected<uform_arena_description_t> describe() const noexcept; makeCreates an empty arena where the executor arguments names computes.
expected<arena_t> make(uform_arena_init_t arguments = {}) noexcept; Functions
free_arenaFrees arena as its owner dies, which an open export of its outputs refuses, leaving it to the export's holder, who closes every export before the owner dies.
void free_arena(uform_arena_t arena) noexcept;