From 06c3b12fe043bd2ae28c1643c23e053654e11316 Mon Sep 17 00:00:00 2001 From: Julian Ng-Thow-Hing Date: Wed, 8 Jul 2026 20:44:51 -0700 Subject: [PATCH] Update [ghstack-poisoned] --- backends/webgpu/test/ops/test_quantized_linear.py | 6 ++++++ backends/webgpu/test/test_webgpu_native.cpp | 9 +++++++++ 2 files changed, 15 insertions(+) diff --git a/backends/webgpu/test/ops/test_quantized_linear.py b/backends/webgpu/test/ops/test_quantized_linear.py index c2c08be186c..65a7ebef772 100644 --- a/backends/webgpu/test/ops/test_quantized_linear.py +++ b/backends/webgpu/test/ops/test_quantized_linear.py @@ -77,6 +77,12 @@ class Q4gswConfig: # there). Same fp64 golden regardless of which kernel runs. Q4gswConfig("pwdq_gs64", 96, 2048, 256, group_size=64), # pwdq, non-32 group Q4gswConfig("pwdq_gs8", 96, 2048, 256, group_size=8), # steel_half fallback + # pwdqf16acc (f16-accumulate) runs under -DWGPU_BACKEND_STEEL_F16ACC when + # gs % BK == 0 (perplexity-gated; see the kernel diff). Same .pte as the f32 + # configs -- only the accumulator dtype differs -- goldened at a looser f16- + # accumulate tol in the native test; the deep-K shape stresses the worst case. + Q4gswConfig("pwdqf16acc", 96, 2048, 256), # f16-accumulate steel (opt-in) + Q4gswConfig("pwdqf16acc_down", 128, 8192, 2048), # deep-K f16-accum worst case Q4gswConfig("gate_proj_pf", 128, 2048, 8192), # gate/up prefill (shmem via N) Q4gswConfig("down_proj_pf", 128, 8192, 2048), # down prefill (shmem via K) Q4gswConfig("shmem_edge", 130, 4096, 2056), # partial 32-tile bounds diff --git a/backends/webgpu/test/test_webgpu_native.cpp b/backends/webgpu/test/test_webgpu_native.cpp index 0a3ee597e8f..985b3bbee9d 100644 --- a/backends/webgpu/test/test_webgpu_native.cpp +++ b/backends/webgpu/test/test_webgpu_native.cpp @@ -300,6 +300,15 @@ const Q4gswConfig kQ4gswConfigs[] = { // gs=8 (< BK=16) falls back to the per-nibble steel_half kernel. {"pwdq_gs64", 96, 2048, 256, 2.3e-4f, 1e-3f, true, false}, {"pwdq_gs8", 96, 2048, 256, 2.3e-4f, 1e-3f, true, false}, +#endif +#ifdef WGPU_BACKEND_STEEL_F16ACC + // f16-ACCUMULATE steel (pwdqf16acc): lossy, so a wider gate than the + // f16-multiply steel_f16 (2.3e-4). f16 accumulation error grows with K, so + // the deep-K down shape (K=8192) gets the loosest tol. Perplexity is the + // primary quality gate (see the kernel diff); this catches gross bit/index + // bugs. gs=32 (% BK == 0) selects pwdqf16acc; opt-in build only. + {"pwdqf16acc", 96, 2048, 256, 2e-2f, 3e-2f, true, false}, + {"pwdqf16acc_down", 128, 8192, 2048, 5e-2f, 8e-2f, true, false}, #endif {"gate_proj_pf", 128, 2048, 8192, 1e-4f, 1e-3f, true, false}, // shmem via N {"down_proj_pf", 128, 8192, 2048, 1e-3f, 1e-2f, true, false}, // shmem via K