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.
Python amdapple-siliconcudadeepseekexl3exllamav3glminferencellmllm-inferencelocal-llmnvidiaopenai-apiquantizationqwenrocmstrix-halo
ROCm EXL3 multi-row GEMV: the 5-row verify takes the one-pass 8-row form too
YanissAmz2e47c86ad194
diff --git a/exllamav3/exllamav3_ext/quant/exl3_dec.cu b/exllamav3/exllamav3_ext/quant/exl3_dec.cuindex 9cd655d..fab2f03 100644--- a/exllamav3/exllamav3_ext/quant/exl3_dec.cu+++ b/exllamav3/exllamav3_ext/quant/exl3_dec.cu@@ -2666,10 +2666,13 @@ static void dec_gemv_r_implenv_int("EXL3_GEMV_R_DEC1", 0) == 1 && GEMV_R_ROW_BUDGET / ktw >= R;if (rm6) rpb = R;- // EXL3_GEMV_R_WIDE8=1 (needs EXL3_GEMV_R_DEC1=1): 7..8 rows run in ONE launch of the 8-row instantiation with the x words in SGPRs- // (lane_gemv_r2) instead of two 4-row chunks that each decode every tile (ktw > 16: the input is staged in 16-tile phases). Grids under- // EXL3_GEMV_R_WIDE8_MINBLK (32) blocks keep the two chunks. Same per-row arithmetic, bit-identical output.- const bool wide8 = R >= 7 && R <= MOE_R_MAX && env_int("EXL3_GEMV_R_WIDE8", 0) != 0 &&+ // EXL3_GEMV_R_WIDE8=1 (needs EXL3_GEMV_R_DEC1=1): rows from EXL3_GEMV_R_WIDE8_MINR (default 5) up run in ONE launch of the+ // 8-row instantiation with the x words in SGPRs (lane_gemv_r2) instead of two 4-row chunks that each decode every tile+ // (ktw > 16: the input is staged in 16-tile phases). Grids under EXL3_GEMV_R_WIDE8_MINBLK (32) blocks keep the two chunks.+ // Same per-row arithmetic, bit-identical output. MINR 5 is the ktw > 16 classes at the 5..6-row verify (rbp 4 chunks them+ // into 2 passes that each stream the weights: 33 calls, 266.5 us vs 149.3 at 1 row; one pass: 101.0 -> 74.2 us in the+ // kernel, -2.9/-3.9 ms on the 5-row verify at 4K/131K in situ); rm6 covers kb2 8 / 10 and still wins there.+ const bool wide8 = R >= env_int("EXL3_GEMV_R_WIDE8_MINR", 5) && R <= MOE_R_MAX && env_int("EXL3_GEMV_R_WIDE8", 0) != 0 &&env_int("EXL3_GEMV_R_DEC1", 0) == 1 &&(GEMV_R_ROW_BUDGET / ktw >= R || (ktw % 16 == 0 && ktw <= 64)) && // ktw 32 / 48 / 64: staged in 16-tile phasesstrips_total * kbs >= env_int("EXL3_GEMV_R_WIDE8_MINBLK", 32); // one pass runs half the blocks of the two 4-row chunks: it loses when the grid gets sparsediff --git a/exllamav3/util/knobs.py b/exllamav3/util/knobs.pyindex a898212..47cccee 100644--- a/exllamav3/util/knobs.py+++ b/exllamav3/util/knobs.py@@ -15,6 +15,7 @@ KNOBS = {"EXL3_GEMV_TRI": "1","EXL3_GEMV_R_ARR1": "1","EXL3_GEMV_R_WIDE8": "1",+ "EXL3_GEMV_R_WIDE8_MINR": "5","EXL3_GEMV_R_RPB78": "4","EXL3_BC_KVWIN": "1","EXL3_CUDA_GRAPH_RING": "1",diff --git a/tools/decode/gemv_r_rows_bench.py b/tools/decode/gemv_r_rows_bench.pyindex d3fa207..12a9624 100644--- a/tools/decode/gemv_r_rows_bench.py+++ b/tools/decode/gemv_r_rows_bench.py@@ -37,8 +37,12 @@ ARMS = {# shipped verify env for 5..8 rows (tools/qwen/serve.py SERVE_ENV): RM6 + WIDE8 + DEC1"S1": {"EXL3_GEMV_R_DEC1": "1", "EXL3_GEMV_R_RM6": "1", "EXL3_GEMV_R_WIDE8": "1"},"S1a0": {"EXL3_GEMV_R_DEC1": "1", "EXL3_GEMV_R_RM6": "1", "EXL3_GEMV_R_WIDE8": "1", "EXL3_GEMV_R_ARR1": "0"},+ # the served 5..6-row env as row_split MODE 2 sets it (RPB 4 + CHUNK_FAST 1) with wide8 pinned to 7 rows (the+ # pre-lever-20 default), and the same with the wide8 one-pass form allowed from 5 rows (the shipped default)+ "S2": {"EXL3_GEMV_R_DEC1": "1", "EXL3_GEMV_R_RM6": "1", "EXL3_GEMV_R_WIDE8": "1", "EXL3_GEMV_R_RPB": "4", "EXL3_GEMV_R_CHUNK_FAST": "1", "EXL3_GEMV_R_WIDE8_MINR": "7"},+ "S2w5": {"EXL3_GEMV_R_DEC1": "1", "EXL3_GEMV_R_RM6": "1", "EXL3_GEMV_R_WIDE8": "1", "EXL3_GEMV_R_RPB": "4", "EXL3_GEMV_R_CHUNK_FAST": "1", "EXL3_GEMV_R_WIDE8_MINR": "5"},}-KEYS = ["EXL3_GEMV_R_DEC1", "EXL3_GEMV_R_RPB", "EXL3_GEMV_R_CHUNK_FAST", "EXL3_GEMV_R_RPB78", "EXL3_GEMV_R_RM6", "EXL3_GEMV_R_RPB9", "EXL3_GEMV_R_SWAP9", "EXL3_GEMV_R_WIDE8", "EXL3_GEMV_R_ARR1"]+KEYS = ["EXL3_GEMV_R_DEC1", "EXL3_GEMV_R_RPB", "EXL3_GEMV_R_CHUNK_FAST", "EXL3_GEMV_R_RPB78", "EXL3_GEMV_R_RM6", "EXL3_GEMV_R_RPB9", "EXL3_GEMV_R_SWAP9", "EXL3_GEMV_R_WIDE8", "EXL3_GEMV_R_ARR1", "EXL3_GEMV_R_WIDE8_MINR"]def setarm(name):for k in KEYS: os.environ.pop(k, None)os.environ.update(ARMS[name])