GPU Goldmines: Tunable WebGPU Kernels for Edge LLM Inference

summary

Video file (mp4)

The gist

The gist The GPU Goldmines framework provides a way to specify, execute, and tune WebGPU kernels for LLM inference by creating a centralized performance database that accelerates subsequent

In short

GPU Goldmines is a framework that allows users to specify, execute, and tune WebGPU kernels for LLM inference by creating a centralized performance database. It makes kernels tunable by parameterizing them, enabling systematic exploration across diverse hardware. This approach derives data-driven policies that accelerate tuning on new devices and predict high-performing configurations for unseen input sizes.

Key concepts

Tunable WebGPU Kernel Families
The framework creates parameterized implementations of critical LLM operations like matrix multiplication and flash attention. These kernels are tunable by performance choices such as workgroup size and tile dimensions, allowing the system to test different configurations that suit specific hardware capabilities.
Centralized Performance Database
This database stores all kernel measurements indexed by device, browser, OS, and tuning parameters. It accumulates data across multiple runs and devices. This centralized knowledge is crucial for deriving policies that map execution contexts to high-performing parameter settings.
Warm-start Heuristic Tuning
When tuning on a new device or input shape, the system uses prior measurements from the database to guide the search. This warm start allows the miner to find optimal parameters significantly faster—up to 52.4% quicker than starting from scratch—by reusing previously successful configurations.
Portability Gaps and Recovery
The framework reveals that performance tuned for one device often yields only 77% of its potential on another. The database is used to derive policies that recover up to 90% of device-optimal performance for known input sizes, demonstrating how to achieve better cross-platform portability.

Terminology used across episodes

This episode discusses

The paper

GPU Goldmines: Tunable WebGPU Kernels for Edge LLM Inference · Read on arXiv

Rithik Sharma, Reese Levine, Zheyuan Chen, Ananthajit Srikanth, Yanwen Xu, Tyler Sorensen

University of California Santa Cruz · EPFL · Microsoft Research

As demand for LLM inference grows and consumer GPUs grow more capable, edge deployment is becoming increasingly attractive. WebGPU is compelling in this setting because it offers cross-platform portability and browser accessibility. However, these same strengths also make high performance difficult to achieve, as an implementation that performs well in one context may not perform well in another. To address this, we present GPU Goldmines, a framework for specifying, executing, and tuning WebGPU kernels. We instantiate GPU Goldmines with kernels for key LLM building blocks: matrix multiplication, matrix-vector multiplication, and flash attention. We characterize performance across diverse devices, shapes, and browsers, and use the resulting database to accelerate subsequent autotuning and configuration selection. On shapes drawn from Llama and Qwen models, our matrix multiplication kernels outperform ONNX Runtime and llama.cpp WebGPU kernels by 7.0x and 1.41x geometric mean, respectively, and deliver end-to-end improvements of 1.48x in the prefill stage of llama.cpp for chat workloads.

Transcript

Introduction to the show: ident: AI Radio. Generated commentary on the latest Artificial Intelligence papers.

Tom: Today's paper: "GPU Goldmines: Tunable WebGPU Kernels for Edge LLM Inference".

Jane: The gist The GPU Goldmines framework provides a way to specify, execute,

Tom: First, who's behind it and why it matters.

Title and authors: Tom: To summarize, this framework provides a way to define these tunable kernels and gives you tools to systematically run them and record how fast they perform across different setups. It’s about making sure those measurements are reliable, too.

Jane: They detail how a tunable kernel has parameters that define the execution context, which makes it flexible for different scenarios. Then they describe the kernel miner operating in three modes: exhaustive, heuristic, and warm-start heuristic to show how they explore the parameter space systematically.

Lu: The system uses those definitions to generate actual concrete kernel instances by either trying every valid setting or searching for good ones using heuristics based on those definitions. And to keep things solid, they include built-in support for warm-up executions, repeated timing iterations, and correctness validation during measurement.

Meng: I wonder about that exhaustive exploration part when you have so many dimensions involved in LLM operations. Does that mean you're just running everything and waiting for it to finish?

Tom: They filter the values using constraint functions called valid args and valid params, as well as the device limits, before instantiating and executing each configuration on the target device in two phases: warmup and measurement. During warmup, they run the kernel sixteen times to stabilize performance and validate outputs against a reference implementation.

Jane: Then during measurement, they run it one hundred twenty-eight times to get an average execution time recorded along with metrics like GFLOPs, which tells you the actual computational work being done. All these results go into that centralized database indexed by device, browser, operating system, kernel type, input dimensions and tuning parameters.

Lalam: So the system systematically explores valid configurations and stores all those performance measurements in a central database structured by context details to track how different setups perform against each other.

The paper's summary: Tom: The authors show that this method actually yields some significant performance gains when you compare it to existing WebGPU LLM kernels. This is where the real numbers come in.

Jane: Specifically, they show that these tuned configurations outperform existing WebGPU LLM kernels by seven point zero times over ONNX Runtime and one point four one times over llama.cpp specifically for matrix multiplication operations.

Lu: On top of that, they report average end-to-end prefill speedups of one point four eight times across these workloads when using llama.cpp. That’s a substantial gain in how fast the model can generate text from scratch.

Meng: That one point four eight times prefill speedup is pretty solid, but I gotta ask about the setup itself. Does this whole tuning process add a lot of overhead when you first set up these new configurations on hardware?

Tom: The framework helps derive simple parameter selection policies that map execution contexts and input shapes to high-performing configurations, reaching an average of ninety percent of hyper-tuned performance for fixed input sizes. This means you get close to the best possible speed without doing all the manual work yourself.

Jane: And here’s something interesting for new hardware: for previously unseen devices, the database allows for strong warm starts during heuristic search, enabling high-performing parameters to be identified fifty two point four percent faster than tuning from scratch.

Lalam: They also use a Bayesian approach that uses prior observations to guide the search when looking at new inputs; they select the nearest training size in Euclidean log2 space and reuse its Min-Avg portable configuration for unseen shapes, achieving eighty four percent retained performance for those cases.

The paper's improvements: Tom: So, to wrap up this paper on GPU Goldmines, it demonstrates that you can derive portable configurations that recover ninety percent of device-optimal performance when you know the input sizes.

Jane: And it also shows that for unknown devices or shapes, the system can warm-start tuning fifty two point four percent faster than starting from scratch. It’s a big win for how we manage performance across different WebGPU targets.

Lu: The authors conclude that their data-driven methods allow them to characterize portability across WebGPU’s broad target space and construct decision procedures that map execution contexts to high-performing parameter settings, which could become a standard way to approach performance portability in the WebGPU ecosystem for LLMs.

Meng: From a deployment standpoint, the ability to reuse prior measurements is key because it cuts down on the time needed for iterative testing on new hardware when you're deploying something new.

Lalam: I think the success of GPU Goldmines comes from its extensible design, letting both the database and kernel families grow alongside the WebGPU ecosystem as things change.

Tom: So they’ve shown how a centralized database can accelerate autotuning and configuration selection for matrix multiplication, matrix-vector multiplication, and flash attention by giving us these concrete performance metrics.

Jane: It proves that even with diverse hardware, you can get substantial speedups by having a system that learns from past performance on different devices through this framework.

Lu: The implication is that this data-driven approach to configuration selection could become a standard way to approach performance portability in the WebGPU ecosystem for LLMs.

Meng: For us in production, it means less manual optimization and more reliance on these automated selection policies when we deploy new model variants.

Conclusion: ---: Conclusion ---

Tom: So, we've seen how GPU Goldmines gives us a way to define tunable WebGPU kernels for edge LLM inference and build this centralized database to speed up all that autotuning later on.

Jane: Exactly. It shows you can get these tuned configurations, which might only hit seventy-seven percent of their potential performance on another device, but the database helps you figure out what’s best based on what you already measured.

Lu: The core idea is using those measurements to derive simple parameter selection policies that map execution contexts and input shapes to high-performing configurations for fixed input sizes.

Meng: For us in production, that means less manual optimization when we deploy a new model variant because we can rely on these automated selection policies.

Lalam: And for previously unseen devices, the warm-start heuristic lets you find high-performing parameters fifty two point four percent faster than tuning from scratch.

Tom: So they’ve successfully demonstrated how to use a centralized database to accelerate autotuning and configuration selection for matrix multiplication, matrix-vector multiplication, and flash attention.

Jane: It shows that even with diverse hardware, you can get substantial speedups by having a system that learns from past performance on different devices.

Lu: The implication is that this data-driven approach to configuration selection could become a standard way to approach performance portability in the WebGPU ecosystem for LLMs.

Meng: For scaling up, it means less time spent on iterative testing and more time actually building the product.

Lalam: I think the success of GPU Goldmines comes from its extensible design, letting both the database and kernel families grow alongside the WebGPU ecosystem.

Tom: That's a solid way to handle performance portability across different hardware targets in LLM inference.

Jane: It’s pretty fascinating how much information you can extract just by systematically executing and recording measurements on every device.

Lu: Next up, we have another paper looking at how embedding bias affects conditional independence testing in AI models.

More episodes

← Home