Files
Strata/engine/tests/prefill/fused_tq_default_test.cpp
T
Niko1221 4058aa782b Layout move for 0.2.16: the top level becomes app/, engine/, terminal/, docs/, tools/ and .github/
Made by tools/layout/move_0216.py (the commit before this one) on db8e0be9c, the final code head of 0.2.16:
- 75 git mv (renames, so `git log --follow` and blame keep working; packaging/acceptance_matrix.md shows as delete + add because its links
  changed too) and 3 removals: SETUP.bat, UPDATE.bat and update.sh (setup.py --update pulls the code now);
- 1,425 path edits in 307 files: root-relative paths in CI, Docker, .gitignore and the release scripts; Markdown links; Python and
  Node joins from a root that moved with its folder; explicit edits for code that computes a root or names a moved path; tables of
  repository paths inside tests.

engine/ holds what CMake builds (src, include, cmake, metal, sycl, spark, third_party, the C++ tests and benches). app/ is the desktop
app and its host (was apps/). terminal/ is the Terminal in the layout of the installed one (strata.py, setup.py, strata_cli,
strata_control, serve, bin, data, ref, crates, the Python tools and tests). docs/ has the documentation, docs/lang/ the translated
READMEs, docs/history and docs/bench-results. tools/ has the repository's own checks, packaging, docker, research and nix.
tests/core/test_tqp_ref.py is a pytest file and stays with the Python tests (terminal/tests/core/).
AGENTS.md, README.md, LICENSE, setup.sh and START-HERE.bat stay at the root.

No behaviour change: the same command lines, the same sources. For this head a replay of the script gave the same numbers and the path
scan (tools/layout/checks/path_scan.py) reports no hit; the suites and the builds run on this commit next.
2026-11-17 13:19:21 +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;
}