Skip to content

qwen cuda: opt-in reuse of bound startup probe records (TF_X_PROBE_CACHE, from #6065) - #6400

Open
ashhart wants to merge 1 commit into
mainfrom
lead/adopt-6065-probe-cache
Open

ashhart wants to merge 1 commit into
mainfrom
lead/adopt-6065-probe-cache

Conversation

@ashhart

@ashhart ashhart commented Dec 5, 2026

Copy link
Copy Markdown
Owner

Adopts part of #6065 by @jojomondag: the startup probe cache from its warm start, as a default-off switch. The commit keeps their authorship.

What it does

TF_X_PROBE_CACHE=1 lets native Qwen3.5/3.8 on CUDA reuse its startup probe record instead of probing again. The record's key binds the code, checkpoint, device and process settings, the resolved kept-state policy, and the drafter actually declared through the API (its config, index and shard identity), so callers that do not name the drafter on the command line are covered. The record's magic, key, checksum and a finite positive rate must all check out before reuse; anything else runs the original probe. TF_X_PROBE_CACHE=verify runs the fresh probe, logs a comparison and uses the fresh result. TF_X_PROBE_CACHE_DIR optionally sets the cache directory.

Default and exactness

Off by default; 0, 1 and verify are accepted, anything else is refused at startup. Unset, nothing changes. On, a reused record holds the values the probe stored for the same identity, so tokens should be the same; the device run below has to confirm that skipping the probe's prefill and warmup leaves tokens and kept states unchanged.

Checked (host only)

  • zig build test-qwen35-probe-cache-host: 20/20 pass. Covered: fresh, cold and warm identity and rate bytes with a recording probe; changed keys; corruption; verify returning fresh values; a changed declared drafter, config or policy; and compiling the real native Qwen caller.
  • zig build test-environment-host 44/44, and python3 tools/zig/env_names.py --check reports no problems.

Still needed before it can be turned on

A CUDA device run, which we do ourselves:

  • build on the device with nvcc;
  • equality on a real checkpoint with conversation learning off and on: cache miss, hit and verify, an unchanged restart and a changed drafter, config or policy, with fresh and cached probe state equal and fresh and restored tokens and logits equal;
  • an A/B run against main and against the same build with the switch unset, timing startup and the first reply.

No speed is claimed here.

  • Synthena

Adopt the independent default-off slice from #6065. Keep the existing arithmetic and strict output checks; device compilation, exactness and performance qualification remain separate.
@ashhart ashhart added kind:perf Classified by Synthena as performance improvement synthena:needs-device Initial diff review passed; waiting for device and slowdown check before READY labels Dec 5, 2026

This branch has not been deployed

No deployments
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

kind:perf Classified by Synthena as performance improvement synthena:needs-device Initial diff review passed; waiting for device and slowdown check before READY

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants