Projects / active
Weft
A compiler that plans a chunk of a model or media pipeline for one specific machine, and checks every output bit for bit against a slow reference.
- Status
- active
- Languages
- C#

I started Weft in late August on a bet: that the speed is less inside any one kernel than in how a group of them gets laid out, fused and scheduled for the machine in front of you. The first result looked like I'd lost. Its kernels were 5% slower than the ones I'd written by hand, and the pipeline built from them was faster anyway.
It isn't allowed to assume much. Every output has to match a slow scalar reference bit for bit or the plan doesn't compile, and it chooses between options from measurements taken on the actual machine. Where it has no measurement, it says Unknown. It's written in C# on .NET 10, which is not where people usually go for this.
What keeps surprising me is how often a good decision on one machine is a bad one on the next. The fused attention I wrote on a Zen+ box lost on a Broadwell Xeon and again on an M4. That's why Weft now prices every fusion instead of matching shapes, and why it emits its own x64 and arm64 where RyuJIT can't reach the instruction it needs.
It's what I work on most days. It's private and unreleased.
- SAM 3 on x64: from 3.75× behind ggml to about 2× ahead, and level with it under Strict floating point.
- On an Apple M4, not fusing attention was 1.46× faster than fusing it.
- The planner reached 96.5% of my best hand-made schedule for SAM 3's vision tower, from measurements alone.
- Generated CUDA is still up to 39× behind cuBLAS.
Related writing
- What Weft is for, and where it losesIts kernels were 5% slower than mine, and the pipeline built from them was faster anyway. Also the places it lost.3 Sept 2026
- Weft now writes its own machine codeUntil September, RyuJIT compiled every kernel Weft produced. Then I needed instructions it couldn't reach.28 Sept 2026
- Fuse it only if it paysWeft used to fuse attention wherever it saw the shape. The engine that replaced it prices the decision on the machine in front of it, and the first thing it did was undo a fusion.1 Oct 2026
- Before you benchmark anything in .NET, run A against AThe same code, timed against itself, came out 19.99% apart. Until you know that number for your harness, you can't read a 20% win.10 Sept 2026
- Something that can tell me noKeryx's retransmission brought back every dropped packet. I didn't believe it until I turned it off.7 Sept 2026