mirror of
https://github.com/Niko1221/Strata.git
synced 2026-12-03 19:03:30 +07:00
[PR #4966] [Engine] Opt-in solo/batch MTP switching with physical single-GPU controls #5269
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#5269
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/4966
Author: @cennac
Created: 11/2/2026
Status: 🔄 Open
Base:
main← Head:fix/mtp-single-batch-transition-20261102📝 Commits (3)
b8603b4增加双阶段流水的可选惩罚历史传递与边界测试4398ff2增加MTP单卡验证与双卡请求切换实验开关2deb363记录MTP实机验证与输出一致性限制📊 Changes
9 files changed (+625 additions, -3 deletions)
View changed files
📝
CMakeLists.txt(+9 -0)➕
docs/MTP_SWITCHING.md(+133 -0)📝
docs/MULTI_GPU.md(+16 -1)➕
include/strata/program/pipeline_batch.hpp(+33 -0)📝
src/program/generate.cpp(+62 -2)➕
src/program/pipeline_batch_test.cpp(+56 -0)➕
src/program/pipeline_penalties_test.cpp(+66 -0)➕
tools/bench_mtp_switch.py(+158 -0)➕
tools/test_bench_mtp_switch.py(+92 -0)📄 Description
Problem and result
With
--batch 4 --batch-groups 2, a lone request on the dual-GPU service lost its solo pipeline windows and fell back to the serial path. This change adds a bounded opt-in so the supported two-stage topology can keep solo pipeline windows when no batch request is admitted, while preserving the existing batch-MTP path for concurrent requests. The default remains unchanged. The tested integration does not reproduce the complete optimized RDNA3 backend; that limitation is documented below.Related discussion
This work follows the existing mechanisms in #3095 and #4121, and uses the pending per-window penalty-history work in #4909. No default behavior is changed.
Approach
Enable the solo/batch exception only for two layer stages, four internal slots, two groups, two pipeline windows, piped MTP and
--spec >= 3. Admissions and prompt reads that could conflict with active batch slots stay on the serial verifier. Allocation and topology checks disable the exception when the required layout is unavailable. Physical single-GPU controls are measurement controls for the existing implementation.Validation
Passed: HIP/gfx1100 build and host tests for pipeline batches, penalties and groups; Windows CUDA-header compilation; HTTP/SSE protocol fixtures; 34 HIP request completions with the 1-to-2-to-1 transition observed; original service/config/power/fan settings restored and verified.
Failed: Paired rendered-text equality was only 3/14; the cause is unresolved, so this is not presented as lossless acceleration.
Not run: SYCL runtime, NVIDIA execution, sampled decoding, other models/quantizations, four simultaneous clients, and a complete port of the custom RDNA3 backend optimizations.
Limits
The measured rates are HTTP end-to-end observations, not a quality or token/logit parity proof. The custom RDNA3 source has backend paths that are outside this integration and remains the performance reference. Output parity and the remaining backend checks are unresolved; the measured requests do not establish merge readiness.
With
--batch 4 --batch-groups 2, a lone request loses solo pipeline windows even when the dual-GPU service has no other active client. Model-card penalties can separately force the serial path. This dependent integration adds an explicit, bounded opt-in for solo pipeline / batch-MTP coexistence, plus a physical single-GPU control and request-sequence measurement tool.Scope: this is a request-path switching integration, not the complete optimized RDNA3 backend port. It does not reproduce the custom build's best performance. The deployed optimized build remains in use; this PR is not its replacement.
Output equality is unresolved. Only 3/14 corresponding rendered-text hashes match between the dual arms. The opt-out control itself also varies before the final solo phase. HTTP completion and speed measurements do not establish lossless acceleration.
Behavior and scope
STRATA_HYBRID_WINDOWS=1keeps solo pipeline windows for exactly two layer stages, four slots, two explicitly selected groups,--pipeline-windows 2, batch MTP,--spec >= 3, andSTRATA_PIPED_MTP=2, with async adaptation off. Allocation/validation that reduces that topology disables the exception again. The setting is off by default.After diagnostic overrides, BGEN admissions and prompt reads beside active slots cannot enter the solo pipeline, including admission before the first batch slot is active. Existing pipeline drain and slot-copy paths handle committed state. The batch MTP drafter stays on the last card. Physical single-GPU MTP is an existing implementation and is unchanged; this contribution supplies separate controls for both physical cards rather than calling a dual-GPU solo request “single GPU”.
Related work and dependency
b8603b46) for exact per-window penalty histories. That patch remains independently reviewable. Once it lands, its dependent commit can be dropped from this diff.Validation
Tested engine code:
4398ff2e8ee44768104587585a5ce6a7e77e99d3, upstream basec62d5e3a15b40ea51c96aae9e8d36928965f53ab. Later documentation changes do not change the tested engine files. Binary/source hashes, commands, sanitized configs, individual requests, cold runs and structural engine excerpts are in the immutable evidence archive.Passed:
3cf03257f219afbe7334045ff7c6a06ac68c627dand rocWMMA source dependencies; no old engine objects reused.pipeline_batch_test,pipeline_penalties_test,batch_groups_teston Linux/GCC and Windows/MSVC. The admission test covers GEN → first admission with no active slot → active batch → GEN, diagnostic override precedence, unsupported topologies and opt-out behavior.generate.cppon Windows/MSVC, CUDA 12.1 headers. This alone is not a complete CUDA build.python tools/test_bench_mtp_switch.py: three HTTP/SSE protocol fixtures, including partial-stream failure and missing token usage; no GPU measurements are attributed to these fixtures.Failed / unresolved:
Not run:
Observed rates, not a lossless speedup claim
Same binary and public 130,020-token prompt, 512 output tokens (128 for the short staggered request), context capacity 131,072, greedy API settings, seed 42, reasoning disabled, retained warm cache. Values are medians of HTTP end-to-end completion-token rates; first cold runs remain in the archive and are excluded here.
Separate existing single-GPU MTP controls: GPU 0 69.54 t/s, GPU 1 60.08 t/s, medians of two warm runs each, with their cold requests retained. These require a 4 GiB conversation cache instead of the dual service's 16 GiB and a 12 GiB host-registration cap. Power limits were retained at 303 W and 231 W; this is not a stock blower/platinum comparison. Automatic expert-cache sizing can also change with the pipeline's extra verifier/snapshot reserve. Different generated text can change MTP acceptance, so these observations do not isolate a quality-preserving speed gain.
Use
docs/MTP_SWITCHING.mdandtools/bench_mtp_switch.pyfor the controls and sequence. Parity investigation and the remaining backend checks are still required before merge. Historical custom-tree 116/161 t/s records belong to that separate build, not this submitted integration.Same-day optimized-production control and missing backend paths
The appended raw control evidence runs both saved measurement scripts on the unchanged optimized production service. Both original and appended evidence are retained.
The switching rows use the medians of three solo-after requests and three synchronized pairs, HTTP end-to-end, actual 130,020-token input and 512 output tokens. Production solo-after samples were 114.48/134.11/134.27; dual pairs were 164.31/168.33/164.35. The original script uses a three-run solo mean and continuous dual throughput over 33.33 seconds, with two distinct prompts rather than the switching script's shared prompt. These scripts must not be treated as identical workloads.
The two stacks have different engine/server revisions; production retained GPU vision while the isolated candidate dual arms disabled it. This was a same-day sequential control, not a randomized kernel ablation. Output differences can also change MTP acceptance. Both scripts completed; the original marker checks passed; production configuration, power caps and fan modes were unchanged. Hotspot peaks were 77/82 C and minimum available RAM was 16.42 GiB. These checks do not resolve the candidate's output-equality failure above.
Source inspection found that the submitted tree does not include the custom
rdna_gr.cucompilation unit or its RDNA GR/Q8/A8/inject/fused control paths. It also does not implement the customSTRATA_RDNA_MMVQ_WAVEandSTRATA_WAIT_FUSEcontrols. Those variables remain in the candidate configuration but cannot restore absent implementations. The per-path explanation of the speed gap remains unconfirmed static analysis until controlled ports/ablations; no per-kernel contribution percentage is claimed.The complete custom source is already public with its existing history and attribution. It is the performance/reproduction reference, not the code submitted by this PR. Porting its backend changes requires separately reviewable patches and same-workload correctness/performance checks. This PR stays focused on switching; output parity and the remaining backend checks are still unresolved.
🔄 This issue represents a GitHub Pull Request. It cannot be merged through Gitea due to API limitations.