Skip to content

Enable native Kev inference with the WebGPU backend #23099

Description

@mergennachin

Enable the native Kev example on the WebGPU backend, extending the XNNPACK and MLX support added in #23023.

Kev runs prefill followed by pointer-head scoring, with an immutable prefix snapshot reused across question batches. Start with the existing C++ Module API and a native Dawn build, without Python at inference.

Use the WebGPU backend guide and operator tests as starting points. Qwen3.5 MoE's GatedDeltaNet implementation provides a reference for GDN math and state layouts. Coordinate shared export/lowering work with the Vulkan issue, #23098.

Work to cover:

  • Audit Kev's prefill and score graphs against WebGPU runtime support. Add missing WGSL kernels and lowering support, including GDN, with focused backend regression tests. Export success alone is insufficient: WebGPUPartitioner shares Vulkan's frontend, whose operator coverage is broader.
  • Add a WebGPU export option and CMake linkage for the existing kev_runner and kev_benchmark. Respect the current mutually exclusive Vulkan/WebGPU runtime registration when linking.
  • Preserve system_one, explicit prefill/evaluate, configurable token limits, variable question/option counts, and batching beyond eight questions. Repeated evaluations must leave the prefix unchanged.
  • Start with an unquantized FP32 baseline, retaining the fitted temperature and checkpoint metadata. Compare logits, probabilities, and reused state against upstream Kev's PyTorch implementation and the existing FP32 path, with documented tolerances.
  • Verify the backbone, including GDN, executes on WebGPU and report any CPU fallback. Document a tested adapter, device/buffer limits, export/build/run commands, and measurements using kev_benchmark.

Keep the integration in the existing example and reuse the runner and benchmark. Document browser/WebAssembly constraints separately from the initial native Dawn support.

cc @iseeyuan @lucylq @helunwencser @tarun292 @kimishpatel @jackzhxng

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

Labels

Type

No type

Projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions