Files
Strata/tests/prefill/fused_tq_default_test.cpp
T
Niko1221 2fdee4aeb1 fused prompt kernels: the sm_86 rule class takes compute capability 8.0 and 8.9 as well
The CUDA fused prompt kernels' default rules were keyed on one flag that was true only for compute capability 8.6 (and 12.0 for the sm_120 part):
the 80+ SM default for the i-quant formats (IQ2_XXS, IQ2_XS, IQ2_S, IQ3_XXS, IQ3_S, IQ4_XS), the staged default of the 40-79 SM cards, the staged and
wide tile lines of pick(), and the Gyro-S default. A100-class (8.0) and RTX 40-class (8.9) cards run the same source as the 8.6 and 12.0 cards those
rules were gated on, and took MMQ instead.

s86_class(major, minor, off) in fused_tile_rule.hpp is true for 8.0, 8.6 and 8.9 (false for everything else, 8.7 and 9.0 included; false for all
when STRATA_PF_FUSED_SM86=0), and DevInfo::s86 in moe_fused_iq.cu comes from it. Nothing else moves: the 40-79 SM rule and its STRATA_PF_FUSED_SM40=0
way back, cards under 40 SMs and the small-card rule (MMQ as before), K-quant / Q6_K / Q8_0 / Q5_0 / Qwen3.6 fused (opt-in on every class), HIP
builds, sm_60 / 6.1 / 7.0 / 7.5. No kernel, tile table, log line or setting changes; the device code is the same.

No card of compute capability 8.0 or 8.9 has run these kernels here. The evidence is the 8.6 and 12.0 gates plus the same source compiled for sm_80
and sm_89 (the release packages carry sm_89 in both CUDA variants and sm_80 in the CUDA 12 variant).

The unit test fused_tile_rule_test gets the compute capability as an input: 12 capabilities x STRATA_PF_FUSED x STRATA_PF_FUSED_SM40 x
STRATA_PF_FUSED_SM86 x STRATA_SM120_PERF x 0-200 SMs x staged x down x 13 formats against an oracle written from the decision, the tile rule and the
Gyro-S default over the same capabilities, and the old rule against the new one for every capability but 8.0 and 8.9. Register notes of
STRATA_PF_FUSED_SM40, STRATA_PF_FUSED_SM86 and STRATA_PF_FUSED_TQ name the new class.
2026-11-12 13:06:33 +01:00

46 lines
2.6 KiB
C++

// the default rule of the CUDA fused trellis (Gyro) prompt kernels (include/strata/prefill/fused_tq_default.hpp): unset = on for a card of the sm_86 class (compute capability 8.6, and
// 8.0 / 8.9 since 11-12: fused_tile_rule.hpp s86_class, tested with the capability in fused_tile_rule_test) with 80+ SMs, off for every other class; =1 forces on, any other value off. No GPU, no model.
#include <cstdio>
#include "strata/prefill/fused_tq_default.hpp"
using strata::prefill::fused_tq::gyro_m_on;
using strata::prefill::fused_tq::on;
using strata::prefill::fused_tq::parse_env;
static int failed = 0;
#define CHECK(x) do { if (!(x)) { std::fprintf(stderr, "FAIL %s:%d: %s\n", __FILE__, __LINE__, #x); ++failed; } } while (0)
int main() {
// the variable's three readings
CHECK(parse_env(nullptr) == -1 && parse_env("") == -1);
CHECK(parse_env("1") == 1 && parse_env("1x") == 1);
CHECK(parse_env("0") == 0 && parse_env("2") == 0 && parse_env("off") == 0);
// unset: the sm_86 cards with 80+ SMs take the trellis kernels (A6000 / A40 84, 3090 Ti 84, 3090 82, 3080 Ti 80) ...
const int unset = parse_env(nullptr);
CHECK(on(unset, true, 84) && on(unset, true, 82) && on(unset, true, 80));
// ... and nothing else does: RTX 3080 (68), A10 (72), A4000 (48) on sm_86 below 80 SMs; sm_120 cards (5070 48, 5080 84, PRO 5000 110, PRO 6000 188), GB10, sm_90 / 8.7
// (s86 false: outside the sm_86 class) whatever their SM count
CHECK(!on(unset, true, 79) && !on(unset, true, 72) && !on(unset, true, 68) && !on(unset, true, 48));
CHECK(!on(unset, false, 48) && !on(unset, false, 84) && !on(unset, false, 110) && !on(unset, false, 188) && !on(unset, false, 108) && !on(unset, false, 128));
// STRATA_PF_FUSED_SM86=0 makes DevInfo::s86 false: the A6000 class is back on MMQ
CHECK(!on(unset, false, 84));
// =1: the opt-in of before, on any card class (the kernels still have to set up on it)
CHECK(on(1, true, 84) && on(1, true, 48) && on(1, false, 48) && on(1, false, 110) && on(1, false, 188));
// =0 (or any other value): off, also on the A6000 class
CHECK(!on(0, true, 84) && !on(0, true, 80) && !on(0, false, 110));
CHECK(!on(parse_env("0"), true, 84) && !on(parse_env("false"), true, 84) && on(parse_env("1"), false, 48));
// Gyro-M (TQ2_T / TQ2_T) has no gate series: never by default, only with =1
CHECK(!gyro_m_on(parse_env(nullptr)) && !gyro_m_on(parse_env("")) && !gyro_m_on(parse_env("0")) && gyro_m_on(parse_env("1")));
if (failed) {
std::fprintf(stderr, "fused_tq_default_test: %d failed\n", failed);
return 1;
}
std::printf("fused_tq_default_test: all checks passed\n");
return 0;
}