Skip to content

Commit cfb143e

Browse files
committed
Update blog
1 parent 086dfc1 commit cfb143e

File tree

1 file changed

+57
-0
lines changed

1 file changed

+57
-0
lines changed
Lines changed: 57 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,57 @@
1+
---
2+
title: "Post from Oct 10, 2025"
3+
date: 2025-10-10T09:35:45
4+
slug: "1760088945"
5+
tags:
6+
- easydiffusion
7+
- sdkit
8+
- compilers
9+
---
10+
11+
Some notes on machine-learning compilers, gathered while researching tech for Easy Diffusion's next engine (i.e. sdkit v3). For context, see the [design constraints](https://cmdr2.github.io/notes/2025/10/1760085894/) of the new engine.
12+
13+
## tl;dr summary
14+
Caveat: This analysis could change in the future.
15+
16+
The current state is:
17+
1. Vendor-specific compilers are the only performant options on consumer GPUs. For e.g. [TensorRT-RTX](https://docs.nvidia.com/deeplearning/tensorrt-rtx/latest/index.html) for NVIDIA, [MiGraphX](https://rocm.docs.amd.com/projects/AMDMIGraphX/en/latest/) for AMD, [OpenVINO](https://github.com/openvinotoolkit/openvino) for Intel.
18+
2. Cross-vendor compilers are just not performant enough for Stable Diffusion-class workloads on consumer GPUs. For e.g. like [TVM](https://tvm.apache.org/), [IREE](https://iree.dev/), [XLA](https://openxla.org/xla).
19+
20+
The focus of cross-vendor compilers seems to be either on datacenter hardware, or embedded devices. The performance on desktops and laptops is pretty poor. Mojo doesn't target this category (and doesn't support Windows). Probably because datacenters and embedded devices are currently where the attention (and money) is.
21+
22+
The idea of a cross-vendor ML compiler is clearly awesome, and I think this is the way things should go. But we're not there yet for desktops/laptops, in terms of runtime performance.
23+
24+
## What's an ML compiler?
25+
The basic idea of an ML compiler is to consider an ML model's execution graph as a program to compile, and produce an optimized set of GPU-specific instructions. The compiler can optimize the execution graph by doing things like fusing operations together, parallelizing operations when possible, and even mapping groups of operators to GPU-specific instructions. It can use its knowledge of the target GPU for optimizing the memory layout and parallelism of operations. Basically what compilers already do for CPUs today, but for GPUs.
26+
27+
We already have a decent graph format: ONNX. Every model that I intend to support has ONNX exports available (and it's easy to export one, for new models).
28+
29+
## Good links for reading more about ML compilers
30+
31+
* [https://huyenchip.com/2021/09/07/a-friendly-introduction-to-machine-learning-compilers-and-optimizers.html](https://huyenchip.com/2021/09/07/a-friendly-introduction-to-machine-learning-compilers-and-optimizers.html)
32+
* [https://unify.ai/blog/deep-learning-compilers](https://unify.ai/blog/deep-learning-compilers)
33+
* [https://spj.science.org/doi/10.34133/icomputing.0040](https://spj.science.org/doi/10.34133/icomputing.0040)
34+
* [https://www.modular.com/blog/democratizing-ai-compute-part-6-what-about-ai-compilers](https://www.modular.com/blog/democratizing-ai-compute-part-6-what-about-ai-compilers)
35+
36+
## ML compiler projects
37+
Cross-vendor ML compilers:
38+
- [XLA](https://openxla.org/xla), 2017 (the first major ML compiler)
39+
- [Apache TVM](https://tvm.apache.org/), 2019
40+
- [IREE](https://iree.dev/), 2023
41+
42+
Vendor-specific ML compilers:
43+
- [TensorRT-RTX](https://docs.nvidia.com/deeplearning/tensorrt-rtx/latest/index.html) (NVIDIA-only, Windows and Linux)
44+
- [MiGraphX](https://rocm.docs.amd.com/projects/AMDMIGraphX/en/latest/) (AMD-only, Linux)
45+
- [OpenVINO](https://github.com/openvinotoolkit/openvino) (Intel-only, Windows and Linux)
46+
47+
## Testing compilers
48+
49+
On a Windows 11 desktop with NVIDIA 3060 12 GB (CUDA backend):
50+
* TensorRT-RTX: fastest performance. Supports weight-stripped engines (for custom model weights) and LoRA.
51+
* IREE: 30x slower than PyTorch on SD 1.5 VAE (130 MB), comparable performance for tiny models (13 MB). So it doesn't look good for larger models (SD 1.5 Unet, 1.7 GB), or Flux (6-12 GB).
52+
* TVM: I wasn't able to get it working. I managed to compile TVM for CUDA, but wasn't able to compile an ONNX graph with it. They're rewriting major parts of the codebase, and the docs and code are out-of-date. I'm sure this could've been figured out, but I don't feel confident in building a new engine on top of a shifting codebase, for unclear performance on desktops. Maybe once it has stabilized, for a future engine.
53+
* `torch.compile` (with WSL) still requires torch, which doesn't fit the "< 200 MB" installation size target of the new engine.
54+
* Executorch isn't focused on desktops/laptops.
55+
* XLA is pretty confusing. They apparently use cuDNN/cuBLAS finally (which exceeds the "< 200 MB" installation size target of the new engine).
56+
57+
I don't have AMD or Intel GPUs to test MiGraphX or OpenVINO, but I plan on compiling with them anyway and asking for testing help on Easy Diffusion's [Discord server](https://discord.com/invite/u9yhsFmEkB). But from what I've read, their features fit my needs and I don't doubt their performance numbers (since it's their hardware).

0 commit comments

Comments
 (0)