Skip to content

Qwen3.8-Flash-Next on any consumer hardware: one-click install for Windows / Linux. Strata inference engine, OpenAI/Anthropic API on localhost, optional image input.

C++

sm_121 (GB10, DGX Spark) speed defaults and the fused prompt tile

Niko12219a398bd5bf60
diff --git a/include/strata/core/nv_defaults.hpp b/include/strata/core/nv_defaults.hpp
index 21a0bfa72..e9e4099a0 100644
--- a/include/strata/core/nv_defaults.hpp
+++ b/include/strata/core/nv_defaults.hpp
@@ -8,6 +8,9 @@
//
// STRATA_SM86_PERF=0 turns the sm_86 table off (cards of compute capability 8.6: RTX 3050-3090, RTX A2000-A6000)
// STRATA_SM60_PERF=0 turns the sm_60 table off (Pascal GP100: Tesla P100)
+// STRATA_SM121_PERF=0 turns the sm_121 table off (GB10: NVIDIA DGX Spark; new in 0.2.7.1, also off under STRATA_DEFAULTS=026). Its
+// switches are measured speed settings, not bit-exact ones: the fused prompt kernels and the FP4-activation NVFP4
+// prompt round differently from the paths they replace (24 of 24 greedy answers identical; no KL run yet).
//
// A switch the user set (to anything, including 0) is never overridden. Applied once at start, before any engine code reads its
// switches; the table is used only when every visible CUDA device has the same compute capability.
@@ -22,6 +25,8 @@ namespace strata::core {
/// The environment settings that are the defaults of a card with compute capability major.minor (raw, as the driver reports it);
/// empty for every other card and when its off switch is 0.
std::vector<std::pair<std::string, std::string>> nv_default_env(int major, int minor);
+/// The same with the answer of STRATA_DEFAULTS=026 given (the sm_121 table is empty then), so a test can check both without the environment.
+std::vector<std::pair<std::string, std::string>> nv_default_env(int major, int minor, bool defaults026);
/// Sets `nv_default_env(major, minor)` in this process's environment where the user has not set the variable, prints one line to
/// stderr when it set anything, and returns the names it set.
diff --git a/src/core/nv_defaults.cpp b/src/core/nv_defaults.cpp
index 05799f836..8c5de7266 100644
--- a/src/core/nv_defaults.cpp
+++ b/src/core/nv_defaults.cpp
@@ -1,6 +1,7 @@
// src/core/nv_defaults.cpp - see include/strata/core/nv_defaults.hpp.
#include "strata/core/nv_defaults.hpp"
+#include "strata/core/defaults_026.hpp"
#include "strata/core/emulate.hpp"
#include <cstdio>
@@ -16,6 +17,10 @@ bool off(const char* name) {
} // namespace
std::vector<std::pair<std::string, std::string>> nv_default_env(int major, int minor) {
+ return nv_default_env(major, minor, strata::qwen_defaults_026());
+}
+
+std::vector<std::pair<std::string, std::string>> nv_default_env(int major, int minor, bool defaults026) {
std::vector<std::pair<std::string, std::string>> t;
const int mj = strata::cc_major_of(major), mn = strata::cc_minor_of(minor);
if (mj == 8 && mn == 6) {
@@ -45,11 +50,37 @@ std::vector<std::pair<std::string, std::string>> nv_default_env(int major, int m
{"STRATA_FUSE_DECODE", "1"}, // -1.3
{"STRATA_GR_UP75", "1"}, // -1.2
};
+ } else if (mj == 12 && mn == 1) {
+ // GB10 (NVIDIA DGX Spark, 48 SMs, unified memory): only what was measured on that part goes in. New in 0.2.7.1, so
+ // STRATA_DEFAULTS=026 (the master switch of everything since 0.2.6) leaves the table out, like STRATA_SM121_PERF=0.
+ if (off("STRATA_SM121_PERF") || defaults026) return t;
+ t = {
+ // the fused IQ prompt kernels. IQ3_S, 64K context, fresh 4K/16K/32K prompts at T=0, 3 paired rounds against
+ // the same tree without it: prompt 1.139 / 1.149 / 1.121, decode unchanged; 5 of 5 greedy answers byte-
+ // identical with it on and off (docs/DGX_SPARK_LINUX.md; HANDOVER §6.2). It rounds differently from MMQ,
+ // so it is a default with an off switch, like the sm_86 table.
+ {"STRATA_PF_FUSED", "1"},
+ // NVFP4 prompt MMQ with FP4 activations (W4A4), the Blackwell path the engine keeps opt-in. On this part, the
+ // NVFP4 pack measured prompt 1.106x at 4K and 1.229x at 16K against the default W4A8 MMQ, decode unchanged
+ // (1.015x), and 24 of 24 greedy answers byte-identical with it on and off. Opt-in upstream because it is only
+ // checked on Blackwell; switched on here for the same reason as the row above, with the same off switch.
+ {"STRATA_PREFILL_NVFP4", "w4a4"},
+ // the hyper-connection read's fused up projection + mix (gr_upmix). Measured on IQ3_S against the unfused read:
+ // decode 1.054x [1.007, 1.089], prompt unchanged, and 24 of 24 greedy answers byte-identical (the parity test
+ // src/prefill/gr_upmix_parity.cu covers it upstream). The HC read is ~13% of a decode round here, which is
+ // why a fusion on it moves the number at all.
+ {"STRATA_HC_UPMIX", "1"},
+ // the cost-aware MTP window: pick the verify window from what a draft costs against what it has been paying.
+ // Measured on IQ3_S: decode 1.047x [1.019, 1.079], prompt unchanged, 24 of 24 greedy answers byte-identical.
+ // It only changes which drafts are attempted, and every draft is verified, so the answers cannot drift.
+ {"STRATA_SPEC_COST", "1"},
+ };
}
return t;
}
std::vector<std::string> apply_nv_defaults(int major, int minor) {
+ const int mj = strata::cc_major_of(major), mn = strata::cc_minor_of(minor);
std::vector<std::string> set;
for (const auto& kv : nv_default_env(major, minor)) {
if (std::getenv(kv.first.c_str()) != nullptr) continue; // the user's setting wins, whatever it is
@@ -61,9 +92,14 @@ std::vector<std::string> apply_nv_defaults(int major, int minor) {
set.push_back(kv.first);
}
if (!set.empty()) {
- const bool sm86 = strata::cc_major_of(major) == 8;
- std::fprintf(stderr, "strata: %s: %zu exact speed switches on by default (%s=0 turns them off; a switch you set is kept): ",
- sm86 ? "sm_86 (Ampere)" : "sm_60 (Pascal)", set.size(), sm86 ? "STRATA_SM86_PERF" : "STRATA_SM60_PERF");
+ const bool sm86 = mj == 8;
+ const bool sm121 = mj == 12 && mn == 1;
+ // sm_86 / sm_60: bit-exact switches. sm_121: the fused prompt path and the FP4-activation NVFP4 prompt round differently from the
+ // paths they replace (24 of 24 greedy answers were identical on the Spark; no KL run), so the line does not say "exact".
+ std::fprintf(stderr, "strata: %s: %zu %sspeed switches on by default (%s=0 turns them off%s; a switch you set is kept): ",
+ sm86 ? "sm_86 (Ampere)" : sm121 ? "sm_121 (GB10)" : "sm_60 (Pascal)", set.size(), sm121 ? "" : "exact ",
+ sm86 ? "STRATA_SM86_PERF" : sm121 ? "STRATA_SM121_PERF" : "STRATA_SM60_PERF",
+ sm121 ? ", as does STRATA_DEFAULTS=026" : "");
for (size_t i = 0; i < set.size(); ++i) std::fprintf(stderr, "%s%s", i ? " " : "", set[i].c_str() + 7);
std::fprintf(stderr, "\n");
}
diff --git a/src/prefill/moe_fused_iq.cu b/src/prefill/moe_fused_iq.cu
index 5d8afd32c..d47251025 100644
--- a/src/prefill/moe_fused_iq.cu
+++ b/src/prefill/moe_fused_iq.cu
@@ -1655,6 +1655,7 @@ struct DevInfo {
bool t75 = false; // Turing (STRATA_PF_FUSED_SM75): the Q2_0 / Q2_0 layers only (what was set up and checked there)
bool q2n = false; // sm_80+ with STRATA_PF_FUSED_Q2N=1: the native Q2_0 pack's Q2_0 gate/up is set up as well (opt-in)
bool s120 = false; // compute capability 12.0 (sm120_series.hpp): the default for the formats measured there
+ bool s121 = false; // GB10 (sm_121, DGX Spark): 128-row tiles win from 65,536 routed rows a launch up (pick_ww)
int sms = 0, occ = 1;
int occ_nt = 0; // blocks per multiprocessor of the NT = 256 kernels (0: not set up)
bool ws = false; // STRATA_PF_FUSED_WS: the warp-specialized kernels are set up
@@ -1784,6 +1785,7 @@ const DevInfo& dev_info() {
cudaDeviceGetAttribute(&major, cudaDevAttrComputeCapabilityMajor, dev);
cudaDeviceGetAttribute(&minor, cudaDevAttrComputeCapabilityMinor, dev);
d.s120 = strata::sm120_default(major, minor); // (takes the raw attributes, as is_sm120 does)
+ d.s121 = major == 12 && minor == 1; // GB10 (DGX Spark): its own tile threshold, see pick_ww
major = strata::cc_major_of(major); // STRATA_EMULATE_CC counts (tests)
minor = strata::cc_minor_of(minor);
cudaDeviceGetAttribute(&d.sms, cudaDevAttrMultiProcessorCount, dev);
@@ -1914,6 +1916,19 @@ int pick_ww(int64_t n, int n_expert) {
}();
if (forced) return forced;
const double avg = (double) n / std::max(n_expert, 1);
+ // GB10 (sm_121, 48 SMs): the launch's average is above 112 rows an expert for every prompt size here, so the 5070's
+ // 56-112 band never fires and the 64-row tile would be chosen everywhere. Forcing 128 rows measured +3.7% [1.030, 1.079]
+ // and +3.4% [1.030, 1.038] at 16K in two independent order-balanced block pairs (12 samples a cell) and +4.3% at 32K
+ // in the second pair, with 4K neutral-to-slightly-worse (0.989x, 0.962x, intervals spanning 1.0). So on this part the
+ // 128-row tile is taken from 65,536 routed rows a launch (about an 11K-token prompt at six experts) up; 4K keeps 64.
+ // STRATA_PF_TILE_DEBUG=1 prints the choice of every launch.
+ if (dev_info().s121) {
+ static const bool dbg = [] { const char* v = std::getenv("STRATA_PF_TILE_DEBUG"); return v != nullptr && v[0] == '1'; }();
+ const int ww = n >= 65536 ? 2 : 4;
+ if (dbg) std::fprintf(stderr, "strata: fused tile: rows %lld experts %d avg %.1f s121 yes -> ww %d\n",
+ (long long) n, n_expert, avg, ww);
+ return ww;
+ }
return avg > 56.0 && avg <= 112.0 ? 2 : 4;
}