[PR #4334] [Engine] STRATA_HOST_TIMELINE host-timeline split + summary-time draft-profiler flush (opt-in, measurement only) #5014

Open
opened 2026-11-07 16:32:01 +07:00 by bsakaguchi · 0 comments
Owner

📋 Pull Request Information

Original PR: https://github.com/Niko1221/Strata/pull/4334
Author: @xyzzing
Created: 10/27/2026
Status: 🔄 Open

Base: main ← Head: pr/host-timeline


📝 Commits (3)

  • 6c8b43e verify: STRATA_HOST_TIMELINE=1 - split the host's per-round timeline (adapt/slot/pool/remote/flags/bal per layer, capture/stage/launch per window, ring-spin histogram+max); report under the verify-window block, zero-cost when off (step 0)
  • d991db5 mtp: flush the draft profilers at the summary site (STRATA_DRAFT_TIMING=1 wall=round+steps+gaps+tail + host split; STRATA_MTP_PROFILE=1 16-stage) - they auto-reported only every 300 rounds, so one-shot runs never saw them
  • ad1c3af mtp: (fix) the profile_flush definition actually lands this time - outside the anonymous namespace; the prior commit's write_text was never called

📊 Changes

5 files changed (+98 additions, -2 deletions)

View changed files

📝 include/strata/core/mtp.hpp (+3 -0)
📝 include/strata/core/verify.hpp (+10 -0)
📝 src/core/mtp.cpp (+6 -0)
📝 src/core/verify.cpp (+70 -2)
📝 src/program/generate.cpp (+9 -0)

📄 Description

Problem and result

Two measurement gaps on the decode path, both hit during a real investigation of "where do 24 ms/round of ring waits go" on gfx1100:

  1. The MTP draft profilers (STRATA_DRAFT_TIMING, STRATA_MTP_PROFILE) auto-report only every 300 rounds, so a one-shot run (one workload, ~100 rounds) never prints them — the per-round draft cost was invisible in every one-shot cell.
  2. The host's per-round timeline was unsplit: the verify-window block showed a single "rings" share, which we and others read as "GPU idle 87-91%" — a misread that sent us down a dead optimization path for a day. The host timeline split shows what the rings actually are: 48 handoff slices of ~0.51 ms each, with the GPU ~87% busy executing layer work during them.

After: with STRATA_HOST_TIMELINE=1 the verify-window block carries a per-layer host-phase split (adapt/slot/pool/remote/flags/bal), window-level capture/stage/launch times, and a ring-spin count + histogram + max. With the summary-time flush, the draft profilers print on every run that ends, not just every 300th round. Both are opt-in and zero-cost when off.

none — no existing issue covers the one-shot profiler visibility or the host-timeline split; the numbers below come from our measurement campaign.

Approach

  • STRATA_HOST_TIMELINE=1 (default off): static getenv, branch-guarded Clock::now() calls around the host phases and the window stages; the report prints under the existing verify-window block. Measured cost when ON against the production binary on our lineage: −0.6% (inside the ±6% single-run noise floor), i.e. the instrument does not move what it measures.
  • Summary-time flush: the two draft profilers' report moves to a profile_flush() called at the one-shot summary site, next to the existing GPU stage report; the 300-round auto-report stays for long runs.
  • No default-path change: all env off = no clocks taken (the guard reads the env once at start).

Compatibility: opt-in diagnostics only; no flag, config, or output changes when the env vars are unset.

Validation

Passed:

  • ninja -C build-pr -k 0 -j 6 on this branch (HIP, gfx1100, ROCm 10.2 nightly SDK, upstream main 5e8a4cca + the three commits): builds clean, binary links.
  • Smoke on the built binary, production config one-shot: with STRATA_HOST_TIMELINE=1 STRATA_DRAFT_TIMING=1 STRATA_MTP_PROFILE=1 the run prints the host-timeline block under the verify-window report and flushes both draft profilers at summary (exact lines in the run log); with the env unset the same binary prints none of them and the output matches the pre-branch binary's sections.
  • On our production lineage (0.1.48.1 fork, the same three commits): three paired instrument-on/off/production-binary cells (instrumentation −0.6% vs the production binary), then the full step-0 split measured with it: rings = 4,992 spins, 99.7% under 1 ms, max 1.5 ms, mean 0.51 ms/layer; host work 3.8 ms/round, all of it the remote-expert serve; the GPU-side confirmation came from the existing per-stage report.

Failed: none observed.

Not run: SYCL and Metal builds — no SYCL toolchain on this AMD-only box and Metal is macOS-only (per-PR CI here builds neither; our fork CI compiles CUDA and HIP in vendor containers, see the run linked in the thread). CUDA is now compile-validated on this branch head (run 40592368748, both containers green). The paired zero-cost measurement was rerun on our lineage, not on upstream main (the smoke above covers function, not the cost number).

Limits

  • The host-timeline report names the host's phases only; the GPU-side stage table (existing STRATA_VERIFY_PROFILE) is what confirms what the GPU does during the spins. The two together are the complete picture.
  • The ring-spin histogram is per-window granularity (count + max + a coarse histogram), not a full distribution dump.
  • STRATA_HOST_TIMELINE stays opt-in default-off by design; we offer it as a measurement instrument, not a default.

2026-11-06: rebased onto main (9f7d977d2) — force-pushed. Three keep-both conflict resolutions (upstream's STRIX-TDR probe block and dispatch-stats call, and the prompt-room API block in mtp.hpp, all retained; the timeline additions re-anchored beside them). The rebased tree builds fully on main: 549 targets, rc=0, gfx1100 HIP. Series note: the middle commit's tree alone does not compile (the profile_flush declaration rides in the third commit, completing it) — the tip is the reviewable state. The CUDA compile-validation run cited below was on the previous head; the fork CI re-runs on this push. The smoke and zero-cost measurement remain from the 0.1.48-era lineage as stated.


🔄 This issue represents a GitHub Pull Request. It cannot be merged through Gitea due to API limitations.

## 📋 Pull Request Information **Original PR:** https://github.com/Niko1221/Strata/pull/4334 **Author:** [@xyzzing](https://github.com/xyzzing) **Created:** 10/27/2026 **Status:** 🔄 Open **Base:** `main` ← **Head:** `pr/host-timeline` --- ### 📝 Commits (3) - [`6c8b43e`](https://github.com/Niko1221/Strata/commit/6c8b43e94414576cf476822c9d57d0dd29b05d55) verify: STRATA_HOST_TIMELINE=1 - split the host's per-round timeline (adapt/slot/pool/remote/flags/bal per layer, capture/stage/launch per window, ring-spin histogram+max); report under the verify-window block, zero-cost when off (step 0) - [`d991db5`](https://github.com/Niko1221/Strata/commit/d991db5a8dc97cdda1f1f8e1a141e28795e92f38) mtp: flush the draft profilers at the summary site (STRATA_DRAFT_TIMING=1 wall=round+steps+gaps+tail + host split; STRATA_MTP_PROFILE=1 16-stage) - they auto-reported only every 300 rounds, so one-shot runs never saw them - [`ad1c3af`](https://github.com/Niko1221/Strata/commit/ad1c3af69c7294c09989e149fe1666eecb8bbce1) mtp: (fix) the profile_flush definition actually lands this time - outside the anonymous namespace; the prior commit's write_text was never called ### 📊 Changes **5 files changed** (+98 additions, -2 deletions) <details> <summary>View changed files</summary> 📝 `include/strata/core/mtp.hpp` (+3 -0) 📝 `include/strata/core/verify.hpp` (+10 -0) 📝 `src/core/mtp.cpp` (+6 -0) 📝 `src/core/verify.cpp` (+70 -2) 📝 `src/program/generate.cpp` (+9 -0) </details> ### 📄 Description ## Problem and result Two measurement gaps on the decode path, both hit during a real investigation of "where do 24 ms/round of ring waits go" on gfx1100: 1. The MTP draft profilers (`STRATA_DRAFT_TIMING`, `STRATA_MTP_PROFILE`) auto-report only every 300 rounds, so a one-shot run (one workload, ~100 rounds) never prints them — the per-round draft cost was invisible in every one-shot cell. 2. The host's per-round timeline was unsplit: the verify-window block showed a single "rings" share, which we and others read as "GPU idle 87-91%" — a misread that sent us down a dead optimization path for a day. The host timeline split shows what the rings actually are: 48 handoff slices of ~0.51 ms each, with the GPU ~87% *busy* executing layer work during them. After: with `STRATA_HOST_TIMELINE=1` the verify-window block carries a per-layer host-phase split (adapt/slot/pool/remote/flags/bal), window-level capture/stage/launch times, and a ring-spin count + histogram + max. With the summary-time flush, the draft profilers print on every run that ends, not just every 300th round. Both are opt-in and zero-cost when off. ## Related discussion none — no existing issue covers the one-shot profiler visibility or the host-timeline split; the numbers below come from our measurement campaign. ## Approach - `STRATA_HOST_TIMELINE=1` (default off): static `getenv`, branch-guarded `Clock::now()` calls around the host phases and the window stages; the report prints under the existing verify-window block. Measured cost when ON against the production binary on our lineage: −0.6% (inside the ±6% single-run noise floor), i.e. the instrument does not move what it measures. - Summary-time flush: the two draft profilers' report moves to a `profile_flush()` called at the one-shot summary site, next to the existing GPU stage report; the 300-round auto-report stays for long runs. - No default-path change: all env off = no clocks taken (the guard reads the env once at start). Compatibility: opt-in diagnostics only; no flag, config, or output changes when the env vars are unset. ## Validation **Passed:** - `ninja -C build-pr -k 0 -j 6` on this branch (HIP, gfx1100, ROCm 10.2 nightly SDK, upstream main `5e8a4cca` + the three commits): builds clean, binary links. - Smoke on the built binary, production config one-shot: with `STRATA_HOST_TIMELINE=1 STRATA_DRAFT_TIMING=1 STRATA_MTP_PROFILE=1` the run prints the host-timeline block under the verify-window report and flushes both draft profilers at summary (exact lines in the run log); with the env unset the same binary prints none of them and the output matches the pre-branch binary's sections. - On our production lineage (0.1.48.1 fork, the same three commits): three paired instrument-on/off/production-binary cells (instrumentation −0.6% vs the production binary), then the full step-0 split measured with it: rings = 4,992 spins, 99.7% under 1 ms, max 1.5 ms, mean 0.51 ms/layer; host work 3.8 ms/round, all of it the remote-expert serve; the GPU-side confirmation came from the existing per-stage report. **Failed:** none observed. **Not run:** SYCL and Metal builds — no SYCL toolchain on this AMD-only box and Metal is macOS-only (per-PR CI here builds neither; our fork CI compiles CUDA and HIP in vendor containers, see the run linked in the thread). CUDA is now compile-validated on this branch head (run 40592368748, both containers green). The paired zero-cost measurement was rerun on our lineage, not on upstream main (the smoke above covers function, not the cost number). ## Limits - The host-timeline report names the host's phases only; the GPU-side stage table (existing `STRATA_VERIFY_PROFILE`) is what confirms what the GPU does during the spins. The two together are the complete picture. - The ring-spin histogram is per-window granularity (count + max + a coarse histogram), not a full distribution dump. - `STRATA_HOST_TIMELINE` stays opt-in default-off by design; we offer it as a measurement instrument, not a default. --- **2026-11-06:** rebased onto main (9f7d977d2) — force-pushed. Three keep-both conflict resolutions (upstream's STRIX-TDR probe block and dispatch-stats call, and the prompt-room API block in mtp.hpp, all retained; the timeline additions re-anchored beside them). The rebased tree builds fully on main: 549 targets, rc=0, gfx1100 HIP. Series note: the middle commit's tree alone does not compile (the `profile_flush` declaration rides in the third commit, completing it) — the tip is the reviewable state. The CUDA compile-validation run cited below was on the previous head; the fork CI re-runs on this push. The smoke and zero-cost measurement remain from the 0.1.48-era lineage as stated. --- <sub>🔄 This issue represents a GitHub Pull Request. It cannot be merged through Gitea due to API limitations.</sub>
Sign in to join this conversation.
No milestone
No project
No assignees
1 participant
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Dependencies

No dependencies set.

Reference
Niko1221/Strata#5014
No description provided.