diff --git a/CMakeLists.txt b/CMakeLists.txt index 2f9ed07..72d9f2a 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -1112,10 +1112,10 @@ if(STRATA_NATIVE_EXPERTS) src/prefill/ggml_cuda_host.cu ${_strata_mmq}/quantize.cu) # q8_0: the drafter's matrices (E-9); STRATA_ORCA_Q4KS_MMQ adds q5_0 (#296, in _strata_mmq_types), and # STRATA_MMQ_KQUANTS 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) + # follows eddoursul/Strata 7706c1b), plus q6_k (Qwen3.6-35B-A3B UD-Q4_K_XL's layers 34, 38, 39) set(_strata_mmq_cuda_types ${_strata_mmq_types}) if(STRATA_MMQ_KQUANTS) - list(APPEND _strata_mmq_cuda_types q4_k q5_k q5_1) + list(APPEND _strata_mmq_cuda_types q4_k q5_k q5_1 q6_k) endif() foreach(_t IN LISTS _strata_mmq_cuda_types) target_sources(strata_mmq PRIVATE ${_strata_mmq}/template-instances/mmq-instance-${_t}.cu) diff --git a/src/prefill/moe_mmq.cu b/src/prefill/moe_mmq.cu index c61e707..00fe653 100644 --- a/src/prefill/moe_mmq.cu +++ b/src/prefill/moe_mmq.cu @@ -116,6 +116,7 @@ bool supported(int t) { 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) + case GGML_TYPE_Q6_K: // Qwen3.6-35B-A3B UD-Q4_K_XL's down projections on layers 34, 38, 39 #endif return true; default: @@ -201,6 +202,7 @@ void Context::run(const Product& p, void* stream) { case GGML_TYPE_Q4_K: mul_mat_q_case(ctx, a, s); break; case GGML_TYPE_Q5_K: mul_mat_q_case(ctx, a, s); break; case GGML_TYPE_Q5_1: mul_mat_q_case(ctx, a, s); break; + case GGML_TYPE_Q6_K: mul_mat_q_case(ctx, a, s); break; #endif default: std::fprintf(stderr, "prefill mmq: type %d is not covered\n", (int) t); diff --git a/tests/cuda/prefill_mmq_kquant_test.cpp b/tests/cuda/prefill_mmq_kquant_test.cpp index 01e6eff..a75bb59 100644 --- a/tests/cuda/prefill_mmq_kquant_test.cpp +++ b/tests/cuda/prefill_mmq_kquant_test.cpp @@ -3,7 +3,8 @@ // 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. +// all-zero row. Qwen3.6-35B-A3B's UD-Q4_K_XL adds Q5_K and Q6_K down projections at its 2048 x 512; a format the +// build does not cover (Q3_K) must say so. #include "strata/prefill/moe_mmq.hpp" #include "ggml.h" @@ -142,7 +143,7 @@ void product(mmq::Context& ctx, cudaStream_t s, const char* name, ggml_type t, i 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"); + if (mmq::supported(GGML_TYPE_Q3_K)) throw std::runtime_error("Q3_K should not be covered"); cudaStream_t s = nullptr; ck(cudaStreamCreateWithFlags(&s, cudaStreamNonBlocking), "stream"); { @@ -155,6 +156,8 @@ int main() { 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); + product(ctx, s, ("Q5_K down 2048x512" + tag).c_str(), GGML_TYPE_Q5_K, 2048, 512, counts, trial + 17); + product(ctx, s, ("Q6_K down 2048x512" + tag).c_str(), GGML_TYPE_Q6_K, 2048, 512, counts, trial + 21); ++trial; } }