mirror of
https://github.com/Niko1221/Strata.git
synced 2026-12-06 00:08:52 +00:00
This puts the 40-79 SM cards back into kq_takes for an unset switch, as the default commit had them: takes_by_default with its staged-launch clause (the K-quant gate/up is a weight-staging instance and its Q5_1 / Q8_0 down is one the staged kernels were measured with). The commit before this one took the class out because its one-layer table is below MMQ at 20,000 tokens; the rule for a default here is that our own kernels take over where quality is kept, also when they are a little slower at the largest size. The evidence for the class: - One layer of Flash-Next's shape on an RTX A4000 (sm_86, 48 SMs, CUDA 12.9, 128-row tile, one repetition), MMQ time / fused time at 300 / 1,000 / 2,048 / 4,096 / 8,192 / 20,000 tokens: 1.67 / 1.44 / 1.49 / 1.35 / 1.05 / 0.97 (Q4_K / Q5_1), 1.79 / 1.61 / 1.67 / 1.46 / 1.08 / 0.98 (Q4_K / Q8_0), 1.72 / 1.59 / 1.60 / 1.45 / 1.05 / 0.99 (Q5_K / Q8_0): ahead up to 8,192 tokens, 1 to 3% behind at 20,000. - The staged K-quant fused path runs end to end on that A4000 in the Qwen3.6 engine. - No end-to-end run of Flash-Next on a card of that size; the Qwen3.6 engine runs the same staged path there. The commit undoes the one before it (kq_takes takes its SM40 argument again, the grid test, the start-up-line test, the register note and the docs/QUANTS.md row name the RTX A4000 and RTX 5070 class again) and adds the numbers above to the comment of kq_takes. Host code only.
65 lines
5.1 KiB
C++
65 lines
5.1 KiB
C++
// strata/core/nv_defaults.hpp - the per-architecture defaults of switches that are exact (bitwise) on NVIDIA sm_86 and sm_60.
|
|
//
|
|
// 148-nv measured every switch of the 0.1.45 bit-exact ON set, one at a time and in the stacked set, on an RTX 3060, an RTX A4000
|
|
// (sm_86) and a Tesla P100 (sm_60): a switch is in a table only when its token ids equal the default's and it was faster on that
|
|
// architecture (5+ interleaved pairs of fresh engines, noise arm, equal expert-cache slots; notes-148-nv.md). The identity gate
|
|
// (10 prompts + exact_pp 4K/20K, fixed flags) is IDENTICAL with the whole table on. Switches that change bits, hang or lost speed
|
|
// on a card (STRATA_EXCHANGE_ROTATE, STRATA_PCIE_BALANCE, STRATA_QSA_WARP, ...) are not in any table.
|
|
//
|
|
// 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.
|
|
#pragma once
|
|
|
|
#include <string>
|
|
#include <utility>
|
|
#include <vector>
|
|
|
|
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.
|
|
std::vector<std::string> apply_nv_defaults(int major, int minor);
|
|
|
|
} // namespace strata::core
|
|
|
|
namespace strata::core {
|
|
|
|
/// NVIDIA default that changes the answers (round 0212, NVSINGLE; the owner said yes 11-03): STRATA_MMQ_KQ=1, the K-quant MMQ prompt
|
|
/// kernels for the experts of Unsloth's UD-Q4/Q5/Q6_K_XL files (Q4_K / Q5_K / Q5_1 / Q6_K), which otherwise are dequantized to FP16 and multiplied by
|
|
/// cuBLAS. A pack without K-quant experts never reads the variable. Cards of compute capability 8.0 and up only (measured on sm_86 and sm_120).
|
|
/// On by default; STRATA_MMQ_KQ=0, STRATA_NV_KQ_DEFAULT=0 and STRATA_DEFAULTS=026 are the off switches (kNvKqDefaultOn=false would leave it behind
|
|
/// STRATA_NV_KQ_DEFAULT=1). Measured: RTX PRO 6000 prompt +26..38%, A6000 +2..11%, first-token KL 0.024 / 0.035, 61-task suite 54 vs 53.
|
|
/// min_major / min_minor are the lowest compute capability among the visible cards.
|
|
constexpr bool kNvKqDefaultOn = true;
|
|
std::vector<std::pair<std::string, std::string>> nv_kq_default_env(int min_major, int min_minor, bool defaults026);
|
|
std::vector<std::pair<std::string, std::string>> nv_kq_default_env(int min_major, int min_minor);
|
|
/// Sets what nv_kq_default_env returns where the user has not set the variable; prints one line to stderr when it set anything. fused_here: Strata's own fused
|
|
/// kernels read the K-quant experts on this machine (nv_kq_fused_here for a visible card); the line then says so, otherwise it is the earlier line, byte for byte.
|
|
std::vector<std::string> apply_nv_kq_default(int min_major, int min_minor, bool fused_here = false);
|
|
/// Whether a CUDA card (raw compute capability, its multiprocessor count) reads UD-Q4_K_XL's K-quant experts (Q4_K / Q5_K gate/up with a Q5_1 or Q8_0 down) on Strata's
|
|
/// own fused kernels, from the environment as the engine reads it: the card rule of fused_tile::kq_takes with STRATA_PF_FUSED_KQ, STRATA_PF_FUSED_SM40 and
|
|
/// STRATA_PF_FUSED_SM86; STRATA_PF_FUSED=0 turns every fused kernel off.
|
|
bool nv_kq_fused_here(int major, int minor, int sms);
|
|
/// The line apply_nv_kq_default prints (without the newline).
|
|
std::string nv_kq_default_line(bool fused_here);
|
|
|
|
/// dflash2-kern: the speculative runs' faster start-up adaptation of the expert tier (opt-in on sm_86 with STRATA_SPEC_ADAPT_SM86=1 since owner round 9; STRATA_SPEC_ADAPT_EVERY / _WARM, read by
|
|
/// generate.cpp): sm_86 only (z440 A4000 Q2_0; the P100 is opt-in through the two variables, notes-dflash2-kern.md). Not part of
|
|
/// the exact table above: the residency it changes decides which experts the GPU rounds, as the adaptive tier always does. The user's
|
|
/// own settings and the cards' off switches (STRATA_SM86_PERF=0) is kept.
|
|
void apply_spec_adapt_default(int major, int minor);
|
|
|
|
} // namespace strata::core
|