Skip to main content

check_wasm_patch_fits

Function check_wasm_patch_fits 

Source
pub fn check_wasm_patch_fits(
    cfg: &TileConfig,
    cost: &TileCost,
) -> Result<(), OnnxError>
Expand description

Refuse a tile config whose patch is too big for a WASM heap even on its own.

Running such a patch does not fail cleanly. Near the ceiling the module stops making progress without an error (#89), so it is refused up front with the largest core that would fit. cost is the network’s (ModelSpec::tile_cost): its size divisor, which tile_patch_size rounds the patch up to, and its bytes per patch voxel. The tiled drivers call this on WASM before building a plan; it is callable anywhere, so a native host can check a config before handing it to a browser.