Skip to content

Multi-kernel compilation units (multiple entry points per module) #79

Description

@tetsuo-cpp

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

  • Two kernels in one source both appear in PTX and are launchable by name
  • Shared helper word usable from both (once params-in-words or explicit args exist)
  • Metadata schema supports multiple kernels
  • LIT tests for parsing and GPU-module structure
  • Error on duplicate kernel names

Related

  • Params/shared in word definitions
  • Kernel metadata emission
  • Python package launch-by-name

Metadata

Metadata

Assignees

No one assigned

    Labels

    enhancementNew feature or request

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions