API

Core, data, and cryptography

Root matrix, data, and cryptography values with C++-parity FnMatrix and FnHash operations.

Compiler-extracted public headersNative C++ surface376 functions180 classes27 enums58 constants & variables
This inventory is extracted from OA public headers by clang-doc. Native types, pointers, references, defaults, public inheritance, comments and source ownership come from the compiler surface.

Examples

Core

Functions

Source

ADL hooks for range-for and std::begin/end (member API is PascalCase).

Prepend OA_TITLE_VIEWPORT to a custom title (no automatic separator) User can add separator in their custom title if desired Returns OA_TITLE_VIEWPORT for empty/null input or if already starts with it

Source

── Exp / log ───────────────────────────────────────────────────────────────

BF16 < -> FP32 conversion (truncation, not rounding — matches storage.slang)

── Rounding / sign / abs ───────────────────────────────────────────────────

Explicitly publish buffered host output. Use after write("\r...") for an immediately visible same-line progress update; print does not auto-flush.

Smart human-readable duration: "3s", "45s", "2m 30s", "1h 15m", "2d 6h"

Uppercase hex with 0x prefix (PCI / vulkan id style, no leading-zero padding).

format integer with comma-separated thousands (e.g. 9521568 → "9,521,568")

Comma-separated decimal for oa::U64 (full range; for log readability only).

── Classification ──────────────────────────────────────────────────────────

log a right-aligned summary line: " (label): type(dims) 1,234" width 60 between left text and right value. Used by model summaries and device info.

═══════════════════════════════════════════════════════════════════════════════ memcpy — Zero-overhead for all sizes ═══════════════════════════════════════════════════════════════════════════════

═══════════════════════════════════════════════════════════════════════════════ memcpyStream — Explicit non-temporal cache policy ═══════════════════════════════════════════════════════════════════════════════

Overlap-safe byte move. Keep this distinct from memcpy so callers make the aliasing contract visible and the compiler selects the appropriate lowering.

═══════════════════════════════════════════════════════════════════════════════ MEMSET / MEMZERO / MEMCMP (defined in memory.cpp) ═══════════════════════════════════════════════════════════════════════════════

Scalar two-argument min/max (the oa::min / oa::max replacement — distinct from minElement/maxElement which scan a range). Returns by const & like std, so ties return the first argument.

Source
Source

parse duration string: "30s", "5m", "20m", "2h", "1d", "1w", "1mo", "1y" Bare number (no suffix) treated as seconds. Returns 0 on parse failure.

═══════════════════════════════════════════════════════════════════════════════ PREFETCH / CACHE CONTROL ═══════════════════════════════════════════════════════════════════════════════

── Trig ────────────────────────────────────────────────────────────────────

── Roots / powers ──────────────────────────────────────────────────────────

Stable insertion sort is intentionally used for the small control-plane collections that require stable ordering. It performs no allocation and keeps equal elements in their original order.

Deliberately not named `swap`: an unconstrained `oa::swap(T & , T & )` enters argument-dependent lookup for every OA type and collides with the Standard Library's own generic swap inside algorithms such as std::sort.

Classes

2 members
4 members
3 members
9 members
20 members
Source
12 members
22 members
Source
2 members

AutogradMeta — per-tensor autograd state (PyTorch-style nullptr-optimized). Inference tensors pay zero bytes: autograd_ stays nullptr. Invariants: - leaf ⇔ !gradFn - leaf with requiresGrad owns a persistent grad matrix (Tier 1) - non-leaf has gradFn; grad is not populated unless retainGrad (v1: unsupported)

Source
1 members
4 members

base callback interface — all methods are optional (no-op by default)

Source
8 members

oa::Channel <T > — bounded MPMC channel (multiple-producer, multiple-consumer). Bounded ring buffer with blocking send/recv and non-blocking trySend/tryRecv. Supports graceful shutdown via close() which unblocks all waiters. usage: oa::Channel <oa ::Matrix> ch(16); // capacity 16 ch.send(tensor); // blocks if full auto t = ch.recv(); // blocks if empty, returns nullopt if closed ch.close(); // unblocks all waiters

Source
0 members
0 members
14 members
8 members
30 members
oa::F32
oa::F32
oa::F32
oa::F32

─── Palette factory functions (Realm Design System) ──────────────────────

static
Source
0 members
8 members
8 members
8 members
0 members
5 members
35 members

Datetime — human-readable UTC date/time over the system clock. For logs, debugging, display. NEVER for consensus or deterministic math.

Source
0 members
3 members
1 members
7 members
22 members
Source
0 members
0 members
Matrix
Matrix
Source
0 members
0 members
4 members

Integer override: returns parsed env value if set+non-empty+parsable, else returns inDefault. Parsing accepts decimal only.

static

String override: returns env value if set+non-empty, else returns inDefault as an oa::String. Empty value falls back to inDefault.

static

bool toggle: true iff the env var is set AND its value is NOT one of {"", "0", "false", "no", "off"} (case-insensitive).

static

Programmatic override — sets the env value to "1" if not already set. Returns false if the env var was already set externally (caller's signal that user-supplied env wins over oa::EngineConfig::numericMode). Used internally by applyNumericMode; not the API to expose to users.

static
Source
1 members
24 members

Filesystem — stateless host-filesystem operations. oa::Path owns lexical path manipulation. oa::Paths owns OA location discovery.

─── Filesystem Resolution ────────────────────────────────────────────

static

─── directory operations ─────────────────────────────────────────────

static

─── Existence & Info ─────────────────────────────────────────────────

static

─── Glob Pattern Matching ────────────────────────────────────────────

static

─── Listing ──────────────────────────────────────────────────────────

static

─── Binary file operations ───────────────────────────────────────────

static

─── text file operations ─────────────────────────────────────────────

static
Source
42 members
const oa::I64
oa::I64
Source
12 members
0 members
8 members
0 members
0 members
23 members
Source
19 members
Source
13 members

───────────────────────────────────────────────────────────────────────────── Image — semantic wrapper around oa::Matrix ─────────────────────────────────────────────────────────────────────────────

Source
13 members

───────────────────────────────────────────────────────────────────────────── ImageBatch — uniform batch of images ─────────────────────────────────────────────────────────────────────────────

Source
7 members
7 members
6 members
0 members
0 members
0 members
1 members
1 members
1 members
1 members
6 members
6 members
6 members
6 members
6 members
6 members
6 members
6 members
6 members
6 members
6 members
6 members
6 members
6 members
6 members
11 members
3 members

A component is a small value, not a closed framework enum or a mutable registry entry. OA supplies neutral built-ins through Builtin; downstream libraries define their own named constexpr values from one-to-four-character tags without modifying OA or acquiring process-global state. namespace ChainLog { inline constexpr LogComponent Consensus{"CONS"}; }

Source
0 members
11 members
0 members

Stateful log output is an explicitly owned host session. oa::Engine creates one from these options and selects it for the thread that owns the engine. The Log* macros use that selected session and fall back to stderr before an engine exists or on a thread that has not selected one.

Source
0 members
0 members
0 members
0 members
Matrix
Matrix
Matrix
Matrix
Matrix
Matrix
Matrix
Source
10 members
68 members

A multidimensional semantic value backed by OA-managed storage. A matrix carries shape, element stride, dtype, device, byte-offset, and optional autograd metadata. Copying a matrix shares its storage and autograd state. Metadata-only views also alias storage; use `clone()` when independent storage is required. Matrix operations use OA's Vulkan execution path. Direct host observation is an explicit synchronization boundary, not a CPU compute fallback. Stateful device ownership remains with `oa::Engine`; a matrix only retains the storage required for its value and recorded graph lifetime.

Defer addition of one contribution into this leaf's gradient accumulator.

inContributionin — Gradient contribution with a compatible element count.

method

Synchronize cached descriptors and return this matrix as a const view.

method

Read one logical flat element as FP32. This host observation submits and waits for recorded work when required and performs device readback when storage is not host-accessible.

inIdxin — Row-major logical flat index. It must be in range.

ReturnsThe selected value converted to FP32.

method

Return this view's byte offset within shared storage.

method

Return the logical element count multiplied by the scalar size in bytes.

method

Copy this matrix into independent storage through `oa::FnMatrix::copy`.

ReturnsThe independent copy, or an empty matrix when this matrix is empty.

method

Return an independently stored row-major matrix with the same values. The current non-row-major path may cross a host-access boundary while materializing the result.

ReturnsA contiguous copy, or an empty matrix when allocation fails.

method

Record a copy or dtype conversion into existing destination storage. Both matrices must have storage and compatible element counts. Missing storage leaves this matrix unchanged.

inOtherin — Source values to copy.

method

Return a read-only pointer when this matrix is host-accessible. This function does not make a device-only allocation host-visible and does not synchronize recorded GPU work.

ReturnsPointer to this view's first byte, or `nullptr` when inaccessible.

method

Return a writable pointer when this matrix is host-accessible. This function does not make a device-only allocation host-visible and does not synchronize recorded GPU work.

ReturnsPointer to this view's first byte, or `nullptr` when inaccessible.

method

Return `data()` cast to the requested element type.

method

Return const `data()` cast to the requested element type.

method

Replace shared autograd metadata before attaching a producer node.

inRequiresGradin — Initial tracking state for the detached metadata.

method

Return a one-dimensional storage-sharing view.

method

Return the device identity associated with this matrix.

method
method
method

Return the persistent gradient accumulator, or an empty matrix when absent.

method

Return whether this value has a non-empty shape and live backing storage.

method

Return the current runtime bindless slot, or `-1` when none is bound.

method

Return the current host-visible span, or an empty span when inaccessible.

method

Return whether this value has no usable backing storage.

method

Return whether `data()` exposes this matrix directly to the host.

method

Return whether this matrix has no producing gradient node.

method

Return whether this matrix currently has a device bindless slot.

method

Read a single-element matrix as FP32. This host observation submits and waits for recorded work when required. The matrix must contain exactly one element.

ReturnsThe scalar value converted to FP32.

method

Advance the shared mutation version after an in-place write.

method

Construct an empty matrix without storage.

constructor

Allocate and fill a matrix through `oa::FnMatrix::full`.

inShapein — Logical dimensions of the matrix.

inFillValuein — Value written to every element.

inDtypein — Scalar representation used by the allocation.

constructor

Return mutable autograd metadata, allocating it on first access.

method

Return the persistent gradient accumulator, allocating it when absent.

method

Return the product of all logical dimensions.

method
method

Return the element-wise product; this operator is not matrix multiplication.

method
method
method
method
method

Return the element-wise negation of this matrix.

method

Return the element-wise difference using `oa::FnMatrix` broadcasting rules.

method

Return this matrix with a scalar subtracted from every element.

method
method

Return the element-wise quotient using `oa::FnMatrix` broadcasting rules.

method
method

Reorder dimensions and element strides without copying storage. Negative dimension indices are accepted. Every source dimension must occur exactly once.

inDimsin — Source dimension for every output dimension.

ReturnsA strided storage-sharing view; an empty matrix for an invalid permutation, or this matrix unchanged when the rank does not match.

method

Return the number of logical dimensions.

method

Return whether this matrix participates in autograd.

method

Create a storage-sharing view with a new shape. This method currently has the same row-major element-count contract as `view()` and does not materialize a copy.

inNewShapein — Logical shape of the returned view.

ReturnsThe storage-sharing view, or an empty matrix on count mismatch.

method

Write one logical flat element from FP32. The index must be in range. Device-only storage uses an explicit upload after completing prior recorded work.

inIdxin — Row-major logical flat index to update.

inValuein — Value converted to the matrix dtype and written.

method

Enable or disable leaf-gradient tracking. Enabling tracking lazily allocates a persistent gradient accumulator. Disabling it preserves allocated gradient storage for reuse.

inValuein — Whether this leaf should accumulate gradients.

method

Return the size of one logical dimension. Negative indices count from the final dimension, so `-1` names the last dimension. The resolved index must be in range.

inDimin — Dimension index to query.

ReturnsNumber of elements along the resolved dimension.

method

Remove one size-one dimension without copying storage.

inDimin — Dimension to remove.

ReturnsA storage-sharing view, or this matrix unchanged when the dimension is invalid or is not size one.

method

Exchange two dimensions through the canonical matrix operation path.

inDim0in — First dimension to exchange.

inDim1in — Second dimension to exchange.

ReturnsA matrix with the requested dimensions exchanged.

method

Insert a size-one dimension without copying storage.

inDimin — Position of the inserted dimension.

ReturnsA storage-sharing view with rank increased by one.

method

Create a metadata-only row-major view with a new shape. The new shape must contain exactly the same number of elements. The returned matrix shares storage and byte offset with this matrix.

inNewShapein — Logical shape of the returned view.

ReturnsThe storage-sharing view, or an empty matrix on count mismatch.

method

Set every element to zero through the placement-appropriate path.

method

Record a zero fill for the persistent gradient accumulator when present.

method

Release this value's references without submitting or waiting for work.

method
Source
10 members

MatrixShape — dimensions of an oa::Matrix (OA's N-D array), rank up to OA_MAX_TENSOR_DIMS. Construct with brace-init for any rank: MatrixShape{m, n} // rank-2 MatrixShape{n, c, h, w} // rank-4 (e.g. conv NCHW) The variadic constructor keeps brace initialization without importing the hosted initializer-list or exception runtime.

oa::I32

Compute broadcast strides for this shape against a broadcasted output shape. Returns row-major strides with 0 where this shape has a broadcasted dim (1 or absent).

method

Row-major: stride in elements for dimension inDim (product of later dims).

method
Source
0 members
0 members

memory capacity for value-only device descriptors. VkCpu reports host physical RAM because that identity is process-independent. Other vulkan descriptors do not identify a live allocator or physical device and return zero; query the exact oa::Engine for live vulkan budget/usage.

Source
0 members
0 members
5 members
7 members
8 members
Source
9 members
Source
2 members
22 members
Source
5 members
23 members
Source
9 members
0 members
0 members
17 members

── Uniform reals in [0, 1) ─────────────────────────────────────────────

method

── Gaussian (Box–Muller, caches the paired variate) ────────────────────

method

── Uniform integer in [inMin, inMax] inclusive (unbiased via rejection) ─

method

── Core engine: PCG32 (32 random bits) ─────────────────────────────────

method

Fixed default seed → reproducible by default. Provide a seed for a specific stream; inSeq selects an independent stream for the same seed (two generators with the same seed but different inSeq never correlate).

constructor

The complete state includes the Box-Muller cached variate. Raw state/inc access remains for compatibility with integer-only checkpoints; use checkpoint/restoreCheckpoint for exact continuation across all APIs.

method

── Fisher–Yates shuffle over a contiguous range ────────────────────────

method
Source
3 members
0 members
0 members
0 members
0 members
0 members
0 members
0 members
0 members
0 members
0 members
22 members
Source
15 members
Source
4 members

oa::RwLock <T > — reader-writer lock wrapping a value. Multiple concurrent readers OR one exclusive writer. Uses oa::SharedMutex under the hood. usage: oa::RwLock <oa ::Vector <oa ::Matrix>> cache; { auto r = cache.read(); use(*r); } // shared { auto w = cache.write(); w->push_back(t); } // exclusive

Source
0 members
0 members
0 members
0 members
0 members
0 members
0 members
0 members
0 members
0 members
0 members
4 members
2 members
8 members
5 members
5 members
4 members
8 members
21 members
Source
15 members
18 members
Source
3 members

oa::Spinlock — PAUSE spinlock + SFENCE unlock Replaces std::mutex for short critical sections. Uncontended: ~1-2ns (vs ~18-22ns for futex). Contended: PAUSE loop stays in userspace (no kernel call).

Source
2 members
0 members
Matrix
Matrix
Matrix
Matrix
Matrix
Matrix
Matrix
Source
0 members
16 members
Source
1 members
13 members
Source
9 members
5 members
47 members
const size_type
const size_type

Member begin/end so range-for mutates this string (free begin(oa::StringView) would not).

method

Lexicographic ordering (unsigned char semantics via memcmp).

method

Converts to view into this string; do not store the view past the string's lifetime.

method

NOLINTNEXTLINE(bugprone-easily-swappable-parameters) — mirrors std::string::resize(n, ch)

method

Zero the entire owned character allocation, including unused capacity and the terminator, before releasing storage.

method
Source
23 members
const size_type

Array binding (string literals AND fixed-size char buffers). Length is the C-string length bounded by the array capacity — i.e. up to the first ' \ 0', else the full N. For an exact-sized literal this equals the historical N-1, so the constexpr name tables are unchanged; for a short string in a larger buffer (e.g. snprintf into char[16]) it stops at the real terminator instead of capturing the embedded NUL + uninitialised tail (which silently corrupted dotted module paths in checkpoint serialization).

constructor
Source
1 members
13 members
Source
8 members

oa::Task <T > — lightweight async result (future/promise). producer calls complete(value) or fail(status) exactly once. consumer calls wait() or tryGet() to retrieve the result. Supports then() for continuation chaining. usage: auto task = oa::makeShared <oa ::Task <oa ::Matrix>>(); pool.submitTask([task] { task->complete(computeSomething()); }); auto result = task->wait(); // blocks until complete

Source
6 members
9 members
8 members
0 members

oa::ThreadPool — work-stealing thread pool with CPU affinity. Workers each own a bounded channel. submit() round-robins jobs. When a worker's own queue is empty, it steals from siblings. Optional CPU pinning via oa::CpuTopology (P-cores preferred). usage: auto pool = oa::ThreadPool::create(); // auto-detect cores pool.submit([] { doWork(); }); // fire-and-forget auto t = pool.submitTask([] { return 42; }); // get future auto val = t->wait(); // blocks, returns 42 pool.shutdown(); // drains and waits explicitly

Source
28 members
Source
0 members
10 members
19 members
Source
12 members

───────────────────────────────────────────────────────────────────────────── Validation — global validation controller ─────────────────────────────────────────────────────────────────────────────

Enable / disable. Debug: on by default. release (OA_ENABLE_VALIDATION): off by default. call initFromEnv() once at startup to apply OA_VALIDATION / OA_VALIDATION_SEVERITY.

static

Read OA_VALIDATION and OA_VALIDATION_SEVERITY from the process environment. call once before any OA_VALIDATE macro fires (e.g. Engine::create).

static
static
Source
21 members
Source
56 members
Source
12 members
12 members
3 members
3 members

Enums

None · InvalidAlignment · SizeOverflow · OutOfMemory

Core · Runtime · Engine · Compute · Ml · Data · Vision · Video · Audio · Render · Ui · Plot · Animation · Network · Crypto · Python · App · Mcp

Performance · Efficiency · Unknown

Fast · Stable · Deterministic

DEVICE TYPE

Host · VkDiscrete · VkIntegrated · VkCpu · VkVirtualGpu · VkOther

Nearest · Linear

───────────────────────────────────────────────────────────────────────────── ImageFormat (channel meaning) ─────────────────────────────────────────────────────────────────────────────

Gray · GrayAlpha · Rgb · Rgba · Bgr · Bgra

───────────────────────────────────────────────────────────────────────────── ImageLayout (tensor shape interpretation) ─────────────────────────────────────────────────────────────────────────────

Nchw · Nhwc · Chw · Hwc · Hw

Trace · Debug · Info · Warn · Error · Fatal · Off

MEMORY LOCATION Logical placement for buffers (not a silicon map). Discrete vs SoC: - Discrete GPU (e.g. dGPU in a Strix-class laptop): Device = separate VRAM; Host = system RAM; Shared = CPU-mapped VRAM (ReBAR / Smart access memory / large BAR) — same VRAM bytes, two views. - Unified memory / UMA soCs (Apple Silicon, Snapdragon X Elite, many iGPUs): one DRAM pool for CPU + GPU + NPU. vulkan often exposes heaps with HOST_VISIBLE and DEVICE_LOCAL on the same memory — treat that as shared (one pool, visible to both). Pure pageable CPU malloc with no device mapping stays Host. Device means "allocated as device-local / GPU-primary" even when it is physically the same DRAM as the CPU (allocator hint + visibility flags), not a second chip. NPU-only carve-outs without a separate vulkan heap are not a fourth category here until modeled.

Host · Device · Shared

Relaxed · Consume · Acquire · Release · AcquireRelease · Sequential

allocation intent carried by semantic values and engine requests. This is distinct from MemoryLocation: Auto is unresolved policy, while HostUpload and HostReadback name transfer direction. The Runtime allocator resolves the intent against the selected device and records the result on its private physical-storage descriptor.

Auto · DeviceLocal · HostUpload · HostReadback · Unified

process-wide numerical execution policy. Core owns the vocabulary and its environment mapping; Runtime consumes it through oa::EngineConfig.

Fast · Stable · Deterministic

Ordered non-value inputs that affect operation meaning. matrices, images, audio values, and video frames remain semantic values; these attributes preserve scalar/configuration data independently of runtime push layouts.

Boolean · SignedInteger · UnsignedInteger · Float · String · Shape · Enum

StraightLine · Conditional · Loop

MatchInput · PromoteFloat · Explicit

None · ReadInputs · WriteOutputs

MatchInput · Broadcast · MatMulNt · Explicit

None · Matrix · Image · Audio · VideoFrame · QuantMatrix

FP32 · BF16 · FP64

Float32 · BFloat16 · Float16 · Int8 · Int32 · UInt8 · Float64 · Int16 · Int64 · UInt16 · UInt32 · UInt64 · Bool · Complex64 · Complex128

STATUS CODES

Ok · Cancelled · Unknown · InvalidArgument · DeadlineExceeded · NotFound · AlreadyExists · PermissionDenied · ResourceExhausted · FailedPrecondition · Aborted · OutOfRange · Unimplemented · Internal · Unavailable · DataLoss · Unauthenticated · VulkanError · DeviceNotFound · OutOfMemory · PipelineError · ShaderCompileError · InvalidSignature · InvalidBlock · InvalidTransaction · InsufficientFunds · InsufficientMargin · Slashed · OrderRejected · PositionNotFound · MarketClosed · PriceLimitExceeded · QuantityTooSmall · ModelNotLoaded · ShapeMismatch · DtypeMismatch · GradientExplosion · CheckpointCorrupt · ConnectionFailed · Timeout · TlsError · DnsError · FileNotFound · FileCorrupt · PermissionError · DiskFull

───────────────────────────────────────────────────────────────────────────── Severity ─────────────────────────────────────────────────────────────────────────────

Verbose · Info · Warning · Error · Fatal

Constants & Variables

Functions

bmmNt: per-batch matrix multiply with transposed right operand storage, A[N,M,K] @ B[N,P,K]^T = out[N,M,P].

--- dtype cast --- cast: allocate a new matrix of inDtype and convert inSrc into it. castInto: convert inSrc into the pre-allocated outDst in place.

convTranspose2d: 2D transposed convolution (learnable upsampling). input: [N, inC, H, W], weight: [inC, outC, K, K], Bias: [outC] output: [N, outC, H_out, W_out] where H_out = (H - 1) * S - 2P + K.

detach: stop-gradient. Returns a view that SHARES inSelf's device buffer but carries no autograd linkage (leaf, requiresGrad=false), so backward terminates here. Metadata-only: no kernel, no copy. This is the primitive the straight- through estimator needs.

gegluBwd: backward pass for GEGLU activation.

inInputin — forward INPUT (up||gate); up*GELU(gate) is not invertible

geluBwd: backward pass for GELU activation. Computes: dInput = dOutput * gelu'(x)

inInputin — forward INPUT x (gelu'(x) is a function of input, not output)

gruCellPointwise: fused GRU pointwise forward. r = sigmoid(gatesI[r] + gatesH[r]) z = sigmoid(gatesI[z] + gatesH[z]) n = tanh(gatesI[n] + r * gatesH[n]) h_new = (1 - z) * n + z * hPrev

inGatesIin — [B, 3H] input projection (reset|update|candidate along dim 1) or [B*T, 3H] with inTimeOffset = t*B to index row t without Slice

inGatesHin — [B, 3H] hidden projection

inHiddenin — [B, H] previous hidden state

inHiddenSizein — H

inTimeOffsetin — row offset into inGatesI (in units of 3H), default 0

gruScan: whole-sequence GRU recurrent scan in ONE dispatch (one workgroup per batch, looping all timesteps). Mathematically identical to running gruCellLinear for each timestep, but collapses S dispatches into 1. The recurrent weight/bias gradient is computed separately via linearWeightBiasBwd on the saved hPrev.

inGatesIin — [B*S, 3H] precomputed input projection (row b*S+t = timestep t)

inSeqLenin — S

linear: linear layer (fully connected). output = input @ weight^T + bias

inXin — [batch, inFeatures]

inWeightin — [outFeatures, inFeatures]

inBiasin — [outFeatures] (optional)

linearGelu: fused linear + GELU. output = GELU(input @ weight^T + bias) The fused forward discards the pre-activation; the autograd node recomputes it (one GEMM) for geluBwd in the backward pass.

linearReluBwdData: fused in-layer linearRelu(x,W,b) backward, data path. For y = reLU(x @ W^T + b), computes dx = (dy * (act > 0)) @ W in a single dispatch. gate is applied INSIDE the inner sum (no materialization of dz), the opposite fusion direction of linearDataReluBwd.

max: Reduce all values by maximum; dim is retained as a compatibility parameter and is not a dimensional reduction.

mean: Reduce by arithmetic mean; a valid non-negative Dim produces a keep-dimension axis reduction, while -1 produces a full reduction.

quantize Float32 storage into one native OA Q4 or Q8 weight value. The returned value retains the source shape; its physical planes remain private.

rnnCellLinear: fused vanilla-RNN recurrent step — Linear(h, W_hh) + rnnCellPointwise. Replaces the per-timestep pair of dispatches with one kernel. inGatesI is the whole input projection [B*T, H]; inTimeOffset/inBatchStride index the current timestep's row directly, so oa::Rnn needs no per-step Slice. The hidden projection required by reverse mode is retained internally rather than exposed as an output parameter.

rnnCellPointwise: fused vanilla-RNN pointwise forward, h_new = tanh(gatesI + gatesH).

inGatesIin — [B, H] input projection (W_ih x + b_ih)

inGatesHin — [B, H] hidden projection (W_hh h_prev + b_hh)

rnnCellPointwiseBwd: fused vanilla-RNN pointwise backward. Returns gradients w.r.t. gatesI and gatesH (both equal to dL/da). inGatesI is the whole-sequence [B*T, H] projection; inTimeOffset/inBatchStride select this timestep's rows so dGatesI is scattered into the full buffer (zeros elsewhere).

rnnScan: whole-sequence vanilla-RNN recurrent scan in ONE dispatch. Mathematically identical to running rnnCellLinear for each timestep, but collapses S dispatches into 1. The recurrent weight/bias gradient is computed separately via linearWeightBiasBwd on the saved hPrev.

inGatesIin — [B*S, H] precomputed input projection (row b*S+t = timestep t)

--- RNG --- seed the host-side seed generator. call once at startup for reproducibility.

siluBwd: backward pass for SiLU activation.

inInputin — forward INPUT x (silu'(x) is a function of input, not output)

siluMulBwd: backward pass for SiluMul activation.

inInputin — forward INPUT (gate||up); the forward output is not invertible

softplus: Softplus: out = log(1+exp(A)), computed stably as max(A,0)+log1p(exp(-|A|)) (no f32 overflow).

softplusBwd: backward pass for Softplus activation.

inForwardOutputin — output y = softplus(a) from the forward pass

ReturnsdOut * sigmoid(a) = dOut * (1 - e^-y)

sum: Reduce by summation; a valid non-negative Dim produces a keep-dimension axis reduction, while -1 produces a full reduction.

vqAssign: vector-quantization nearest-code assignment (VQ-VAE codebook lookup). inZe: [N, D] latents. inCodebook: [K, D] codes. Returns the per-row argmin index (int32 [N]) and the gathered winning code (float [N, D]) by squared L2 distance.

vqEmaUpdate: EMA codebook update + dead-code reinit (van den Oord 2017). The codebook is NOT gradient-trained; each entry tracks the running mean of encoder outputs assigned to it, and dead codes are revived from live encoder rows. inZe [N,D], inIdx [N] int32 (from vqAssign), ioEmbedSum [K,D], ioClusterSize [K], outCodebook [K,D]. inDecay = EMA γ; inEps = division floor; inDeadThreshold = revive codes whose EMA count falls below it; inSeed = per-step seed; inNormalize rescales each codebook row to unit RMS (cosine VQ).

--- Configuration --- weight allocation follows the precision of the active engine context.

Crypto

Functions

Classes

13 members
5 members
1 members
1 members
0 members
0 members
5 members
1 members
3 members
10 members
0 members

Incremental sponge context — absorb in chunks, squeeze in chunks.

oa::Byte[168]
oa::U32
oa::U64[25]
Source
4 members

Functions

Batch Keccak-f[1600] permutation. input/output [N, 200] bytes (25 lanes × u64 per state). out-of-place.

Merkle root by GPU SHAKE-256 pair reduction. input [N, 32] leaf hashes, N a power of two; output [1, 32] root. Bit-identical to oa::merkleRoot for power-of-two leaf counts. Use oa::merkleRoot (CPU) for arbitrary counts, and oa::verifyMerkleProof (CPU) for inclusion proofs.

SHAKE-128 batch XOF. input [N, msgLen] bytes; output [N, ceil(outLen/8)*8] bytes (16-byte default). Row i = SHAKE128(message i).

SHAKE-256 batch XOF. input [N, msgLen] bytes; output [N, ceil(outLen/8)*8] bytes (32-byte default). Row i = SHAKE256(message i).

Data

Classes

2 members
5 members
0 members

DataLoader (analogous to torch.utils.data.dataLoader)

Source
5 members
6 members
4 members