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
User-defined words lower to func.func + func.call. On GPU, small helper words should almost always be inlined. Without CSE/LICM/DCE after stack materialization, redundant address math and dead stack traffic survive into PTX.
Proposed passes (order sketch)
After Forth→GPU (and ideally after stack flattening if/when that lands):
Inliner — always-inline (or aggressively inline) private word functions into the kernel
CSE
Canonicalizer (already present; may run more than once)
LICM / loop-invariant code motion where profitable
DCE / SCCP as appropriate
Then existing NVVM/LLVM lowering
Make the set overridable via pass-manager CLI options for experiments (warpforth-opt already registers MLIR passes).
Acceptance criteria
Small user words are inlined into main in default pipeline IR dumps
Documented pass list in README or architecture notes
LIT tests showing inlining and at least one CSE/LICM win on a reduced example
No compile-time regression on existing check-warpforth suite
Pipeline remains debuggable: ability to stop before/after opt stages (see also dump stages on warpforthc)
Related
Stack flattening (promoted SSA makes these opts much more effective)
Summary
Grow
buildWarpForthPipelinebeyond a singlecanonicalizerpass so user words and lowered stack/memory IR get the GPU-relevant opts they need.Motivation
Current pipeline (
lib/Conversion/Passes.cpp):convert-forth-to-memrefconvert-forth-to-gpucanonicalizeronlyUser-defined words lower to
func.func+func.call. On GPU, small helper words should almost always be inlined. Without CSE/LICM/DCE after stack materialization, redundant address math and dead stack traffic survive into PTX.Proposed passes (order sketch)
After Forth→GPU (and ideally after stack flattening if/when that lands):
Make the set overridable via pass-manager CLI options for experiments (
warpforth-optalready registers MLIR passes).Acceptance criteria
mainin default pipeline IR dumpscheck-warpforthsuitewarpforthc)Related