Module gdn_flags

Module gdn_flags 

Source
Expand description

2026-09-25: GDN / SSM decode-path flags, resolved once per process from the serve command line or, failing that, the environment.

Owner: model-layers (qwen3 SSM). Invariants:

  • The flags are one process-wide cell: the first of set_from_cli or flags() fixes them, and later calls see the same value. A model loaded later in the same process keeps that resolution.
  • The server publishes h_f16_pool only together with h_f16 (both come from ssm_h_dtype_bits), and the environment fallback never sets it.

The flags select kernels and are coupled: the FP16 h-state twins exist only on the fused-norm arm, so h_f16 without fused_norm would reach an FP32-only kernel. The server’s argument validation rejects that pair before load. When the command line gives any GDN flag, the server publishes the whole cell through set_from_cli; otherwise flags() reads the environment on first use.

Structs§

GdnFlags

Constants§

MAX_F16_TWIN_DFLASH_GAMMA
2026-09-25: The largest --dflash-gamma whose verify width still has an FP16 twin.
MAX_F16_TWIN_K
2026-09-25: The widest chain-verify K with an FP16 h-state twin (gated_delta_rule_wy{5..16}_f16).
UNRESOLVED_DFLASH_GAMMA
2026-09-30: The γ of a DFlash serve when neither --dflash-gamma nor a drafter block size decides it.

Functions§

default_dflash_gamma
2026-09-25: The DFlash gamma for a drafter of this trained block size, when no --dflash-gamma was given.
flags
2026-09-25: The resolved flags, falling back to the environment on first use.
gdn_fused_norm_enabled
2026-09-25: --gdn-fused-norm (environment fallback: METRALE_GDN_FUSED_NORM=1).
gdn_woa_enabled
2026-09-25: Write-on-accept K=4 batched verify. Off unless METRALE_GDN_WOA=1. With it off the parent wy4 kernel runs, the fold in woa.rs returns Ok(false), and the accept path (async_chkpt.rs) restores h for every K.
resolve_dflash_gamma
2026-09-30: The one resolver of a DFlash serve’s γ: --dflash-gamma when pinned, else default_dflash_gamma of the drafter’s trained block size (DflashConfig::effective_block_size), else UNRESOLVED_DFLASH_GAMMA. The server resolves it once before the preflight reserve (serve_phases::apply_dflash_gamma); the reserve, the pools the build sizes and the scheduler all read that value.
set_from_cli
2026-09-25: Publish the command line’s resolution. Call once, before the model builds.
ssm_batched_recurrent_enabled
2026-09-25: --ssm-batched-recurrent (environment fallback: METRALE_SSM_BATCHED_RECURRENT).
ssm_h_dtype_bits
2026-09-25: Decode --ssm-h-dtype into the two h-state bits it publishes: (h_f16, h_f16_pool).
ssm_h_f16_pool_enabled
2026-09-25: --ssm-h-dtype f16-pool: h pools sized at 2 bytes per element. Implies ssm_h_fp16_enabled; ssm_h_dtype_bits guarantees that where the flag is decoded.
ssm_h_fp16_enabled
2026-09-25: --ssm-h-dtype f16 or f16-pool (environment fallback: METRALE_SSM_H_FP16).
verify_exact_enabled
2026-09-25: --exact-verify given: the MTP-verify pass runs the sequential-decode-exact chain. See GdnFlags::verify_exact_active.