You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
flow.transpiler --wasm32 already selects a 32-bit ABI for MLIR generation.
flow.transpiler --llvm already lowers MLIR through mlir-opt/mlir-translate to LLVM IR.
The missing stage is a supported LLVM IR → .wasm linker/compiler target and browser-oriented export/runtime conventions.
Execution plan
Add an LLVM-IR-to-wasm compiler utility using the LLVM/Clang wasm32 target, with deterministic export/memory/link flags and toolchain discovery.
Add a Flow-file entry point that internally invokes the existing MLIR/LLVM pipeline; no C generation is permitted in this path.
Add tests that assert the pipeline uses --wasm32 --llvm and the wasm32 LLVM target.
Add browser ABI/export support for stable Flow function symbols and linear-memory marshalling.
Define the minimal freestanding browser runtime required by allocation-heavy Flow programs.
Port flow-scikit browser demos from the C/Emscripten artifact to this backend, beginning with allocation-free kernels and then full training pipelines.
Add CI that builds a .flow fixture to .wasm, instantiates it, and checks exported numerical results.
Acceptance criteria
A .flow source file can be compiled to .wasm without generating C.
The resulting module is valid WebAssembly and exposes requested computational entry points.
Browser-compatible numerical kernels execute with parity to native MLIR/JIT results.
flow-scikit can build its browser runtime through this target.
Reopening: #529 landed the compiler utility foundation, but the issue's acceptance criteria are not yet complete. The active #530 work is still proving a real Flow-exported function can survive Flow → MLIR → LLVM IR → wasm32 and execute under WebAssembly; linear-memory marshalling, allocation-heavy browser runtime support, numerical parity against native MLIR/JIT, and the flow-scikit migration remain outstanding.
Scalar named-export execution milestone landed in #530 (3b92bfa). CI now proves a real export function answer() -> i32 compiles Flow → MLIR → LLVM IR → wasm32 and executes under Node's native WebAssembly runtime with answer() == 42. The shared CI toolchain was also corrected from MLIR 14 to MLIR 18, requested wasm exports are validated against generated LLVM IR, and empty LLVM lowering can no longer masquerade as success. Keeping this issue open for linear-memory marshalling, allocation-heavy freestanding runtime support, numerical parity against native MLIR/JIT, and migration of flow-scikit browser demos.
Direct Flow → MLIR → LLVM IR → wasm32 compilation is implemented; no generated C/Emscripten path is used.
CI now instantiates a real exported Flow function under Node and verifies answer() == 42.
The shared toolchain is aligned on MLIR 18 and exposes mlir-translate.
wasm compilation now rejects empty LLVM IR and requested exports that do not exist.
Linear-memory ABI is proven end-to-end: JavaScript writes two Float32 values into exported wasm memory, passes their byte address to ptr<f32>, and exported Flow returns the correct numerical result.
Remaining acceptance work is now narrower: define the minimal allocation/runtime contract for memref.alloc/allocation-heavy Flow, prove an allocation-backed numerical kernel, then add native-MLIR parity and migrate flow-scikit browser builds to this backend.
Allocation/runtime milestone landed in #534 (d1bc667). Dynamic array<f32> now lowers correctly through MLIR after fixing parser-normalized array_T constructor dispatch, the resulting wasm imports exactly env.malloc, and runtime/wasm/flow_runtime.mjs provides that minimal contract with a growing bump allocator. CI executes the allocation-backed Flow function 32 consecutive times under Node and verifies memory growth. Remaining acceptance work: explicit native-MLIR vs wasm numerical parity for the same source, then migrate flow-scikit's published browser bundle off its legacy Emscripten runtime/artifacts.
Production GitHub Pages run 32022755604 on flow-scikit main completed successfully: direct MLIR wasm build, Node browser-API smoke, benchmark publication checks, artifact upload, and deploy-pages all green. The old Emscripten JS/WASM artifacts were removed before that deployment.
Closing this issue as completed. Further browser demos are now ordinary downstream flow-scikit work rather than missing core wasm backend capability.
Activity
godofecht commentedon Aug 17, 2026
Reopening: #529 landed the compiler utility foundation, but the issue's acceptance criteria are not yet complete. The active #530 work is still proving a real Flow-exported function can survive Flow → MLIR → LLVM IR → wasm32 and execute under WebAssembly; linear-memory marshalling, allocation-heavy browser runtime support, numerical parity against native MLIR/JIT, and the flow-scikit migration remain outstanding.
godofecht commentedon Aug 17, 2026
Scalar named-export execution milestone landed in #530 (
3b92bfa). CI now proves a realexport function answer() -> i32compiles Flow → MLIR → LLVM IR → wasm32 and executes under Node's native WebAssembly runtime withanswer() == 42. The shared CI toolchain was also corrected from MLIR 14 to MLIR 18, requested wasm exports are validated against generated LLVM IR, and empty LLVM lowering can no longer masquerade as success. Keeping this issue open for linear-memory marshalling, allocation-heavy freestanding runtime support, numerical parity against native MLIR/JIT, and migration of flow-scikit browser demos.godofecht commentedon Aug 17, 2026
Progress update after #529/#530/#532:
answer() == 42.mlir-translate.Float32values into exported wasm memory, passes their byte address toptr<f32>, and exported Flow returns the correct numerical result.Remaining acceptance work is now narrower: define the minimal allocation/runtime contract for
memref.alloc/allocation-heavy Flow, prove an allocation-backed numerical kernel, then add native-MLIR parity and migrate flow-scikit browser builds to this backend.godofecht commentedon Aug 17, 2026
Allocation/runtime milestone landed in #534 (
d1bc667). Dynamicarray<f32>now lowers correctly through MLIR after fixing parser-normalizedarray_Tconstructor dispatch, the resulting wasm imports exactlyenv.malloc, andruntime/wasm/flow_runtime.mjsprovides that minimal contract with a growing bump allocator. CI executes the allocation-backed Flow function 32 consecutive times under Node and verifies memory growth. Remaining acceptance work: explicit native-MLIR vs wasm numerical parity for the same source, then migrate flow-scikit's published browser bundle off its legacy Emscripten runtime/artifacts.godofecht commentedon Aug 17, 2026
All acceptance criteria are now met.
The direct backend is CI- and deployment-proven end-to-end:
.flowcompiles directly through Flow → MLIR → LLVM IR → wasm32 without generated C/Emscripten (Add first-class MLIR to wasm32 compilation target #529/Execute direct MLIR wasm32 output in CI #530).WebAssembly(answer() == 42).ptr<f32>Flow kernels (Exercise direct wasm32 linear-memory marshalling #532).array<f32>allocation executes under wasm with the minimal reusableenv.mallocruntime, including repeated allocation/memory growth (Execute allocation-backed Flow under direct wasm32 #534).imports: []and accuracy/precision/recall/F1 all returning 0.75.deploy-pagesall green. The old Emscripten JS/WASM artifacts were removed before that deployment.Closing this issue as completed. Further browser demos are now ordinary downstream flow-scikit work rather than missing core wasm backend capability.