Skip to content

feat(warpforthc): add --emit to stop after mlir, llvm, or ptx - #139

Merged
tetsuo-cpp merged 2 commits into
canonfrom
feat/warpforthc-emit
Nov 2, 2026
Merged

tetsuo-cpp merged 2 commits into
canonfrom
feat/warpforthc-emit

Conversation

@tetsuo-cpp

@tetsuo-cpp tetsuo-cpp commented Nov 2, 2026 •

Copy link
Copy Markdown
Owner

Why

warpforthc always compiled a Forth kernel through to PTX. Inspecting an earlier stage meant splitting the compile across warpforth-translate and warpforth-opt. This adds one flag so the same driver can stop after parsing, after lowering, or at PTX.

What changed

  • warpforthc --emit=mlir|llvm|ptx writes the parsed Forth module, the lowered module as MLIR, or PTX. The default is ptx.
  • buildWarpForthLoweringPipeline holds the stages before PTX emission. The full pipeline calls it, then emits PTX as before.

Scope

  • Covers the remaining stage-stop flag from issue 120.
  • Leaves out real LLVM IR text and a compilation-target flag on this driver.

Tradeoffs

  • --emit=llvm writes the lowered module as MLIR text. A .ll export would add a second translator and a new link dependency for a debug stop.

Blast Radius

  • A run without --emit still writes PTX. That output matched the canon binary on the new test kernel. warpforth-opt is unchanged.

Verification

  • Ran warpforthc --emit=mlir, --emit=llvm, --emit=ptx, and a default run on test/Pipeline/warpforthc-emit.forth. The default run and --emit=ptx matched each other and the canon binary. --emit=cubin exited 1 with Cannot find option named 'cubin'!.
  • The worktree lit suite passed 138 of 138, including the new emit test and the existing options test.

Closes #120

@tetsuo-cpp
tetsuo-cpp force-pushed the feat/warpforthc-emit branch from 41d16d3 to bd1375f Compare November 2, 2026 03:26
@tetsuo-cpp
tetsuo-cpp merged commit 76ebea6 into canon Nov 2, 2026
1 check passed
@tetsuo-cpp
tetsuo-cpp deleted the feat/warpforthc-emit branch November 2, 2026 03:38
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Expose opt-level, features, libdevice and emit-stage options in warpforthc

1 participant