Summary
Allow a single Forth source (or module) to define multiple GPU kernel entry points and non-kernel device functions, instead of one \! kernel per compilation unit.
Motivation
Real GPU libraries ship several related kernels (e.g. attn_fwd, attn_fwd_kv, softmax_fix). Today the model is effectively one kernel name per file/compile. Multi-entry modules simplify demos, metadata, and host APIs.
Proposed model
\! module attention
\! kernel attn_fwd
\! param ...
...
\! kernel attn_fwd_cached
\! param ...
...
: helper { ... -- } \ device function shared by both
...
;
Semantics
- Multiple
gpu.func kernels inside one gpu.module
- Shared device words callable from any kernel in the unit
- Params/shared scopes: per-kernel (preferred) vs module-global — decide and document
warpforthc emits one PTX module; metadata lists all kernels
Acceptance criteria
Related
- Params/shared in word definitions
- Kernel metadata emission
- Python package launch-by-name
Summary
Allow a single Forth source (or module) to define multiple GPU kernel entry points and non-kernel device functions, instead of one
\! kernelper compilation unit.Motivation
Real GPU libraries ship several related kernels (e.g.
attn_fwd,attn_fwd_kv,softmax_fix). Today the model is effectively one kernel name per file/compile. Multi-entry modules simplify demos, metadata, and host APIs.Proposed model
\! module attention \! kernel attn_fwd \! param ... ... \! kernel attn_fwd_cached \! param ... ... : helper { ... -- } \ device function shared by both ... ;Semantics
gpu.funckernels inside onegpu.modulewarpforthcemits one PTX module; metadata lists all kernelsAcceptance criteria
Related