[PR #4740] [Engine] expose per-request decode pipeline diagnostics #5156

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

📋 Pull Request Information

Original PR: https://github.com/Niko1221/Strata/pull/4740
Author: @marshr00m
Created: 10/30/2026
Status: 🔄 Open

Base: main ← Head: codex/pipeline-decode-diagnostics-refresh


📝 Commits (3)

  • 23de4bd [Engine] expose per-request decode pipeline diagnostics
  • a805764 [Engine] validate decode diagnostic reports and clarify scope
  • aa7bd3a Merge remote-tracking branch 'origin/main' into codex/pipeline-decode-diagnostics-refresh

📊 Changes

4 files changed (+261 additions, -4 deletions)

View changed files

📝 docs/MULTI_GPU.md (+28 -0)
📝 serve/server.py (+20 -1)
➕ serve/test_decode_diagnostics.py (+185 -0)
📝 src/program/generate.cpp (+28 -3)

📄 Description

Problem and result

With --pipeline-windows 2, a request can still decode serially when repetition penalties or coupled draft
sampling are active. The existing warning is printed once per reason, so an API client cannot associate the
chosen path with each response or tell whether two timing measurements used the same decode loop.

With the opt-in STRATA_DECODE_DIAGNOSTICS=1, the Flash-Next solo serve path reports the selected loop and its
reason in timings.decode_segments. For example:

{"decode_segments": [{"mode": "serial", "pipeline_windows": 2, "reason": "repetition_penalties"}]}

Without the option, the engine emits no new fields. No sampling defaults or pipeline eligibility rules change.

No issue is claimed as resolved. Checked related open and closed PRs again on October 31; no equivalent
request-level loop/reason API was found. #3631 traces serial decode windows and excludes the pipeline loop;
#2697 adds request tracing;
#4334 adds a host timeline and draft-profiler output; #4197 preserves native error logs. These measure or preserve
other information. #3760 proposes a third pipeline window; this patch targets current main's zero-to-two range.

Approach

Append optional key/value fields to the existing DONE statistics and parse them in the server. The server does
not infer execution from requested settings. Keep native segments in order across continuations rather than
presenting the final segment's path as the entire request. A missing report next to reported segments is unknown.

mode identifies the dedicated decode loop, not GPU utilization or measured overlap. none means neither loop
ran; the prompt tail may still emit tokens. Engines started with --batch omit this diagnostic even for requests
processed on their solo path, because admission statistics are not the whole slot request. Old engines keep
their existing response shape. Unknown or contradictory window/reason combinations are ignored.

Validation

Base: 870aedd9e1ebe1c91f94da93b59af17729f6c5c0 (Strata 0.2.8 / engine 0.1.54).
Candidate: aa7bd3a159e95ad0330d622dc0ddbb79040775d1; tracked tree 0922b168226e4c5d7a842dfcd2ce80475f36a3c0.
Windows 11 10.0.26200, Python 3.14.2; MSVC 19.44 for the host-only native fixture.

Passed:

  • API regression over serve.test_decode_diagnostics, serve.test_request_accounting, serve.test_answer_speed,
    serve.test_server and serve.test_responses: 429 tests, no failures, 4 existing skips, 132.803 s. These ran
    on an isolated main-plus-patch tree before integration; the integrated candidate's complete tracked Git tree
    matches that tested tree exactly. The runner uses a writable temporary directory and periodic stack dumps.
  • The 11 focused diagnostic tests also passed in the integrated checkout. They cover complete/streamed mock
    HTTP, thinking-budget continuations, cancellation, legacy DONE lines, mixed/missing reports, and 14 contradictory
    serial window/reason combinations without retaining the previous request's report.
  • Host-only native fixtures: the actual reporting block extracted from the integrated source compiled with
    MSVC /std:c++17 /EHsc /W4 /WX; 17 cases and their corrected-Python parser round trips passed. The reporting
    block is unchanged from the earlier candidate. Inputs simulate startup/loop facts; this is not GPU failure-path
    execution or a complete native-engine build.
  • Negative control: the earlier parser accepted serial / windows=2 / not_requested; the corrected parser omits
    that diagnostic while preserving the existing numerical statistics.
  • git diff --check, patch applicability checks, clean checkout, and GitHub comparison: main is fully included
    and the PR diff is limited to the four intended files.

Captured output from the API regression run:

Ran 429 tests in 132.803s
OK (skipped=4)

Historical native reference: on October 30, source 23de4bd24c6eb2a1bfb2c349835e7aad1c8fdb36 against base
46c152a1310f77cd2f0ce2c7cd213962df14fe83 built and linked all 169 CUDA steps for sm_86/sm_120. Real RTX 3070 +
RTX 5070 Ti requests checked pipeline/penalty/coupled paths and cancellation recovery, with 22 controlled output/count
comparisons matching baseline. Those runs used IQ3_S, 8/40 split, 128K, int8 KV, MTP, 20 GiB expert RAM and direct I/O.
They are retained as earlier-version evidence, not a full native validation of the newly integrated source.

Failed:

  • None in the current API checks, host fixtures or integration checks. Earlier environment setup failures remain
    in their dated validation records and are not presented as candidate failures or successes.

Not run:

  • Full CUDA, HIP and Metal builds or real-GPU execution of this integrated candidate. The earlier CUDA build
    covers the old source only; HIP and Metal have no matching local toolchains. Keep this PR in draft until the
    affected-backend checks can be completed; targeted help is needed. SYCL uses its own unchanged generator and
    no SYCL engine-side diagnostic support is claimed.
  • GPU execution of configuration-disabled, pipeline-unavailable or snapshot-unavailable failure paths;
    fixture inputs do not reproduce device/startup failures.
  • Image input, near-limit context, long-running stability and quality evaluations.

Limits

Unbatched Flash-Next serving only; a --batch engine and the separate SYCL generator do not report this field.
Thinking-budget continuations use mock HTTP, not a real-model thinking-loop test. Historical output equality
was demonstrated only under documented fixed controls, not every setting or the newly integrated engine.
These checks do not tightly bound overhead or establish a speedup. No performance change is claimed.

Individual runs, configurations, output hashes and exact commands are retained with the validation records.
Local reproduction entry points include verify_tests.py and verify_native_reporting.py; the standalone
native-reporting-fixture.cpp contains the compiled reporting fixture.


🔄 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/4740 **Author:** [@marshr00m](https://github.com/marshr00m) **Created:** 10/30/2026 **Status:** 🔄 Open **Base:** `main` ← **Head:** `codex/pipeline-decode-diagnostics-refresh` --- ### 📝 Commits (3) - [`23de4bd`](https://github.com/Niko1221/Strata/commit/23de4bd24c6eb2a1bfb2c349835e7aad1c8fdb36) [Engine] expose per-request decode pipeline diagnostics - [`a805764`](https://github.com/Niko1221/Strata/commit/a8057649e2987f5d7427869e7cf1c8c4420747e6) [Engine] validate decode diagnostic reports and clarify scope - [`aa7bd3a`](https://github.com/Niko1221/Strata/commit/aa7bd3a159e95ad0330d622dc0ddbb79040775d1) Merge remote-tracking branch 'origin/main' into codex/pipeline-decode-diagnostics-refresh ### 📊 Changes **4 files changed** (+261 additions, -4 deletions) <details> <summary>View changed files</summary> 📝 `docs/MULTI_GPU.md` (+28 -0) 📝 `serve/server.py` (+20 -1) ➕ `serve/test_decode_diagnostics.py` (+185 -0) 📝 `src/program/generate.cpp` (+28 -3) </details> ### 📄 Description ## Problem and result With `--pipeline-windows 2`, a request can still decode serially when repetition penalties or coupled draft sampling are active. The existing warning is printed once per reason, so an API client cannot associate the chosen path with each response or tell whether two timing measurements used the same decode loop. With the opt-in `STRATA_DECODE_DIAGNOSTICS=1`, the Flash-Next solo serve path reports the selected loop and its reason in `timings.decode_segments`. For example: ```json {"decode_segments": [{"mode": "serial", "pipeline_windows": 2, "reason": "repetition_penalties"}]} ``` Without the option, the engine emits no new fields. No sampling defaults or pipeline eligibility rules change. ## Related discussion No issue is claimed as resolved. Checked related open and closed PRs again on October 31; no equivalent request-level loop/reason API was found. #3631 traces serial decode windows and excludes the pipeline loop; #2697 adds request tracing; #4334 adds a host timeline and draft-profiler output; #4197 preserves native error logs. These measure or preserve other information. #3760 proposes a third pipeline window; this patch targets current main's zero-to-two range. ## Approach Append optional key/value fields to the existing DONE statistics and parse them in the server. The server does not infer execution from requested settings. Keep native segments in order across continuations rather than presenting the final segment's path as the entire request. A missing report next to reported segments is unknown. `mode` identifies the dedicated decode loop, not GPU utilization or measured overlap. `none` means neither loop ran; the prompt tail may still emit tokens. Engines started with `--batch` omit this diagnostic even for requests processed on their solo path, because admission statistics are not the whole slot request. Old engines keep their existing response shape. Unknown or contradictory window/reason combinations are ignored. ## Validation Base: `870aedd9e1ebe1c91f94da93b59af17729f6c5c0` (Strata 0.2.8 / engine 0.1.54). Candidate: `aa7bd3a159e95ad0330d622dc0ddbb79040775d1`; tracked tree `0922b168226e4c5d7a842dfcd2ce80475f36a3c0`. Windows 11 10.0.26200, Python 3.14.2; MSVC 19.44 for the host-only native fixture. **Passed:** - API regression over `serve.test_decode_diagnostics`, `serve.test_request_accounting`, `serve.test_answer_speed`, `serve.test_server` and `serve.test_responses`: 429 tests, no failures, 4 existing skips, 132.803 s. These ran on an isolated main-plus-patch tree before integration; the integrated candidate's complete tracked Git tree matches that tested tree exactly. The runner uses a writable temporary directory and periodic stack dumps. - The 11 focused diagnostic tests also passed in the integrated checkout. They cover complete/streamed mock HTTP, thinking-budget continuations, cancellation, legacy DONE lines, mixed/missing reports, and 14 contradictory serial window/reason combinations without retaining the previous request's report. - Host-only native fixtures: the actual reporting block extracted from the integrated source compiled with MSVC `/std:c++17 /EHsc /W4 /WX`; 17 cases and their corrected-Python parser round trips passed. The reporting block is unchanged from the earlier candidate. Inputs simulate startup/loop facts; this is not GPU failure-path execution or a complete native-engine build. - Negative control: the earlier parser accepted `serial / windows=2 / not_requested`; the corrected parser omits that diagnostic while preserving the existing numerical statistics. - `git diff --check`, patch applicability checks, clean checkout, and GitHub comparison: main is fully included and the PR diff is limited to the four intended files. Captured output from the API regression run: ```text Ran 429 tests in 132.803s OK (skipped=4) ``` Historical native reference: on October 30, source `23de4bd24c6eb2a1bfb2c349835e7aad1c8fdb36` against base `46c152a1310f77cd2f0ce2c7cd213962df14fe83` built and linked all 169 CUDA steps for sm_86/sm_120. Real RTX 3070 + RTX 5070 Ti requests checked pipeline/penalty/coupled paths and cancellation recovery, with 22 controlled output/count comparisons matching baseline. Those runs used IQ3_S, 8/40 split, 128K, int8 KV, MTP, 20 GiB expert RAM and direct I/O. They are retained as earlier-version evidence, not a full native validation of the newly integrated source. **Failed:** - None in the current API checks, host fixtures or integration checks. Earlier environment setup failures remain in their dated validation records and are not presented as candidate failures or successes. **Not run:** - Full CUDA, HIP and Metal builds or real-GPU execution of this integrated candidate. The earlier CUDA build covers the old source only; HIP and Metal have no matching local toolchains. Keep this PR in draft until the affected-backend checks can be completed; targeted help is needed. SYCL uses its own unchanged generator and no SYCL engine-side diagnostic support is claimed. - GPU execution of configuration-disabled, pipeline-unavailable or snapshot-unavailable failure paths; fixture inputs do not reproduce device/startup failures. - Image input, near-limit context, long-running stability and quality evaluations. ## Limits Unbatched Flash-Next serving only; a `--batch` engine and the separate SYCL generator do not report this field. Thinking-budget continuations use mock HTTP, not a real-model thinking-loop test. Historical output equality was demonstrated only under documented fixed controls, not every setting or the newly integrated engine. These checks do not tightly bound overhead or establish a speedup. No performance change is claimed. Individual runs, configurations, output hashes and exact commands are retained with the validation records. Local reproduction entry points include `verify_tests.py` and `verify_native_reporting.py`; the standalone `native-reporting-fixture.cpp` contains the compiled reporting fixture. --- <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#5156
No description provided.