# linjiaty/pathfinder architecture

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

- Interactive diagram: https://gitdiagram.com/linjiaty/pathfinder
- Repository: https://github.com/linjiaty/pathfinder

## Overview

Pathfinder turns execution traces into learned prefetch predictions, then uses ChampSim to measure their effects and produce results. The Python command layer coordinates model training/generation and simulation; the model delegates its spiking-neural-network work to Pathfinder logic built on BindsNET. ChampSim supplies the processor, cache, and memory-simulation runtime. The README also describes IPC and LLC prefetch metrics. Several BindsNET and simulator links below are supported only by the SOURCE INDEX; unsampled implementation details and the README-mentioned run script are not assumed.

Main entry points: [`ChampSim/pathfinder_pcpage_functions.py`](https://github.com/linjiaty/pathfinder/blob/main/ChampSim/pathfinder_pcpage_functions.py) (Pathfinder SNN logic), [`ChampSim/bindsnet/bindsnet/network/network.py`](https://github.com/linjiaty/pathfinder/blob/main/ChampSim/bindsnet/bindsnet/network/network.py) (Network runtime), [`ChampSim/ml_prefetch_sim.py`](https://github.com/linjiaty/pathfinder/blob/main/ChampSim/ml_prefetch_sim.py) (CLI orchestration), [`ChampSim/src/main.cc`](https://github.com/linjiaty/pathfinder/blob/main/ChampSim/src/main.cc) (Simulation entry)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_workflow["Pathfinder workflow"]
  node_trace["Execution traces"]
  node_commands["CLI orchestration<br/>[ml_prefetch_sim.py]"]
  node_prefetches["Prefetch predictions"]
end

subgraph group_learning["Prediction learning"]
  node_model["Prefetch model<br/>[model.py]"]
  node_pathfinder["Pathfinder SNN logic"]
  node_bindnet_models["SNN models<br/>[models.py]"]
  node_bindnet_network["Network runtime<br/>[network.py]"]
  node_bindnet_nodes["Neuron nodes<br/>[nodes.py]"]
  node_bindnet_topology["Network topology<br/>[topology.py]"]
  node_bindnet_learning["Learning rules<br/>[learning.py]"]
  node_bindnet_monitors["State monitors<br/>[monitors.py]"]
  node_bindnet_encoding["Input encoding<br/>[encodings.py]"]
end

subgraph group_simulator["ChampSim runtime"]
  node_sim_main["Simulation entry<br/>[main.cc]"]
  node_cpu["Out-of-order CPU<br/>[ooo_cpu.cc]"]
  node_cache["Cache simulation<br/>[cache.cc]"]
  node_cache_types["Cache structures<br/>[cache.h]"]
  node_kpcp["KPCP prefetch logic<br/>[kpcp.h]"]
  node_replacement["Cache replacement"]
  node_dram["DRAM controller<br/>[dram_controller.cc]"]
  node_dram_interface["DRAM interface<br/>[dram_controller.h]"]
end

subgraph group_analysis["Analysis"]
  node_results["Simulation metrics"]
  node_stats["Result processing<br/>[get_stats.py]"]
end

node_researcher(("Experimenter"))

node_researcher -->|"runs commands"| node_commands
node_trace -->|"supplies trace"| node_commands
node_commands -->|"invokes model"| node_model
node_model -->|"delegates prediction"| node_pathfinder
node_pathfinder -->|"constructs model"| node_bindnet_models
node_pathfinder -->|"records state"| node_bindnet_monitors
node_pathfinder -->|"uses encoding"| node_bindnet_encoding
node_bindnet_models -.->|"builds network"| node_bindnet_network
node_bindnet_network -.->|"runs nodes"| node_bindnet_nodes
node_bindnet_network -.->|"uses topology"| node_bindnet_topology
node_bindnet_network -.->|"applies learning"| node_bindnet_learning
node_model -->|"generates predictions"| node_prefetches
node_commands -.->|"runs simulator"| node_sim_main
node_prefetches -.->|"provides prefetches"| node_sim_main
node_sim_main -->|"schedules execution"| node_cpu
node_cpu -.->|"accesses caches"| node_cache
node_cache -->|"uses cache structures"| node_cache_types
node_kpcp -->|"uses cache interface"| node_cache_types
node_cache -.->|"uses replacement"| node_replacement
node_cpu -.->|"issues memory requests"| node_dram
node_dram -->|"implements interface"| node_dram_interface
node_sim_main -->|"reports metrics"| node_results
node_results -.->|"processes results"| node_stats

click node_commands "https://github.com/linjiaty/pathfinder/blob/main/ChampSim/ml_prefetch_sim.py"
click node_model "https://github.com/linjiaty/pathfinder/blob/main/ChampSim/model.py"
click node_pathfinder "https://github.com/linjiaty/pathfinder/blob/main/ChampSim/pathfinder_pcpage_functions.py"
click node_bindnet_models "https://github.com/linjiaty/pathfinder/blob/main/ChampSim/bindsnet/bindsnet/models/models.py"
click node_bindnet_network "https://github.com/linjiaty/pathfinder/blob/main/ChampSim/bindsnet/bindsnet/network/network.py"
click node_bindnet_nodes "https://github.com/linjiaty/pathfinder/blob/main/ChampSim/bindsnet/bindsnet/network/nodes.py"
click node_bindnet_topology "https://github.com/linjiaty/pathfinder/blob/main/ChampSim/bindsnet/bindsnet/network/topology.py"
click node_bindnet_learning "https://github.com/linjiaty/pathfinder/blob/main/ChampSim/bindsnet/bindsnet/learning/learning.py"
click node_bindnet_monitors "https://github.com/linjiaty/pathfinder/blob/main/ChampSim/bindsnet/bindsnet/network/monitors.py"
click node_bindnet_encoding "https://github.com/linjiaty/pathfinder/blob/main/ChampSim/bindsnet/bindsnet/encoding/encodings.py"
click node_sim_main "https://github.com/linjiaty/pathfinder/blob/main/ChampSim/src/main.cc"
click node_cpu "https://github.com/linjiaty/pathfinder/blob/main/ChampSim/src/ooo_cpu.cc"
click node_cache "https://github.com/linjiaty/pathfinder/blob/main/ChampSim/src/cache.cc"
click node_cache_types "https://github.com/linjiaty/pathfinder/blob/main/ChampSim/inc/cache.h"
click node_kpcp "https://github.com/linjiaty/pathfinder/blob/main/ChampSim/inc/kpcp.h"
click node_replacement "https://github.com/linjiaty/pathfinder/blob/main/ChampSim/replacement/base_replacement.cc"
click node_dram "https://github.com/linjiaty/pathfinder/blob/main/ChampSim/src/dram_controller.cc"
click node_dram_interface "https://github.com/linjiaty/pathfinder/blob/main/ChampSim/inc/dram_controller.h"
click node_stats "https://github.com/linjiaty/pathfinder/blob/main/ChampSim/get_stats.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_trace,node_commands,node_prefetches toneBlue
class node_model,node_pathfinder,node_bindnet_models,node_bindnet_network,node_bindnet_nodes,node_bindnet_topology,node_bindnet_learning,node_bindnet_monitors,node_bindnet_encoding toneAmber
class node_sim_main,node_cpu,node_cache,node_cache_types,node_kpcp,node_replacement,node_dram,node_dram_interface toneMint
class node_results,node_stats toneRose
class node_researcher toneIndigo
```

## Components

### Pathfinder workflow

- **Execution traces**
- [CLI orchestration](https://github.com/linjiaty/pathfinder/blob/main/ChampSim/ml_prefetch_sim.py): `ChampSim/ml_prefetch_sim.py`
- **Prefetch predictions**

### Prediction learning

- [Prefetch model](https://github.com/linjiaty/pathfinder/blob/main/ChampSim/model.py): `ChampSim/model.py`
- [Pathfinder SNN logic](https://github.com/linjiaty/pathfinder/blob/main/ChampSim/pathfinder_pcpage_functions.py): `ChampSim/pathfinder_pcpage_functions.py`
- [SNN models](https://github.com/linjiaty/pathfinder/blob/main/ChampSim/bindsnet/bindsnet/models/models.py): `ChampSim/bindsnet/bindsnet/models/models.py`
- [Network runtime](https://github.com/linjiaty/pathfinder/blob/main/ChampSim/bindsnet/bindsnet/network/network.py): `ChampSim/bindsnet/bindsnet/network/network.py`
- [Neuron nodes](https://github.com/linjiaty/pathfinder/blob/main/ChampSim/bindsnet/bindsnet/network/nodes.py): `ChampSim/bindsnet/bindsnet/network/nodes.py`
- [Network topology](https://github.com/linjiaty/pathfinder/blob/main/ChampSim/bindsnet/bindsnet/network/topology.py): `ChampSim/bindsnet/bindsnet/network/topology.py`
- [Learning rules](https://github.com/linjiaty/pathfinder/blob/main/ChampSim/bindsnet/bindsnet/learning/learning.py): `ChampSim/bindsnet/bindsnet/learning/learning.py`
- [State monitors](https://github.com/linjiaty/pathfinder/blob/main/ChampSim/bindsnet/bindsnet/network/monitors.py): `ChampSim/bindsnet/bindsnet/network/monitors.py`
- [Input encoding](https://github.com/linjiaty/pathfinder/blob/main/ChampSim/bindsnet/bindsnet/encoding/encodings.py): `ChampSim/bindsnet/bindsnet/encoding/encodings.py`

### ChampSim runtime

- [Simulation entry](https://github.com/linjiaty/pathfinder/blob/main/ChampSim/src/main.cc): `ChampSim/src/main.cc`
- [Out-of-order CPU](https://github.com/linjiaty/pathfinder/blob/main/ChampSim/src/ooo_cpu.cc): `ChampSim/src/ooo_cpu.cc`
- [Cache simulation](https://github.com/linjiaty/pathfinder/blob/main/ChampSim/src/cache.cc): `ChampSim/src/cache.cc`
- [Cache structures](https://github.com/linjiaty/pathfinder/blob/main/ChampSim/inc/cache.h): `ChampSim/inc/cache.h`
- [KPCP prefetch logic](https://github.com/linjiaty/pathfinder/blob/main/ChampSim/inc/kpcp.h): `ChampSim/inc/kpcp.h`
- [Cache replacement](https://github.com/linjiaty/pathfinder/blob/main/ChampSim/replacement/base_replacement.cc): `ChampSim/replacement/base_replacement.cc`
- [DRAM controller](https://github.com/linjiaty/pathfinder/blob/main/ChampSim/src/dram_controller.cc): `ChampSim/src/dram_controller.cc`
- [DRAM interface](https://github.com/linjiaty/pathfinder/blob/main/ChampSim/inc/dram_controller.h): `ChampSim/inc/dram_controller.h`

### Analysis

- **Simulation metrics**
- [Result processing](https://github.com/linjiaty/pathfinder/blob/main/ChampSim/get_stats.py): `ChampSim/get_stats.py`

### Other components

- **Experimenter**

## Connections

- Experimenter → CLI orchestration: runs commands (evidence: `ChampSim/ml_prefetch_sim.py`)
- Execution traces → CLI orchestration: supplies trace
- CLI orchestration → Prefetch model: invokes model (evidence: `ChampSim/ml_prefetch_sim.py`)
- Prefetch model → Pathfinder SNN logic: delegates prediction (evidence: `ChampSim/model.py`)
- Pathfinder SNN logic → SNN models: constructs model (evidence: `ChampSim/pathfinder_pcpage_functions.py`)
- Pathfinder SNN logic → State monitors: records state (evidence: `ChampSim/pathfinder_pcpage_functions.py`)
- Pathfinder SNN logic → Input encoding: uses encoding (evidence: `ChampSim/pathfinder_pcpage_functions.py`)
- SNN models → Network runtime: builds network
- Network runtime → Neuron nodes: runs nodes
- Network runtime → Network topology: uses topology
- Network runtime → Learning rules: applies learning
- Prefetch model → Prefetch predictions: generates predictions (evidence: `ChampSim/model.py`)
- CLI orchestration → Simulation entry: runs simulator
- Prefetch predictions → Simulation entry: provides prefetches
- Simulation entry → Out-of-order CPU: schedules execution (evidence: `ChampSim/src/main.cc`)
- Out-of-order CPU → Cache simulation: accesses caches
- Cache simulation → Cache structures: uses cache structures (evidence: `ChampSim/src/cache.cc`)
- KPCP prefetch logic → Cache structures: uses cache interface (evidence: `ChampSim/inc/kpcp.h`)
- Cache simulation → Cache replacement: uses replacement
- Out-of-order CPU → DRAM controller: issues memory requests
- DRAM controller → DRAM interface: implements interface (evidence: `ChampSim/src/dram_controller.cc`)
- Simulation entry → Simulation metrics: reports metrics
- Simulation metrics → Result processing: processes results
