Repository navigation
dsv41 metal: TF_DSV41_ROUND_PROF times each decode round and the drafter's passes (stacked on #1720) - #2951
Conversation
891606d to
1eeb70e
Compare
|
Thanks @gilby. The profiler is cleanly off by default: the target and the pass hold null pointers,
These five all sit on #1720 and touch the same few fields, so they'll land in this order, each rebased on the one before: #2951 (the profiler, to read the others' receipts), #2950 (opt-in), #2954, #2953 (on #2951, so
|
|
Thanks. At head
At this head on an M5 Max: |
|
Thanks @gilby. Both fixes at
The code is ready. What's left:
One small thing, not blocking: This still lands first after #1720. With #2953 closed, the order is #2951, #2950, #2954, #2973, #2983, then #2952, so that #2952's cost table is measured on the final kernels.
|
|
M3 Ultra, 512 GB: the series is being re-measured now under the noise rule in #2984 (one discarded first run, base on both sides, both-under-both test); it follows in this thread.
Summary: with the profiler off (the default) this head matches base in every cell of the series: off over base, mean over mean, 0.998 to 1.001; with Cells under 0.98 of base: none. Profiler off and on against base ( Order as run: base 1, off 1, off 2, base 2, on. Ratios are over the base run named in the column;
Method as run: each cell is a fresh server started just before it; a thermal-pressure check ( Per-phase summaries printed by the round profiler at shutdown, quoted verbatim (ms, mean / p50 / p95). M5 Ultra, 512 GB M5 Ultra, 1 stream, plain rounds ( M5 Ultra, 1 stream, drafted (default): M5 Ultra, 4 streams, M5 Ultra, 4 streams, default: What the blocks show:
Not run: a profiler off / on pair for the 2- and 3-stream cells; the profiler summaries on a base arm (base has no profiler); the checkpoint's pinned revision is not recorded. Raw JSON, server logs and driver scripts: https://gist.github.com/gilby/93abf0522daeab023989979a54d78493 |
|
Thanks @gilby for the M5 Ultra receipt. With the profiler off, this head is 0.998 to 1.001 of base (mean over mean). With These series came before the discarded first run in #2984's noise rule. Base ran first, so any first-run lift favours base, not this branch. We'll take the M5 Ultra numbers as they are, with no need to rerun them. The summaries are already useful. At four plain streams a round takes 35.5 ms, and 95% of that is waiting on the GPU. Prepare, encode and choose add up to under 2 ms. So the multi-stream time is GPU work, which is where #2954 and #2973 aim. What's left:
The empty summary at
|
|
M3 Ultra, 512 GB: the receipt promised above, run on 2026-11-13 under the noise rule in #2984 (one discarded first run per series, base on both sides, both-under-both test).
Summary: with the profiler unset (the default) this head is level with base on this chip: aggregate decode this over base, mean over mean, is 0.998 to 1.003 in all 20 cells (16 Cells under 0.98 of base: none. Profiler unset against base: aggregate tok/s ( Order as run: base 1, this 1, this 2, base 2. Ratios: this 1 over base 1, this 2 over base 2, and mean over mean. Verdict by the #2984 rule: slower only if both this runs are under both base runs and the mean gap is over 1%, faster the mirror image, otherwise within noise. Verdicts: 0 faster, 0 slower, 20 within noise, out of 20 cells.
End level key: Nom = Nominal, Mod = Moderate, Heavy = Heavy, Exactness: token hashes are equal across all four runs in every one of the 20 cells (all reps of each cell compared), with 0 failed requests and 0 Profiler on ( Two single servers on this head with the profiler enabled, run after the bracketed series: one at 1 stream (temperatures 0 and 1,
Token hashes of the profiler-on servers equal those of the off runs in all 8 cells, 0 failed or unequal comparisons. Two of the lines the profiler prints at shutdown, verbatim (ms, mean / p50 / p95; the 1-stream server and the 4-stream server): Discarded, retried and flagged cells
Method as run: each cell is a fresh server started after the previous one was stopped and a 60 s settle, and a cell starts only when the powermetrics thermal sampler reports Nominal (the driver polls every 30 s); the level is recorded again at the end of the cell. One run per series is discarded and not in any table, base is on both sides, and the series are per stream count and temperature ( Not run: a repeat of the profiler-on servers as a bracketed series; the checkpoint's pinned revision, the macOS version and the toolchain versions are not recorded; kernel-contract runs are not part of this series' data. Raw JSON, server logs and driver scripts: https://gist.github.com/gilby/b7971860d74a10478600592f099299f8 |
|
New head:
Your asks:
M3 Ultra, 1 stream, default drafts: M3 Ultra, 4 streams, default drafts: What these show on the M3 Ultra: one plain row takes 28.3 ms a round, of which 27.4 ms is waiting on the GPU; drafted rounds take 38.0 ms at 2 rows, 46.5 ms at 3-4 and 64.2 ms at 5-8; at four slots a plain round of 3-4 rows takes 46.5 ms with 44.8 ms of wait, and prepare, encode and choose stay under 2 ms. As on the M5 Ultra, the multi-stream time is GPU work. Still owed: the 1 stream plain summary (
At |
|
M3 Ultra, 512 GB: the profile summaries with
1 stream, plain rounds. The summary the server printed at shutdown, verbatim (ms, mean / p50 / p95; one block, rounds 1 to 2600): 4 streams. The periodic summary covering rounds 1 to 4096, verbatim: The shutdown block of this server covers only the last 28 rounds (rounds 4097 to 4124), because the summary at 4096 rounds had already been printed; verbatim: Reading them: in the 1-stream block one plain row takes 28.406 ms a round, of which 27.460 ms is waiting on the GPU (2600 rounds). In the 4-stream block the rounds with four slots of 3-4 rows take 46.639 ms on average (1496 rounds), of which 44.935 ms is waiting on the GPU; prepare, encode and choose together are 1.70 ms. The 28-round block, all at 4 slots of 3-4 rows, reads 55.239 ms a round with 52.750 ms of it waiting on the GPU. Raw JSON, server logs and drivers: https://gist.github.com/gilby/7eae3dd8607156d2bcbe11e5313c8e06 |
|
I’m preparing the dense MTP work for #2485 as an unpublished local branch. ATC reports conflicts in |
|
Yes — let's coordinate one shape. Our settings can move to whatever registry/test shape #2485 needs; we are not attached to how they read. What we have in that shared area: our #2951 adds five Landing order: #2485 first. Once it is pushed and in, we rebase #2951, #2952 and our other drafts onto it, keep yours' signatures, and append our rows in your shape. If you can tell us the row shape and where the test cases live when the branch is up, we will prepare the rebase against that so there is no second conflict when you are ready to land. Our served runs all have these settings unset, so the landing order does not move any number we have reported. |
|
Thanks; that sequencing fits our planned stack: the shared-lanes prerequisite PR will target The local MTP change adds this environment rule: .{ .name = "TF_MTP_TREES", .scope = .cuda, .kind = .flag, .forms = "0 or 1 (default 0; opt in to sampled MTP tree drafting)" },Its valid-value cases are in .{ .name = "TF_MTP_TREES", .raw = "0", .n = 0 },
.{ .name = "TF_MTP_TREES", .raw = "1", .n = 1 },The branches are still local while we finish coordinating the other ATC overlaps, so there is no public branch ref yet. We’ll share the branch when preflight clears; the 2K TTFT regression will remain explicit in the draft PR. |
|
Marked ready for review as-is at Coordination note vs
|
|
Measured side-by-side M5 Ultra (512 GB) comparison on common base
What the comparison shows & recommendation
Full 7-arm logs, summary JSON, and the tested |
a6a9a1e to
040b840
Compare
|
The current In scratch I retained the compatibility export to zig build test-dsv41-metal test-environment-host \
-Dcpu=apple_m1 -Doptimize=ReleaseSafe -j2 --summary allThis validates the compile repair and queue-close regression. It leaves the release-model timing results on their original receipts. Igor Lessio - AIFLOW LABS |
|
Thanks @gilby for the detailed profiling work. Our last rebase of this branch removed the Two small notes on the profile output, neither blocking. With
|
|
@gilby The
|
|
Thanks @gilby. The Metal 4 export and both profiling-output fixes are present. One issue remains in the optional FP8 timing run: the expanded default layer list includes layer 21, which has no indexer projection under the default configuration, but the shape list unconditionally unwraps that weight. Could you add the indexer shape only when its weight exists, while still timing the other projections, and add a small host regression for a non-index layer?
|
|
Fixed in commit
Verified on this commit: |
|
Thank you, @gilby. The optional indexer projection is now added only when present, while the other six timing shapes remain. The focused host case checks both forms, and the timing run uses that same helper. The compatibility export and both earlier profile-output fixes are present too. No further source correction is requested. What's left is the device comparison on the integrated profiler: with
|
|
Device comparison for Checkpoint & Configuration
1. Metal 3 (
|
Cell (N, T) |
Metal 3 main vs #2951 agg (per-stream) |
Metal 4 main vs #2951 agg (per-stream) |
|---|---|---|
code N=1, T=0 |
73.8 (73.8) vs 73.7 (73.8) |
74.7 (74.7) vs 74.6 (74.6) |
code N=4, T=0 |
150.2 (39.5) vs 150.1 (39.5) |
151.9 (40.0) vs 151.8 (40.0) |
chat N=1, T=0 |
74.9 (75.0) vs 74.9 (75.0) |
75.9 (75.9) vs 75.8 (75.8) |
chat N=4, T=0 |
146.4 (39.0) vs 146.4 (39.0) |
148.2 (39.5) vs 148.0 (39.5) |
code N=1, T=1 |
88.6 (88.6) vs 88.6 (88.7) |
89.8 (89.8) vs 89.7 (89.7) |
code N=4, T=1 |
109.0 (28.2) vs 109.0 (28.2) |
109.8 (28.5) vs 109.8 (28.5) |
chat N=1, T=1 |
79.3 (79.3) vs 79.3 (79.3) |
80.3 (80.2) vs 80.2 (80.2) |
chat N=4, T=1 |
110.0 (28.9) vs 110.1 (28.9) |
111.0 (29.1) vs 110.9 (29.1) |
|
Thanks @gilby. The new Metal 3 and Metal 4 release-model comparisons answer the remaining request: profiling off matches main, and the four direct cases still match with profiling on. The optional-indexer guard, compatibility export and both output fixes remain present. The relevant Metal source matches the measured integration, and this head merges cleanly with current main. No further source correction or duplicate device run is requested. Exact-tree CI remains before landing.
|
…ter's passes, summed by launch shape
…ts of one row, five layers and GB/s per shape
…and each summary covers its own window
…oked since the last one The summary at close followed a periodic one even when no round had been booked in between, and printed only a header such as "rounds 4097 to 4096 (0 rounds; ...)". write now returns at once when no round was booked since the last summary. A test writes a fresh profile (nothing) and one after a round (its header); it found 104 bytes before the change.
…ter's passes, summed by launch shape
e71417a to
cbf8254
Compare
|
Thank you @gilby. This is merged into main with your commits under your own name, so you're listed as a TensorFold contributor. It ships in the next release, credited to you in the changelog and the release notes. |
What this changes
DeepSeek-V4.1 on Metal has no way to see where a decode round's time goes.
TF_DSV41_ROUND_PROF=1(default off, read once at load) times every round: host prepare, encode, wait and choose, each command buffer's span on the GPU clock and the idle time between buffers, and the drafter's ingest, propose and finish, then logs mean, p50 and p95 grouped by slots, rows and drafted or plain. Unset, the target and the pass hold null pointers, no clock is read, and tokens are unchanged. The release-layer timing test (time-dsv41-metal-real) also covers 1 to 16 rows, four slots of one row, five layers, and GB/s per FP8 shape.a43ad7b98); this adds two commits (the profiler; the timing test). One commit since review:86050b1ee(no summary is written when no round was booked since the last one).atc overlap --json: run on this head against main; incomplete (its time and pull-request limits). Nine textual conflicts with other open pull requests, each in one file:CHANGELOG.mdor the settings tables inplatform/environment.ziganddocs/environment.md(qwen27: serve the 27B pair, refuse what a pair cannot keep, and die with the peer #1434, Vulkan: qmm_q4_tile_rows computes four rows and two columns of a prompt chunk per thread, 3.6% to 33% less run time on an M1 with the same logits (stacked on #2016) #2017, Ling-3.1-flash on CUDA, on one or two GB10s #2340, Flash Next TP=2 on CUDA: head and rollback graphs replay, and one-row split lanes skip the interleave copies #2837, CUDA EXL3 grouped experts: launch and size storage at the caller's tile and pair count #2843, Nemotron 3.5 Bolt on CUDA: the shared expert runs on the side stream in decode windows #2847, server: --execution-witness serves a read-scoped snapshot of what runs, or why it is unknown #2901, server: "execution_witness": true binds a reply to the witness at admission and at its end, with its prompt, resolved request and tokens #2958, flashnext cuda: the opt-in --tp 2 decode graph takes the dense split and keeps its graph across drafted verifies #2982). No shared source logic.Checks on this head
86050b1eepython3 tools/zig/lean_check.py, on the base and on this head: 345 and 345, 0 new (tools/pr_check.py0 errors, 0 warnings).zig build test-dsv41-metal-all: 9/9 steps, 39/39 tests.zig build test: the newround_proftest (a fresh profile writes nothing; one round writes its header) failed before86050b1eeand passes after; the only other failure in the full suite isdashboard_test, which fails the same way on this base and was fixed on main by tests: the dashboard page's test runs on every OS, and expects only tiles the page has #2946.CHANGELOG.md), and per the order in DeepSeek-V4.1 on Metal: decode and prompt speed on M3 Ultra and M5 Ultra, token-exact (gate and order for the drafts) #2984 it is rebased onto the PR before it at landing.--no-draftsprofiled summary (the 1-stream drafted and 4-stream summaries are in the M3 receipt comment); CUDA (the CUDA server never reads the setting).Receipt
TF_DSV41_ROUND_PROF=10.997 to 1.004. Receipts: https://gist.github.com/gilby/93abf0522daeab023989979a54d78493 (M5 Ultra) and https://gist.github.com/gilby/b7971860d74a10478600592f099299f8 (M3 Ultra), measured at3eb04181e;86050b1eechanges only what the profiler writes at close when nothing was booked.TF_DSV41_ROUND_PROF, a flag, default off, Metal only, with its row inplatform/environment.ziganddocs/environment.md.token_sha256equal across every arm of every cell on both chips, profiler on and off, 0 failed and 0--alone/--serialmismatches.bench_openailevel on both chips (M3 Ultra 0.999 to 1.001); tables in the receipt comments.3eb04181eon dsv41 metal: the lane target, the prompt cache and the native server over Metal #1720'sa43ad7b98;deepseek-ai/DeepSeek-V4.1-Flash-1017release weights at revision1bae0e1088993b9b82de08f59de5be5a34e42170; M5 Ultra 512 GB and M3 Ultra 512 GB; Zig 0.17.0; tests on an M5 Max.Checklist
"draft": false, a resumed prompt equals a fresh one, and concurrent equals solo (synthetic weights, and on the release weights in the receipts).--drafter, no slower than without it, greedy and sampled