# gatmannes/xdna2- architecture

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

- Interactive diagram: https://gitdiagram.com/gatmannes/xdna2-
- Repository: https://github.com/gatmannes/xdna2-

## Overview

This is an experimental Windows XDNA2/AIE2P kernel-development and runtime research project. Its documented workflow takes a workload through execution planning and AIE kernel generation, compiles XCLBINs and instruction streams, runs them on NPU hardware, then checks correctness and measures performance; those observations can inform later planning. The graph includes the sampled emitter/operator and wrapper, plus README-documented planner and validation stages. Planner internals and runtime wiring are not shown in the excerpts, so those links are documented at a high level rather than inferred from unsampled code.

Main entry points: [`AM101_kernels_20260815/runtime_modifs/f3best_emit.py`](https://github.com/gatmannes/xdna2-/blob/main/AM101_kernels_20260815/runtime_modifs/f3best_emit.py) (F3Best emitter), [`AM101_kernels_20260815/runtime_modifs/op.py`](https://github.com/gatmannes/xdna2-/blob/main/AM101_kernels_20260815/runtime_modifs/op.py) (Decode operator), [`kernels`](https://github.com/gatmannes/xdna2-/tree/main/kernels) (XCLBIN and instructions), [`reproductible`](https://github.com/gatmannes/xdna2-/tree/main/reproductible) (Hardware measurements)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_planning["Planning and workloads"]
  node_workload["Workload specification"]
  node_planner["Adaptive planner"]
  node_plans["Execution plans"]
  node_cost_model["Hardware cost model"]
end

subgraph group_generation["Kernel generation"]
  node_emitter["F3Best emitter<br/>[f3best_emit.py]"]
  node_emitter_nokv["No-KV emitter"]
  node_operator["Decode operator<br/>[op.py]"]
  node_bcast_wrapper["Broadcast GEMV wrapper"]
  node_asm_kernels["Broadcast assembly kernels"]
  node_artifacts["XCLBIN and instructions"]
end

subgraph group_execution["Runtime execution"]
  node_runtime["Windows runtime<br/>[ggml-xdna.cpp]"]
  node_npu{{"XDNA2 NPU"}}
end

subgraph group_evaluation["Validation and research"]
  node_correctness["Correctness checks"]
  node_measurements["Hardware measurements"]
  node_pdi_tools["PDI analysis tools"]
end

node_engineer(("Workload engineer"))

node_engineer -->|"defines workload"| node_workload
node_workload -->|"plans execution"| node_planner
node_planner -->|"ranks candidates"| node_plans
node_plans -.->|"configures compile"| node_operator
node_operator -->|"generates MLIR"| node_emitter
node_emitter -->|"inherits emitter"| node_emitter_nokv
node_operator -->|"compiles artifacts"| node_artifacts
node_emitter -.->|"calls GEMV"| node_bcast_wrapper
node_bcast_wrapper -->|"calls assembly"| node_asm_kernels
node_artifacts -->|"loads programs"| node_runtime
node_runtime -->|"executes kernels"| node_npu
node_npu -->|"checks outputs"| node_correctness
node_npu -->|"measures performance"| node_measurements
node_correctness -->|"gates results"| node_measurements
node_measurements -->|"informs costs"| node_cost_model
node_cost_model -->|"ranks plans"| node_planner
node_artifacts -.->|"inspects PDI"| node_pdi_tools

click node_workload "https://github.com/gatmannes/xdna2-/blob/main/ref/modeling_qwen3_5.py"
click node_emitter "https://github.com/gatmannes/xdna2-/blob/main/AM101_kernels_20260815/runtime_modifs/f3best_emit.py"
click node_emitter_nokv "https://github.com/gatmannes/xdna2-/blob/main/AM101_kernels_20260815/runtime_modifs/f3best_emit_nokv.py"
click node_operator "https://github.com/gatmannes/xdna2-/blob/main/AM101_kernels_20260815/runtime_modifs/op.py"
click node_bcast_wrapper "https://github.com/gatmannes/xdna2-/blob/main/AM101_kernels_20260815/sources/layer_fused_bcast_wrapper.cc"
click node_asm_kernels "https://github.com/gatmannes/xdna2-/blob/main/AM101_kernels_20260815/sources/layer_fused_bcast_kc256.s"
click node_artifacts "https://github.com/gatmannes/xdna2-/tree/main/kernels"
click node_runtime "https://github.com/gatmannes/xdna2-/blob/main/AM101_kernels_20260815/runtime_modifs/ggml-xdna.cpp"
click node_correctness "https://github.com/gatmannes/xdna2-/tree/main/reproductible"
click node_measurements "https://github.com/gatmannes/xdna2-/tree/main/reproductible"
click node_pdi_tools "https://github.com/gatmannes/xdna2-/tree/main/AM101_kernels_20260815/scripts_pdi"

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_workload,node_planner,node_plans,node_cost_model toneBlue
class node_emitter,node_emitter_nokv,node_operator,node_bcast_wrapper,node_asm_kernels,node_artifacts toneAmber
class node_runtime,node_npu toneMint
class node_correctness,node_measurements,node_pdi_tools toneRose
class node_engineer toneIndigo
```

## Components

### Planning and workloads

- [Workload specification](https://github.com/gatmannes/xdna2-/blob/main/ref/modeling_qwen3_5.py): `ref/modeling_qwen3_5.py`
- **Adaptive planner**
- **Execution plans**
- **Hardware cost model**

### Kernel generation

- [F3Best emitter](https://github.com/gatmannes/xdna2-/blob/main/AM101_kernels_20260815/runtime_modifs/f3best_emit.py): `AM101_kernels_20260815/runtime_modifs/f3best_emit.py`
- [No-KV emitter](https://github.com/gatmannes/xdna2-/blob/main/AM101_kernels_20260815/runtime_modifs/f3best_emit_nokv.py): `AM101_kernels_20260815/runtime_modifs/f3best_emit_nokv.py`
- [Decode operator](https://github.com/gatmannes/xdna2-/blob/main/AM101_kernels_20260815/runtime_modifs/op.py): `AM101_kernels_20260815/runtime_modifs/op.py`
- [Broadcast GEMV wrapper](https://github.com/gatmannes/xdna2-/blob/main/AM101_kernels_20260815/sources/layer_fused_bcast_wrapper.cc): `AM101_kernels_20260815/sources/layer_fused_bcast_wrapper.cc`
- [Broadcast assembly kernels](https://github.com/gatmannes/xdna2-/blob/main/AM101_kernels_20260815/sources/layer_fused_bcast_kc256.s): `AM101_kernels_20260815/sources/layer_fused_bcast_kc256.s`
- [XCLBIN and instructions](https://github.com/gatmannes/xdna2-/tree/main/kernels): `kernels`

### Runtime execution

- [Windows runtime](https://github.com/gatmannes/xdna2-/blob/main/AM101_kernels_20260815/runtime_modifs/ggml-xdna.cpp): `AM101_kernels_20260815/runtime_modifs/ggml-xdna.cpp`
- **XDNA2 NPU**

### Validation and research

- [Correctness checks](https://github.com/gatmannes/xdna2-/tree/main/reproductible): `reproductible`
- [Hardware measurements](https://github.com/gatmannes/xdna2-/tree/main/reproductible): `reproductible`
- [PDI analysis tools](https://github.com/gatmannes/xdna2-/tree/main/AM101_kernels_20260815/scripts_pdi): `AM101_kernels_20260815/scripts_pdi`

### Other components

- **Workload engineer**

## Connections

- Workload engineer → Workload specification: defines workload (evidence: `README.md`)
- Workload specification → Adaptive planner: plans execution (evidence: `README.md`)
- Adaptive planner → Execution plans: ranks candidates (evidence: `README.md`)
- Execution plans → Decode operator: configures compile
- Decode operator → F3Best emitter: generates MLIR (evidence: `AM101_kernels_20260815/runtime_modifs/op.py`)
- F3Best emitter → No-KV emitter: inherits emitter (evidence: `AM101_kernels_20260815/runtime_modifs/f3best_emit.py`)
- Decode operator → XCLBIN and instructions: compiles artifacts (evidence: `AM101_kernels_20260815/runtime_modifs/op.py`)
- F3Best emitter → Broadcast GEMV wrapper: calls GEMV
- Broadcast GEMV wrapper → Broadcast assembly kernels: calls assembly (evidence: `AM101_kernels_20260815/sources/layer_fused_bcast_wrapper.cc`)
- XCLBIN and instructions → Windows runtime: loads programs (evidence: `README.md`)
- Windows runtime → XDNA2 NPU: executes kernels (evidence: `README.md`)
- XDNA2 NPU → Correctness checks: checks outputs (evidence: `README.md`)
- XDNA2 NPU → Hardware measurements: measures performance (evidence: `README.md`)
- Correctness checks → Hardware measurements: gates results (evidence: `README.md`)
- Hardware measurements → Hardware cost model: informs costs (evidence: `README.md`)
- Hardware cost model → Adaptive planner: ranks plans (evidence: `README.md`)
- XCLBIN and instructions → PDI analysis tools: inspects PDI
