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++
native_mmvq: the interleaved 2-4 column kernel on Volta, with a rows table read off a V100
NoxestNoze509ba5e3d9d
diff --git a/src/kernels/cuda/native_mmvq.cu b/src/kernels/cuda/native_mmvq.cuindex 3384d4157..bf511b96d 100644--- a/src/kernels/cuda/native_mmvq.cu+++ b/src/kernels/cuda/native_mmvq.cu@@ -2510,9 +2510,18 @@ constexpr IlRows kIlRowsShared[] = { // sm_86 + sm_120, and the fallback for e// `mmvq_il_parity --bench --emit-table` on the card (docs/MMVQ_IL_TABLE.md), paste the printed block as a// `constexpr IlRows kIlRows_89[]` and add {89, kIlRows_89, sizeof(kIlRows_89) / sizeof(IlRows)} below. Each choice// is bitwise the same output, so a table is only speed. Without a rebuild: STRATA_MMVQ_IL_ROWS (see il_env_rows).+// Volta (sm_70): read off mmvq_il_parity --bench on a V100-SXM2-32GB (two runs, mean), the same rule - per cell the+// rows count whose every measured shape takes at least 3% off native_mmvq's time (e.g. the Q5_K head at 3 columns+// 1094 -> 821 us, Q6_K 12288 rows 68.9 -> 47.9 us), else 0; unmeasured classes take a neighbour's value (PR 1401)+constexpr IlRows kIlRows_70[] = {+ {23, {{0, 2, 2, 2, 2}, {0, 2, 2, 2, 2}, {0, 4, 2, 2, 2}}}, // IQ4_XS+ {12, {{0, 2, 2, 4, 4}, {0, 2, 2, 2, 2}, {0, 2, 2, 2, 2}}}, // Q4_K+ {13, {{0, 2, 2, 2, 2}, {0, 2, 2, 2, 2}, {0, 1, 2, 2, 2}}}, // Q5_K+ {14, {{0, 1, 1, 1, 1}, {0, 2, 2, 2, 2}, {0, 2, 2, 4, 2}}}, // Q6_K+};struct IlArch { int cc; const IlRows* t; size_t n; };constexpr IlArch kIlArch[] = {- {0, nullptr, 0}, // (placeholder so the array is never empty)+ {70, kIlRows_70, sizeof(kIlRows_70) / sizeof(IlRows)}, // Volta: PR 1401, measured on a V100-SXM2};// STRATA_MMVQ_IL_ROWS="type:ncols:r0,r1,r2,r3,r4;..." overrides single rows of the table for every card (type = ggml// type 23/12/13/14, ncols 2-4, r* = rows a warp 0/1/2/4 for the five n_out classes). Parsed once.@@ -2582,14 +2591,18 @@ int g_tune_rows = 0; // native_mmvq_il_tune (tests, benchmarks): rows a warp fvoid native_mmvq_il_tune(int rows) { g_tune_rows = rows; }namespace {-// sm_80 and newer only (measured on sm_86 and sm_120): Pascal/Volta/Turing keep native_mmvq's kernels unchanged+// sm_80 and newer (measured on sm_86 and sm_120) and Volta (sm_70, its own table above); Pascal/Turing keep+// native_mmvq's kernels unchangedbool il_arch_ok() {static int ok[16] = {}; // 0 unknown, 1 yes, -1 no, by device ordinalint dev = 0;if (cudaGetDevice(&dev) != cudaSuccess || dev < 0 || dev >= 16) return false;if (ok[dev] == 0) {int major = 0;- ok[dev] = (cudaDeviceGetAttribute(&major, cudaDevAttrComputeCapabilityMajor, dev) == cudaSuccess && major >= 8) ? 1 : -1;+ int minor = 0;+ cudaDeviceGetAttribute(&minor, cudaDevAttrComputeCapabilityMinor, dev);+ ok[dev] = (cudaDeviceGetAttribute(&major, cudaDevAttrComputeCapabilityMajor, dev) == cudaSuccess &&+ (major >= 8 || (major == 7 && minor == 0))) ? 1 : -1;}return ok[dev] > 0;}diff --git a/src/kernels/mmvq_il_parity.cpp b/src/kernels/mmvq_il_parity.cppindex ac6046789..30fc33012 100644--- a/src/kernels/mmvq_il_parity.cpp+++ b/src/kernels/mmvq_il_parity.cpp@@ -224,6 +224,12 @@ int check_tables() {if (a != 0 && a != 1 && a != 2 && a != 4) { ++bad; std::printf("FAIL table: rows %d", a); }}+ // Volta has its own table (PR 1401): Q6_K at 2 columns, 2560 rows -> 1 row a warp; the Ampere table says 0 there+ if (native_mmvq_il_rows_for(70, 14, 2, 2560) != 1 || native_mmvq_il_rows_for(86, 14, 2, 2560) != 0) {+ ++bad;+ std::printf("FAIL table: the sm_70 table is not the V100's+");+ }if (native_mmvq_il_rows_for(89, 99, 2, 2560) != 0 || native_mmvq_il_rows_for(89, 12, 5, 2560) != 0) {++bad;std::printf("FAIL table: an unknown type or ncols must be 0