Skip to content

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++

prefill: UD-Q4_K_XL prompts 2.8x faster (16K: 57 -> 160 tok/s on an RTX 5070) - 32 stager threads and a 128-deep ring when the experts are read from the GGUF in place; MMQ for its Q4_K / Q5_K / Q5_1 experts

Niko12212ba4504b7152
diff --git a/CMakeLists.txt b/CMakeLists.txt
index a47c32e6d..b01a1b307 100644
--- a/CMakeLists.txt
+++ b/CMakeLists.txt
@@ -817,7 +817,9 @@ if(STRATA_NATIVE_EXPERTS)
endif()
set(_strata_mmq ${_strata_gg}/src/ggml-cuda)
add_library(strata_mmq STATIC src/prefill/moe_mmq.cu src/prefill/ggml_cuda_host.cu ${_strata_mmq}/quantize.cu)
- foreach(_t q2_0 iq2_xxs iq2_xs iq2_s iq3_xxs iq3_s iq4_nl iq4_xs q8_0) # q8_0: the drafter's matrices (E-9)
+ # q8_0: the drafter's matrices (E-9); q4_k q5_k q5_1: the experts of Unsloth's UD-Q4_K_XL (docs/UNSLOTH_Q4.md;
+ # the dispatch follows eddoursul/Strata 7706c1b), compiled in with STRATA_MMQ_KQUANTS
+ foreach(_t q2_0 iq2_xxs iq2_xs iq2_s iq3_xxs iq3_s iq4_nl iq4_xs q8_0 q4_k q5_k q5_1)
target_sources(strata_mmq PRIVATE ${_strata_mmq}/template-instances/mmq-instance-${_t}.cu)
endforeach()
target_include_directories(strata_mmq PRIVATE ${_strata_gg}/include ${_strata_gg}/src ${_strata_mmq}
@@ -827,8 +829,16 @@ if(STRATA_NATIVE_EXPERTS)
target_compile_options(strata_mmq PRIVATE $<$<COMPILE_LANGUAGE:CUDA>:-Xcompiler=/bigobj>)
endif()
target_link_libraries(strata_mmq PUBLIC ggml-base ${_strata_gpu_runtime_target})
+ target_compile_definitions(strata_mmq PRIVATE STRATA_MMQ_KQUANTS=1)
target_link_libraries(strata_prefill PUBLIC strata_mmq)
target_compile_definitions(strata_prefill PUBLIC STRATA_PREFILL_MMQ=1)
+ if(STRATA_BUILD_TESTS)
+ # the UD-Q4_K_XL expert formats through MMQ against ggml's dequantized weights (synthetic, a few seconds)
+ add_executable(prefill_mmq_kquant_test tests/cuda/prefill_mmq_kquant_test.cpp)
+ target_link_libraries(prefill_mmq_kquant_test PRIVATE strata_mmq ggml-base ${_strata_gpu_runtime_target})
+ add_test(NAME prefill_mmq_kquant_test COMMAND prefill_mmq_kquant_test)
+ set_tests_properties(prefill_mmq_kquant_test PROPERTIES TIMEOUT 120)
+ endif()
elseif(STRATA_PREFILL_MMQ)
# Compile only the pinned GGML MMQ and activation-quantizer sources used by prefill. This uses
# common.cuh's native HIP path without enabling a second GGML HIP backend.
diff --git a/docs/UNSLOTH_Q4.md b/docs/UNSLOTH_Q4.md
index 31d254396..dc81ca469 100644
--- a/docs/UNSLOTH_Q4.md
+++ b/docs/UNSLOTH_Q4.md
@@ -146,8 +146,15 @@ low-RAM mode; `STRATA_RESIDENT_PIN=0` keeps the budget locked only (the CPU then
| 40 GiB | **7-8.5 tok/s** (6 runs: 6.7-8.6, mean 7.9) | 1.1 GB read from the SSD per verify round, ~0.33 GB per token |
- The first answer comes about 60 s after the engine starts (mostly loading: the RAM budget is copied from the GGUF
- files at start). A 30-token prompt then took 5-6 s. Longer prompts have not been measured and will be slow: the
- prompt path dequantizes these formats to FP16 (fast prompt kernels for Q4_K/Q5_K/Q5_1 are future work).
+ files at start). A 30-token prompt then took 5-6 s.
+- Long prompts (engine 0.1.32): a 16K prompt is read at **160 tokens/s** (15,873 tokens in 99 s; 0.1.31: 57 tokens/s,
+ 273-282 s). Reading a prompt streams every expert once per 4K chunk, and the third of them outside the RAM budget
+ come from the SSD (~35 GB per chunk), so the prompt path now reads them with 32 threads and up to 128 blobs in
+ flight when the experts are read from the GGUF in place (`STRATA_STAGER_THREADS` / `STRATA_STAGER_RING` override
+ it; 4 and 16 before, still the default for every other model). The experts' products go through llama.cpp's MMQ
+ kernels for Q4_K / Q5_K / Q5_1 / Q8_0 (as for the other models' formats; `STRATA_PREFILL_MMQ=0` for FP16): 4x less
+ GPU time for them, but on this PC the prompt waits for the SSD either way (the same 29 s per 4K chunk with or
+ without). Between the chunks, the 28.8 GB PLE table's rows take ~5 s per chunk.
- The speed varies from run to run (6.7-8.6 tok/s at 40 GiB for the same prompt), with what the OS file cache holds.
- For comparison, IQ3_S (all its experts in RAM) writes ~53 tok/s on the same PC ([the speed tables](DETAILS.md#speed-measured)).
- Where the time goes (`--stats` on the command line): at 40 GiB about 550-750 ms of each verify round (3.5 tokens) is
@@ -183,7 +190,9 @@ code answer's 400), which is why its agreement is lower. It is not the long cont
positions after only 512 tokens agree a little less (89.2%), and the perplexities match within 3% in every set. For
scale, Strata's own greedy run and its teacher-forced rerun of the continuation pick different tokens at 6% of the
positions (93.8% the same: other window sizes, other experts in VRAM), the same kind of near-tie flips. The 16K
-prompts were read by Strata's batched prompt path (15,872 tokens), the rest through the verify windows.
+prompts were read by Strata's batched prompt path (15,872 tokens), the rest through the verify windows. These numbers
+are engine 0.1.31's prompt path (FP16 products); with 0.1.32's MMQ prompt path the continuation after the 16K prompt
+agrees at 92.2% (KL 0.029, three runs, identical).
To repeat it: Strata's side is `STRATA_LOGPOS=<file>` with `STRATA_LOGPOS_TOPK=20` (engine 0.1.32) on a serve
engine with `--short-read` covering the positions to compare; llama.cpp's side was a short program over
@@ -196,7 +205,7 @@ engine with `--short-read` covering the positions to compare; llama.cpp's side w
| `STRATA_LOOKAHEAD=0` | Turns off the routing-aware prefetch (on by default in this mode): while the CPU works on a layer, a thread applies the next layer's router to this layer's input and asks the OS to read the predicted experts' pages. Pages only, the answers are the same. About half of the SSD reads were predicted; mean +14% (6.9 -> 7.9 tok/s). `STRATA_LOOKAHEAD_K` sets the experts per token (default 10). |
| `STRATA_KQ256=1` | Multi-token AVX2 kernels for the Q4_K / Q5_1 / Q8_0 experts. Bit-exact with ggml's, but measured no faster, so off. |
| `STRATA_PARTIAL_PIN=1` | Registers the hottest part of the RAM budget (up to `STRATA_PARTIAL_PIN_GIB`, default 24) with the GPU driver, so the GPU computes a share of the misses over PCIe (`--pcie-frac`). Measured no faster on this PC, and it changes the numerics of those experts (GPU kernels instead of the CPU's), so off. |
-| `STRATA_FETCH_THREADS=N` | Threads that read the experts from the GGUF (default 8; 16 was no faster). |
+| `STRATA_FETCH_THREADS=N` | Threads that read the experts from the GGUF while it answers (default 8; 16 was no faster). The prompt path has its own: `STRATA_STAGER_THREADS` (default 32 here) and `STRATA_STAGER_RING` (128). |
## Scope and validation
@@ -204,7 +213,8 @@ engine with `--short-read` covering the positions to compare; llama.cpp's side w
have kernels for; the engine checks every layer's formats at start and refuses an unsupported one by name.
- Tests: the packer's synthetic 4-shard and conversion tests (`.venv/bin/python -m unittest discover -s tools -p
test_iq_pack.py`); CTests `gguf_split_test`, `expert_layout_test`, `native_expert_parity_*` (the three real expert
- format pairs against ggml-cpu, the Q5_1 min term, Q8_0 rows); the in-place mode against `experts.bin` on the Coder
+ format pairs against ggml-cpu, the Q5_1 min term, Q8_0 rows), `prefill_mmq_kquant_test` (the prompt path's MMQ
+ products for Q4_K / Q5_K / Q5_1 / Q8_0 against ggml's dequantized weights); the in-place mode against `experts.bin` on the Coder
(identical tokens and logits).
- Real runs: greedy answers to a coding prompt (correct) at every budget and setting above, identical across them;
the same tokens as llama.cpp at 97.5-99% of the positions of short greedy answers and 90-91% after a 16K prompt,
diff --git a/include/strata/prefill/moe_mmq.hpp b/include/strata/prefill/moe_mmq.hpp
index 4efa1baf8..4d1e4d88a 100644
--- a/include/strata/prefill/moe_mmq.hpp
+++ b/include/strata/prefill/moe_mmq.hpp
@@ -12,7 +12,8 @@ namespace strata::prefill::mmq {
/// This build has the MMQ path (the ggml sources were available to the build).
bool built();
-/// MMQ covers this ggml type (the i-quants and Q2_0 the packs use; IQ1_M is not covered).
+/// MMQ covers this ggml type (the i-quants and Q2_0 the packs use, Q8_0, and on CUDA the Q4_K / Q5_K / Q5_1 of
+/// Unsloth's UD-Q4_K_XL; IQ1_M is not covered).
bool supported(int ggml_type);
/// Bytes of one expert's gate+up ([2*n_ff, n_embd]) or down ([n_embd, n_ff]) weights in `ggml_type`.
size_t matrix_bytes(int ggml_type, int64_t rows, int64_t cols);
diff --git a/src/prefill/moe_mmq.cu b/src/prefill/moe_mmq.cu
index ac2daee4f..27b52ad51 100644
--- a/src/prefill/moe_mmq.cu
+++ b/src/prefill/moe_mmq.cu
@@ -94,6 +94,9 @@ bool supported(int t) {
case GGML_TYPE_Q2_0: case GGML_TYPE_IQ2_XXS: case GGML_TYPE_IQ2_XS: case GGML_TYPE_IQ2_S:
case GGML_TYPE_IQ3_XXS: case GGML_TYPE_IQ3_S: case GGML_TYPE_IQ4_NL: case GGML_TYPE_IQ4_XS:
case GGML_TYPE_Q8_0: // the draft layer's dense matrices (E-9)
+#ifdef STRATA_MMQ_KQUANTS
+ case GGML_TYPE_Q4_K: case GGML_TYPE_Q5_K: case GGML_TYPE_Q5_1: // Unsloth's UD-Q4_K_XL experts (CUDA)
+#endif
return true;
default:
return false;
@@ -143,6 +146,11 @@ void Context::run(const Product& p, void* stream) {
case GGML_TYPE_IQ4_NL: mul_mat_q_case<GGML_TYPE_IQ4_NL>(ctx, a, s); break;
case GGML_TYPE_IQ4_XS: mul_mat_q_case<GGML_TYPE_IQ4_XS>(ctx, a, s); break;
case GGML_TYPE_Q8_0: mul_mat_q_case<GGML_TYPE_Q8_0>(ctx, a, s); break;
+#ifdef STRATA_MMQ_KQUANTS
+ case GGML_TYPE_Q4_K: mul_mat_q_case<GGML_TYPE_Q4_K>(ctx, a, s); break;
+ case GGML_TYPE_Q5_K: mul_mat_q_case<GGML_TYPE_Q5_K>(ctx, a, s); break;
+ case GGML_TYPE_Q5_1: mul_mat_q_case<GGML_TYPE_Q5_1>(ctx, a, s); break;
+#endif
default:
std::fprintf(stderr, "prefill mmq: type %d is not covered\n", (int) t);
std::exit(1);
diff --git a/src/prefill/prefill.cpp b/src/prefill/prefill.cpp
index 117cae95c..a24a8d131 100644
--- a/src/prefill/prefill.cpp
+++ b/src/prefill/prefill.cpp
@@ -525,8 +525,15 @@ bool Prefill::init(const core::WeightTable& wt, const core::ModelGeometry& g, co
m.stager = std::make_unique<Stager>();
const int hw = (int) std::thread::hardware_concurrency();
const char* stv = std::getenv("STRATA_STAGER_THREADS"); // D-5: the host copy threads of unpinned blobs
- if (!m.stager->init((size_t) MAXBLOB(), stv ? std::clamp(std::atoi(stv), 1, 32) : std::max(2, std::min(4, hw / 4))))
- ok = false;
+ // A GGUF read in place (UD-Q4_K_XL beyond its RAM budget): most of a chunk's blobs are page faults on the
+ // SSD, so the copies need many reads in flight - 32 threads and a 128-deep ring read a 4K chunk in 29 s
+ // instead of 71 s on an RTX 5070 / NVMe PC (4 threads, 16 deep: the defaults, kept for every other source)
+ bool files = false;
+ for (int64_t l = 0; src != nullptr && !files && l < g.n_layers; ++l)
+ for (int64_t e = 0; !files && e < g.n_expert; ++e) files = src->transient(l, e);
+ const int threads = stv ? std::clamp(std::atoi(stv), 1, 32) : files ? 32 : std::max(2, std::min(4, hw / 4));
+ if (files && std::getenv("STRATA_STAGER_RING") == nullptr) m.stager->kRing = 4 * threads;
+ if (!m.stager->init((size_t) MAXBLOB(), threads)) ok = false;
}
m.steps_host.resize(T * strata::kernels::kStepCount);
m.ids_host.resize(T * K); m.slot_host.resize(T * K); m.src_host.resize(T * K); m.cnt.resize(m.g->n_expert); m.off.resize(m.g->n_expert + 1);
diff --git a/tests/cuda/prefill_mmq_kquant_test.cpp b/tests/cuda/prefill_mmq_kquant_test.cpp
new file mode 100644
index 000000000..01e6efffb
--- /dev/null
+++ b/tests/cuda/prefill_mmq_kquant_test.cpp
@@ -0,0 +1,168 @@
+// prefill_mmq_kquant_test - the prompt path's MMQ products for the expert formats of Unsloth's UD-Q4_K_XL (Q4_K and
+// Q5_K gate/up at 1280 x 2560, Q5_1 and Q8_0 down at 2560 x 640), on synthetic weights quantized by ggml's own
+// reference quantizers, against a double-precision product of ggml's dequantized weights. MMQ rounds the activations
+// to q8_1 by design, so this is a screen for layout, stride, expert-bound and row-id errors (the bounds of
+// tests/hip/prefill_mmq_parity.cpp), not a bit-exactness test. Several experts per product, permuted rows, an
+// all-zero row; the formats the build does not cover (Q6_K) must say so.
+#include "strata/prefill/moe_mmq.hpp"
+
+#include "ggml.h"
+
+#include <cuda_runtime.h>
+
+#include <algorithm>
+#include <cmath>
+#include <cstdint>
+#include <cstdio>
+#include <numeric>
+#include <stdexcept>
+#include <string>
+#include <vector>
+
+namespace {
+namespace mmq = strata::prefill::mmq;
+
+void ck(cudaError_t e, const char* what) {
+ if (e != cudaSuccess) throw std::runtime_error(std::string(what) + ": " + cudaGetErrorString(e));
+}
+
+struct Dev {
+ void* p = nullptr;
+ explicit Dev(size_t n) { ck(cudaMalloc(&p, n), "cudaMalloc"); }
+ ~Dev() { cudaFree(p); }
+ Dev(const Dev&) = delete;
+ Dev& operator=(const Dev&) = delete;
+};
+
+std::vector<uint8_t> make_matrix(ggml_type t, int64_t rows, int64_t cols, int expert, int trial) {
+ const auto* tr = ggml_get_type_traits(t);
+ if (tr == nullptr || tr->from_float_ref == nullptr) throw std::runtime_error("no reference quantizer");
+ const size_t rb = ggml_row_size(t, cols);
+ std::vector<uint8_t> out((size_t) rows * rb);
+ std::vector<float> row((size_t) cols);
+ for (int64_t r = 0; r < rows; ++r) {
+ for (int64_t k = 0; k < cols; ++k) {
+ const int code = (int) ((k * 37 + r * 19 + expert * 23 + trial * 11) % 101) - 50;
+ row[(size_t) k] = 0.025f * std::sin(0.013f * (float) (k + 1) + 0.17f * (float) r + 0.31f * (float) expert) +
+ 0.0015f * (float) code;
+ }
+ tr->from_float_ref(row.data(), out.data() + (size_t) r * rb, cols);
+ }
+ return out;
+}
+
+std::vector<float> make_x(int rows, int64_t cols, int trial) {
+ std::vector<float> x((size_t) rows * (size_t) cols);
+ for (int r = 0; r < rows; ++r)
+ for (int64_t k = 0; k < cols; ++k)
+ x[(size_t) r * (size_t) cols + (size_t) k] =
+ 0.45f * std::sin(0.009f * (float) (k + 1) + 0.23f * (float) r + 0.07f * (float) trial) +
+ 0.17f * std::cos(0.021f * (float) (k + 3) - 0.19f * (float) r) +
+ 0.002f * (float) (((k * 7 + r * 13 + trial * 5) % 19) - 9);
+ std::fill(x.end() - cols, x.end(), 0.0f); // an all-zero row: exactly zero out
+ return x;
+}
+
+std::vector<int32_t> perm(int n, int shift, bool reverse) {
+ std::vector<int32_t> p((size_t) n);
+ for (int i = 0; i < n; ++i) p[(size_t) i] = (int32_t) (((reverse ? n - 1 - i : i) + shift) % n);
+ return p;
+}
+
+// one grouped product: experts side by side at one stride (a zeroed tail after them, as prefill.cpp stages them)
+void product(mmq::Context& ctx, cudaStream_t s, const char* name, ggml_type t, int64_t out_rows, int64_t cols,
+ const std::vector<int>& counts, int trial) {
+ if (!mmq::supported((int) t)) throw std::runtime_error(std::string(name) + ": not covered by this build");
+ const int n = (int) counts.size(), rows = std::accumulate(counts.begin(), counts.end(), 0);
+ std::vector<int32_t> bounds((size_t) n + 1, 0);
+ for (int e = 0; e < n; ++e) bounds[(size_t) e + 1] = bounds[(size_t) e] + counts[(size_t) e];
+ const auto src = perm(rows, trial + 1, false), dst = perm(rows, trial + 2, true);
+ const std::vector<float> x = make_x(rows, cols, trial);
+ const size_t eb = mmq::matrix_bytes((int) t, out_rows, cols);
+ if (eb != (size_t) out_rows * ggml_row_size(t, cols)) throw std::runtime_error(std::string(name) + ": matrix_bytes");
+ std::vector<std::vector<uint8_t>> ws;
+ std::vector<uint8_t> w((size_t) n * eb + 4096, 0);
+ for (int e = 0; e < n; ++e) {
+ ws.push_back(make_matrix(t, out_rows, cols, e, trial));
+ std::copy(ws.back().begin(), ws.back().end(), w.begin() + (ptrdiff_t) ((size_t) e * eb));
+ }
+ Dev dx(x.size() * 4), dsrc((size_t) rows * 4), ddst((size_t) rows * 4), db(bounds.size() * 4), dw(w.size()),
+ dxq(mmq::q8_bytes(rows, cols)), dy((size_t) rows * (size_t) out_rows * 4);
+ ck(cudaMemcpy(dx.p, x.data(), x.size() * 4, cudaMemcpyHostToDevice), "x");
+ ck(cudaMemcpy(dsrc.p, src.data(), src.size() * 4, cudaMemcpyHostToDevice), "src");
+ ck(cudaMemcpy(ddst.p, dst.data(), dst.size() * 4, cudaMemcpyHostToDevice), "dst");
+ ck(cudaMemcpy(db.p, bounds.data(), bounds.size() * 4, cudaMemcpyHostToDevice), "bounds");
+ ck(cudaMemcpy(dw.p, w.data(), w.size(), cudaMemcpyHostToDevice), "w");
+ ck(cudaMemset(dy.p, 0xff, (size_t) rows * (size_t) out_rows * 4), "sentinel");
+ mmq::quantize((const float*) dx.p, (const int32_t*) dsrc.p, dxq.p, (int) t, cols, cols, rows, s);
+ mmq::Product p;
+ p.w = dw.p; p.type = (int) t; p.w_rows = out_rows; p.w_cols = cols; p.expert_bytes = eb; p.n = n;
+ p.xq = dxq.p; p.bounds = (const int32_t*) db.p; p.ids = (const int32_t*) ddst.p; p.total_rows = rows;
+ p.max_rows = *std::max_element(counts.begin(), counts.end()); p.dst = (float*) dy.p; p.ld_dst = out_rows;
+ ctx.run(p, s);
+ ck(cudaGetLastError(), "launch");
+ ck(cudaStreamSynchronize(s), "sync");
+ std::vector<float> got((size_t) rows * (size_t) out_rows);
+ ck(cudaMemcpy(got.data(), dy.p, got.size() * 4, cudaMemcpyDeviceToHost), "y");
+
+ const auto* tr = ggml_get_type_traits(t);
+ std::vector<float> ref(got.size(), 0.0f), wd((size_t) out_rows * (size_t) cols);
+ for (int e = 0; e < n; ++e) {
+ const size_t rb = ggml_row_size(t, cols);
+ for (int64_t o = 0; o < out_rows; ++o)
+ tr->to_float(ws[(size_t) e].data() + (size_t) o * rb, wd.data() + (size_t) o * (size_t) cols, cols);
+ for (int r = bounds[(size_t) e]; r < bounds[(size_t) e + 1]; ++r) {
+ const float* xr = x.data() + (size_t) src[(size_t) r] * (size_t) cols;
+ for (int64_t o = 0; o < out_rows; ++o) {
+ double acc = 0;
+ const float* wr = wd.data() + (size_t) o * (size_t) cols;
+ for (int64_t k = 0; k < cols; ++k) acc += (double) wr[k] * xr[k];
+ ref[(size_t) dst[(size_t) r] * (size_t) out_rows + (size_t) o] = (float) acc;
+ }
+ }
+ }
+ double err2 = 0, ref2 = 0, max_abs = 0, zero_max = 0;
+ for (size_t i = 0; i < got.size(); ++i) {
+ if (!std::isfinite(got[i])) throw std::runtime_error(std::string(name) + ": unwritten or non-finite output");
+ const double d = (double) got[i] - ref[i];
+ err2 += d * d; ref2 += (double) ref[i] * ref[i]; max_abs = std::max(max_abs, std::fabs(d));
+ }
+ for (int r = 0; r < rows; ++r)
+ if (src[(size_t) r] == rows - 1) // the zero row
+ for (int64_t o = 0; o < out_rows; ++o)
+ zero_max = std::max(zero_max, (double) std::fabs(got[(size_t) dst[(size_t) r] * (size_t) out_rows + (size_t) o]));
+ const double rms = std::sqrt(ref2 / (double) ref.size()), rel = std::sqrt(err2 / (double) ref.size()) / rms;
+ std::printf("%-22s rows %2d experts %d ref_rms %.4g rel_l2 %.5f max/rms %.4f zero row %.3g\n", name, rows, n, rms,
+ rel, max_abs / rms, zero_max);
+ if (rel > 0.04 || max_abs / rms > 0.35 || zero_max > std::max(1e-5, 1e-4 * rms))
+ throw std::runtime_error(std::string(name) + ": outside the screen");
+}
+} // namespace
+
+int main() {
+ try {
+ if (!mmq::built()) { std::printf("no MMQ in this build\n"); return 1; }
+ if (mmq::supported(GGML_TYPE_Q6_K)) throw std::runtime_error("Q6_K should not be covered");
+ cudaStream_t s = nullptr;
+ ck(cudaStreamCreateWithFlags(&s, cudaStreamNonBlocking), "stream");
+ {
+ mmq::Context ctx;
+ const std::vector<std::vector<int>> batches{{1, 3, 3}, {4, 1, 2}, {2, 3}, {17}};
+ int trial = 0;
+ for (const auto& counts : batches) {
+ const std::string tag = "-" + std::to_string(trial);
+ product(ctx, s, ("Q4_K gate/up" + tag).c_str(), GGML_TYPE_Q4_K, 1280, 2560, counts, trial);
+ product(ctx, s, ("Q5_K gate/up" + tag).c_str(), GGML_TYPE_Q5_K, 1280, 2560, counts, trial + 5);
+ product(ctx, s, ("Q5_1 down" + tag).c_str(), GGML_TYPE_Q5_1, 2560, 640, counts, trial + 9);
+ product(ctx, s, ("Q8_0 down" + tag).c_str(), GGML_TYPE_Q8_0, 2560, 640, counts, trial + 13);
+ ++trial;
+ }
+ }
+ ck(cudaStreamDestroy(s), "destroy");
+ std::printf("prefill MMQ K-quant screen passed\n");
+ return 0;
+ } catch (const std::exception& e) {
+ std::fprintf(stderr, "prefill MMQ K-quant screen failed: %s\n", e.what());
+ return 1;
+ }
+}