Skip to content

Emit structured kernel metadata alongside PTX #71

Description

@tetsuo-cpp

Summary

When compiling, emit a machine-readable description of the kernel interface (name, parameters, shared memory, element types/sizes) next to or embedded with the PTX.

Motivation

Hosts currently re-parse Forth headers or hard-code layouts. That is brittle for:

  • Python launch APIs
  • Multi-kernel projects
  • Tooling that binds tensors by name

Metadata should be a compile artifact, not a second parser of source.

Proposed artifact

kernel.ptx + kernel.json (or a single archive / PTX comment section):

{
  "kernel": "attention",
  "arch": "sm_80",
  "params": [
    {"name": "Q", "kind": "buffer", "element": "f32", "count": 32768},
    {"name": "SEQ_LEN", "kind": "scalar", "type": "i64"}
  ],
  "shared": [
    {"name": "SCORES", "element": "f64", "count": 1024}
  ]
}

CLI

warpforthc attention.forth -o attention.ptx --emit-metadata attention.json
# or default: write attention.json next to -o

Acceptance criteria

  • Metadata covers kernel name, params (scalar vs buffer), types, static sizes
  • Stable schema version field
  • Python package / runner can launch using metadata without re-reading .forth
  • LIT or unit test that schema matches a fixture kernel
  • Document schema in docs/

Related

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