# useplx/myelin architecture

> Architecture diagram of the GitHub repository useplx/myelin, generated by GitDiagram from its file tree, README and a sample of source files (last updated 2026-11-10). It is an AI-made overview: check details against the source.

- Interactive diagram: https://gitdiagram.com/useplx/myelin
- Repository: https://github.com/useplx/myelin

## Overview

MyeLiN provides a C++ model-authoring SDK, shared contracts for compiled deployment artifacts, and a runtime that loads those artifacts and streams invocation output. The primary path is graph and orchestration authoring, external compilation via SYNaPSe, then artifact loading and session invocation. The README also documents weights, native providers, state, assets, metadata, diagnostics, and C/Python interfaces. Runtime internals are only partly sampled; unsampled subsystem links are included only where README claims support, not as inferred call chains.

Main entry points: [`src/runtime/runtime.cpp`](https://github.com/useplx/myelin/blob/main/src/runtime/runtime.cpp) (Runtime), [`include/mln/sdk/module.hpp`](https://github.com/useplx/myelin/blob/main/include/mln/sdk/module.hpp) (Tensor Graphs), [`include/mln/package.hpp`](https://github.com/useplx/myelin/blob/main/include/mln/package.hpp) (MLN Artifact), [`include/mln/runtime/runtime.hpp`](https://github.com/useplx/myelin/blob/main/include/mln/runtime/runtime.hpp) (Session Execution)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_authoring["SDK Authoring"]
  node_graphs["Tensor Graphs<br/>[module.hpp]"]
  node_operations["Tensor Operations<br/>[operations.hpp]"]
  node_nn["Neural Layers"]
  node_audio["Audio DSP<br/>[dsp.cpp]"]
  node_orchestration["Orchestration<br/>[orchestration.hpp]"]
  node_parameters["Parameters<br/>[parameters.cpp]"]
end

subgraph group_contracts["Artifact Contracts"]
  node_weights["Weight Formats<br/>[weight.hpp]"]
  node_native["Native Providers<br/>[export.hpp]"]
  node_artifact["MLN Artifact<br/>[package.hpp]"]
end

subgraph group_runtime["Runtime Execution"]
  node_runtime["Runtime<br/>[runtime.cpp]"]
  node_package["Package Loading<br/>[package.cpp]"]
  node_configuration["Runtime Configuration<br/>[configuration.hpp]"]
  node_drivers["Device Drivers"]
  node_session["Session Execution<br/>[runtime.hpp]"]
  node_stateassets["State and Assets<br/>[runtime.hpp]"]
  node_metadata["Metadata<br/>[metadata.cpp]"]
  node_diagnostics["Diagnostics<br/>[error.hpp]"]
end

subgraph group_interfaces["Language Interfaces"]
  node_cabi["C Runtime ABI<br/>[c_api.cpp]"]
  node_python["Python Wrapper<br/>[runtime.py]"]
end

node_author(("Package Author"))
node_synapse["SYNaPSe Compiler"]
node_streamconsumer(("Output Consumer"))

node_author -->|"authors"| node_graphs
node_graphs -->|"builds with"| node_operations
node_graphs -->|"composes"| node_nn
node_author -->|"authors"| node_orchestration
node_author -->|"configures"| node_parameters
node_author -.->|"uses"| node_audio
node_author -->|"chooses formats"| node_weights
node_author -->|"defines providers"| node_native
node_graphs -->|"compiled by"| node_synapse
node_orchestration -->|"compiled by"| node_synapse
node_weights -->|"configures formats"| node_synapse
node_native -->|"packaged in"| node_artifact
node_synapse -->|"produces"| node_artifact
node_artifact -->|"loaded from"| node_package
node_package -.->|"provides package"| node_runtime
node_configuration -.->|"configures"| node_runtime
node_runtime -->|"uses registry"| node_drivers
node_runtime -->|"creates"| node_session
node_session -->|"streams output"| node_streamconsumer
node_session -->|"reads and writes"| node_stateassets
node_artifact -->|"carries metadata"| node_metadata
node_runtime -->|"reports diagnostics"| node_diagnostics
node_python -->|"calls"| node_cabi
node_cabi -->|"exposes runtime"| node_runtime

click node_graphs "https://github.com/useplx/myelin/blob/main/include/mln/sdk/module.hpp"
click node_operations "https://github.com/useplx/myelin/blob/main/include/mln/sdk/operations.hpp"
click node_nn "https://github.com/useplx/myelin/tree/main/src/sdk/nn"
click node_audio "https://github.com/useplx/myelin/blob/main/src/sdk/audio/dsp.cpp"
click node_orchestration "https://github.com/useplx/myelin/blob/main/include/mln/sdk/orchestration.hpp"
click node_parameters "https://github.com/useplx/myelin/blob/main/src/sdk/parameters.cpp"
click node_weights "https://github.com/useplx/myelin/blob/main/include/mln/weight.hpp"
click node_native "https://github.com/useplx/myelin/blob/main/include/mln/sdk/native/export.hpp"
click node_artifact "https://github.com/useplx/myelin/blob/main/include/mln/package.hpp"
click node_runtime "https://github.com/useplx/myelin/blob/main/src/runtime/runtime.cpp"
click node_package "https://github.com/useplx/myelin/blob/main/src/runtime/package.cpp"
click node_configuration "https://github.com/useplx/myelin/blob/main/src/runtime/configuration.hpp"
click node_drivers "https://github.com/useplx/myelin/blob/main/src/runtime/driver_registry.cpp"
click node_session "https://github.com/useplx/myelin/blob/main/include/mln/runtime/runtime.hpp"
click node_stateassets "https://github.com/useplx/myelin/blob/main/include/mln/runtime/runtime.hpp"
click node_metadata "https://github.com/useplx/myelin/blob/main/src/runtime/metadata.cpp"
click node_diagnostics "https://github.com/useplx/myelin/blob/main/include/mln/error.hpp"
click node_cabi "https://github.com/useplx/myelin/blob/main/src/runtime/c_api.cpp"
click node_python "https://github.com/useplx/myelin/blob/main/python/src/myelin/runtime.py"

classDef toneNeutral fill:#f8fafc,stroke:#334155,stroke-width:1.5px,color:#0f172a
classDef toneBlue fill:#dbeafe,stroke:#2563eb,stroke-width:1.5px,color:#172554
classDef toneAmber fill:#fef3c7,stroke:#d97706,stroke-width:1.5px,color:#78350f
classDef toneMint fill:#dcfce7,stroke:#16a34a,stroke-width:1.5px,color:#14532d
classDef toneRose fill:#ffe4e6,stroke:#e11d48,stroke-width:1.5px,color:#881337
classDef toneIndigo fill:#e0e7ff,stroke:#4f46e5,stroke-width:1.5px,color:#312e81
classDef toneTeal fill:#ccfbf1,stroke:#0f766e,stroke-width:1.5px,color:#134e4a
class node_graphs,node_operations,node_nn,node_audio,node_orchestration,node_parameters toneBlue
class node_weights,node_native,node_artifact toneAmber
class node_runtime,node_package,node_configuration,node_drivers,node_session,node_stateassets,node_metadata,node_diagnostics toneMint
class node_cabi,node_python toneRose
class node_author,node_synapse,node_streamconsumer toneIndigo
```

## Components

### SDK Authoring

- [Tensor Graphs](https://github.com/useplx/myelin/blob/main/include/mln/sdk/module.hpp): `include/mln/sdk/module.hpp`
- [Tensor Operations](https://github.com/useplx/myelin/blob/main/include/mln/sdk/operations.hpp): `include/mln/sdk/operations.hpp`
- [Neural Layers](https://github.com/useplx/myelin/tree/main/src/sdk/nn): `src/sdk/nn`
- [Audio DSP](https://github.com/useplx/myelin/blob/main/src/sdk/audio/dsp.cpp): `src/sdk/audio/dsp.cpp`
- [Orchestration](https://github.com/useplx/myelin/blob/main/include/mln/sdk/orchestration.hpp): `include/mln/sdk/orchestration.hpp`
- [Parameters](https://github.com/useplx/myelin/blob/main/src/sdk/parameters.cpp): `src/sdk/parameters.cpp`

### Artifact Contracts

- [Weight Formats](https://github.com/useplx/myelin/blob/main/include/mln/weight.hpp): `include/mln/weight.hpp`
- [Native Providers](https://github.com/useplx/myelin/blob/main/include/mln/sdk/native/export.hpp): `include/mln/sdk/native/export.hpp`
- [MLN Artifact](https://github.com/useplx/myelin/blob/main/include/mln/package.hpp): `include/mln/package.hpp`

### Runtime Execution

- [Runtime](https://github.com/useplx/myelin/blob/main/src/runtime/runtime.cpp): `src/runtime/runtime.cpp`
- [Package Loading](https://github.com/useplx/myelin/blob/main/src/runtime/package.cpp): `src/runtime/package.cpp`
- [Runtime Configuration](https://github.com/useplx/myelin/blob/main/src/runtime/configuration.hpp): `src/runtime/configuration.hpp`
- [Device Drivers](https://github.com/useplx/myelin/blob/main/src/runtime/driver_registry.cpp): `src/runtime/driver_registry.cpp`
- [Session Execution](https://github.com/useplx/myelin/blob/main/include/mln/runtime/runtime.hpp): `include/mln/runtime/runtime.hpp`
- [State and Assets](https://github.com/useplx/myelin/blob/main/include/mln/runtime/runtime.hpp): `include/mln/runtime/runtime.hpp`
- [Metadata](https://github.com/useplx/myelin/blob/main/src/runtime/metadata.cpp): `src/runtime/metadata.cpp`
- [Diagnostics](https://github.com/useplx/myelin/blob/main/include/mln/error.hpp): `include/mln/error.hpp`

### Language Interfaces

- [C Runtime ABI](https://github.com/useplx/myelin/blob/main/src/runtime/c_api.cpp): `src/runtime/c_api.cpp`
- [Python Wrapper](https://github.com/useplx/myelin/blob/main/python/src/myelin/runtime.py): `python/src/myelin/runtime.py`

### Other components

- **Package Author**
- **SYNaPSe Compiler**
- **Output Consumer**

## Connections

- Package Author → Tensor Graphs: authors (evidence: `README.md`)
- Tensor Graphs → Tensor Operations: builds with (evidence: `README.md`)
- Tensor Graphs → Neural Layers: composes (evidence: `README.md`)
- Package Author → Orchestration: authors (evidence: `README.md`)
- Package Author → Parameters: configures (evidence: `README.md`)
- Package Author → Audio DSP: uses
- Package Author → Weight Formats: chooses formats (evidence: `README.md`)
- Package Author → Native Providers: defines providers (evidence: `README.md`)
- Tensor Graphs → SYNaPSe Compiler: compiled by (evidence: `README.md`)
- Orchestration → SYNaPSe Compiler: compiled by (evidence: `README.md`)
- Weight Formats → SYNaPSe Compiler: configures formats (evidence: `README.md`)
- Native Providers → MLN Artifact: packaged in (evidence: `README.md`)
- SYNaPSe Compiler → MLN Artifact: produces (evidence: `README.md`)
- MLN Artifact → Package Loading: loaded from (evidence: `README.md`)
- Package Loading → Runtime: provides package
- Runtime Configuration → Runtime: configures (evidence: `src/runtime/runtime.cpp`)
- Runtime → Device Drivers: uses registry (evidence: `src/runtime/runtime.cpp`)
- Runtime → Session Execution: creates (evidence: `README.md`)
- Session Execution → Output Consumer: streams output (evidence: `README.md`)
- Session Execution → State and Assets: reads and writes (evidence: `README.md`)
- MLN Artifact → Metadata: carries metadata (evidence: `README.md`)
- Runtime → Diagnostics: reports diagnostics (evidence: `README.md`)
- Python Wrapper → C Runtime ABI: calls (evidence: `README.md`)
- C Runtime ABI → Runtime: exposes runtime (evidence: `src/runtime/c_api.cpp`)
