Module geometry

Module geometry 

Source
Expand description

2026-09-26: The vision-token counts the geometry leg predicts, from an image’s size, the patch and merge sizes, and the serve’s declared area bound.

Owner: bench, vision. Invariants: none beyond the types.

Constants§

ABS_MAX_DIM
2026-09-26: The long-side ceiling applied with or without an area bound; a copy of ABS_MAX_DIM in model-layers/src/vision_preprocess.rs. It binds when an area bound admits a long side over 4096, such as a 64×8192 strip.
FALLBACK_MAX_DIM
2026-09-26: The engine’s long-side clamp when no area bound is given; a copy of FALLBACK_MAX_DIM in model-layers/src/vision_preprocess.rs.

Functions§

expected_vision_tokens
2026-09-26: Merged vision tokens for a w × h image at native size.
expected_vision_tokens_bounded
2026-09-26: Merged vision tokens for w × h under a declared area bound.
served_size
2026-09-26: The (w, h) the server encodes for a w × h source.
snap
2026-09-26: Snap a side to the grid as the engine’s target_size_for does at scale 1: max(round(side / grid), 1) * grid. f32::round rounds half away from zero, so 336 snaps to 352 at grid 32 (the_rounding_mode_is_pinned).