This document provides instructions for Dawn developers on how to configure, build, and run the LiteRT-LM benchmarks against Dawn, as well as how to inspect and interpret the benchmark output.
LiteRT-LM is an on-device Large Language Model (LLM) inference runtime. In Dawn, it benchmarks real-world WebGPU compute shader execution and pipeline dispatch performance using the libwebgpu_dawn shared library.
The benchmark reports several phases of execution. Not all reported numbers are affected by changes to Dawn:
tokens/sec)Measures prompt evaluation throughput while processing input tokens into the KV-cache.
WebGPU relevance: Highly relevant. This phase is GPU compute-bound, exercising matrix multiplication and attention shaders as well as buffer memory bandwidth.
tokens/sec)Measures autoregressive generation throughput while predicting output tokens one by one.
WebGPU relevance: Highly relevant. This phase is memory-bandwidth and dispatch-latency bound, making it a direct measure of Dawn's command submission and dispatch overhead.
Measures the wall-clock time from submitting the prompt to emitting the first generated token.
WebGPU relevance: Relevant. Dominated by the initial WebGPU prefill execution plus the first decode step.
Measures the time required to initialize the engine before inference begins.
WebGPU relevance: Relevant. Directly captures WebGPU device acquisition, pipeline layout creation, and shader compilation times.
Includes Init Tokenizer, Init LLM metadata, and TextToTokenIds.
WebGPU relevance: Not relevant. These are host-side CPU operations (SentencePiece tokenization, protobuf decoding) that do not execute WebGPU code.
Linux and macOS need no setup beyond gclient sync. Windows builds LiteRT-LM with Bazel and MSVC, which requires the upstream prerequisites: Visual Studio 2022, Git for Windows, Python 3, and a JDK with JAVA_HOME set.
Two machine settings are also required:
cargo-bazel can create symlinks without elevation. Without it the build fails with os error 1314.LongPathsEnabled set to 1 under HKLM\SYSTEM\CurrentControlSet\Control\FileSystem.LiteRT-LM sources, prebuilt accelerators, and benchmark model weights are managed conditionally in DEPS to keep checkout sizes small for developers who do not need them.
To enable LiteRT-LM, add "checkout_litert_lm": True to custom_vars in your .gclient file:
solutions = [ { "name": ".", "url": "https://dawn.googlesource.com/dawn", "deps_file": "DEPS", "managed": False, "custom_vars": { "checkout_litert_lm": True, }, }, ]
After editing .gclient, sync dependencies:
gclient sync
This fetches Bazel (tools/bazelisk/), the LiteRT-LM source tree (third_party/litert-lm/src/), and the CIPD package containing model.litertlm and precompiled platform accelerators (third_party/litert-lm/data/).
Use the tools/setup-build script to configure a release build:
./tools/setup-build gn release
This generates a GN build configuration in out/gn-release (and updates the out/active symlink to point to it) with optimizations enabled and debugging/sanitizer overhead disabled.
Build the benchmark executable using autoninja:
autoninja -C out/active litert_lm
out/active/libwebgpu_dawn.soout/active/libwebgpu_dawn.dylibout/active/webgpu_dawn.dllthird_party/litert-lm/build_litert_lm.py, which:third_party/llvm-build (on Linux/macOS) or Visual Studio toolchain (on Windows).libwebgpu_dawn and platform prebuilts.//runtime/engine:litert_lm_advanced_main.litert_lm_advanced_main binary and required shared libraries into out/active/.You can run the benchmark binary directly from the root of your Dawn checkout.
LD_LIBRARY_PATH=out/active ./out/active/litert_lm_advanced_main \ --benchmark \ --backend=gpu \ --model_path=third_party/litert-lm/data/model.litertlm
DYLD_LIBRARY_PATH=out/active ./out/active/litert_lm_advanced_main \ --benchmark \ --backend=gpu \ --model_path=third_party/litert-lm/data/model.litertlm
.\out\active\litert_lm_advanced_main.exe ` --benchmark ` --backend=gpu ` --model_path=third_party\litert-lm\data\model.litertlm
Ensure "checkout_litert_lm": True is present under custom_vars in your .gclient file, then run gclient sync.
The prebuilt libLiteRtWebGpuAccelerator cannot find libwebgpu_dawn. Ensure that LD_LIBRARY_PATH=out/active (Linux) or DYLD_LIBRARY_PATH=out/active (macOS) is set when running the command.
Prebuilt LiteRT binaries are not built with sanitizers. Avoid ASan/UBSan configurations when benchmarking LiteRT-LM and use a clean is_debug = false release build.