Skip to content

Instantly share code, notes, and snippets.

Use-case: GPU-heavy ML workloads

Reproducibility idea: Terraform definition of system container with NixOS image for reproducibility.

Virtualization

= isolation for workloads sharing the same machine

VMs are only needed for untrusted users (of cloud providers) or workloads that need their own kernels. They add unnecessary overhead, except for micro VMs like "kata containers" (misnomer).

{
"unmatched_xdsl": [
"llvm.call_intrinsic",
"llvm.mlir.addressof",
"llvm.mlir.constant",
"llvm.mlir.global",
"llvm.mlir.null",
"llvm.mlir.undef",
"llvm.mlir.zero"
],
@sueszli
sueszli / intended-mapping.json
Last active January 5, 2026 22:44
intended op mapping
{
"llvm.add": "add",
"llvm.fadd": "fadd",
"llvm.sub": "sub",
"llvm.fsub": "fsub",
"llvm.mul": "mul",
"llvm.fmul": "fmul",
"llvm.udiv": "udiv",
"llvm.sdiv": "sdiv",
"llvm.fdiv": "fdiv",
@sueszli
sueszli / compare.sh
Created January 4, 2026 16:00
type conversions are correct. differences are purely cosmetic or related to generator defaults.
#!/bin/bash
set -e
set -o pipefail
# llvmlite
uv run python tests/backend/llvm/generate_types_ir.py --mlir > source.mlir
uv run python tests/backend/llvm/generate_types_ir.py --llvm > generated.ll
# mlir-translate
cat source.mlir | \
I think it might make sense to `@cache`.
retrieval benchmark results:
- mixed types: 1.57x speedup
- repeated types: 2.31x speedup
- unique types: 0.68x speedup
- avg speed: 1.52x
{
"xdsl.dialects.builtin": {
"IntegerType": "ir.IntType",
"IndexType": "ir.IntType(64)",
"Float16Type": "ir.HalfType",
"Float32Type": "ir.FloatType",
"Float64Type": "ir.DoubleType",
"BFloat16Type": null,
"Float80Type": null,
@sueszli
sueszli / reprod.py
Last active January 1, 2026 22:44
Drop `scf.if` if it only has an `scf.yield`.
from xdsl.dialects import scf, arith, func
from xdsl.ir import Block, Region
from xdsl.context import Context
from xdsl.pattern_rewriter import PatternRewriteWalker, PatternRewriter, GreedyRewritePatternApplier
from xdsl.transforms.canonicalization_patterns.scf import IfPropagateConstantCondition
from xdsl.printer import Printer
ctx = Context()
ctx.load_dialect(scf.Scf)
ctx.load_dialect(arith.Arith)
@sueszli
sueszli / test_false_no_else.py
Created December 29, 2025 15:50
this breaks if we don't drop the ELSE region when cond==false
from xdsl.context import Context
from xdsl.dialects import scf, arith, func, builtin
from xdsl.dialects.builtin import ModuleOp
from xdsl.ir import Block, Region
from xdsl.transforms.canonicalization_patterns.scf import IfPropagateConstantCondition
from xdsl.pattern_rewriter import PatternRewriteWalker
ctx = Context()
ctx.load_dialect(scf.Scf)
ctx.load_dialect(arith.Arith)
@sueszli
sueszli / llvmlite.py
Last active December 28, 2025 23:21
llvmlite
# /// script
# requires-python = ">=3.11"
# dependencies = [
# "llvmlite==0.46.0",
# ]
# ///
import llvmlite.binding as llvm
import llvmlite.ir as ir
@sueszli
sueszli / cheat-sheet.sh
Last active December 31, 2025 14:27
xdsl contribution
# ---------- new branch
git switch -c <name>
git push origin <name>
git branch -r
# reset to upstream
git remote add upstream https://github.com/xdslproject/xdsl/
git config pull.rebase false
git pull upstream main