Implement parallel interpreter for Op DSL

t-436·WorkTask·
·
·
Created1 month ago·Updated1 month ago

Description

Edit

Implement the parallel interpreter in Omni/Agent/Interpreter/Parallel.hs.

Context

  • The Op DSL (Omni/Agent/Op.hs) has Par and Race operations
  • The Sequential interpreter (Omni/Agent/Interpreter/Sequential.hs) runs them sequentially
  • We need a Parallel interpreter that actually runs them concurrently

Requirements

1. Implement runParallel that interprets Op programs with true parallelism 2. Par [Op a] should run all ops concurrently and collect results 3. Race [Op a] should run all ops concurrently and return first success 4. Budget enforcement should work across parallel branches 5. Trace events should be merged correctly from parallel executions 6. Use async library for concurrency

Files to Study

  • Omni/Agent/Op.hs - The Op DSL with Par/Race types
  • Omni/Agent/Interpreter/Sequential.hs - Reference implementation
  • Omni/Agent/Interpreter/Parallel.hs - Stub to implement

Approach

1. Read the existing Sequential interpreter to understand the pattern 2. Look at how runParSequentially works as a baseline 3. Implement parallel versions using async/mapConcurrently 4. Handle budget tracking across parallel branches 5. Merge traces from parallel executions 6. Add tests

Verification

  • bild Omni/Agent/Interpreter/Parallel.hs should pass
  • Tests should verify Par runs concurrently (timing)
  • Tests should verify Race returns first result

Timeline (3)

💬[human]1 month ago

Parallel interpreter already implemented in Omni/Agent/Interpreter/Parallel.hs. Build passes, all 7 tests pass. Features: Par (concurrent branches with state merge via Semigroup), Race (first winner), Fork/Join events, timeout, budget tracking.

🔄[human]Open → Done1 month ago