mirror of
https://github.com/Niko1221/Strata.git
synced 2026-12-03 19:03:30 +07:00
[PR #4909] [Engine] Stage penalty histories for opt-in two-stage pipeline decode #5245
Labels
No labels
needs-format
pull-request
No milestone
No project
No assignees
1 participant
Notifications
Due date
No due date set.
Dependencies
No dependencies set.
Reference
Niko1221/Strata#5245
Loading…
Add table
Add a link
Reference in a new issue
No description provided.
Delete branch "%!s()"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
📋 Pull Request Information
Original PR: https://github.com/Niko1221/Strata/pull/4909
Author: @cennac
Created: 11/1/2026
Status: 🔄 Open
Base:
main← Head:fix/pipeline-penalties-20261101📝 Commits (1)
b8603b4增加双阶段流水的可选惩罚历史传递与边界测试📊 Changes
4 files changed (+109 additions, -2 deletions)
View changed files
📝
CMakeLists.txt(+5 -0)📝
docs/MULTI_GPU.md(+13 -1)📝
src/program/generate.cpp(+25 -1)➕
src/program/pipeline_penalties_test.cpp(+66 -0)📄 Description
Problem and result
A non-thinking Flash-Next request can inherit
presence_penalty=1.5from its model card. The engine then seeshist_n > 0and decodes serially even when--pipeline-windows 2is configured. Keeping pipeline windows beside batch slots alone does not address this second fallback.This draft adds
STRATA_PIPELINE_PENALTIES=1to stage each accepted window's per-row history before the final stage samples. It retains repetition/frequency/presence penalties instead of zeroing them. The opt-in is limited to two stages with async adaptation off; the coupled-draft restriction remains. No default or batch-coexistence rule changes.This is a focused port to main
c62d5e3a15b40ea51c96aae9e8d36928965f53ab. GPU measurements below belong to an earlier custom 0.1.43-based tree, not this submitted revision. This PR remains draft pending full builds, mainline GPU execution and output-parity checks.Related discussion
--batchplus pipeline windows.No default change or broad refactor is proposed.
Approach
The final stage only evaluates window A after the preceding verdict. Before its launch, use the existing
penalty_rowswith the acceptedconsumedprefix and A's fed-back/draft tokens. Checkconsumed.size() == A.p, upload to the existingd_histon the final stage's stream, and synchronize that stream before reusing the pageable host staging buffer. Both final-stage parities share this stream; rejected speculative window B does not contribute to the accepted prefix.The host sampler, per-row penalty rules and requested parameters stay in place. A failed copy or prefix check reports an engine error. The switch is off by default, uses no debug gate, and retains the serial fallback for more than two stages or async adaptation. SYCL has a separate untouched driver. Metal shares this source but has not been built or executed for this change.
The new host test compares per-window rows against independently constructed plain-decode histories across padding, short/capped history, first-draft rejection, partial/full acceptance and subsequent parity windows. It does not prove GPU stream ordering.
Validation
Submitted code:
b8603b46d758ff5fc452656e4ec9f63c0c4a1b0c, based on mainc62d5e3a. Environment for checks: Ubuntu 26.04.1 LTS, kernel 7.0.0-38-generic, GCC 15.2.0; installed ROCm 10 and CUDA 13.1 headers. Tests and compile logs, including exact expanded commands and existing warnings, are in the separate evidence archive.Passed on the submitted source:
Both tests passed. Also compiled
src/program/generate.cppinto an object independently with HIP compatibility headers and with CUDA headers, using GCC-std=c++20 -O0 -Wall -Wextra, native experts and fused/MMQ prefill definitions. Both returned 0. These are host translation-unit checks, not full engine/backend builds or links.Historical custom-tree execution (supporting evidence, not validation of the mainline port):
Failed or inconclusive:
Not run / needed before review:
Limits
This remains experimental and opt-in. The historical numbers justify investigation on RDNA3 but do not predict mainline performance or another GPU's gains. The stream synchronization has a cost; measure before enabling it. Model weights, private deployment paths and application configuration are excluded from the public export. The historical patch requires a custom base whose hashes and upstream MTP attribution are recorded in the evidence branch; the archive alone is not a complete reproduction of that binary.
Targeted help with full backend builds, mainline GPU validation and parity is welcome here before this is marked ready for review. The measurements and limitations above were checked against the saved local records.
🔄 This issue represents a GitHub Pull Request. It cannot be merged through Gitea due to API limitations.