Skip to content

Kyojin: open-source engine that runs 100 GB-class open models (GLM-5.3, Qwen3.8, DeepSeek V4.1) on one desktop machine. AMD Strix Halo, NVIDIA RTX and Apple Mac. OpenAI API, built on ExLlamaV3.

MoE decode: keep the original prefetch depth and the stream-K grid choice off Ampere

YanissAmze9afda7d83c2
diff --git a/exllamav3/exllamav3_ext/quant/exl3_moe_coop.cu b/exllamav3/exllamav3_ext/quant/exl3_moe_coop.cu
index 1099eb6..ae79aad 100644
--- a/exllamav3/exllamav3_ext/quant/exl3_moe_coop.cu
+++ b/exllamav3/exllamav3_ext/quant/exl3_moe_coop.cu
@@ -175,7 +175,7 @@ void exl3_moe_coop_launch(const MoeCoopParams& p_in, int K_gu, int K_d, int cb,
{
int sms;
const int grid_sk = moe_coop_sk_grid(ka, device, sms);
- if (sk == 2 || base_a > sms)
+ if (sk == 2 || base_a > sms || DevCtx::instance().get_cc(device) != CC_AMPERE)
{
grid_a = grid_sk;
p.ksplit_a = -((sk == 2 || grid_a <= sms ? 0 : sms) + 1);
diff --git a/exllamav3/exllamav3_ext/quant/exl3_moe_coop_kernel.cuh b/exllamav3/exllamav3_ext/quant/exl3_moe_coop_kernel.cuh
index e340301..8f38d8f 100644
--- a/exllamav3/exllamav3_ext/quant/exl3_moe_coop_kernel.cuh
+++ b/exllamav3/exllamav3_ext/quant/exl3_moe_coop_kernel.cuh
@@ -34,7 +34,13 @@ namespace exl3_moe_coop_ns {
constexpr int WK = 16; // k-split (warps per block)
constexpr int WNT = MOE_COOP_WNT; // adjacent n-tiles per warp
-constexpr int PF = 1; // prefetch ring depth: deeper rings spilled at 64 registers and measured slower at every width
+// Prefetch ring depth. On Ampere (64 registers per thread at 2 blocks per SM) a deeper ring spills and measured slower at every
+// width (RTX 3090); other architectures keep the original depth
+#if defined(__CUDA_ARCH__) && __CUDA_ARCH__ >= 800 && __CUDA_ARCH__ < 890
+constexpr int PF = 1;
+#else
+constexpr int PF = 4;
+#endif
constexpr int FOLD = 4; // fp16 -> fp32 fold cadence
constexpr int THREADS = WK * 32;
constexpr int COLS = WNT * 16; // columns per warp