Repository navigation
Conversation
|
It hasn't been merged yet, but STRATA_PEER_DIRECT is on by default, so the flag handoff runs on the default peer path, not just with STRATA_P2P_DECODE_SCATTER=1. With it, the greedy answers on two cards will differ from main's and can change from run to run, while with STRATA_PEER_DIRECT_SIGNAL=0 they will match main so it looks like a race. STRATA_PEER_DIRECT_SIGNAL is also missing from the settings register so the register check will fail. Could you make it opt-in, find the race and register the variable? |
b56d415 to
aed5648
Compare
|
Thanks for catching all three — fixed and re-verified on
|
aed5648 to
cd0e7ea
Compare
…PU decode window - Rebase on PR simplexai-labs#274 (direct hardware flag handoff opt-in via STRATA_PEER_DIRECT_SIGNAL=1) - Add system fences (__threadfence_system) on PCIe doorbells and scatter completion signals to prevent mutual wait_flag_ge deadlocks - Add all_gpu_resident check in Verifier::init and refresh_ar to gracefully disable autonomous mode when host expert fallback is required - Ensure safe pre-launch gather for PLE and propagate return status from peer_->launch_window
Problem and result
Builds on PR #272 (
pr-p2p-fused-scatter).Even with
STRATA_P2P_DECODE_SCATTER=1and user-space completion polling (h_done_seq_), the host pool thread still waits for the peer GPU to finish before raising*flag = wanton the primary GPU's verify stream:h_done_seq_*flag = wantWhen a layer has zero CPU experts (
!any_cpu && d.remote_count == 0) anddirectP2P scatter is active (STRATA_P2P_DECODE_SCATTER=1), there is no host work left to wait for. This PR lets the peer GPU's last scatter block write*flag = wantdirectly viacudaHostGetDevicePointer(d_target_flag_) after__threadfence_system(), allowingPeerExperts::finishto return immediately (zero CPU wait) andVerifier::run/serviceto skip raising*flagredundantly.Use-case impact & zero-regression guarantees
--peer-devicewith P2P direct scatter (STRATA_P2P_DECODE_SCATTER=1), eliminating the CPU round-trip between peer scatter completion and primary GPU wakeup on GPU-resident layers.PHB, staged D2H,--layer-split, HIP, Metal, SYCL, CPU):direct == true(STRATA_P2P_DECODE_SCATTER=1+p2p()+direct_mode()),!any_cpu,d.remote_count == 0,d_target_flag_ != nullptr, andSTRATA_PEER_DIRECT_SIGNALis not0.!direct(staged D2H or non-P2PPHB),flag_targetstaysnullptrsoPeerExperts::finishalways executes its hostmemcpyfromh_out_intooutnormally.STRATA_PEER_DIRECT_SIGNAL=0.Approach
engine/include/strata/core/verify.hpp&engine/src/program/generate.cpp: ExposedVerifier::h_flag()and bound it viapeer.set_target_flag(ver.h_flag()).engine/include/strata/core/expert_source.hpp&engine/src/core/expert_source.cpp: Addedwant_flag/peer_signals_flagonGpuPlanSink, checked!any_cpubeforepeer.launch, and skipped host*flag = wantinverify.cppwhensink_.peer_signals_flagis set.engine/include/strata/kernels/elementwise.hpp&engine/src/kernels/cuda/elementwise.cu: Extendedscatter_rows_and_signal_f32to optionally write*flag_ptr = flag_valafter__threadfence_system()on the final block.engine/include/strata/core/peer_experts.hpp&engine/src/core/peer_experts.cpp: Addedset_target_flagandsignaled_target_flag(), guarded strictly ondirect && direct_signal_env && want_flag > 0.Validation
Empirical benchmark built with Ninja + CUDA 13.4 (
sm_89;120) on Windows 11 (RTX 5080 16 GB+RTX 4060 Ti 16 GBon PCIe Gen4 x2), runningSwift-Qwen3.8-Flash-Next-GSQ-RCO-IQ2_XS(--peer-device 1 --kv q4_0 --spec 4 --resident-experts --resident-budget-gib 8, 511-token prompt, 64 generated tokens,STRATA_P2P_DECODE_SCATTER=1):upstream/main):20.65 tok/s(3099.2 ms)STRATA_P2P_DECODE_SCATTER=1, CPU wait):21.67 tok/s(2952.9 ms)STRATA_P2P_DECODE_SCATTER=1, direct hardware flag handoff): 22.87 tok/s (2798.1 ms, +5.5% over PR [Engine] peer_experts: mapped completion signal, zero-copy meta, and fused scatter+signal #272 scatter, +10.8% overupstream/mainbaseline), verifiedstrata peer: direct hardware flag handoff enabled.