Skip to content

Host-import float array return: alloc_result_ok_float_array infrastructure #373

@aallan

Description

@aallan

Host functions that return Result<Array<Float64>, String> (or any float array) currently have no WASM memory allocation helper to do so. The existing helpers are:

  • _alloc_result_ok_string — allocates a Result<String, String> Ok on the WASM heap
  • _alloc_result_err_string — allocates a Result<String, String> Err on the WASM heap

A parallel _alloc_result_ok_float_array helper is needed that:

  1. Allocates a float array header + payload on the WASM heap via the alloc export
  2. Writes each f64 element at the correct 8-byte-aligned offset
  3. Wraps it in a Result Ok variant and returns the pointer

Blocked by this

  • #371Inference.embed returning vector embeddings as Result<Array<Float64>, String>

Scope

The helper lives in vera/codegen/api.py alongside the existing string allocators. The browser runtime (vera/browser/runtime.mjs) needs a matching JS implementation.

Metadata

Metadata

Assignees

No one assigned

    Labels

    enhancementNew feature or request

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions