Radically simple WASM/WebGPU engine for cross-platform compute with Rust
TL;DR, the goal is to simplify running high-performance compute use cases locally on the web and natively through a unified API with Rust, WASM, and WebGPU.
Tilekit is modular client-side backend engine to build performant desktop-class software like Photoshop (opens in a new tab) on web and native. We believe creators need an immediate connection to what they're creating, and for that, our tools need to be fast. Unfortunately, writing high performance cross-platform compute code is a complicated affair. Rust lets you write performance-intensive code in a natural way, and it now runs on the web! Furthermore, the computing power of modern ARM-based silicon chips, such as Apple's M series, and particularly GPUs, is becoming more powerful and efficient than ever.
Taking advantage of these developments, we aim to run heavy compute locally with an unified interface across browser and native platforms and make it easy to do so. We achieve this with the help of a node graph engine. Nodes are Rust functions that run on multicore CPU and GPU, eliminating the need to learn a shading language. Because nodes are arranged in a directed acyclic graph rather than a sequential list, many stages of the computation can run in parallel. Nodes are sandboxed, making it easy to share compute workloads, such as local LLMs, and more.
Architecture
Tilekit is open source. We choose open source tools that are scalable and make them simple to use. Wherever possible, we use and support existing tools rather than developing from scratch.
- Node graph engine is powered by WebGPU (opens in a new tab) with rust-gpu (opens in a new tab), a compiler backend to generate compute shaders from Rust source code, and multicore CPU fallback using Rayon (opens in a new tab), a data parallelism library.
- WebAssembly (opens in a new tab) is used both as a sandboxed runtime for the nodes, and as a way to run the entire runtime.
- Unified cross platform interface for the node API with wasm_component_layer (opens in a new tab), a runtime agnostic implementation of the WebAssembly component model. We use wasmtime (opens in a new tab) as our native runtime.
- Integrations as Vite (opens in a new tab) plugin for browser and Tauri (opens in a new tab) plugin for native.
- Local LLMs integration via ONNX models with Burn (opens in a new tab), a deep learning framework in Rust.
We build on top of web platform standards and simplify them while keeping non-standard, Tilekit-specific APIs in the tile
namespace. This means if you've ever built for WASM/WebGPU, you're likely already familiar with Tilekit, and if you're learning Tilekit, you're also investing in your knowledge of these technologies.
Credits
Tilekit draws inspiration and code from the innovative work of Ambient (opens in a new tab), Embark Studios (opens in a new tab), Graphite Labs (opens in a new tab), Tracel (opens in a new tab), Stackblitz (opens in a new tab), Dylibso (opens in a new tab) and the wider open source community.
Seeking Collaboration
The project is in its early exploratory (opens in a new tab) stage. A technical preview (opens in a new tab) targeting only the web, featuring an experimental GPU executor, is set to be released in early 2024.
Contributions are very much welcomed even without large experience in WASM, WebGPU, or Rust. I hope that this project can be a sandbox for all of us to learn more about those technologies beyond this project's initial scope. Our design needs feedback from real-world applications. If you are excited about a local-first future and think Tilekit can help you, please don’t hesitate to contact us at hello@tilekit.dev or join our Discord (opens in a new tab). We're open to collaboration and ready to help.