arXivDaily arXiv每日学术速递 周一至周五更新
arXiv周末暂无论文更新,休息一下吧,周末愉快~~
arXiv 2604.02344cs.LGcs.DCcs.PF
收藏

对四种GPU厂商、三个后端和三个浏览器下LLM推理中WebGPU调度开销的表征

Characterizing WebGPU Dispatch Overhead for LLM Inference Across Four GPU Vendors, Three Backends, and Three Browsers

Independent Researcher(独立研究者)

Jędrzej Maczan

AI总结:

本文研究WebGPU调度开销对LLM推理的影响,通过四个GPU厂商、两个后端和三个浏览器的系统表征,发现调度开销显著影响性能,提出顺序调度方法揭示调度开销真实成本,并展示不同后端和实现的选择对性能的影响。

摘要:

WebGPU的安全设计对每个操作进行验证,这在神经网络推理中导致多个小调度的累积开销,但其真实成本尚不明确。本文系统表征了LLM推理中WebGPU调度开销,覆盖四个GPU厂商(NVIDIA、AMD、Apple、Intel)、两个原生实现(Dawn、wgpu-native)和三个浏览器(Chrome、Safari、Firefox),以及两种模型大小(Qwen2.5-0.5B和1.5B)。主要贡献是顺序调度方法,揭示单操作基准测试高估调度开销约20倍。WebGPU API开销单独为24-36μs(Vulkan)和32-71μs(Metal),包含Python成本后总开销约95μs,对优化至关重要。在Vulkan上,内核融合提升吞吐量53%,而CUDA融合无益,证实每操作开销是主要区分因素。LLM推理在Linux、Windows和macOS上测试。构建了torch-webgpu,一个PrivateUse1基于的PyTorch后端和FX到WebGPU编译器,在参考平台实现11-12%的CUDA性能。在dtype匹配的float32下,RTX PRO 2000在计算量仅为RTX 5090的约60%时,仍达到WebGPU的1.4倍吞吐量。调度开销中,后端选择是主导因素,尽管在后端内实现选择也显著影响(2.2倍对于Metal)。在调度与内核计算效率方面,结论是,在当前调度密集的流程中,每操作开销主导,无论内核质量如何。所有代码、基准和原始数据均为开源。

英文摘要:

WebGPU's security-focused design imposes per-operation validation that compounds across the many small dispatches in neural network inference, yet the true cost of this overhead is poorly characterized. We present a systematic characterization of WebGPU dispatch overhead for LLM inference at batch size 1, spanning four GPU vendors (NVIDIA, AMD, Apple, Intel), two native implementations (Dawn, wgpu-native) and three browsers (Chrome, Safari, Firefox), and two model sizes (Qwen2.5-0.5B and 1.5B). Our primary contribution is a sequential-dispatch methodology that reveals naive single-operation benchmarks overestimate dispatch cost by ${\sim}20\times$. The true per-dispatch cost of WebGPU API overhead alone is 24-36 $μ$s on Vulkan and 32-71 $μ$s on Metal, while the total per-operation overhead including Python cost is ${\sim}95$~$μ$s, which turns out to be a distinction critical for optimization. On Vulkan, kernel fusion improves throughput by 53%, while CUDA fusion provides no benefit, confirming that per-operation overhead is a primary differentiator. LLM inference was tested across three major operating systems (Linux, Windows, macOS). We built $\texttt{torch-webgpu}$, a PrivateUse1-based out-of-tree PyTorch backend and an FX-to-WebGPU compiler, which on our reference platform achieves 11--12% of CUDA performance. At dtype-matched float32, RTX PRO 2000 achieves 1.4$\times$ WebGPU's throughput despite ${\sim}6\times$ less compute than RTX 5090. For dispatch overhead, backend choice is the dominant factor, although implementation choice also matters substantially within a backend (2.2$\times$ for Metal). In terms of dispatch vs kernel compute efficiency, we conclude that at batch=1 with the current dispatch-heavy pipeline, per-operation overhead dominates regardless of kernel quality. All code, benchmarks, and raw data are open source.

机构、总结、中文摘要均由AI分析而来,可能存在错误,请以论文正文为准。

↑