Skip to main content

Runtime And Backend Ownership

Plugin-first Morph work does not stop at syntax and semantic logic.

Runtime and backend behavior are package ownership too.


Runtime Ownership

If a package owns a runtime family, its runtime behavior should stay under that package.

The contract lives in morph.toml:

  • [runtime.family.<name>] declares import variants and documents the family.
  • [runtime.family.<name>.symbol.<variant>] (or similar nested tables) bind native_symbol, llvm_signature, and optional aliases.
  • [runtime.bundle.shared], [runtime.bundle.web], and *.platform.<triple> slices list C sources and include dirs the build links for that target (see morphs/Core/morph.toml, morphs/GPU/morph.toml, morphs/Wasm/morph.toml).

Examples:

  • tensor runtime behavior belongs in Tensor
  • test runtime behavior belongs in Test
  • platform runtime behavior belongs in platform packages (Windows/Linux/Mac/Web platform C under those packages, not random folders in the generic kernel)

Do not move domain runtime behavior into the generic runtime kernel just because it is low-level. Wasm web bundles intentionally pull morphs/Wasm/runtime/platform/* via [runtime.bundle.web] so browser hosts stay package-owned—see morphs/Wasm/README.md.


Backend Ownership

If a package owns a backend route or route-specific emission, that route should stay under the package.

Examples:

  • graphics backend routes belong in Graphics
  • tensor backend routes belong in Tensor
  • threading backend routes belong in Threading

Why This Matters

When runtime and backend ownership leaks into core, the system becomes:

  • harder to extend
  • harder to reason about
  • easier to break with unrelated changes

Package-owned runtime and backend code keeps the ownership graph stable.


Platform And Build Boundaries

Domain packages own domain runtime behavior.

Platform packages own platform materialization and provider behavior.

That means:

  • Graphics owns graphics semantics
  • Windows owns Windows platform behavior
  • Build owns generic orchestration

Do not collapse these into one core-owned layer.


Runtime Example

If a new feature needs package-specific runtime helpers:

  • add them under the package runtime/
  • wire them through package manifests and generated discovery
  • test them through package-owned behavior

Do not inject one-off runtime symbols into shared core runtime files.


Next Steps