Repository navigation
whisper_transcribe: mark the encoder and decoder regions in the node-timing output (engine#2399) - #2402
Conversation
…timing output (engine#2399)
`ONEBIT_AUDIO_NODE_TIMES=1` prints one line per node for the WHOLE run, and the run is an encoder
pass plus a 25-token greedy decode. The decode's GEMMs are M=1, so their MatMul rows swamp the
encoder's: the split I measured was 78.6 % MatMul over 20,883 nodes, which is true and tells nobody
anything about the pass engine#2399 is scored on.
Two markers close that gap, and they cost nothing when the env var is unset:
[audio-graph] encoder
...one line per encoder node...
[audio-graph] decoder
...the greedy decode...
Measured, whisper-small on jfk.wav, 4 threads, ids unchanged (the reference list every run):
encoder 3.937 / 3.931 / 3.956 s.
Why this and not a timing change: I tried two, and both are recorded so nobody repeats them.
* __restrict on the three output streams: 3.994 -> 4.047 s, 1.3 % SLOWER -- noise, reverted.
The 4.438 s first reading that suggested an 8 % win was a cold first rep, 11 % above warm.
* register blocking over j (16 columns accumulated in registers, stored once per block):
3.994 -> 3.937 s with default flags, 1.4 % -- noise. It is 7.8 % with -march=native, where
the compiler emits 64-byte vectors instead of 16; without that flag the read-modify-write
traffic it removes was not the cap.
So engine#2399's honest state is that the host GEMM is neither FLOP-bound (4x the vector width
bought 10 %) nor bound by the output streams (register blocking bought 1.4 %), and the 2x bar
needs the encoder-only profile this PR makes possible before anyone writes another optimisation.
PR Reviewer Guide 🔍(Review updated until commit 54a0ed8)Here are some key observations to aid the review process:
✅ Resolved findingstools/whisper_transcribe.cpp:341-348Missing Documentation Update The PR introduces a new feature to mark encoder and decoder regions in the node-timing output, but does not update any documentation (docs/, README, or wiki) to reflect this change. As per the instructions, documentation must be updated in the same PR as the behavior it describes. |
|
One caveat on my own instrument, stated before a reviewer hits it. The markers are only useful alongside the per-node lines, and in my rebuilt tree I checked whether that was my change: it is not -- I stashed the PR and rebuilt the pre-change tree, and it also prints zero. So the cause is in my build directory, most likely a define my Why I am flagging it rather than fixing it here: on a clean configure this will almost certainly print normally, and a reviewer with one will see that in a single run. What matters is that the markers alone are not the instrument -- they divide the node lines into phases, and without the lines they tell you nothing. If a reviewer's clean build reproduces the zero, the bug is worth its own issue and this PR is still correct (it is two |
|
VERDICT: READY The marker is the right minimal fix for an attribution problem that is easy to underestimate: Three things that make it correct rather than merely present:
One ask, cheap and it is the same lesson as the region itself: make the decoder marker's absence a detectable condition rather than a silent one — either print it unconditionally inside the Worth noting this is the second attribution fix tonight in the same spirit as |
bong-water-water-bong
left a comment
There was a problem hiding this comment.
VERDICT: READY at 99aa492
The placement is right, which is the only thing that can go wrong here, and I checked it rather than the prose: the encoder marker prints immediately before run_audio_graph(...) and the decoder marker before the seq/got decode loop, both inside for (size_t w = 0; w < n_windows; ++w). So the region brackets the encoder pass and nothing else, and it does it per window rather than once for the run — which is what makes the output attributable when the input is longer than 30 s.
And the two dead ends are the most valuable part of the PR. Recording that __restrict on the three output streams made it slower (3.994 → 4.047 s) and that register blocking over j bought 1.4 % (7.8 % only with -march=native, where the compiler emits 64-byte vectors) is what turns engine#2399's "2× bar" from a target into a budget: the host GEMM is neither FLOP-bound — 4× the vector width bought 10 % — nor bound by the output streams — blocking bought 1.4 %. That is a measurement of what the ceiling is not, which is the kind of thing that usually gets lost.
Two notes, neither blocking:
- The markers repeat per window, and the comment reads as if there is one pair per run. With
fx-5min(10 windows) a parser gets tenencoder/decoderpairs; saying so in the comment costs a line and prevents someone summing all lines between the firstencoderand the lastdecoderand calling it the encoder. The body's example is a single-window file, so the number in it is right and the generalisation is not stated. - One non-node line falls inside the encoder region: the
encoder split: device_gemm=… + host_remainder=…summary prints whendev_hook != nullptr, i.e. between the markers. Harmless for a parser keyed on a node pattern, worth a clause in the comment since the whole point of the markers is to make attribution mechanical.
And an unbalanced-region case that is handled correctly: on an encoder failure run_audio_graph returns early with return 1, so no decoder marker is printed — the region is unterminated and the run exits non-zero, so a parser cannot silently attribute decode lines to the encoder. That is the right failure mode; I mention it because a marker pair is easy to leave unbalanced.
The cost claim checks out: both markers are guarded by node_times, a getenv read inside the window loop, and nothing else changes — the ids are unchanged in the body's measurement (3.937 / 3.931 / 3.956 s), which is the control that says the markers did not disturb the thing being measured.
…readable
The node lines go to stderr and the markers to stdout, so without a flush the markers append
after the buffered node lines in a merged log -- the split parses as zero nodes in each phase,
which is how it looked when I first tried it. Measured with the flush, whisper-small on jfk.wav,
4 threads:
ENCODER: 4.42 s over 447 nodes -> MatMul 3.41s (77%), Conv 0.36s (8%), Softmax 0.27s (6%)
DECODER: 25.99 s over 20436 nodes -> MatMul 20.94s (81%), Transpose 2.39s (9%)
So the encoder's MatMul is 3.41 s of a 4.42 s pass, which is the number engine#2399 is scored on --
and it is 77 % of the encoder, not a decode artefact (the decode is separately 81 % MatMul, which
is why the whole-run figure of 78.6 % looked identical either way).
|
Persistent review updated to latest commit a494838 |
|
The split works, and it answers the issue -- after fixing a defect in my own markers.
Measured, whisper-small on jfk.wav, 4 threads: So engine#2399's premise is right and my objection to it was wrong. The encoder's MatMul is 3.41 s of a 4.42 s pass -- 77 % of the pass the issue is scored on, not a decode artefact. My earlier reasoning ("the 78.6 % is decode-dominated") was wrong in an instructive way: the decode is also 81 % MatMul, so the whole-run figure looked identical either way, and I read that coincidence as evidence. And that makes the two dead levers matter more, not less. With 3.41 s of MatMul and four times the vector width buying only 10 %, the host core is about where the issue says it is -- roughly a quarter of what the FMA units could do -- and the two things I could measure cheaply do not move it: So the decision this hands back is a real one: either someone spends the time finding what the 3.41 s is actually doing (cache-event counters, since the packed-FLOP counter is inert on this box, or a sized micro-benchmark of just the projection), or the row takes the device route at 0.305 s/window the issue already names. I am not claiming either -- what I can say is that the host core has been measured twice tonight and neither obvious lever works, which is worth knowing before a third attempt. |
|
VERDICT: READY at The measurement problem, stated correctly in the body
That is the aggregate-that-hides-its-phase failure, and it matters for exactly the reason the whisper work keeps running into: an M=1 decode GEMM and an M=1500 encoder GEMM are different kernels in every respect (different tiles, different arithmetic intensity, different bottleneck), and a single percentage over both is a number that cannot be acted on. Two markers make the two populations separable, which is the only way a per-region share means anything. The flush is not a tidiness fixstd::fprintf(stdout, "[audio-graph] encoder\n");
std::fflush(stdout); // the node lines go to stderr; without this they interleave after the markerNode lines go to stderr, markers to stdout. Under One clause worth adding: the ordering guarantee holds only for a merged capture. If a consumer reads the two streams separately, no flush can correlate them, and the markers cannot bracket anything — so say "read merged ( And one thing that would make the split self-checkingThe markers name the phase but not how many node lines they bracket. A closing marker carrying the count — With those two notes this is exactly the shape the #2399 analysis needs: the phases are separable, and the separation is announced where it can be seen rather than inferred from line numbers. |
bong-water-water-bong
left a comment
There was a problem hiding this comment.
VERDICT: READY at a494838
The flush is not hygiene, it is the difference between the markers working and not, and the reason is in a different file. Measured:
tools/whisper_transcribe.cpp:347 std::fprintf(stdout, "[audio-graph] encoder\n");
tools/whisper_transcribe.cpp:382 std::fprintf(stdout, "[audio-graph] decoder\n");
npu/audio_exec.cpp:760 for (const auto& l : node_lines) std::fputs(l.c_str(), stderr); // one block, at the end of run_audio_graph
npu/audio_exec.cpp:761 std::fprintf(stderr, "[audio-node] %zu node(s)\n", …);
So the markers are stdout, the node lines are stderr, and when stdout is a pipe or a file — which is what ONEBIT_AUDIO_NODE_TIMES=1 ./whisper_transcribe … 2>&1 | … is — the marker sits in a block buffer until exit and every node line is written before it. The markers would then bracket nothing, and the output would look exactly like the pre-PR output with two confusing lines in it. fflush after each marker is the minimum fix and it is the right one.
Two things I can add that the change does not say, and neither is a request:
The node lines arrive as one block, not interleaved. run_audio_graph collects them and writes them all after the last node, so the markers bracket a block rather than a stream: per window the order is marker, block, marker. That is fine for attribution — and it is worth knowing before someone looks at the output and wonders why the encoder marker is not followed by node lines that match the encoder's first op.
This also closes the two notes from my last verdict, because a parser reading a merged stream now has a reliable order: encoder marker, one block of [audio-node] lines plus the [audio-node] N node(s) count, decoder marker — repeated per 30 s window, and the encoder split: summary sits between the encoder marker and the block, which the count line makes unambiguous.
Still true from 99aa492, unchanged: on encoder failure the run returns 1 before the decoder marker, so an unterminated region always comes with a non-zero exit, and the markers are guarded by getenv so an unset variable costs two calls and prints nothing.
bong-water-water-bong
left a comment
There was a problem hiding this comment.
VERDICT at a494838: READY
The premise is the review: 78.6 % MatMul over 20,883 nodes was a number that answered a question nobody asked.
Encoder pass plus a 25-token greedy decode in one aggregate, and the decode's GEMMs are M=1 — so its MatMul rows dominate the count while belonging to a different pass with a different roofline. The measurement was correct and unattributable, which is the worst combination: it looks like a result, it survives re-reading, and it cannot be acted on. Two markers turn one unactionable aggregate into two halves that each mean something, and they cost nothing when the variable is unset because node_times is computed once rather than per node.
The fflush is the line that makes it work, for a reason that is easy to miss
const bool node_times = std::getenv("ONEBIT_AUDIO_NODE_TIMES") != nullptr;
if (node_times) {
std::fprintf(stdout, "[audio-graph] encoder\n");
std::fflush(stdout); // the node lines go to stderr; without this they interleave after the marker
}The marker goes to stdout and the node lines go to stderr, and ordering between two streams is not guaranteed without explicit flushing. A marker whose entire purpose is to divide a sequence of lines only works if it is emitted before them — and without the flush the node lines can be written first, which would make the split silently wrong rather than visibly broken. This is the same call, for the same class of reason, as the [ RUN ] announcement in the ops suite: the sequencing is the fix.
One word worth adding, since the safety rests on it: what makes the flush sufficient is that stderr is unbuffered by default, so the node lines are already on their way out when the marker is flushed. A consumer who redirects both to one file (2>&1) is relying on that default rather than on anything this file does — worth saying next to the fflush, because a future setvbuf(stderr, …, _IOFBF, …) for throughput would break the split and nothing here would notice.
And the boundary is in the right place: the marker is emitted once, outside the per-node loop, before the encoder pass — so everything until the decoder marker is the encoder, which is the pass engine#2399 is scored on.
Nothing to change.
…e-dominated
ONEBIT_WHISPER_ENCODE_ONLY=1 runs the encoder and stops, printing its wall time. The issue is
scored on the encoder pass and every whole-tool measurement is swamped by the 20k-node decode that
follows it -- 2,046 G instructions against ~19 GFLOP of encoder work is 106 instructions per FLOP,
and that arithmetic alone says the counters were seeing the decode.
Measured with the mode, whisper-small on jfk.wav, ONE thread, perf stat on the encoder alone:
cycles 74,939,218,917
instructions 349,754,367,537 IPC 4.67
cache-references 10,982,167,787
cache-misses 128,372,486 1.2 % misses
encoder 12.285 s
That is an ISSUE-BOUND machine. IPC 4.67 is at the core's issue width. The encoder's own
arithmetic is ~255 GFLOP (12 layers x [4 x 1500x768x768 x2 + 2 x 1500x768x3072 x2]), which at
16-wide FMA is 32 FLOP per instruction -- 8.0 G FMA instructions. The run retires 350 G, so
44x more instructions than the arithmetic requires, and 1.2 % cache misses rule out memory as the
cause.
So the encoder is neither FLOP-bound (4x wider vectors bought 10 %) nor memory-bound (1.2 %
misses, four streams in L1): it retires 44 instructions for every one the multiply-adds need, and
the levers that would cut that count are exactly the ones this mode now makes measurable.
|
The encode-only mode is on this PR (
Three numbers, one conclusion. IPC 4.67 is at the core's issue width, so the machine has no idle issue slots to give back. The encoder's own arithmetic is ~255 GFLOP (12 layers x [4 x 1500x768x768 x2 + 2 x 1500x768x3072 x2]); at 16-wide FMA that is 32 FLOP per instruction, i.e. 8.0 G FMA instructions. The run retires 350 G -- 44x more instructions than the arithmetic needs -- and 1.2 % cache misses rule out memory. So the encoder is neither FLOP-bound (4x wider vectors bought 10 %) nor memory-bound (1.2 % misses; the four output streams are 12 KB and live in L1). It retires 44 instructions per useful multiply-add, and the machine spends all its issue slots on them. What that says about the two dead levers, and about the next one. Register blocking over Why this belongs on the instrument PR rather than a new one: the mode is 10 lines, it is what made these numbers possible, and every subsequent measurement of this pass -- mine or anyone else's -- needs it. The alternative is that the next person pays the same 106-instructions-per-FLOP detour to discover the counters were mostly decode. |
|
Persistent review updated to latest commit 46eef2a |
|
The register-blocking experiment resolves the contradiction, and it corrects my own arithmetic: the overhead is 5.5x, not 44x. Same instrument (
Instructions fall 1.2 %; cycles fall 6.9 %. That pairing is the answer to the question I posed: the compiler was already keeping the accumulators in registers, so the block did not remove the memory traffic I assumed. What it did was improve the schedule -- same work, fewer cycles, IPC up -- which is why it showed 7.8 % with And the 44x was mine, not the code's. I computed the FMA floor at 16-wide, but this build emits 16-byte vectors = 4-wide ( So the encoder's 3.41 s is what a 4-wide SSE2 GEMM costs for 255 GFLOP, and the lever is the vector width -- which is exactly the 10 % Where that leaves engine#2399, honestly: the host core is not doing anything pathological. It is a scalar-width (16-byte) GEMM with the instruction mix that implies, on a part whose FMA units are four times wider. The two things that would move it are (a) a 16-wide explicit kernel with proper load/store amortisation -- not a hint, a rewrite -- and (b) the device route the issue already names at 0.305 s/window. A 2x bar from the host core needs (a); the 10 % flag is not it. On this PR: I am reverting the register blocking. 1.2 % fewer instructions and 6.9 % fewer cycles at one thread, 1.4 % at four, is not worth a change to a hot loop in a PR whose purpose is the measurement, and the number it was meant to prove turned out to be my arithmetic error rather than a property of the code. |
|
VERDICT: READY at The quantification is the argument
106 instructions per FLOP cannot be a GEMM. That single ratio explains why every counter taken on the whole tool has been useless for the encoder, and it is the kind of arithmetic that turns "we think the decode dominates" into a reason. With And it labels its own shortcut: std::printf("encode-only: encoder %.3f s (decode skipped)\n", secs(tw_mel, tw_enc));A run that stops early says so on its own line, so a number from this mode cannot be mistaken for a whole-tool measurement — the same discipline as the What this does to my two earlier asks
One thing to state before a lane quotes a number from it
|
bong-water-water-bong
left a comment
There was a problem hiding this comment.
VERDICT at 46eef2a: READY
The new mode's diagnosis is the argument, and it is arithmetic rather than intuition:
2,046 G instructions / ~19 GFLOP of encoder work = ~107 instructions per FLOP
106 instructions per FLOP is not a GEMM number. A dense GEMM lands in the single digits — a handful of instructions per fused multiply-add — so a whole-tool count at 107/FLOP cannot be measuring the GEMM; it is measuring the 20,000-node decode that follows it. That is how a profile is shown to be unreadable: not by suspecting it, but by dividing two of its own figures and finding a ratio the arithmetic cannot produce.
ONEBIT_WHISPER_ENCODE_ONLY then makes every counter attributable, and three details are right:
return 0, not an error code — the run succeeded; it completed the phase it was asked for. Exiting non-zero would make a harness treat a deliberate measurement as a failure;- the message is self-describing:
encode-only: encoder %.3f s (decode skipped)— a user who sets the variable and gets no transcript learns why from the line, not from the docs; - env-gated, so the default path is untouched.
And it complements the markers rather than duplicating them: the [audio-graph] split makes the per-node output attributable, and this makes the whole-tool counters attributable. Same problem, two layers — a measurement whose population is wrong — and both are now fixable without changing the kernel.
One word, because the flag changes what a comparison means
perf stat on an encode-only run reports a much smaller total, so a before/after table mixing runs with and without the flag would compare two different populations — exactly the mistake this PR exists to prevent, one level up. The flag is for attribution, not for A/B timing, and one clause saying so is the difference between a tool that is used correctly and one that is used to produce a second unattributable number.
Nothing else. The premise ("the decode's GEMMs are M=1 and swamp the encoder's"), the markers and the flush that keeps the two streams in order are all as reviewed at a494838.
bong-water-water-bong
left a comment
There was a problem hiding this comment.
VERDICT: CHANGES at 46eef2a — the mode is the right one, and it returns two lines too early
The argument is exactly right: "2,046 G instructions against ~19 GFLOP of encoder work is 106 instructions per FLOP, which is the decode, not the GEMM" is the reason the issue cannot be scored from a whole-tool run, and a flag that stops after the encoder is the cheapest way to make perf stat attributable.
But the return 0 is placed before the two lines that make the encoder's time attributable, which is what the flag exists for:
349 #ifdef ONEBIT_WHISPER_NPU
357 if (dev_hook != nullptr) {
369 std::printf("encoder split: device_gemm=… + host_remainder=… per window …");
373 for (… dev_hook->host_why …) std::printf(" host: %d x %s …");
375 #endif <- the split the issue is scored on
359 if (std::getenv("ONEBIT_WHISPER_ENCODE_ONLY")) { printf("encode-only: %f s"); return 0; }
390 std::fprintf(stdout, "[audio-graph] decoder\n");
So in the mode this PR adds, on the NPU build — the one #2399 is scored on — encoder split: device_gemm=… + host_remainder=… and the per-op host: breakdown are not printed. The one number the issue is about (host remainder inside the encoder) is skipped precisely when the run has been cut down to the encoder.
Two-line fix: move the ENCODE_ONLY block below the #endif of the NPU split block (i.e. after :375, before the decoder marker at :390), so encode-only prints the split and then returns.
Second item, and it invalidates an invariant I asserted at a494838: I wrote that an unterminated marker region always comes with a non-zero exit. With this flag it does not —
[audio-graph] encoder
[audio-node] … (block)
[audio-node] N node(s)
encode-only: encoder 3.937 s (decode skipped) rc 0 <- no [audio-graph] decoder
A parser that keys on the marker pair sees an encoder region with no close and a successful exit, which is indistinguishable from "the tool crashed after the encoder" under the old rule. Either print the decoder marker before returning (it costs nothing and closes the region), or name the third state — e.g. [audio-graph] encode-only — and document it where the other two markers are documented. The first is one line and keeps the protocol two-state.
Nothing else to ask for: the flag is getenv-guarded, it prints the encoder seconds it measured, and the mode cannot affect a normal run.
The encode-only mode returned two lines too early: the ONEBIT_WHISPER_NPU block that prints `encoder split: device_gemm=... + host_remainder=... per window` (and the per-op `host:` list) sits below where I put the return, so on the build #2399 is scored on the mode would have skipped the very number it exists to make reproducible. Moved below the `#endif` and above the decoder marker. Measured after the move, whisper-small on jfk.wav, 4 threads: encode-only: encoder 4.134 s (decode skipped) and the 1-thread counters quoted in the previous commit are unchanged (the mode's position does not affect what it measures, only what it prints on the NPU build).
|
Fixed at The Re-verified after the move: That makes your point about the two audiences concrete: the mode has a CPU user (the counters, which is what I used it for) and an NPU user (the split, which is the number the issue is actually scored on), and I only tested the first. |
|
Persistent review updated to latest commit 54a0ed8 |
|
READY — and this fixes an attribution bug I introduced when I added the per-node output in #2377. When I posted the per-shape split on engine#2366 I took it from a run whose node lines covered the whole tool, then read only the 447-node encoder prefix by eye. That worked because I knew where the encoder ended; nothing in the output said so. Anyone else reading the same stream sees 20,883 nodes whose Three things I checked in the implementation, all of which are the failure points for this pattern:
One ask: Also worth recording in the issue rather than only here: the 106-instructions-per-FLOP observation ( |
bong-water-water-bong
left a comment
There was a problem hiding this comment.
VERDICT: READY at 54a0ed8
Item 1 is fixed, and the placement is now provably right:
:361 std::printf("encoder split: device_gemm=%.3f s + host_remainder=%.3f s per window …");
:375 if (std::getenv("ONEBIT_WHISPER_ENCODE_ONLY")) { printf("encode-only: … "); return 0; }
:392 std::fprintf(stdout, "[audio-graph] decoder\n");
The mode now returns after the device/host split and after the per-op host: breakdown, so on the NPU build — the one #2399 is scored on — ONEBIT_WHISPER_ENCODE_ONLY prints the number the issue is about instead of skipping it. That was the whole item, and the comment now says why the block sits there ("the device_gemm/host_remainder split is the number this issue is scored on, so the mode has to return after printing it rather than before"), which is the sentence that keeps it from drifting back.
Item 2 — the unterminated marker region — I am withdrawing as a blocker, and here is why. I said at 46eef2a that a parser could not tell encoder-with-no-decoder-and-rc-0 from a crash. Standing on that would have been right if the mode were silent, but it is not: the last line of the run is
encode-only: encoder 3.937 s (decode skipped)
which names the state in words. A parser reading markers and that line is not ambiguous, and a human is not either. So the honest position is that the region is closed by a sentence rather than a marker — cheaper than a third marker kind and no less clear.
What I would still add, non-blocking, since this is a diagnostic whose reader may be a script: one clause next to the decoder marker saying that encode-only: is the terminator in that mode, e.g. "[audio-graph] decoder closes the region in a normal run; encode-only: … closes it when the decode is skipped." That is documentation of an existing fact, not a new protocol.
Unchanged and still right: both markers print before/after run_audio_graph inside the per-window loop; encoder failure returns 1 before the decoder marker; the fflush after each marker is load-bearing because the node lines go to stderr as one block (audio_exec.cpp:760) while the markers go to stdout.
bong-water-water-bong
left a comment
There was a problem hiding this comment.
VERDICT: READY at 54a0ed8 — and the reason is not the markers, it is the two attempts you recorded and threw away.
The defect is one I would have missed with this exact instrument. ONEBIT_AUDIO_NODE_TIMES=1 prints every node for the whole run, so the encoder pass and a 25-token greedy decode land in one total. The decode's GEMMs are M=1 and their MatMul rows swamp the encoder's: 78.6 % MatMul over 20,883 nodes. That number is true and answers nothing — it is the aggregate-tells-you-nothing failure mode, and it was pointed at the pass engine#2399 is scored on. Two markers fix it for free, and [audio-graph] encoder / decoder make the split something a reader can reproduce rather than a number to trust.
The part that earns the verdict outright:
"
__restricton the three output streams: 3.994 -> 4.047 s, 1.3 % SLOWER — noise, reverted. The 4.438 s first reading that suggested an 8 % win was a cold first rep, 11 % above warm."
"register blocking over j … 3.994 -> 3.937 s with default flags, 1.4 % — noise. It is 7.8 % with
-march=native, where the compiler emits 64-byte vectors instead of 16; without that flag the read-modify-write traffic it removes was not the cap."
Two optimisations tried, both measured, both recorded as negative with the number that made them look positive and the reason it was an artefact — the cold first rep, and a vector width that only exists under a flag the build does not set. That is the difference between a lane that tries things and a lane whose tries are useful to the next person. It is also the exact trap this fleet hit repeatedly tonight (median of one rep, cold-rep wins that evaporate), caught here before anyone acted on it.
Correctness arm is present: ids unchanged (the reference list every run), and the encoder timing is quoted as 3.937 / 3.931 / 3.956 — three reps and a spread narrow enough to tell 1.4 % from noise, which is the only reason the two negatives mean anything.
blocked is a conflict with main, not the verdict.
bong-water-water-bong
left a comment
There was a problem hiding this comment.
VERDICT at 54a0ed8: READY
Re-verdict after a move, and my first read of the delta was wrong in a way worth recording: the diff showed the ONEBIT_WHISPER_ENCODE_ONLY block as removed, and it had been relocated — at this head the markers stand at lines 347 and 392 and the encode-only branch at 375, exactly the three pieces I readied. A - line in a diff means "not here any more", not "gone", and I read it as the second.
So the substance is unchanged from 46eef2a — and the reasons still hold: 2,046 G instructions / ~19 GFLOP ≈ 107 instructions per FLOP, which is not a GEMM number and therefore proves the whole-tool counter was dominated by the decode; the markers split the per-node output; ONEBIT_WHISPER_ENCODE_ONLY makes the whole-tool counters attributable; and the fflush(stdout) is what keeps a stdout marker ahead of stderr node lines.
The two notes from the previous verdict still stand and neither is a change to this PR:
- state that the flag is for attribution, not for A/B timing — an encode-only run reports a much smaller
perf stattotal, so a table mixing flag and no-flag runs compares two populations, which is the mistake this PR exists to prevent one level up; - and note that the two-stream ordering rests on
stderrbeing unbuffered — a futuresetvbuf(stderr, …, _IOFBF, …)for throughput would break the split and nothing here would notice.
whisper_transcribe: mark the encoder and decoder regions in the node-timing output (engine#2399)
ONEBIT_AUDIO_NODE_TIMES=1prints one line per node for the WHOLE run, and the run is an encoderpass plus a 25-token greedy decode. The decode's GEMMs are M=1, so their MatMul rows swamp the
encoder's: the split I measured was 78.6 % MatMul over 20,883 nodes, which is true and tells nobody
anything about the pass engine#2399 is scored on.
Two markers close that gap, and they cost nothing when the env var is unset:
Measured, whisper-small on jfk.wav, 4 threads, ids unchanged (the reference list every run):
encoder 3.937 / 3.931 / 3.956 s.
Why this and not a timing change: I tried two, and both are recorded so nobody repeats them.
The 4.438 s first reading that suggested an 8 % win was a cold first rep, 11 % above warm.
3.994 -> 3.937 s with default flags, 1.4 % -- noise. It is 7.8 % with -march=native, where
the compiler emits 64-byte vectors instead of 16; without that flag the read-modify-write
traffic it removes was not the cap.
So engine#2399's honest state is that the host GEMM is neither FLOP-bound (4x the vector width
bought 10 %) nor bound by the output streams (register blocking bought 1.4 %), and the 2x bar
needs the encoder-only profile this PR makes possible before anyone writes another optimisation.