Skip to main content

Module tile_budget

Module tile_budget 

Source
Expand description

How much heap a tiled network’s tiles take, and how many a browser keeps in flight.

The arithmetic the tiled drivers (inversion::tiled, onnx feature) budget with, kept out of the onnx gate so a host that only estimates memory (and does not run networks) computes the same figures. A network’s cost per tile comes from the registry (ModelSpec::tile_cost).

Structs§

TileConfig
Tiling parameters for the tiled drivers (tiled_field_inversion, tiled_volume_algorithm).

Constants§

WASM_MAX_PATCH_ACTIVATION_BYTES
Largest footprint a single patch may have on WASM, running alone.
WASM_TILE_ACTIVATION_BUDGET
Heap budget for all concurrent tiles on WASM — see tile_concurrency (onnx feature).

Functions§

max_wasm_patch_edge
Largest patch edge that fits WASM_MAX_PATCH_ACTIVATION_BYTES for a network costing bytes_per_voxel per patch voxel.
patch_bytes 🔒
Heap one cubic patch of this edge holds.
tile_bytes
Heap one tile of this config holds while it runs, for a network of this cost (ModelSpec::tile_cost): its patch, rounded up to the network’s divisor as tile_patch_size does, times the network’s bytes per patch voxel. u64, because p³ · bytes overflows a 32-bit usize for large patches.
tile_patch_size
Padded input-patch size per axis for a config and the net’s size_divisor: core + 2·halo rounded up to a multiple of divisor. Isotropic, so one value serves all axes. Callers use this to build a reusable OnnxModel::plan_for plan of shape [1, 1, p, p, p].
tiles_within_wasm_budget
How many tiles of this config fit a browser’s share of heap — at least one, however big the patch — for a network of this cost (ModelSpec::tile_cost).
wasm_tiles_in_flight
Tiles a WASM host with threads workers keeps in flight: the threads, capped by tiles_within_wasm_budget. This is what tile_concurrency (onnx feature) returns on WASM; it is callable anywhere, so a host estimating a browser run’s memory can use the same count.