PERFORMANCE Signal 123
Singeli DSL compiles high-level SIMD abstractions to C
Singeli is a domain-specific language for building high-performance algorithms with SIMD, implemented in BQN, that emits C code from a simple IR.
For engineers writing performance-critical code, Singeli offers a metaprogramming approach to generate specialized SIMD code without hand-writing assembly. It is already used in production in CBQN with 5k lines, suggesting it is usable. However, the standard includes for sophisticated SIMD instructions are less solid, so adopting it may require extending the language.
Written by elseif from the cluster below · every claim links back to a sourceThe three things worth knowing
Singeli is a DSL for high-performance algorithms including SIMD, implemented in BQN, with a frontend emitting IR and a backend converting to C.
It uses generators for metaprogramming, allowing flexible abstractions over CPU instructions, and is Turing-complete at compile time.
It is used in production in CBQN with 5k lines, and the core language is stable, though standard includes for SIMD are less solid.
THE READ
What the cluster adds up to.
Singeli changes how developers write SIMD code by letting them define high-level abstractions that expand into specialized instruction sequences at compile time. The cost is learning a new language and its metaprogramming model, which differs from typical C or C++ templates. Generators provide more flexibility than macros or templates, but they also add complexity to the source code. The language is designed around compile-time metaprogramming, so developers must shift their thinking to what happens during compilation rather than at runtime.
The implementation in BQN and the simple IR mean that other backends like LLVM could be supported without much work, but currently the backend emits C. This is a trade-off: C is portable and easy to integrate, but it may not achieve the same optimization level as a direct LLVM backend. The core language is stable, but the standard includes for sophisticated SIMD instructions are less solid, so users may need to write their own includes for advanced features. This could be a barrier for teams that rely on specific SIMD extensions.
Singeli is already used in production in CBQN with 5k lines, indicating it is practical for real projects. The tooling includes an interactive playground and an LSP, which help with the compile-debug loop, though the playground is described as a nice way to get parts of code working without the awkward loop. Debugging compilation errors is straightforward with parsing and stack traces, and the emitted C code embeds source names for orientation. However, the tooling is still evolving, so it may not be as polished as mature language ecosystems.
Where Singeli stops working is when the standard includes do not cover the SIMD instructions you need, particularly the more sophisticated ones. The language's metaprogramming is Turing-complete, which can lead to complex compile-time code that is hard to debug if something goes wrong. Additionally, because it generates C, you must add a build step to compile the generated code, which may complicate integration with existing build systems. For teams already invested in C or C++ with established SIMD libraries, the learning curve and tooling maturity might outweigh the benefits.
Written by elseif from the cluster below · checked for specifics the sources never containedTHE CLUSTER