# ckorikov/2025-ttie architecture

> Architecture diagram of the GitHub repository ckorikov/2025-ttie, generated by GitDiagram from its file tree, README and a sample of source files (last updated 2025-07-16). It is an AI-made overview: check details against the source.

- Interactive diagram: https://gitdiagram.com/ckorikov/2025-ttie
- Repository: https://github.com/ckorikov/2025-ttie

## Overview

##### Project type and purpose
- This is a C++-based library and accompanying example/executable for “Toy Training and Inference Engine (TTIE)” that implements neural-network training and inference on various back-ends (CPU, GPU, NPU). It targets efficient AI model execution.

##### File structure
- Top level:
- CMakeLists.txt – project build orchestration
- /ttie/ttie.h – public API header for the library
- example/main.cpp (+ run.sh) – sample client application using the library
- tests/test_main.cpp – unit-test driver
- .github/workflows/*.yml – CI build & test definitions
- No separate “src/” folder; library sources are likely under include/ttie or implicitly added via CMake.
- Configuration: .clang-format, .clang-tidy, CMake-based build.

##### README for additional insights
- The library defines Layers (convolution, pooling, normalization, activations, RNNs, etc.), Loss and Distance functions, Tensor abstraction, and multiple hardware back-ends.
- Emphasis on performance optimizations (parallelism, operator fusion, quantization).

##### Final recommendations
- Core component (Tensor, Layer, Backend) as a separate node.

## Diagram (Mermaid)

```mermaid
graph TB

    subgraph "Consumers"
        Example["Example Executable"]:::consumer
        Test["Test Suite"]:::consumer
    end

    Example -->|"uses API"| API
    Test -->|"uses API"| API

    API["Public API"]:::library
    click API "https://github.com/ckorikov/2025-ttie/blob/main/include/ttie/ttie.h"

    subgraph "Core Engine"
        Engine["Engine Dispatcher"]:::library
        Tensor["Tensor Abstraction"]:::library
        Layers["Layers (Conv, Pooling, Norm, RNN, etc.)"]:::library
        Loss["Loss/Distance Functions"]:::library
    end

    API -->|"forward(Tensor&)"| Engine
    Engine -->|"manages data"| Tensor
    Engine -->|"executes layers"| Layers
    Engine -->|"computes loss"| Loss

    subgraph "Backends"
        CPU["CPU Backend"]:::backend
        GPU["GPU Backend"]:::backend
        NPU["NPU Backend"]:::backend
    end

    Engine -->|"dispatch()"| CPU
    Engine -->|"dispatch()"| GPU
    Engine -->|"dispatch()"| NPU

    subgraph "Hardware"
        CPUHW["CPU Hardware"]
        GPUHW["GPU Hardware"]
        NPUHW["NPU Hardware"]
    end

    CPU -->|"runs kernels"| CPUHW
    GPU -->|"runs kernels"| GPUHW
    NPU -->|"runs kernels"| NPUHW

    subgraph "Build & CI" 
        Build["Build System"]:::ci
        CI1["CMake Single-Platform CI"]:::ci
        CI2["MSVC CI"]:::ci
        LintFmt["Linting/Formatting"]:::ci
        Docs["Documentation & Licensing"]:::ci
    end

    Build -.-> CI1
    Build -.-> CI2
    Build -.-> LintFmt
    Build -.-> Docs

    click Example "https://github.com/ckorikov/2025-ttie/blob/main/example/main.cpp"
    click Example "https://github.com/ckorikov/2025-ttie/blob/main/run.sh"
    click Test "https://github.com/ckorikov/2025-ttie/blob/main/tests/test_main.cpp"
    click Build "https://github.com/ckorikov/2025-ttie/blob/main/CMakeLists.txt"
    click CI1 "https://github.com/ckorikov/2025-ttie/blob/main/.github/workflows/cmake-single-platform.yml"
    click CI2 "https://github.com/ckorikov/2025-ttie/blob/main/.github/workflows/msvc.yml"
    click LintFmt "https://github.com/ckorikov/2025-ttie/blob/main/.clang-format"
    click LintFmt "https://github.com/ckorikov/2025-ttie/blob/main/.clang-tidy"
    click Docs "https://github.com/ckorikov/2025-ttie/blob/main/README.md"
    click Docs "https://github.com/ckorikov/2025-ttie/tree/main/LICENSE"

    classDef library fill:#D6EAF8,stroke:#3498DB,stroke-width:2px
    classDef consumer fill:#D5F5E3,stroke:#27AE60,stroke-width:2px
    classDef backend fill:#FDEBD0,stroke:#E67E22,stroke-width:2px
    classDef ci fill:none,stroke:#95A5A6,stroke-dasharray:5 5
```
