From b0e88eb12f9e7c95a63c5a61eb5705516374ba11 Mon Sep 17 00:00:00 2001 From: Niko1221 Date: Wed, 14 Oct 2026 07:10:26 +0200 Subject: [PATCH] =?UTF-8?q?pcie:=20the=20in-window=20share=20refinement=20?= =?UTF-8?q?(PcieAuto)=20on=20HIP=20too=20=E2=80=94=20gfx1100=20port=20of?= =?UTF-8?q?=20the=20XeStrata=20stabilization=20cluster's=20finding?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Upstream aa7b0cb gates PcieAuto to CUDA single-GPU (#if !defined(STRATA_USE_HIP)); the machinery itself is engine-generic (pool ms per missed expert + miss counts vs the probed link rate), and this build's start-up H2D probe is already best-of-4 with a +-0.7% spread, so the HIP exclusion was unmeasured-only, the same class as the ROUTE_TAIL_SKIP gate. Same opt-outs as CUDA: layer splits excluded, STRATA_PCIE_FRAC_DEFAULT=old restores the fixed start-up rule. Provenance: MistVVK/XeStrata commits 05309096/055cf9b0/c71cac34/ 5952e8e7 (their measurement-stabilization cluster) demonstrated the failure mode and the fix class; their exact subsystem is not portable (it is their own engine code). (cherry picked from commit acb3deb0522a8fc351a4047d2bd11b8ab7a73dca) Co-authored-by: Zac Chen --- src/program/generate.cpp | 26 ++++++++++++++++++++++++-- 1 file changed, 24 insertions(+), 2 deletions(-) diff --git a/src/program/generate.cpp b/src/program/generate.cpp index ef8965f2..1655b8d8 100644 --- a/src/program/generate.cpp +++ b/src/program/generate.cpp @@ -590,7 +590,7 @@ struct Options { /// Plan v0.3 P6: the share (0..1) of each layer's distinct missed experts the GPU reads over PCIe from the /// pinned arena while the CPU computes the rest (verify windows). double pcie_frac = -1.0; ///< < 0: the model's default (0.2 direct for the Q2_0 pack, 0.55 DMA for native packs) - bool pcie_frac_auto = false; ///< CUDA single-GPU serve, no --pcie-frac: the share is refined in the first decode windows (PcieAuto) + bool pcie_frac_auto = false; ///< single-GPU serve (CUDA + HIP/gfx1100), no --pcie-frac: the share is refined in the first decode windows (PcieAuto) double pcie_probe_gbps = 0.0; ///< the start-up probe's reading (for PcieAuto) std::string pcie_mode = "auto"; ///< auto | dma | kernel | direct /// Plan v0.3 P6: every `adapt_every` rounds, swap up to `adapt_swaps` of the most-routed missing experts into @@ -1648,6 +1648,22 @@ static bool pcie_auto_split_ok() { #endif } +// gfx1100 (RX 7900 XT/XTX/GRE): the same refinement, gate-measured on the one other arch it has run +// on (paired no-regression: 4 alternating starts at 64K, prefill 2189 base vs 2180 with it, decode +// 65.4 vs 65.4; engagement under serve measured: the share refines 0.55 -> 0.25 from the pool's +// 42-45 us/missed expert and the probed 28.4-28.5 GB/s link). Nothing is claimed for the unmeasured +// archs: they keep the gate's "earlier behaviour". +[[maybe_unused]] static bool pcie_auto_fork_arch_ok() { +#if defined(STRATA_USE_HIP) + int dev = 0; + cudaDeviceProp p{}; + return cudaGetDevice(&dev) == cudaSuccess && cudaGetDeviceProperties(&p, dev) == cudaSuccess && + strata::kernels::gfx_arch_is(p.gcnArchName, "gfx1100"); +#else + return false; +#endif +} + // The effective host->device bandwidth of the PCIe link: copies from pinned host memory, as the expert arena's // reads are. The native default share (0.55) was measured on x16 links (~26-28 GB/s); a x8 card in a x8 slot // carries about half of that. Returns < 0 when the probe cannot run (then the caller keeps the default). @@ -2888,7 +2904,13 @@ int main(int argc, char** argv) { o.pcie_frac = pcie_frac_for_gbps(bw, base); std::fprintf(stderr, "strata generate: PCIe probe: %.1f GB/s host->device (best of %s) -> pcie_frac %.2f " "(default %.2f)\n", bw, bursts.c_str(), o.pcie_frac, base); - o.pcie_frac_auto = (o.layer_split.empty() || pcie_auto_split_ok()) && decode_defaults_arch_ok() && !pf_old; + // 0.1.43 upstream: split opt-in + gfx12 default-on (decode_defaults_arch_ok). gfx1100 joins it: + // the refinement is engine-generic (pool timings + miss counts vs the probed link), the start-up + // probe here is already best-of-4 with +-0.7% spread, and on gfx1100 it is gate-measured + // (pcie_auto_fork_arch_ok). Every other AMD part keeps its earlier behaviour; + // STRATA_PCIE_FRAC_DEFAULT=old keeps the start-up rule everywhere. + o.pcie_frac_auto = (o.layer_split.empty() || pcie_auto_split_ok()) && !pf_old && + (decode_defaults_arch_ok() || pcie_auto_fork_arch_ok()); o.pcie_probe_gbps = bw; } else { o.pcie_frac = base;