mirror of
https://github.com/Niko1221/Strata.git
synced 2026-12-06 08:18:54 +00:00
Qwen4-35B-A3B's UD-Q4_K_XL pairs (a Q4_K / Q5_K gate/up with a Q5_K / Q6_K down) were not covered by the fused kernels of moe_fused_iq.cu in the q4_lite build: native_supported took only the Q5_1 / Q8_0 downs of Flash-Next, so every Qwen4 prompt ran them on the int8 dp4a kernels (nsys, RTX 5090, 4,096 tokens: i8_kernel 198 ms of 496 ms of kernel time). The Qwen3.6 copy of the file had its own dispatch (native_supported_ext) for the same pairs; the K-quant down instances (native_kernel<Q5_K / Q6_K, false>, 256-value super-blocks, n_ff 512) are already in the file. This takes them into the main copy for the q4_lite shape: - kKqDownGeo (n_ff % 256 == 0, and not the Qwen3.6 copy): DevInfo sets the two down instances up (kqd, occ_kqd5 / occ_kqd6), native_supported takes the pair, experts_native launches them, and the pair counts as the wide class of the tile rule. Flash-Next's n_ff 640 and the Qwen3.6 copy compile the code they had: the device code of moe_fused_iq.cu, of its Qwen3.6 copy and of every kernel of prefill/kernels.cu in a default-geometry sm_120 build is byte-identical to H11's (cuobjdump -sass per function, 74 + 78 + 66 functions; the one new function is below). - STRATA_PF_FUSED_KQD: unset = on for a compute capability 12.0 card (measured), off elsewhere; 1 on any sm_80+ card, 0 the dp4a kernels again. - fused_tile::Card::mid_all (STRATA_PF_S120_MID_ALL, on in the q4_lite build, wide pairs only): a 150+ SM sm_120 card (RTX 5090, RTX PRO 6000) takes the 100-149 SM mid rule, 128 rows from 112 rows an expert. The tile only groups routed rows: same output bits (hashes below). Unit test: tests/prefill/fused_tile_rule_test.cpp. - gdn_tc_scan_kernel<false, true, 3, 4> and its launch branch, STRATA_GDN_TC_TILES=4 / STRATA_GDN_TC_TILES4 (default off: an RTX 5090 ran the scan 19.9 ms against 18.8 ms with two tiles, 4,096 tokens). Same bits as two tiles by construction (a warp owns its columns). Measured (UD-Q4_K_XL, --prefill auto, one engine process per arm, ABBA, medians of the requests): - RTX 5090, CUDA 12.9, PCIe 28 GB/s, tokens / s old (dp4a) -> new: 2,048 6,051 -> 6,559, 4,096 6,801 -> 7,238, 8,192 7,397 -> 8,455, 16,384 8,079 -> 9,307, 32,768 7,955 -> 9,384. - 4,096 tokens with the 128-row tile against the 64-row one: 7,429 against 7,014 (+5.9 %). - Golden (36 probes, K = 256): dp4a top-1 0.97413 / KL 0.016412; fused 0.97448 / KL 0.014918 (the owner's Ultra 0.97622 / 0.013379). - Logits of the last prompt position and 512 greedy ids: switch off = H11 bit for bit (3 real prompts of 900 / 655 / 6,144 tokens, tiled 4,096 / 5,120 / 12,000); tile 64 / 128, mid_all and four GDN tiles = the same bits as the default. Fused against dp4a: the same ids until position 263 / 77 / 96 of 512 (rounding level, as the other fused pairs). phaseA-tests/notes-q4-bw.md has the tables. settings register and docs/SETTINGS.md regenerated.