-
Notifications
You must be signed in to change notification settings - Fork 0
Open
Labels
enhancementNew feature or requestNew feature or request
Description
Summary
WarpForth uses a compile-time control-flow stack in the translator, emitting cf.br/cf.cond_br directly. This matches standard Forth's cf-stack semantics and supports interleaved control flow patterns (multi-WHILE, WHILE+UNTIL, etc.).
Remaining Gaps
High impact for GPU kernels
| Feature | Standard Forth | Notes |
|---|---|---|
| LEAVE / UNLOOP | Early exit from DO...LOOP |
Very common in search/scan patterns. Requires adding a forward branch target to LoopContext and branching to the exit block. |
| EXIT | Early return from a word | Common in utility words with multiple exit conditions. Requires emitting func.return mid-body. |
Medium impact
| Feature | Standard Forth | Notes |
|---|---|---|
| +LOOP | Arbitrary loop step | Useful for strided iteration. The current LOOP always increments by 1; +LOOP would pop the step from the stack. Straightforward to add. |
Low/no impact for GPU kernels
| Feature | Why |
|---|---|
| BEGIN...AGAIN | Infinite loops hang the GPU; trivial workaround BEGIN 0 UNTIL |
| ?DO...LOOP | WarpForth's DO already behaves like ?DO (zero-trip safe via arith.cmpi slt check) |
| RECURSE | Recursion is dangerous on GPUs (tiny call stacks, thread divergence) |
| CS-PICK / CS-ROLL | Exotic metaprogramming, never used in kernel code |
Related
- refactor: lower control flow to cf dialect instead of scf #20 — refactor: lower control flow to cf dialect instead of scf
- Add validation for mismatched control flow words #21 — Add validation for mismatched control flow words
Reactions are currently unavailable
Metadata
Metadata
Assignees
Labels
enhancementNew feature or requestNew feature or request