Skip to content

Profiles: ncu bandwidth regimes for the head and GDN kernels, GDN kernel bench, reproduction reruns - #173

Merged
SamMausberg merged 7 commits into
mainfrom
profile/ncu-dflash
Oct 2, 2026
Merged

SamMausberg merged 7 commits into
mainfrom
profile/ncu-dflash

Conversation

@SamMausberg

@SamMausberg SamMausberg commented Oct 2, 2026 •

Copy link
Copy Markdown
Owner

The profile workstream's queued GPU chain finished on 2026-10-01, and nobody had summarised its output. Two of its four holds ran: the plain nsys rerun (02:44 UTC) and gdn ncu microbench (ended 11:25 UTC), both from repository 0aec3e0 with SGLang bd66ce34, CUDA graphs and the overlap scheduler on. The DFlash attribution never ran. It was deferred at 16:01 and is now queued again (below). This PR adds what the finished holds measured, fixes a units bug in the ncu summary, and points the queued DFlash attribution at the frontier's tuned arms.

What the runs show (all in evidence/profiles/README.md)

Head GEMM: bandwidth-bound. Under Nsight Compute, the M = 1 and M = 32 launches read 1.27 GB, the weight itself, at 3.61 and 3.53 TB/s. That is 89.6% and 87.8% of ncu's DRAM peak (1,536 B per DRAM cycle at 2.619 GHz = 4.02 TB/s). SM throughput is 4.5-12% and the tensor pipe is busy 3% of the time. The served head GEMM runs at 3.48-3.62 TB/s (92-96% of the measured 3.79 TB/s read peak) up to M = 128.

GDN decode kernel: latency-bound up to at least B = 32. The B = 32 launch moves 107.7 MB in 40.3 us: the 67.7 MB state read plus 40.1 of the 67.1 MB written. The other 27 MB of writes are still in L2 when the launch ends. DRAM runs at 67% of peak and the SMs at 19%. Achieved occupancy is 11% of a theoretical 12.5%: 205 registers per thread in one-warp blocks allow 8 blocks per SM. The served time per request is the same at B = 32 and 128 (1.21 and 1.20 us per layer). At B = 128 that rate puts DRAM at about 82% of peak (derived), close to the limit. This corrects a claim on main. The evidence README and the research notes (paper/notes/stack.tex, "The plain step beyond the head") say the kernel streams the state "at 92% of the read peak", from bytes divided by the served duration. That counts writes that reach DRAM only after the kernel ends.

GDN verify kernel: latency-bound at B = 8 (54% of DRAM peak, 51% SM throughput). The kernel bench shows what the four per-position state saves cost. Without them the kernel reads only the state and runs at 0.15-1.18 TB/s. With them its traffic is five times larger and it takes 63-89% longer at B = 8-128. Below B = 128 the no-save launch also uses a different value tile (SGLang's _select_recurrent_launch_config gives target verify with up to 64 requests a 4-wide tile on SM90), so only the B = 128 comparison isolates the saves: +204 us on 228 us per layer, about 4.9 ms per verify forward (derived).

The reruns reproduce the cited numbers.

  • The head microbenchmark rerun matches every GEMM median within 1.2 us (0.3%) and both read peaks within 0.4%.
  • Its clock log explains the M = 128/256 spread the README attributed to clocks. The SM clock drops from 1980 MHz to 1305-1965 MHz at 458-691 W during the last 14 s of the sweep, where the largest M rows run, while the memory clock stays at 2619 MHz.
  • The plain traces taken again with the committed driver give the same step time within 0.4% and the same head share within 0.03 points at B = 1-128.

The cited files (head_microbench.json, hbm_bandwidth.json, attribution/plain_bs*.json) are unchanged, so no paper number moves. The reruns sit beside them as reproduction checks (microbench_rerun/, attribution/plain_rerun/, plain_rerun_check.csv).

Changes

  • ncu_summary.py: ncu 2025.3 reports gpu__time_duration in us, which the old unit table missed. Durations stayed in microseconds, and the hold's dram_tb_per_s came out 10^12 too small. Units are now checked against a table, and an unknown unit or a missing metric fails the run. The script also records ncu's DRAM peak and percent of peak, theoretical occupancy, tensor-pipe use and waves per SM. ncu_key_kernels.json is regenerated from the same reports.
  • kernel_bandwidth.py (new): kernel_bandwidth.csv puts the microbenchmark, the GDN bench, the serving traces and ncu side by side by batch. It classifies each ncu launch by the speed-of-light rule (bandwidth-bound at 80% of DRAM peak; latency-bound when memory and SM throughput both stay under 70% and warps wait on memory).
  • compare_attribution.py (new): plain_rerun_check.csv.
  • clock_summary.py: reports the samples under load with the SM clock below its maximum.
  • run_profiles.py, run_all.sh dflash: the DFlash arms are now dflash-tuned-b16 and dflash-tuned, resolved whole from bench/arms.toml, so the profile runs the frontier's exact server flags. The old dflash16/dflash8 arms used FlashInfer GDN kernels and the overlap plan stream, which the bench treats as ablations. max_new_tokens is now sized from the resolved KV pool: the plain and MTP pools give the old budget, and all 64 DFlash requests are admitted. The step adds untraced windows for the cycle time.
  • analyze_all.sh reads the cited plain traces from plain_nsys_v0/, so it still regenerates the committed plain evidence. It attributes the rerun separately and runs the new steps.
  • Evidence README: a new section "Bandwidth- or latency-bound?", the corrected GDN paragraph, the clock result, the plain-provenance caveat resolved, and the Files and Pending lists updated. The /start_profile, graph-level and eager-label runs were dropped with main's agreement, since nothing in the paper depends on them.

DFlash attribution (queued, not in this PR)

run_all.sh dflash is queued at its original FIFO arrival (main's go) from a worktree pinned at 5bc91db, this branch's first commit. It runs nsys node-level windows and untraced windows at c = 1, 4, 16 and 64 for both tuned arms. The cycle split (draft, verify, GDN commit, head, sampling, host gaps) and a breakdown figure will follow as their own PR.

Validation

  • pre-commit (ruff, ruff-format, mypy, codespell, shellcheck, host-identity guard) on every file the branch changes, run in a CPU window at 3421b4b plus the review fixes: passed.
  • scripts/check_host_identity.sh on every new or changed file: no matches. The raw ncu CSV pages carry a host-name column, which ncu_summary.py does not keep.
  • Re-attributing plain_nsys_v0/ reproduces the committed attribution/plain_bs*.json: every value is identical. The committed B = 8 and 32 files lack the host_sync_calls field that the committed B = 1 and 128 files and the current code write.
  • summarize.py on the updated tree leaves step_share.csv and breakdown.csv (the inputs of Figure 1) unchanged; tables.md gains eight rows for the rerun windows, committed in 3db5fd2.
  • Not run: scripts/verify_artifact.py and the paper build, because nothing under paper/ or src/ changed.

Codex review

  • summarize.py:173, regenerate the table after adding rerun windows: done in 3db5fd2.
  • evidence/profiles/README.md, the rerun command wrote to evidence/profiles/ rather than microbench_rerun/: run_microbench.sh now takes MICROBENCH_EVIDENCE, and the README documents the command that recreates microbench_rerun/ (3db5fd2).
  • analyze_all.sh:26, the summarizer did not know the renamed DFlash arms: summarize.py uses dflash-tuned-b16/dflash-tuned; breakdown.csv stays plain + MTP (Figure 1 plots every row), and DFlash rows go to dflash_breakdown.csv (9b18965).
  • analyze_all.sh:23, the documented command never creates plain_nsys_v0/: PLAIN_CITED overrides it, and on a fresh $VP_DATA the plain evidence comes from plain_nsys/ without the rerun comparison (9b18965).
  • analyze_all.sh:76, collect the cited plain windows before the bytes model reads them: the cited run is collected as plain_nsys from $PLAIN_CITED and the rerun as plain_nsys_rerun; collecting plain_nsys_v0/ reproduces the committed window files byte for byte (4500b4f).
  • analyze_all.sh:56, require every rerun batch before the comparison: the script stops if any rerun trace is missing and re-attributes all four (366dc66).
  • run_all.sh:78, resume incomplete DFlash sweeps instead of skipping them: scoped reply. No DFlash evidence is committed here, and the queued hold runs once from a worktree pinned at 5bc91db. The follow-up DFlash PR makes prof() check every expected window record (with a test), and its analysis refuses a partial windows file.

run_profiles.py now takes the DFlash arms whole from bench/arms.toml
(dflash-tuned-b16 and dflash-tuned), so the profile runs the frontier's
server flags; the old dflash16/dflash8 arms used FlashInfer GDN kernels and
the overlap plan stream, which the bench treats as ablations. max_new_tokens
is sized from the resolved KV pool, which keeps the old budget for plain and
MTP and lets all 64 DFlash requests be admitted at once. The dflash step adds
untraced windows for the cycle time.

ncu_summary.py scaled durations only for 'nsecond'/'usecond'; ncu 2025.3
reports 'us', so durations stayed in microseconds and dram_tb_per_s came out
1e12 too small. Units are now checked against a table and a missing metric
fails the run. It also records ncu's DRAM peak and percent of peak,
theoretical occupancy, tensor-pipe use and waves per SM.

clock_summary.py reports the samples under load with the SM clock below its
maximum, which shows when a power limit lowered the clock.
kernel_bandwidth.py puts the head GEMM and the GDN kernels' achieved
bandwidth side by side by batch from the microbenchmark, the GDN kernel
bench, the serving traces and Nsight Compute, and classifies each ncu
launch by the speed-of-light rule. compare_attribution.py compares two
attributions of the same configurations component by component.

analyze_all.sh now reads the plain traces behind the committed plain
evidence from plain_nsys_v0/ (plain_nsys/ holds the 2026-10-01 rerun),
attributes the rerun into attribution/plain_rerun/ with its comparison,
collects the rerun's windows as plain_nsys_rerun, and runs the new steps.
summarize.py gives rerun windows their own rows in the runs table.
From the profile holds of 2026-10-01 (repository 0aec3e0, SGLang bd66ce34):
ncu_key_kernels.json regenerated from the four Nsight Compute reports with
the fixed units, gdn_kernel_bench.json, kernel_bandwidth.csv, the head
microbenchmark rerun with its clock log (microbench_rerun/), and the plain
trace rerun with its comparison (attribution/plain_rerun/,
plain_rerun_check.csv, windows/plain_nsys_rerun*). The cited head
microbenchmark, bandwidth and plain attribution files are unchanged.

The evidence README gains a section on whether each kernel is bandwidth- or
latency-bound: the head GEMM is bandwidth-bound (88-90% of ncu's DRAM peak
at M = 1 and 32); the GDN decode kernel at B = 32 and the verify kernel at
B = 8 are latency-bound. It corrects the claim that the decode kernel
streams the state at 92% of the read peak (27 MB of its writes at B = 32 are
still in L2 when it ends), records the clock throttling behind the large-M
spread, resolves the plain-trace provenance caveat, and updates the pending
list.
@chatgpt-codex-connector

chatgpt-codex-connector Bot commented Oct 2, 2026 •

Copy link
Copy Markdown

Codex Review Summary

This comment shows the latest Codex review activity on this pull request.

Review Status Commit Review trigger
📝 Code Review ✅ Completed 2026-10-02T03:30:43.957083Z 366dc66 Manual request
ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review" or "@codex security review".

Codex reacts with 👀 while any review is running, comments if it has suggestions, and reacts with 👍 once all reviews finish with no findings.

@SamMausberg

Copy link
Copy Markdown
Owner Author

@codex review

@chatgpt-codex-connector chatgpt-codex-connector Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

💡 Codex Review

Here are some automated review suggestions for this pull request.

Reviewed commit: 3421b4bbaf

ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".

@@ -171,6 +171,9 @@ def runs_table(evidence: Path) -> str:
kind = 'SGLang /start_profile (CUDA_PROFILER) under nsys'
else:
continue

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

P2 Badge Regenerate the table after adding rerun windows

With the newly committed windows/plain_nsys_rerun.jsonl, this branch makes runs_table() emit rerun records, but the tracked evidence/profiles/tables.md was not regenerated. Running summarize.py --evidence evidence/profiles adds eight rerun rows, so the committed table omits the measurements and analyze_all.sh immediately leaves a diff. Commit the regenerated table with this logic change.

AGENTS.md reference: AGENTS.md:L15-L18

Useful? React with 👍 / 👎.

Copy link
Copy Markdown
Owner Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Fixed in 3db5fd2: tables.md regenerated with summarize.py; the rerun windows now appear as their own rows (labelled ", rerun"), and the original rows are unchanged.

Comment thread evidence/profiles/README.md Outdated
| `ncu_key_kernels.json` | one Nsight Compute launch each of the head GEMM (M = 1, 32), the GDN decode kernel (B = 32) and the GDN verify kernel (B = 8): DRAM bytes, throughput against ncu's DRAM peak, SM throughput, occupancy, stalls | `run_ncu.sh` (`ncu_summary.py`) | measured (profiler timings) |
| `gdn_kernel_bench.json` | one GDN layer's decode, verify and verify-without-saves kernels at B = 1-128 under CUDA graphs, L2 evicted | `run_all.sh gdn` (`gdn_kernel_bench.py`) | measured |
| `kernel_bandwidth.csv` | achieved bandwidth of the head GEMM and the GDN kernels by batch and source (microbenchmark, GDN bench, serving traces, ncu), with the ncu regime | `kernel_bandwidth.py` | measured; regime by rule |
| `microbench_rerun/` | 2026-10-01 rerun of `run_microbench.sh` with the clock log: `hbm_bandwidth.json`, `head_microbench.json`, `microbench_clocks.csv` (nvidia-smi, 100 ms), `microbench_clocks.json` | `run_all.sh microbench` (`clock_summary.py`) | measured; reproduction check |

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

P2 Badge Make the rerun command write to the documented directory

When this documented run_all.sh microbench command is used to reproduce microbench_rerun/, run_microbench.sh actually writes hbm_bandwidth.json, head_microbench.json, and microbench_clocks.json directly under evidence/profiles/; it never writes or copies anything into microbench_rerun/. Following the instructions therefore overwrites the cited originals and cannot recreate the committed rerun files without the undocumented manual move described later. Provide a command/output option that targets the rerun directory.

AGENTS.md reference: AGENTS.md:L15-L18

Useful? React with 👍 / 👎.

Copy link
Copy Markdown
Owner Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Fixed in 3db5fd2: run_microbench.sh takes MICROBENCH_EVIDENCE (default evidence/profiles), writes hbm_bandwidth.json, head_microbench.json, microbench_clocks.csv and microbench_clocks.json there, and the README documents MICROBENCH_EVIDENCE=evidence/profiles/microbench_rerun experiments/profiling/run_all.sh microbench. The README also says the 2026-10-01 files were moved by hand because that hold predates the option.

…tory

Address Codex review on #173: tables.md now carries the rerun windows'
rows that summarize.py emits, and run_microbench.sh takes
MICROBENCH_EVIDENCE, so the documented command recreates
evidence/profiles/microbench_rerun/ (with the clock log) instead of
overwriting the cited files. The README says how the 2026-10-01 rerun's
files got there and corrects the M = 256 FLOP rate to 572 TFLOP/s.
@SamMausberg

Copy link
Copy Markdown
Owner Author

@codex review

@chatgpt-codex-connector chatgpt-codex-connector Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

💡 Codex Review

Here are some automated review suggestions for this pull request.

Reviewed commit: 3db5fd2c1d

ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".


# Attribution per configuration.
for arm_kind in plain:plain mtp:spec dflash16:dflash dflash8:dflash; do
for arm_kind in plain:plain mtp:spec dflash-tuned-b16:dflash dflash-tuned:dflash; do

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

P1 Badge Teach the summarizer the renamed DFlash arms

When run_all.sh dflash completes, this loop writes attribution/dflash-tuned-b16_bs*.json and attribution/dflash-tuned_bs*.json, but summarize.py still restricts CONFIGS to the removed dflash16 and dflash8 names. Consequently analyze_all.sh silently omits every new tuned DFlash attribution from tables.md, step_share.csv, and breakdown.csv; update the summarizer's arm names or normalize them before writing the evidence.

AGENTS.md reference: AGENTS.md:L15-L18

Useful? React with 👍 / 👎.

Copy link
Copy Markdown
Owner Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Fixed in 9b18965: summarize.py now uses dflash-tuned-b16 and dflash-tuned (DFLASH_ARMS). breakdown.csv stays plain + MTP because the paper's Figure 1 plots every row of it; the DFlash rows, same columns, go to dflash_breakdown.csv once the attributions exist. tables.md and step_share.csv include them.

Comment thread experiments/profiling/analyze_all.sh Outdated
# The plain traces behind the committed plain evidence (2026-09-30 18:28) are kept in
# plain_nsys_v0/; plain_nsys/ now holds the 2026-10-01 rerun with the committed driver,
# which is attributed separately below and compared with them.
PLAIN_CITED="$VP_DATA/plain_nsys_v0"

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

P2 Badge Make the reproduction command create the cited trace directory

With a fresh $VP_DATA, the documented run_all.sh plain command creates plain_nsys/, never plain_nsys_v0/. Hard-coding the cited input to this uncreated directory therefore makes the attribution loop skip all cited plain traces and leaves the committed attribution files untouched rather than regenerating them; if the evidence directory is cleaned, downstream generation also lacks those inputs. Document and automate creation of plain_nsys_v0/, or provide an explicit fallback/input option.

AGENTS.md reference: AGENTS.md:L15-L18

Useful? React with 👍 / 👎.

Copy link
Copy Markdown
Owner Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Fixed in 9b18965: PLAIN_CITED overrides the cited directory, and when plain_nsys_v0/ does not exist (fresh VP_DATA) analyze_all.sh takes the plain evidence from plain_nsys/ and skips the rerun comparison. The evidence README's Reproduction section says so.

…ed plain traces

Address Codex review on #173. summarize.py knew only the removed
dflash16/dflash8 names, so the tuned DFlash attributions would have been
left out of the tables; it now uses dflash-tuned-b16 and dflash-tuned.
breakdown.csv keeps plain decoding and MTP only, because the paper's
Figure 1 plots every row of it, and the DFlash rows (same columns) go to
dflash_breakdown.csv once they exist.

analyze_all.sh read the cited plain traces only from plain_nsys_v0/, which
a fresh run_all.sh never creates. PLAIN_CITED now overrides the path, and
without that directory the plain evidence comes from plain_nsys/ with no
rerun comparison. The evidence README documents both.
@SamMausberg

Copy link
Copy Markdown
Owner Author

@codex review

@chatgpt-codex-connector chatgpt-codex-connector Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

💡 Codex Review

Here are some automated review suggestions for this pull request.

Reviewed commit: 9b18965617

ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".

# Derived bytes and label checks.
shopt -s nullglob
windows=("$VP_DATA"/plain_nsys/windows.jsonl "$VP_DATA"/mtp_nsys/windows.jsonl)
windows=("$EV"/windows/plain_nsys.jsonl "$VP_DATA"/mtp_nsys/windows.jsonl)

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

P2 Badge Collect the cited plain windows before consuming them

When both plain_nsys_v0/ and plain_nsys/ exist—the documented cited-plus-rerun layout—the collection loop writes only plain_nsys_rerun.jsonl, but this line still requires windows/plain_nsys.jsonl. Consequently, running analyze_all.sh after clearing generated evidence fails in bytes_model.py unless the old tracked file already exists, so the documented command cannot regenerate the evidence solely from the raw run directories. Collect $PLAIN_CITED/windows.jsonl under plain_nsys before using it here.

AGENTS.md reference: AGENTS.md:L15-L18

Useful? React with 👍 / 👎.

Copy link
Copy Markdown
Owner Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Fixed in 4500b4f: the cited run is collected as plain_nsys from $PLAIN_CITED (plain_nsys_v0/ holds its windows.jsonl, run_meta.json and server.log) before bytes_model.py reads windows/plain_nsys.jsonl, and the rerun as plain_nsys_rerun. Collecting plain_nsys_v0/ reproduces the committed windows/plain_nsys.jsonl, _meta.json and _server_startup.log byte for byte (checked in a CPU window).

Address Codex review on #173: with both plain_nsys_v0/ and plain_nsys/
present, analyze_all.sh collected only the rerun's windows, so after a
clean of the evidence the bytes model would find no windows/plain_nsys.jsonl.
The cited run is now collected as plain_nsys from $PLAIN_CITED, and the
rerun as plain_nsys_rerun. Collecting plain_nsys_v0/ reproduces the
committed windows/plain_nsys.jsonl, _meta.json and _server_startup.log
byte for byte.
@SamMausberg

Copy link
Copy Markdown
Owner Author

@codex review

@chatgpt-codex-connector chatgpt-codex-connector Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

💡 Codex Review

Here are some automated review suggestions for this pull request.

Reviewed commit: 4500b4f765

ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".

Comment thread experiments/profiling/analyze_all.sh Outdated
Comment on lines +54 to +56
if have "$EV/attribution/plain_rerun/plain_bs1.json"; then
run compare_attribution.py --base "$EV/attribution" --test "$EV/attribution/plain_rerun" \
--arm plain --batch 1 8 32 128 --out "$EV/plain_rerun_check.csv"

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

P2 Badge Require every rerun batch before producing the comparison

If the plain rerun is interrupted after B=1, this guard succeeds and compare_attribution.py still requests B=1,8,32,128. Because the destination already contains committed rerun JSONs, the refreshed B=1 result can be silently compared alongside stale results for the other batches; if those files were cleaned, analysis instead aborts. Verify that every requested raw/rebuilt batch exists—or compare only the completed batch set—before regenerating plain_rerun_check.csv.

AGENTS.md reference: AGENTS.md:L15-L18

Useful? React with 👍 / 👎.

Copy link
Copy Markdown
Owner Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Fixed in 366dc66: analyze_all.sh stops with an error if any of plain_bs{1,8,32,128}.nsys-rep is missing from the rerun directory, and re-attributes all four before compare_attribution.py runs, so fresh and stale results cannot mix.

…aces

Address Codex review on #173: an interrupted rerun with only some batches
could have mixed fresh and stale attributions in plain_rerun_check.csv.
analyze_all.sh now stops if any of the four rerun traces is missing and
re-attributes all four before the comparison.
@SamMausberg

Copy link
Copy Markdown
Owner Author

@codex review

@chatgpt-codex-connector chatgpt-codex-connector Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

💡 Codex Review

Here are some automated review suggestions for this pull request.

Reviewed commit: 366dc669f2

ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".

Comment on lines +77 to +78
prof --arm "$arm" --mode none --concurrency 1 4 16 64 --repeats 3 \
--out-dir "$VP_DATA/${arm}_none"

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

P2 Badge Resume incomplete DFlash sweeps instead of skipping them

When this newly added untraced sweep is interrupted after any window (for example, after the first B=1 repetition), run_profiles.py has already appended to windows.jsonl; rerunning run_all.sh dflash then makes prof() treat that nonempty file as a completed run and skip all remaining repetitions and batch sizes. The subsequent collection and summarization accept the partial file, so the queued DFlash experiment can silently produce incomplete throughput evidence unless the operator notices and deletes the directory or sets VP_RERUN=1; verify the expected windows before skipping or resume the missing points.

Useful? React with 👍 / 👎.

Copy link
Copy Markdown
Owner Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Scoped: this only bites an interrupted and resubmitted DFlash sweep. Nothing at this head depends on it: no DFlash window, attribution or summary is committed (git ls-tree -r HEAD evidence/profiles has no dflash file), and the one queued DFlash hold runs once from a worktree pinned at 5bc91db. The follow-up DFlash PR will (1) make prof() skip a run only when windows.jsonl holds every expected (concurrency, window kind, repeat) record, with a test, and (2) have the DFlash cycle analysis refuse a windows file that lacks any planned point or did not hold its batch. If the hold is interrupted, its partial output will be discarded and rerun, not resumed.

@SamMausberg

Copy link
Copy Markdown
Owner Author

Verdict: APPROVE at 366dc66

I checked the README's and body's numbers against ncu_key_kernels.json, kernel_bandwidth.csv, gdn_kernel_bench.json, plain_rerun_check.csv and the two microbench runs.

Head GEMM.

  • ncu: M = 1 reads 1.2715 GB in 353.44 µs, 3.606 TB/s, 89.6% of a 1,536 B/cycle × 2.619 GHz = 4.022 TB/s peak. M = 32 is 3.533 TB/s, 87.8%.
  • SM throughput is 4.5% and 11.9%, tensor pipe 3.2%.
  • Served: 3.475-3.624 TB/s, 91.7-95.6% of the 3.79 TB/s read peak, up to M = 128.

GDN decode at B = 32.

  • 67.67 MB read + 40.08 MB written in 40.256 µs, 2.677 TB/s, 66.6% of DRAM peak; SM 18.8%.
  • Occupancy 11.0% of 12.5%, with 205 registers per thread in 32-thread blocks.
  • Served 38.71/32 = 1.21 and 154.23/128 = 1.20 µs per request per layer.

GDN verify.

  • B = 8: 53.8% of DRAM peak, SM 50.7%.
  • Bench at B = 128: 432.43 against 228.37 µs without saves, so +204 µs; × 24 layers = 4.9 ms.
  • 63-89% longer at B = 8-128; traffic 5× larger; no-save 0.15-1.18 TB/s.

The regime rule (80% for bandwidth-bound; under 70% on both, with memory stalls, for latency-bound) is applied as stated.

Reruns.

  • All 18 GEMM rows agree with the cited table within 1.17 µs (at most 0.33%), and the read sweeps agree closely.
  • The plain re-traces agree on step time within 0.42% and on head share within 0.023 points at B = 1-128.
  • The cited files (head_microbench.json, hbm_bandwidth.json, attribution/plain_bs*.json) are unchanged, so no paper number moves.

The proposed paper/notes/stack.tex fix is supported. Line 14 says the recurrent kernel "streams the state once each way at 92% of the read peak". That figure is the modelled bytes, a full read and a full write, divided by the served kernel time: 134.2 MB in 38.71 µs at B = 32 and 536.9 MB in 154.23 µs at B = 128, 3.47-3.48 TB/s, 91.5-91.8% of 3.79 TB/s (kernel_bandwidth.csv, gdn_decode serving rows). ncu at B = 32 shows only 107.7 MB reaching DRAM during the launch, 66.6% of peak, with about 27 MB of the 67 MB of writes still in L2 at kernel end (ncu_key_kernels.json). So "92% of the read peak" overstates the kernel's DRAM rate.

Suggested replacement, to route to the paper agent: "which would be 3.47-3.48 TB/s if every state byte reached DRAM during the kernel; Nsight Compute shows that at B = 32 about 27 of the 67 MB it writes are still in L2 when it ends and DRAM runs at 67% of peak, and at B = 128 the same per-request rate puts DRAM at about 82% of peak (derived)."

Codex. Six comments were fixed, with replies. The one at 366dc66 (run_all.sh:78, resuming an interrupted DFlash sweep) has a scoped reply, which I verified: git ls-tree -r 366dc66 evidence/profiles has no DFlash file, so nothing committed here depends on the resume logic, and the follow-up DFlash PR commits to the fix. Codex completed on 366dc66 with only that comment.

Hygiene. No hostname in the commit log, including the regenerated ncu_key_kernels.json, or in the PR body. All 7 commits are authored and committed by Samuel Mausberg, with no co-author lines.

Optional: the B = 128 figure of "about 82%" assumes the 27 MB left in L2 at B = 32 carries over. The L2 holds at most 60 MB, so the same per-request time bounds DRAM at 77-87% of peak (537 MB less 0 to 60 MB, in 154 µs). Giving the range beside the point estimate would show how much rests on that assumption.

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