Context
ESA PaGMO (Parallel Global Multiobjective Optimizer) runs different optimization strategies on independent "islands" that periodically exchange best solutions. Jolt Physics uses the same "island" concept for parallel rigid body solving. Both achieve better results within the same time budget.
Problem
Loom's 12-phase optimization pipeline runs a fixed sequence of passes. But multiple valid optimization sequences exist for any WASM module — different orderings can produce significantly different code sizes and verification outcomes.
Proposal
Implement island-model parallel optimization:
-
Multiple islands: Each island runs the 12-phase pipeline with a different configuration:
- Different pass orderings (e.g., inline-first vs. CSE-first)
- Different aggressiveness levels (e.g., inline threshold)
- Different loop unrolling strategies
-
Migration: After each island completes, compare results by:
- Output binary size
- Z3 verification success (provably correct optimizations preferred)
- Instruction count / estimated cycle cost
-
Selection: Pick the best verified result across all islands
-
Implementation sketch:
// Run N islands in parallel (rayon or tokio::spawn)
let results: Vec<OptResult> = islands.par_iter().map(|config| {
let mut pipeline = Pipeline::new(config);
pipeline.run(module.clone())
}).collect();
// Select best verified result
results.into_iter()
.filter(|r| r.z3_verified)
.min_by_key(|r| r.output_size)
-
Cost: Bounded by number of cores. Each island is independent — no synchronization during optimization. Memory cost is N copies of the IR.
Benefits
- Better optimization results with the same wall-clock time
- Naturally exploits multi-core developer machines
- Each island's result is independently Z3-verified — no compromise on correctness
- Can discover that certain pass orderings are generally better (learning)
References
Priority
High — better optimization without compromising verification.
Context
ESA PaGMO (Parallel Global Multiobjective Optimizer) runs different optimization strategies on independent "islands" that periodically exchange best solutions. Jolt Physics uses the same "island" concept for parallel rigid body solving. Both achieve better results within the same time budget.
Problem
Loom's 12-phase optimization pipeline runs a fixed sequence of passes. But multiple valid optimization sequences exist for any WASM module — different orderings can produce significantly different code sizes and verification outcomes.
Proposal
Implement island-model parallel optimization:
Multiple islands: Each island runs the 12-phase pipeline with a different configuration:
Migration: After each island completes, compare results by:
Selection: Pick the best verified result across all islands
Implementation sketch:
Cost: Bounded by number of cores. Each island is independent — no synchronization during optimization. Memory cost is N copies of the IR.
Benefits
References
Priority
High — better optimization without compromising verification.