Skip to content

Run frontier MoE models on hardware you already own — pure C, zero deps, experts streamed from disk. Tiny engine, immense model. 🐦

C

vulkan: the chain's pipelines at the device's subgroup size; Windows shader paths and aligned frees

JustVugg41cf9397e18f
diff --git a/c/backend_vulkan.c b/c/backend_vulkan.c
index bcabd27c..2e149043 100644
--- a/c/backend_vulkan.c
+++ b/c/backend_vulkan.c
@@ -369,6 +369,7 @@ static struct {
VkGemmTile gemm_t[VK_GEMM_SLOTS];
VkCoopTile coop_t[VK_COOP_SLOTS];
int gemm_min_s, gemm_min_so, has_coop, coop_sg, coop_off;
+ int pin_sg; /* the subgroup size the chain pins its pipelines to (vk_pin_sg); 0 = none */
int has_bda; /* bufferDeviceAddress on: the expert batch's grouped GEMM reads weights by address */
/* fused dual gate+up+silu pipeline (6 bindings): x, Wg, gscale, Wu, uscale, hidden */
VkShaderModule shader_gu; VkDescriptorSetLayout dsl_gu; VkPipelineLayout plyt_gu;
@@ -445,6 +446,57 @@ struct PCN { int S, D; float eps; };
/* Push constants of the absorb attention kernel (must match attention_absorb.comp). */
struct PCAttn { int fmt, S, H, Q, R, V, K, st0, T, rowWords, cap; float scale; int gs; };
+/* The subgroup size the dense chain pins its pipelines to (vk_chain.c, make_pipe): the
+ * one the device reports, on a device that compiles compute shaders at more than one
+ * subgroup size and can be told which (VK_EXT_subgroup_size_control). The chain's
+ * shaders size their work by gl_SubgroupSize and gl_SubgroupID; an Intel Iris Xe
+ * (8 to 32) ran chain_gemv and chain_gemv2 at another width than the one they read,
+ * and every decode GEMV of the chain came out wrong. 0: a device with one size (NVIDIA,
+ * Lavapipe), no control, or COLI_VK_SUBGROUP=0 (the driver's choice, as before). */
+static int vk_pin_sg(VkPhysicalDevice phys, int has_ext) {
+#ifdef VK_EXT_subgroup_size_control
+ const char *e = getenv("COLI_VK_SUBGROUP");
+ if (!has_ext || (e && *e == '0')) return 0;
+ VkPhysicalDeviceProperties pp; vkGetPhysicalDeviceProperties(phys, &pp);
+ if (pp.apiVersion < VK_API_VERSION_1_1) return 0;
+ VkPhysicalDeviceSubgroupSizeControlFeaturesEXT f = {
+ .sType = VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_SUBGROUP_SIZE_CONTROL_FEATURES_EXT};
+ VkPhysicalDeviceFeatures2 f2 = {.sType = VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_FEATURES_2, .pNext = &f};
+ vkGetPhysicalDeviceFeatures2(phys, &f2);
+ VkPhysicalDeviceSubgroupSizeControlPropertiesEXT sp = {
+ .sType = VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_SUBGROUP_SIZE_CONTROL_PROPERTIES_EXT};
+ VkPhysicalDeviceSubgroupProperties sg = {.sType = VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_SUBGROUP_PROPERTIES, .pNext = &sp};
+ VkPhysicalDeviceProperties2 p2 = {.sType = VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_PROPERTIES_2, .pNext = &sg};
+ vkGetPhysicalDeviceProperties2(phys, &p2);
+ uint32_t n = sg.subgroupSize;
+ if (!f.subgroupSizeControl || !(sp.requiredSubgroupSizeStages & VK_SHADER_STAGE_COMPUTE_BIT) ||
+ sp.minSubgroupSize >= sp.maxSubgroupSize || n < sp.minSubgroupSize || n > sp.maxSubgroupSize || (n & (n - 1)))
+ return 0;
+ return (int)n;
+#else
+ (void)phys; (void)has_ext;
+ return 0;
+#endif
+}
+/* vkCreateDevice with subgroup size control on, for vk_pin_sg: 1 with the device. */
+static int vk_create_device_pinned(VkPhysicalDevice phys, const VkDeviceCreateInfo *di, VkDevice *dev) {
+#ifdef VK_EXT_subgroup_size_control
+ VkPhysicalDeviceSubgroupSizeControlFeaturesEXT f = {
+ .sType = VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_SUBGROUP_SIZE_CONTROL_FEATURES_EXT,
+ .pNext = (void *)di->pNext, .subgroupSizeControl = VK_TRUE};
+ const char *ext[16]; uint32_t n = 0;
+ for (uint32_t i = 0; i < di->enabledExtensionCount && n < 15; i++) ext[n++] = di->ppEnabledExtensionNames[i];
+ ext[n++] = VK_EXT_SUBGROUP_SIZE_CONTROL_EXTENSION_NAME;
+ VkDeviceCreateInfo dc = *di;
+ dc.pNext = &f; dc.enabledExtensionCount = n; dc.ppEnabledExtensionNames = ext;
+ if (vkCreateDevice(phys, &dc, NULL, dev) == VK_SUCCESS) return 1;
+ *dev = VK_NULL_HANDLE;
+#else
+ (void)phys; (void)di; (void)dev;
+#endif
+ return 0;
+}
+
static int pick_memtype(VkPhysicalDevice phys) {
VkPhysicalDeviceMemoryProperties m;
vkGetPhysicalDeviceMemoryProperties(phys, &m);
@@ -1012,6 +1064,8 @@ int coli_vk_init(const char *spv_path) {
#endif
#ifdef VK_KHR_cooperative_matrix
if (!strcmp(ep[i].extensionName, VK_KHR_COOPERATIVE_MATRIX_EXTENSION_NAME)) has_cm = 1;
+#endif
+#ifdef VK_EXT_subgroup_size_control
if (!strcmp(ep[i].extensionName, VK_EXT_SUBGROUP_SIZE_CONTROL_EXTENSION_NAME)) has_ssc = 1;
#endif
}
@@ -1109,8 +1163,11 @@ int coli_vk_init(const char *spv_path) {
dc.enabledExtensionCount = nc; dc.ppEnabledExtensionNames = cext;
if (vkCreateDevice(G.phys, &dc, NULL, &G.dev) != VK_SUCCESS) { G.has_coop = 0; G.has_bda = 0; G.dev = VK_NULL_HANDLE; }
}
- if (!G.dev)
#endif
+ /* the cooperative-matrix device enables subgroup size control already */
+ G.pin_sg = vk_pin_sg(G.phys, has_ssc);
+ if (!G.dev && G.pin_sg && !vk_create_device_pinned(G.phys, &di, &G.dev)) G.pin_sg = 0;
+ if (!G.dev)
VKCHECK(vkCreateDevice(G.phys, &di, NULL, &G.dev), "vkCreateDevice");
vk_mem_device(0, G.phys, G.dev); /* the device memory books, and COLI_VK_DEVICE_CAP_MB */
vk_pool_blocks(0);
@@ -2553,7 +2610,7 @@ static struct {
VkDescriptorPool pool; VkDescriptorSet gu[64], dn[64]; int nsets;
Scratch x, h, y;
int inflight; size_t pending_yb;
- int has_budget, has_hostmem;
+ int has_budget, has_hostmem, pin_sg;
/* what the expert batch's context on this device needs (xb_bind) */
uint32_t memtype_dev, ts_bits; float ts_period;
size_t ssbo_align, ssbo_range, buf_align;
@@ -2651,6 +2708,9 @@ int coli_vk_init_dev2(const char *spv_path, int devidx) {
#endif
#ifdef VK_EXT_external_memory_host
if (!strcmp(ep[i].extensionName, VK_EXT_EXTERNAL_MEMORY_HOST_EXTENSION_NAME)) G2.has_hostmem = 1;
+#endif
+#ifdef VK_EXT_subgroup_size_control
+ if (!strcmp(ep[i].extensionName, VK_EXT_SUBGROUP_SIZE_CONTROL_EXTENSION_NAME)) G2.pin_sg = 1;
#endif
}
free(ep);
@@ -2665,6 +2725,9 @@ int coli_vk_init_dev2(const char *spv_path, int devidx) {
VkDeviceCreateInfo di = {.sType = VK_STRUCTURE_TYPE_DEVICE_CREATE_INFO,
.queueCreateInfoCount = 1, .pQueueCreateInfos = &qi,
.enabledExtensionCount = ndext, .ppEnabledExtensionNames = ndext ? dext : NULL};
+ G2.pin_sg = vk_pin_sg(G2.phys, G2.pin_sg);
+ if (G2.pin_sg && !vk_create_device_pinned(G2.phys, &di, &G2.dev)) G2.pin_sg = 0;
+ if (!G2.dev)
VKCHECK(vkCreateDevice(G2.phys, &di, NULL, &G2.dev), "d2 vkCreateDevice");
vk_mem_device(1, G2.phys, G2.dev);
vk_pool_blocks(1);
@@ -5005,6 +5068,7 @@ int coli_vk_core(ColiVkCore *o) {
o->gemm_min_s = G.gemm_min_s; o->gemm_min_so = G.gemm_min_so;
o->integrated = coli_vk_device_integrated(); o->shares_ram = coli_vk_device_shares_ram();
o->coop_sg = G.has_coop ? G.coop_sg : 0;
+ o->pin_sg = G.pin_sg;
return 1;
}
int coli_vk_tensor_info(const ColiVkTensor *t, ColiVkTensorInfo *o) {
@@ -5032,6 +5096,7 @@ int coli_vk_core_dev(int d, ColiVkCore *o) {
o->has_prio = 0;
o->integrated = G2.integrated; o->shares_ram = G2.shares_ram;
o->coop_sg = 0; /* the second device's cooperative matrices are not probed: its chain keeps the plain shaders */
+ o->pin_sg = G2.pin_sg;
return 1;
}
int coli_vk_available_dev(int d) { return d == 1 ? G2.ready : G.ready; }
diff --git a/c/backend_vulkan.h b/c/backend_vulkan.h
index 6619a180..1c18d14a 100644
--- a/c/backend_vulkan.h
+++ b/c/backend_vulkan.h
@@ -424,6 +424,7 @@ typedef struct {
int gemm_min_s, gemm_min_so;
int has_prio, integrated, shares_ram;
int coop_sg; /* subgroup size the cooperative-matrix shaders run at; 0 = none */
+ int pin_sg; /* the subgroup size every chain pipeline requires; 0 = the driver's */
} ColiVkCore;
int coli_vk_core(ColiVkCore *out);
/* A resident tensor's buffers (VkBuffer as void *) and layout; 0 for a COLI_VK_DEV2 one. */
diff --git a/c/glm53.c b/c/glm53.c
index e6ca98ea..b1756b01 100644
--- a/c/glm53.c
+++ b/c/glm53.c
@@ -1698,7 +1698,7 @@ static int glm53_mirror_probe_weight(GModel *m, int rep) {
} while (got < 0 && errno == EINTR);
if (got > 0) bytes += got;
- free(buf);
+ compat_aligned_free(buf); /* _aligned_malloc on Windows */
}
clock_gettime(CLOCK_MONOTONIC, &t1);
diff --git a/c/vk_chain.c b/c/vk_chain.c
index 8e3fff9a..48a4c26c 100644
--- a/c/vk_chain.c
+++ b/c/vk_chain.c
@@ -287,14 +287,19 @@ VkcBuf *vkc_host(const void *ptr, size_t bytes, size_t *off) {
}
/* ---- init ------------------------------------------------------------------------ */
-static VkShaderModule load_module(const char *dir_spv, const char *file) {
- char path[1200];
- const char *sl = strrchr(dir_spv, '/');
+/* The length of a path's directory with its separator, 0 without one: the shaders'
+ * directory from qmatmul.spv's path (a backslash ends it too on Windows). */
+static size_t dir_prefix(const char *path) {
+ const char *sl = strrchr(path, '/');
#ifdef _WIN32
- const char *bs = strrchr(dir_spv, '\\');
+ const char *bs = strrchr(path, '\\');
if (bs && (!sl || bs > sl)) sl = bs;
#endif
- size_t pre = sl ? (size_t)(sl - dir_spv) + 1 : 0;
+ return sl ? (size_t)(sl - path) + 1 : 0;
+}
+static VkShaderModule load_module(const char *dir_spv, const char *file) {
+ char path[1200];
+ size_t pre = dir_prefix(dir_spv);
if (pre + strlen(file) + 1 >= sizeof path) return VK_NULL_HANDLE;
memcpy(path, dir_spv, pre); strcpy(path + pre, file);
FILE *f = fopen(path, "rb");
@@ -311,10 +316,19 @@ static VkShaderModule load_module(const char *dir_spv, const char *file) {
if (!m) fprintf(stderr, "[VK] chain: cannot load %s\n", path);
return m;
}
+/* The chain's shaders size their work by gl_SubgroupSize and gl_SubgroupID, so each
+ * pipeline runs at the subgroup size the device reports (ColiVkCore.pin_sg), not one
+ * the compiler picks: an Intel Iris Xe (subgroups of 8 to 32) compiled chain_gemv and
+ * chain_gemv2 at another width than the shader saw, and every decode GEMV came out
+ * wrong. 0 (no subgroup size control, COLI_VK_SUBGROUP=0): the driver's choice. */
static VkPipeline make_pipe(VkShaderModule m, const VkSpecializationInfo *si) {
+ VkPipelineShaderStageRequiredSubgroupSizeCreateInfoEXT rss = {
+ .sType = VK_STRUCTURE_TYPE_PIPELINE_SHADER_STAGE_REQUIRED_SUBGROUP_SIZE_CREATE_INFO_EXT,
+ .requiredSubgroupSize = (uint32_t)KC.core.pin_sg};
VkComputePipelineCreateInfo ci = {.sType = VK_STRUCTURE_TYPE_COMPUTE_PIPELINE_CREATE_INFO,
- .stage = {.sType = VK_STRUCTURE_TYPE_PIPELINE_SHADER_STAGE_CREATE_INFO, .stage = VK_SHADER_STAGE_COMPUTE_BIT,
- .module = m, .pName = "main", .pSpecializationInfo = si}, .layout = KC.pl};
+ .stage = {.sType = VK_STRUCTURE_TYPE_PIPELINE_SHADER_STAGE_CREATE_INFO, .pNext = KC.core.pin_sg > 0 ? &rss : NULL,
+ .stage = VK_SHADER_STAGE_COMPUTE_BIT, .module = m, .pName = "main", .pSpecializationInfo = si},
+ .layout = KC.pl};
VkPipeline p = VK_NULL_HANDLE;
if (vkCreateComputePipelines(KC.dev, VK_NULL_HANDLE, 1, &ci, NULL, &p) != VK_SUCCESS) return VK_NULL_HANDLE;
return p;
@@ -375,8 +389,7 @@ int vkc_init(void) {
/* the MLA, KDA and mHC shaders, optional: without one only its ops decline */
for (int i = 0; i < PM_N; i++) {
char path[1200];
- const char *sl = strrchr(KC.core.spv_path, '/');
- size_t pre = sl ? (size_t)(sl - KC.core.spv_path) + 1 : 0;
+ size_t pre = dir_prefix(KC.core.spv_path);
FILE *f = NULL;
if (pre + strlen(mla_file[i]) + 1 < sizeof path) {
memcpy(path, KC.core.spv_path, pre); strcpy(path + pre, mla_file[i]);
@@ -1822,8 +1835,7 @@ static struct { VkShaderModule mod; VkPipeline pipe; } g_d4[2];
#define D4 (g_d4[g_kd])
static void dsv4_init(void) {
char path[1200];
- const char *sl = strrchr(KC.core.spv_path, '/');
- size_t pre = sl ? (size_t)(sl - KC.core.spv_path) + 1 : 0;
+ size_t pre = dir_prefix(KC.core.spv_path);
const char *file = "chain_dsv4.spv";
if (pre + strlen(file) + 1 >= sizeof path) return;
memcpy(path, KC.core.spv_path, pre); strcpy(path + pre, file);
@@ -1930,8 +1942,7 @@ static VkPipeline kvs_pipe(void) {
if (KS.pipe || KS.tried || !vkc_ready()) return KS.pipe;
KS.tried = 1;
char path[1200];
- const char *sl = strrchr(KC.core.spv_path, '/');
- size_t pre = sl ? (size_t)(sl - KC.core.spv_path) + 1 : 0;
+ size_t pre = dir_prefix(KC.core.spv_path);
const char *file = "chain_kvs.spv";
if (pre + strlen(file) + 1 >= sizeof path) return VK_NULL_HANDLE;
memcpy(path, KC.core.spv_path, pre); strcpy(path + pre, file);
diff --git a/c/vk_kvsplit.h b/c/vk_kvsplit.h
index d906da30..ff3c08c1 100644
--- a/c/vk_kvsplit.h
+++ b/c/vk_kvsplit.h
@@ -51,6 +51,9 @@
#include "vk_chain.h"
#include <stdio.h>
#include <stdlib.h>
+#ifdef _WIN32
+#include <malloc.h> /* _aligned_malloc */
+#endif
#include <string.h>
#include <math.h>
#include <time.h>
@@ -109,11 +112,28 @@ typedef struct {
static double vkc_kv_now(void) { struct timespec t; clock_gettime(CLOCK_MONOTONIC, &t); return t.tv_sec * 1e3 + t.tv_nsec / 1e6; }
+/* The shadows' pages, aligned for the host-memory import. On Windows they come from
+ * _aligned_malloc, which only _aligned_free may release (free() corrupts the heap). */
+static void *vkc_kv_pages(size_t al, size_t bytes) {
+#ifdef _WIN32
+ return _aligned_malloc(bytes, al);
+#else
+ void *p = NULL;
+ return posix_memalign(&p, al, bytes) ? NULL : p;
+#endif
+}
+static void vkc_kv_pages_free(void *p) {
+#ifdef _WIN32
+ _aligned_free(p);
+#else
+ free(p);
+#endif
+}
static void vkc_kv_shadow_free(VkcKvSplit *ks) {
if (ks->sh) for (int i = 0; i < ks->nl; i++)
for (int k = 0; k < 2; k++) {
vkc_free(ks->sh[i].b[k]); /* after the frames that read it, before its pages go */
- free(ks->sh[i].p[k]);
+ vkc_kv_pages_free(ks->sh[i].p[k]);
}
free(ks->sh); ks->sh = NULL; ks->shadow_bytes = 0;
vkc_free(ks->cscr); ks->cscr = NULL;
@@ -728,14 +748,13 @@ static VkcKvShadow *vkc_kv_shadow(VkcKvSplit *ks, int li, int nparts, const floa
size_t al = coli_vk_import_alignment();
for (int k = 0; k < nparts; k++) {
size_t n = (size_t)nseg[k] * ks->cap * seglen[k], bytes = (n * sizeof(float) + al - 1) / al * al;
- void *p = NULL;
- if (!al || posix_memalign(&p, al, bytes)) p = NULL;
+ void *p = al ? vkc_kv_pages(al, bytes) : NULL;
sh->p[k] = (float *)p;
if (p) { memset(p, 0, bytes); sh->b[k] = vkc_host(p, bytes, &sh->off[k]); }
if (!p || !sh->b[k]) {
fprintf(stderr, "[VK] %s chain: no shadow for layer %d's host rows (%.1f MiB), the CPU computes its part\n",
ks->engine, li, bytes / 1048576.0);
- for (int j = 0; j <= k; j++) { vkc_free(sh->b[j]); free(sh->p[j]); sh->b[j] = NULL; sh->p[j] = NULL; }
+ for (int j = 0; j <= k; j++) { vkc_free(sh->b[j]); vkc_kv_pages_free(sh->p[j]); sh->b[j] = NULL; sh->p[j] = NULL; }
sh->cap = -1;
return NULL;
}
diff --git a/docs/ENVIRONMENT.md b/docs/ENVIRONMENT.md
index 2423727d..67bd4e3f 100644
--- a/docs/ENVIRONMENT.md
+++ b/docs/ENVIRONMENT.md
@@ -280,6 +280,7 @@ With `COLI_VULKAN=1` every MoE engine (qwen36, qwen38, inkling, olmoe, kimi_k3,
| `COLI_VK_IMPORT` | on for a model without routed experts on a device sharing the CPU's RAM; off otherwise | qwen36: the device reads the int8 and f16 dense rows where the host keeps them (`VK_EXT_external_memory_host`, `coli_vk_tensor_import`) instead of holding a copy of each. `1` requests import, `0` copies. On an integrated GPU, imported rows remain shared even with `COLI_VK_DENSE_HOST=0`: they already have one physical copy, and their pages stay alive while Vulkan reads them. `COLI_VK_IMPORT=0` forces an independent device copy whose host pages can be released; only those released pages count as RAM given back. On other devices, `COLI_VK_DENSE_HOST=0` disables import. Unset, on for the dense 27B family (Qwen3.8-27B, Clef) on an integrated GPU or Lavapipe, whose trunk is the whole model and would be held twice (Clef's f16 trunk, 54 GB, twice past a 61 GB box); a copy elsewhere. Where the device cannot import (no extension, staged uploads) the rows are copied. See [vulkan.md](vulkan.md#the-decision-engines). |
| `COLI_VK_CHAIN_FLASH` | `16` | Rows of a forward from which the chain's causal attention (no selection list, window, ring or sink, head dim a multiple of 64) runs on the matrix units (`chain_attn_flash.comp`, f16 operands) on a device with cooperative matrices at subgroup size 64. Ahead of `COLI_VK_ATTN_BLOCK`'s blocked shader. `0` never. |
| `COLI_VK_CHAIN_GEMV` | on | `0`: the chain's decode matrices take `qmatmul.comp`'s GEMV instead of `chain_gemv.comp`'s. |
+| `COLI_VK_SUBGROUP` | on where the size varies | The dense chain's pipelines require the subgroup size the device reports, on a device that compiles compute shaders at more than one size and lets a pipeline choose (an Intel GPU: 8 to 32; a Radeon: 32 or 64). The chain's shaders size their work by the subgroup; an Intel Iris Xe compiled `chain_gemv.comp` and `chain_gemv2.comp` at another size than they read and decoded garbage. `0`: the driver's choice, as before. |
| `COLI_VK_CHAIN_GEMV2` | on where supported | The chain's int8 decode matrices on `chain_gemv2.comp`: rows a workgroup from the matrix's length (16 up to 1024 outputs, 32 up to 4096, else 64), a row's 16-byte words over a power-of-two lane group with clustered adds, up to four rows of x (a verify's) sharing each weight load with a decode step's bits. Needs clustered subgroup operations. `0` keeps `chain_gemv.comp`. |
| `COLI_VK_CHAIN_SPIN_US` | `2000` | How long a wait on a chain frame polls before blocking. |
| `COLI_VK_CHAIN_PROF` | off | `1`: device time per kind of chain op, one line per run. |
diff --git a/docs/vulkan.md b/docs/vulkan.md
index f07a1f2e..dd6df34b 100644
--- a/docs/vulkan.md
+++ b/docs/vulkan.md
@@ -1121,6 +1121,7 @@ f32 throughout, as the CPU's f32 path.
| `COLI_VK_CHAIN_LAYERS` | what fits | The engines on [the partial chain](#a-partial-chain): the first N layers on the device, the CPU the rest and the head. Unset or `auto`: the most layers the device's free memory holds (every layer when they fit, the chain as before); `n`: n layers; `0`: the chain off. |
| `COLI_VK_CHAIN_FLASH` | `16` | Rows from which a forward's plain causal attention runs on the matrix units (`chain_attn_flash.comp`: query heads of one kv head folded into 16-row tiles, K/V staged once per block as f16, two passes); `0` never. Needs cooperative matrices at subgroup size 64; otherwise, and for a selection list, a window, a ring or a sink, the blocked shader or `chain_attn.comp`. On a Radeon 8060S (Qwen3.6, 1011-token prompt) the attention went from 186 ms (`chain_attnb`) to 22 ms, the first token from 2.08 to 1.85 s, perplexity unchanged (7.65). |
| `COLI_VK_CHAIN_GEMV` | on | `0`: the decode matrices take `qmatmul.comp`'s GEMV instead of `chain_gemv.comp`'s. |
+| `COLI_VK_SUBGROUP` | on where the size varies | Every chain pipeline requires the subgroup size the device reports (`VK_EXT_subgroup_size_control`), where the device has more than one. Without it an Intel Iris Xe (Windows driver 101.7076) compiled the chain's GEMVs at another size than the shaders read: Qwen3.6 answered garbage with the chain on and correctly with it off. `0`: the driver's choice. |
| `COLI_VK_CHAIN_GEMV2` | on where supported | `0`: the int8 decode matrices keep `chain_gemv.comp` instead of `chain_gemv2.comp` (rows a workgroup by the matrix's length). On a Radeon 8060S (Qwen3.6, a 256-token answer, int8 trunk) decode went from 36.8 to 39.0 tok/s; at int4 (`COLI_DENSE_BITS=4`) it measured slower, so it takes int8 only. |
| `COLI_VK_CHAIN_SPIN_US` | `2000` | How long a wait on a chain frame polls the fence before blocking. |
| `COLI_VK_CHAIN_PROF` | off | `1`: one `[VK] chain profile` line of device time per kind of op (timestamps). |