okami.mom/strata

git clone https://git.nkp.pet/okami.mom/strata

Niko1221Merge f-p4-sibling 2fdee4aeb into f-p4-int (NVIDIA compute capability 8.0 and 8.9 join the sm_86 rule class for the fused prompt kernels)e98350152

main
2.6 KiB45 linesraw
1// 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
2// 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.
3#include <cstdio>
4
5#include "strata/prefill/fused_tq_default.hpp"
6
7using strata::prefill::fused_tq::gyro_m_on;
8using strata::prefill::fused_tq::on;
9using strata::prefill::fused_tq::parse_env;
10
11static int failed = 0;
12#define CHECK(x) do { if (!(x)) { std::fprintf(stderr, "FAIL %s:%d: %s\n", __FILE__, __LINE__, #x); ++failed; } } while (0)
13
14int main() {
15    // the variable's three readings
16    CHECK(parse_env(nullptr) == -1 && parse_env("") == -1);
17    CHECK(parse_env("1") == 1 && parse_env("1x") == 1);
18    CHECK(parse_env("0") == 0 && parse_env("2") == 0 && parse_env("off") == 0);
19
20    // unset: the sm_86 cards with 80+ SMs take the trellis kernels (A6000 / A40 84, 3090 Ti 84, 3090 82, 3080 Ti 80) ...
21    const int unset = parse_env(nullptr);
22    CHECK(on(unset, true, 84) && on(unset, true, 82) && on(unset, true, 80));
23    // ... 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
24    // (s86 false: outside the sm_86 class) whatever their SM count
25    CHECK(!on(unset, true, 79) && !on(unset, true, 72) && !on(unset, true, 68) && !on(unset, true, 48));
26    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));
27    // STRATA_PF_FUSED_SM86=0 makes DevInfo::s86 false: the A6000 class is back on MMQ
28    CHECK(!on(unset, false, 84));
29
30    // =1: the opt-in of before, on any card class (the kernels still have to set up on it)
31    CHECK(on(1, true, 84) && on(1, true, 48) && on(1, false, 48) && on(1, false, 110) && on(1, false, 188));
32    // =0 (or any other value): off, also on the A6000 class
33    CHECK(!on(0, true, 84) && !on(0, true, 80) && !on(0, false, 110));
34    CHECK(!on(parse_env("0"), true, 84) && !on(parse_env("false"), true, 84) && on(parse_env("1"), false, 48));
35
36    // Gyro-M (TQ2_T / TQ2_T) has no gate series: never by default, only with =1
37    CHECK(!gyro_m_on(parse_env(nullptr)) && !gyro_m_on(parse_env("")) && !gyro_m_on(parse_env("0")) && gyro_m_on(parse_env("1")));
38
39    if (failed) {
40        std::fprintf(stderr, "fused_tq_default_test: %d failed\n", failed);
41        return 1;
42    }
43    std::printf("fused_tq_default_test: all checks passed\n");
44    return 0;
45}