Repository navigation
Conversation
|
Thanks @jschmied, and for the planted controls on the XPU ops. This follows #2239 too. Before it leaves draft:
The decode GEMV can be its own PR later, as you say.
|
… KV head, against FP64 (ashhart#2105) qwen3_asr.cl holds what no shared Gen12LP kernel covers: a bf16 Linear (64 x 64 tiles as vit_gemm, bf16 rows, bias, GELU and residual epilogue), the 3 x 3 stride-2 conv on channels-last rows, the flatten to torch's order, LayerNorm with bias, erf GELU, the tower's windowed attention and Qwen3's per-head RMSNorm with RoPE rounded at each product and sum (lfm3's rounds once). The language model's RMSNorm, SwiGLU and split-K GQA attention are lfm3.cl's, built again as lfm3_gq2 with GQ 2. tf-xpu-qwen3_asr_ops-test checks each against FP64 with a planted control, the shared kernels as the binding launches them.
xpu/ binds the shared tower and Qwen3 schedules to qwen3_asr.cl and the shared kernels on Level Zero, as cuda/ does on CUDA: the store places bf16 tensors as stored, the embedding copies rows by id, and lfm3's attention merge takes a +inf gate (bf16(sigmoid) = 1). tf-qwen3-asr-xpu runs a clip against a qwen3_asr_case.py case, each stage's cosine and the greedy ids. On Iris Xe the three LibriSpeech dev clips (1272-128104-0000, -0001, -0004) are byte-identical to the windowed reference (26, 17 and 91 tokens; worst stage cosine 0.99765).
796c211 to
bf48bf3
Compare
|
@ashhart restacked on main The Iris Xe gate was not rerun: no XPU tester was reachable. This head has host tests, an x86_64 cross-compile of |
…e Intel GPU; the forced tools share forced.zig (ashhart#2105) tf-qwen3-asr-xpu-forced runs a clip teacher-forced on a case's greedy ids and judges every step by the tie rule, as tf-qwen3-asr-forced does on CUDA: a differing top token passes only as a swap with both margins at most 0.25. With logits_fp32 and logits_bf16 in the case it prints both distances to fp32. --plant splice and --plant norms (q_norm and k_norm swapped in every layer, Model.swapQkNorms) are the faults it must catch. forced.zig now holds the distance and the step tally both tools print, byte for byte the change ashhart#2254 makes for its Metal tool.
…a planted control each, gate 5 live (ashhart#2105) tf-xpu-qwen3_asr_contract-test (in xpu-tests) runs gates 1 to 4 on the card for every kernel the binding launches from qwen3_asr.cl (the Linear plain, with bias and residual and with bias and GELU; the conv, flatten, LayerNorm, GELU, the tower's attention, Qwen3's q/k norm and RoPE with its cache writes) and from lfm3.cl at GQ 2 (RMSNorm, the split-K attention pair, SwiGLU), each against float64. Each has a planted control: the same source with one edit (cl_edit fails the build when the edited line is gone), red at the shapes gate, and one at the sums gate (the Linear's steps added in bf16). Gate 5 reads the card's properties against a Gen12LP row (xpu_limits.gen12lp) and every loaded kernel against its record (qwen3_asr_xpu_records.zig); the declared control at 1,024 work-items is red. The guarded buffers move to contract_guarded.zig, generic over the device, so both XPU contract runners share them.
…s bits at one row (ashhart#2105) A 16-lane sub-group an output: lane l takes the 16-k steps l, l + 16, ..., each step's fma chain from 0 as asr_gemm's tile, then the steps' sums are added in order, so every output equals asr_gemm's at m = 1 bit for bit. It lives in its own image, qwen3_asr_mv.cl: added to qwen3_asr.cl it changed the driver's build of asr_conv (SIMD 16 and 1,024 spill bytes on Gen12LP), so qwen3_asr.cl stays byte for byte ashhart#2255's. The kernel contract runs it with replaces = asr_gemm at one row (gate 3 bit-equal on every shape), float64 at gates 1 and 4, and a planted control that adds each 16 steps last first; its Gen12LP record joins gate 5.
…s bits at one row (ashhart#2105) A 16-lane sub-group an output: lane l takes the 16-k steps l, l + 16, ..., each step's fma chain from 0 as asr_gemm's tile, then the steps' sums are added in order, so every output equals asr_gemm's at m = 1 bit for bit. It lives in its own image, qwen3_asr_mv.cl: added to qwen3_asr.cl it changed the driver's build of asr_conv (SIMD 16 and 1,024 spill bytes on Gen12LP), so qwen3_asr.cl stays byte for byte ashhart#2255's. The kernel contract runs it with replaces = asr_gemm at one row (gate 3 bit-equal on every shape), float64 at gates 1 and 4, and a planted control that adds each 16 steps last first; its Gen12LP record joins gate 5.
|
@ashhart all three asks rerun on the Iris Xe, head
It stays a draft. The decode GEMV comes next as its own PR, stacked on this one. |
Qwen3-ASR's XPU binding, for #2105, on Gen12LP (Iris Xe, no DPAS). Head
e7e03b485, on maine6094de13: four commits. The first two are the binding (3b6dc91b3,bf48bf374, unchanged since the rebase). The two new ones answer ashhart's three asks (6764829964):bb07f9b91adds the forced tool ande7e03b485the kernel contract. Still a draft until the #2105 / #2118 decisions move.ashhart's asks, on the Iris Xe (0x9a49, WSL2, ocloc 23.43)
1. The two short clips (cut50 = 1272-128104-0000 cut to 0.50 s, cut99 = cut to 0.99 s; Qwen3-ASR-0.6B, qwen-asr 0.0.6 CPU cases),
tf-qwen3-asr-xpu --caseonbf48bf374:tf-qwen3-asr-xpu-forced), cut50 is 9 of 9 same and cut99 is 9 same plus that 1 swap: both PASS.tf-xpu-qwen3_asr_ops-testis ok.2. Kernel contract (
tf-xpu-qwen3_asr_contract-test, inxpu-tests). It ran ona263b1aab; this head differs from it only in comments:13 kernels. From
qwen3_asr.cl:asr_gemmthree ways: plain, with bias and residual, and with bias and GELU;asr_conv,asr_flatten(bit for bit),asr_layernorm,asr_gelu,asr_attn_full;asr_qk_rope: its q, k and v rows, and its cache writes (bit for bit).From the
lfm3_gq2build:lfm3_rmsnorm, thelfm3_attn_partial+lfm3_attn_merge_gatepair, andlfm3_swiglu. Each is checked against float64 at the binding's shapes (0.6B and 1.7B widths) and at the tiles' edges.11 planted controls, all red. Each is the same source with one edit, applied at build time by
zig/build/cl_edit.zig, which fails the build if the edited line is gone. The edits are listed inzig/build/xpu_qwen3_asr_contract.zig:Gate 4 (exact fp32 sums under stress) is proven on the Linear.
asr_qk_ropeasks 50x for fp16: a sum past fp16's range zeroes rs, so an output can miss by at most itself over its bound (about 85x). Each spec states why.Gate 5 is live. The card's properties are checked against a new Gen12LP row (
xpu_limits.gen12lp: 12 subslices of 8 EUs, 7 threads, SIMD 8), and every loaded kernel against its record inqwen3_asr_xpu_records.zig. The declared control, the norm at 1,024 work-items, is red.asr_gemmandasr_convbuild at SIMD 8.asr_gemmspills 1,024 bytes on Gen12LP. The record states it.The guarded buffers moved from
contract_rig.zigtocontract_guarded.zig, generic over the device, so the BMG runner and this one share them. The BMG runner andtf-xpu-kernel-contractstill build.3. The full clip set under #2239's tie rule: gate2's 40 clips (LibriSpeech test-clean plus FLEURS cmn), teacher-forced on the package's fp32 greedy ids with
tf-qwen3-asr-xpu-forced. It ran on0c162ed60, which differs from this head only in the contract's files (the Gen12LP row, two records and two stress fills). Qwen3-ASR-0.6B:--plant normscmn-4527058471786347963step 36, where the package's bf16 is 2.0766. The mean is lower than bf16's.forced.zig's distance and step tally. That change is byte for byte the one qwen3-asr: the Metal binding (#2105, stacked on #2239) #2254 makes for its Metal tool, so the two merge cleanly in either order.The decode GEMV stays a later PR, as agreed.
Host checks on this head
On
e7e03b485, x86 lane (8 cores, no GPU), all green:zig build -Dfixed-cpu test-host test-qwen3-asr-host: 2395/2395 steps, 24194/24356 tests (162 skipped).zig build -Dfixed-cpu test test-golden test-kernel-contract test-server-security test-pull-security fuzz-cortheon check-release-paths: 867/867 steps, 771/784 tests (13 skipped).check-native-cuda-host compile-cuda-tests17/17. The XPU build for tgllp (tf-qwen3-asr-xpu,tf-qwen3-asr-xpu-forced,xpu-tests) 105/105, and the BMG contract runner (-Dxpu-contract=true) 15/15. Both have ocloc stubbed, so they check the host code; the kernels ran on the card above.tools/pr_check.py0 errors, lean 165 vs 165 on the base (0 new),zig fmt --checkandgit diff --checkclean.What it adds
Shared kernels first:
lfm3.cl, rebuilt aslfm3_gq2with-DGQ=2; the merge with a +inf gate is x1;add_bf16;qwen3_asr.cl, only where nothing on Gen12LP has the same rounding:vit_gemm's tiles on bf16 rows, with bias, GELU and residual);vit_attn's order);lfm3's rope rounds once; Qwen3 rounds each product and the sum).#1838's
vit_*kernels are not reused: they take fp32 activations, and the shared tower buffers are bf16.The original gate (Qwen3-ASR-0.6B @
5eb1441, Iris Xe)The reference is qwen-asr 0.0.6's windowed backend, as on #2239. The prompt ids are equal on all three clips.
tf-xpu-qwen3_asr_ops-test: 16 checks against FP64 and 4 bitwise; all 14 planted controls fail as they should.test-qwen3-asr-host: green.a0d850c1b): lean 0 new, fmt and diff-check clean.zig fmtand comment commits.796c21107: lean 0 new,zig build test, the no-GPU CI set,git diff --checkandzig fmt --checkpass.Notes
tf-qwen3-asr-xpuis an offline one-stream greedy tool, and no served path changes.forced.zig(the CUDA forced tool's tally and distance moved there, as on qwen3-asr: the Metal binding (#2105, stacked on #2239) #2254) and the BMG contract rig (moved tocontract_guarded.zig, unchanged in behaviour; the BMG runner still builds). Neither CUDA nor BMG was rerun on a device for this.qwen3-asr: the XPU binding on Gen12LP (no DPAS) and tf-qwen3-asr-xpu (#2255).