Qwen3.8-Flash-Next on any consumer hardware: one-click install for Windows / Linux. Strata inference engine, OpenAI/Anthropic API on localhost, optional image input.
C++
sm_60: IQ3 table staging is opt-in (STRATA_IQ_STAGE_TABLES=1), not the default on cc 6.0: no end-to-end gain on a Tesla P100 (#1424)
Niko1221e1ee39169d8f
diff --git a/docs/OLDER_GPUS.md b/docs/OLDER_GPUS.mdindex c4cd2a73f..87415ba5a 100644--- a/docs/OLDER_GPUS.md+++ b/docs/OLDER_GPUS.md@@ -114,16 +114,16 @@ and i-quant blocks (Q6_K, IQ4_XS, Q4_K, IQ3_S, ...) one int at a time. Two chang(+3.5 GiB; the experts keep their offsets, so the native pack is reused). Point `--native` and`--ple-gguf` at the new folder. Requantizing costs at most 0.4% of a tensor's |w|max (Q8_0 is finer than thesources).-- IQ3_XXS's and IQ3_S's codebooks and sign-mask tables are staged in shared memory by the grouped expert kernels on- compute capability 6.0 (IQ3_XXS's ported from shinbunbun/llama-cpp-p100-patches 29 and 30, IQ3_S's the same for its- sign bytes; bitwise the same output; `STRATA_IQ_STAGE_TABLES=0|1` forces it off or on, on any card). IQ3_S was the- one gate/up format whose codebook those kernels still read from global memory: a verify window's layer of IQ3_S- experts (20 experts, 24 entries) takes 24% less on a GP100 die (517 -> 393 us with a Q2_0 down projection, 492 ->- 369 us with IQ4_NL), and Swift 1.5 IQ3_XXS (13 of its 48 layers are IQ3_S) decodes 3.2% faster with the settings- below at 1M context (39.3 -> 40.5 tok/s, mean of the four prompts; the same drafts accepted). IQ3_XXS's tables- alone were within noise (+0-4%). It is a trade that only pays where the decode is the limit: on an RTX 3090 Ti- (sm_86), forced on, the same IQ3_S layers took 3-13% longer (those kernels already read at 490-665 GB/s there), so- the default is 6.0 only.+- **Opt-in `STRATA_IQ_STAGE_TABLES=1`**: IQ3_XXS's and IQ3_S's codebooks and sign-mask tables are staged in shared memory by+ the grouped expert kernels (IQ3_XXS's ported from shinbunbun/llama-cpp-p100-patches 29 and 30, IQ3_S's the same for its+ sign bytes; bitwise the same output). IQ3_S was the one gate/up format whose codebook those kernels still read from+ global memory: the contributor measured a verify window's layer of IQ3_S experts (20 experts, 24 entries) 24% faster on a+ GP100 die (517 -> 393 us with a Q2_0 down projection, 492 -> 369 us with IQ4_NL), and Swift 1.5 IQ3_XXS (13 of its 48+ layers are IQ3_S) 3.2% faster at 1M context (39.3 -> 40.5 tok/s); IQ3_XXS's tables alone were within noise (+0-4%). The+ maintainers' interleaved A/Bs on a Tesla P100 (PCIe, IQ3_XXS pack and IQ3_S pack, 5-6 pairs each) showed no end-to-end+ change (decode 0.97-1.03x, inside the noise of that box), so it is off by default (the contributor's version had it on+ for compute capability 6.0). On an RTX 3090 Ti, forced on, the same IQ3_S layers took 3-13% longer (those kernels already+ read at 490-665 GB/s there).- Neither change is measured on compute capability 6.1 (P40, P4, GTX 10 series), which has `__dp4a`. Both build forsm_61, and on a card with `__dp4a` the Q8_0 kernel's dot is the hardware instruction (`tools/q8_sm60_check.cu`passes on an RTX 3090 Ti); numbers from a 6.1 card with `STRATA_Q8_SM60=1` or `STRATA_IQ_STAGE_TABLES=1` woulddiff --git a/src/kernels/cuda/iq_kernels.cu b/src/kernels/cuda/iq_kernels.cuindex 21927e14b..a42cc4e5f 100644--- a/src/kernels/cuda/iq_kernels.cu+++ b/src/kernels/cuda/iq_kernels.cu@@ -2202,28 +2202,17 @@ bool g_stage_grid_mmvq = g_stage_grid && [] {return v != nullptr && v[0] == '1';}();// IQ3_XXS's and IQ3_S's codebooks and sign-mask tables staged in shared memory by the grouped expert kernels (the-// single-matrix mmvq does not): bitwise the same either way. The default on compute capability 6.0 (GP100: no-// __dp4a, these kernels decode-bound at 70-140 GB/s) and off elsewhere: on an RTX 3090 Ti, where they run at-// 490-665 GB/s, the staging made the IQ3_S layers 3-13% slower, and 6.1 cards (which have __dp4a) are unmeasured.-// STRATA_IQ_STAGE_TABLES=1 / 0 forces it on / off on any card.+// single-matrix mmvq does not): bitwise the same either way. OPT-IN: STRATA_IQ_STAGE_TABLES=1. The PR (#1424) made it+// the default on compute capability 6.0 (GP100: no __dp4a, these kernels decode-bound at 70-140 GB/s); on a Tesla P100+// (IQ3_XXS and IQ3_S packs, 5-6 interleaved pairs each) the decode was 0.97-1.03x of the unstaged kernels, noise, so+// it is not on by default. On an RTX 3090 Ti, forced on, the IQ3_S layers took 3-13% longer.bool stage_tables_on() {if (!g_stage_grid) return false;- static const int forced = [] {+ static const bool on = [] {const char* v = std::getenv("STRATA_IQ_STAGE_TABLES");- return (v && v[0]) ? (v[0] != '0' ? 1 : 0) : -1;+ return v && v[0] && v[0] != '0';}();- if (forced >= 0) return forced == 1;- static int by_device[64]; // 0 unknown, 1 on, 2 off- int dev = 0;- if (cudaGetDevice(&dev) != cudaSuccess || dev < 0 || dev >= 64) return false;- if (by_device[dev] == 0) {- int major = 0, minor = 0;- const bool gp100 = cudaDeviceGetAttribute(&major, cudaDevAttrComputeCapabilityMajor, dev) == cudaSuccess &&- cudaDeviceGetAttribute(&minor, cudaDevAttrComputeCapabilityMinor, dev) == cudaSuccess &&- major == 6 && minor == 0;- by_device[dev] = gp100 ? 1 : 2;- }- return by_device[dev] == 1;+ return on;}template<int TY, bool STAGE_GRID = kStageIqGrid<TY>>