Commit Graph
4 Commits
Author SHA1 Message Date
lotherk 4ad0206b1f serve: capture the verify windows up front, not on the first request
cudaGraphInstantiate allocates device memory for each window size's exec and the
exec is never freed (measured ~22-26 MiB per size on a GTX 1070 Ti, 2026-10-15).
serve captured each size lazily, on the first request that used it, so that
memory came out of - and could outrun - the reserve the auto-cache had been sized
against.  A serve planned down to its last ~150 MiB therefore captured the sizes
its first requests asked for and then failed the next

    strata serve: verify: instantiate: out of memory

mid-request, which took the engine and the front end down with it (the container
restarted).  This is not the sampler or the Qwen3.6 port: the DRY work adds ~4 KB
of device arrays and a 128 KB history row, and the lazy capture predates both.

Every size 1..max_t the serve path can ask for is now captured right after the
verifier is bound (after set_split / set_pcie_mode, which the recorded graph
depends on).  That makes the cost part of what the serve free-VRAM check sees and
bounds it before any request runs: a size that does not fit is reported at
startup, naming the knobs that make room, instead of killing a request.

Seen on kontron.local: a GTX 1070 Ti (sm_61) serving Flash-Next Coder IQ1_M with
--ctx 131072 --vram-cap 7680.  There the window graphs need ~135 MiB and the plan
left 135 MiB free; --vram-reserve-mib 700 (which skips #496's lowering to 300)
leaves ~630 MiB and all six fit.  The cap itself is honoured: the blocker held
back the 424 MiB it should.
2026-10-15 09:29:23 +01:00
lotherk c8c3ca492c Sampler: DRY anti-repetition penalty, exposed end to end
The sampler chain gains llama.cpp's dry stage (penalties -> DRY -> top_k -> ...): a token that would extend a
repeat longer than dry_allowed_length over the last dry_penalty_last_n history tokens loses
dry_multiplier * dry_base^(repeat - allowed_length), with tokenized restart sequences capping the scan.

- kernels/cuda/sampler.cu: dry_window/dry_build/apply_dry in the greedy, old, one-block, split and coupled
  penalize kernels; the DRY window is the same history row the penalties count, clamped to kDryWindowCap=512;
  the membership bitmap spans the wider of the two windows and gates both.  Off (the default) the neutral path
  is unchanged: shmem 0, the cluster argmax still runs, the parity fixtures pin every path against a host
  reference (sampler_parity, 19 fixtures).
- include/strata/kernels/sampler.hpp: the dry_* fields, DryBreakers (device flat/off), dry_enabled.
- verify / mtp: Verifier::set_breakers and MtpDrafter::set_draft_breakers thread the tokenized breakers to the
  head sampling and the captured coupled-draft graph (stable device arrays).
- generate.cpp (engine): dry_multiplier / dry_base / dry_allowed_length / dry_penalty_last_n / dry_breakers GEN
  keys; the breaker arrays are allocated once at the cap on the head device, the request refills them; a
  DRY-only request still stages history (the wider of the two windows).
- front end: --dry-multiplier / --dry-base / --dry-allowed-length / --dry-penalty-last-n / --dry-breakers
  defaults and dry_* / dry_sequence_breakers request fields; the front end tokenizes the restart sequences
  (the engine has no tokenizer) and sends them as ids.  The defaults are llama.cpp's: multiplier 0.8, base
  1.75, allowed length 2, window 256, breakers newline, colon, quote, asterisk when unset.
2026-10-14 22:44:58 +01:00
Robert KarlandClaude Fable 5.1 328501fc9e Qwen3.6 step 3: the verify window at hc = 1 - plain reads and writes over the T rows, k from the file
Verifier::record_window branches on g.hc == 1 in pre (plain_norm_rows for attn_norm, the residual add then
plain_norm_rows for post_attention_norm over the group's rows), post (R += ffn out in place, then the control
vector) and the head (output_norm over the T rows; the canonical head goes through lm_head, which branches the
same way).  The hc_* tensors are resolved only at hc > 1, no pending write is folded, STRATA_FUSE_HEAD_GR
applies only there, and a wired PLE is refused.  The init refusal `ss.k == 10 && fused_gr_supported && ...`
becomes verify_geometry_supported(g, k, why): the fused GR shape only at hc > 1, k == expert_used_count from
the file (8 for Qwen3.6, 10 for Flash-Next), state 128 / conv 4; a free function so the negative case
(top-10 on an 8-expert file) is a unit test and the message names both numbers.  Rows 141, 142.

Co-Authored-By: Claude Fable 5.1 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_017tPVMg2wGSNR1KANEiUtwr
2026-10-11 11:54:24 -07:00
Robert KarlandClaude Fable 5.1 12a7825605 Import Strata at 6f32ec0 (upstream snapshot, unmodified)
Source: https://github.com/Niko1221/Strata, commit 6f32ec070f23ced9f50e704d854d775da52591ab
(engine 0.1.39, MIT). Every file is as upstream published it; later commits
show exactly what this fork changes.

Co-Authored-By: Claude Fable 5.1 <noreply@anthropic.com>
2026-10-04 12:55:44 -07:00