sm_120: the wide hyper-connection up read is on by default

STRATA_GR_UP_WIDE (one warp a row, N/2 = 1,280 blocks instead of 160)
measured on the RTX PRO 5000 Blackwell 72 GB, IQ3_S, every expert in VRAM,
5 interleaved pairs of fresh engines: story 197.6 -> 201.3 tok/s (+1.9%),
code 243.5 -> 245.1 (+0.7%).  A third run against the switch (default on vs
STRATA_GR_UP_WIDE=0) reads +1.7% / +0.8%.  The produced token ids were
identical in all 6 pairs, and fused_gr_bench's per-T hashes are the plain
read's.  The switch stays: =0 off, =1 on any card, STRATA_SM120_PERF=0 the
whole 12.0 set.  Other cards are untouched.
This commit is contained in:
Niko1221 committed 2026-10-25 21:21:28 +01:00
1 parent 3a26753027
commit d39e2a7539
2 files changed
+20 -4

No files matched your search

+2
View File
@@ -10,6 +10,8 @@
// STRATA_GR_DOWN_TG=1 the hyper-connection down projection with one token a block row (T times the blocks); =2 (token
// pairs) on a 12.0 card with fewer than 80 SMs
// STRATA_GU_SWIGLU=1 gate/up, SwiGLU and the q8_1 blocks of the routed experts in one launch
// STRATA_GR_UP_WIDE=1 the hyper-connection up projection with one warp a row (1,280 blocks instead of 160; +1.9%
// story / +0.7% code decode on the RTX PRO 5000, 5 pairs, token ids identical; bitwise)
// and one that rounds differently (KL-checked, the AMD gfx12 rule): STRATA_PF_FUSED (the native packs' prompt experts on the
// fused int8 kernels, IQ2_S / IQ3_XXS / IQ3_S / IQ4_XS gate/up only, 12.0 cards with 80+ SMs only; =0 keeps MMQ, =1 takes every
// covered format on any card).
+18 -4
View File
@@ -439,13 +439,27 @@ __global__ void __launch_bounds__(THREADS) gr_up_multi_kernel(GrMulti m) {
constexpr int UPW_COLS = 2;
constexpr int UPW_BLOCKS = N / UPW_COLS;
/// STRATA_GR_UP_WIDE=1: the wide up read; default off (each card's own A/B decides).
/// STRATA_GR_UP_WIDE: the wide up read. ON BY DEFAULT on a 12.0 card (sm120_series.hpp; STRATA_SM120_PERF=0 or
/// STRATA_GR_UP_WIDE=0 turns it off, =1 forces it on any card). Measured on the RTX PRO 5000 (IQ3_S, all experts
/// resident, 5 interleaved pairs of fresh engines): story 197.6 -> 201.3 tok/s (+1.9%), code 243.5 -> 245.1 (+0.7%),
/// the produced token ids identical in 6/6 runs; the isolated read (fused_gr_bench) is bitwise the old kernel's.
bool gr_up_wide_on() {
static const bool on = [] {
static const int env = [] {
const char* v = std::getenv("STRATA_GR_UP_WIDE");
return v != nullptr && std::atoi(v) != 0;
return v != nullptr ? (std::atoi(v) != 0 ? 1 : 0) : -1;
}();
return on;
if (env >= 0) return env != 0;
static int per_dev[64]; // 0 unknown, 1 no, 2 yes
int dev = 0;
if (cudaGetDevice(&dev) != cudaSuccess || dev < 0 || dev >= 64) return false;
if (!per_dev[dev]) {
int major = 0, minor = 0;
cudaDeviceGetAttribute(&major, cudaDevAttrComputeCapabilityMajor, dev);
cudaDeviceGetAttribute(&minor, cudaDevAttrComputeCapabilityMinor, dev);
per_dev[dev] = strata::sm120_default(major, minor) ? 2 : 1;
cudaGetLastError(); // drop what an attribute query on a CPU-only box leaves behind
}
return per_dev[dev] == 2;
}
template <int MAX_T = kFusedGrMaxT, bool EXACT_T = false>