✗
Failing This test is currently failing.
Failed: backend-exec
Failure Output
error[KORU021]: continuation branch 'done' on tor 'input:compute' — a bare return has no tags
--> tests/regression/300_ADVANCED_FEATURES/370_VARIANTS/8209_mlir_cpu_variant/input.kz:37:0
hint: bind the value with `: name`, not `| done`
❌ Compiler coordination error: Incomplete branch coverage
(set KORU_BACKEND_TRACE=1 for the backend return trace) Code
// Test 8209: MLIR CPU variant — the root of the MLIR AOT backend.
//
// A `|mlir` proc variant carries an opaque MLIR text body (balanced braces,
// like 8205's GLSL body). The compiler routes it through the MLIR toolchain
// ahead of time — mlir-opt -> mlir-translate -> clang -c, pinned to LLVM/MLIR
// 19 — and links the object into the output binary. The emitter declares the
// extern symbol (`koru_mlir_<event-path>`) and a thin wrapper that calls it;
// no runtime machinery. Mirrors 8205's zig+gpu variant coexistence, for a
// target that actually runs.
//
// Scalar calling convention on purpose (one i32 in, one i32 out): the smallest
// thing that proves Koru -> emitted MLIR -> lowered -> linked -> ran. The loop
// shape is 8210; compiler-GENERATED kernels and the buffer ABI are
// 390_100/101/102.
~import std/io
~pub tor compute { value: i32 } -> i32
// Zig fallback — always works, and defines the answer the MLIR variant must match.
~proc compute|zig {
return value * 2;
}
// MLIR implementation — opaque MLIR text body (balanced braces, like the GLSL
// body in 8205). The compiler must route this through the MLIR toolchain.
~proc compute|mlir {
func.func @koru_mlir_compute(%arg0: i32) -> i32 {
%two = arith.constant 2 : i32
%r = arith.muli %arg0, %two : i32
return %r : i32
}
}
// Explicitly select the MLIR variant (the |variant suffix, resolved at compile time).
~compute|mlir(value: 21)
| done d |> std/io:print.ln("result: {{ d:d }}")
Expected output
result: 42
Flows
flow ~compute click a branch to expand · @labels scroll to their anchor
compute|mlir(value: 21)
Test Configuration
MUST_RUN