Skip to content

perf(engine): FREETOKEN_GRAPH_UPLOAD switch; #697's capture-time upload costs 1-2% decode - #97

Open
gdevenyi wants to merge 1 commit into
5080/48-logprob-read-isolatefrom
5080/49-decode-fix
Open

gdevenyi wants to merge 1 commit into
5080/48-logprob-read-isolatefrom
5080/49-decode-fix

Conversation

@gdevenyi

Copy link
Copy Markdown
Owner

Adds FREETOKEN_GRAPH_UPLOAD (default 1, as upstream) so FlashML-org#697's capture-time cuGraphUpload can be turned off. Production sets it to 0 in run-freetoken.sh. Stacked on #96.

Why

A graph uploaded at capture replays with a median 0.51 µs gap between kernels instead of 0.19 µs. That holds on all four streams, from nsys over 200 decode steps. Kernel counts and API calls are identical, and kernel busy time is even 0.37 ms lower. A decode step has about 1090 kernels, so the gaps cost +0.2 to 0.45 ms per step, about 1-2% of decode.

copy64: verbatim copy from a 64K context, same output hash in every arm GPU ms/step tok/s
upload on (cc13fec) 20.97 47.56
FREETOKEN_GRAPH_UPLOAD=0 20.54 48.56
c23d2d5 (before FlashML-org#697) 20.51 48.62

A per-step fit (time = a + b·misses) gave fixed cost 12.95 ms before FlashML-org#697 and 13.36 ms after, with the same per-miss slope. FlashML-org#739's larger slot rows and FlashML-org#700's slot pools cost nothing measurable. Data: ~/projects/FreeToken-bench/steptime/.

Risk

FlashML-org#697 uploads at capture to avoid a first-launch block under PLE wait-sync. This branch already runs the PLE graph fill on a filler thread submitted before the launch (fork #65 / 4f2528f) and recycles the readback events (5221ce0, 7bb5359). c23d2d5 served production without the upload. With the upload off: test_ple_disk_fill_order.py, test_ple_disk_no_graph_fence.py and test_graph_upload.py pass (10), and 3 cold starts of the production launcher answered the first request in 1.24 s. More than 10 cold starts during the investigation also never hung.

🤖 Generated with Claude Code

https://claude.ai/code/session_01Td2gieja9Da2rPTN17Z846

… FREETOKEN_GRAPH_UPLOAD

On Qwen3.8-Flash / RTX 5080 a decode graph uploaded with cuGraphUpload at capture (FlashML-org#697) replays
with ~0.5 us instead of ~0.2 us between kernels: +0.19 ms/step (-1% decode), +0.43 ms with
--moe-collect-stats. FREETOKEN_GRAPH_UPLOAD=0 keeps the driver's first-launch upload; default on.

Assisted-by: Claude Opus 5.5
Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01Td2gieja9Da2rPTN17Z846
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant