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

APR port: TQ row bytes on the GPU (iq_row_bytes returned 0 for 144-146)

Laurent Zuijdwijkbda227817e2f
diff --git a/src/kernels/cuda/iq_kernels.cu b/src/kernels/cuda/iq_kernels.cu
index 7d4fcae73..4d6ef38ab 100644
--- a/src/kernels/cuda/iq_kernels.cu
+++ b/src/kernels/cuda/iq_kernels.cu
@@ -3028,6 +3028,9 @@ size_t iq_row_bytes(int t, int64_t n) noexcept {
case 40: return (size_t) (n / 64) * sizeof(block_nvfp4);
case 8: return (size_t) (n / 32) * sizeof(block_q8_0);
case 30: return (size_t) n * 2; // BF16: the token embedding only (iq_embed_rows, iq_dequant_f32)
+ case 144: return (size_t) (n / 128) * sizeof(block_tq2_t); // APR trellis types
+ case 145: return (size_t) (n / 128) * sizeof(block_tqk6);
+ case 146: return (size_t) (n / 128) * sizeof(block_tqk7);
default: return 0;
}
}
@@ -3137,7 +3140,8 @@ const float* hadamard_device_signs(const float* host, int width) {
bool native_expert_supported(int gu_type, int d_type, int64_t n_embd, int64_t n_ff) noexcept {
const int qg = gu_qk(gu_type), qd = d_qk(d_type);
- return qg > 0 && qd > 0 && is_iq(gu_type) && is_iq(d_type) && n_embd % qg == 0 && n_ff % qd == 0 &&
+ // a type without row bytes would make every row (and the up/down offsets) 0: refused, not run wrong
+ return qg > 0 && qd > 0 && iq_row_bytes(gu_type, n_embd) > 0 && iq_row_bytes(d_type, n_ff) > 0 && is_iq(gu_type) && is_iq(d_type) && n_embd % qg == 0 && n_ff % qd == 0 &&
n_embd % 256 == 0 && (n_ff * n_embd) % 256 == 0;
}