# yyysjz1997/sgdp architecture

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

- Interactive diagram: https://gitdiagram.com/yyysjz1997/sgdp
- Repository: https://github.com/yyysjz1997/sgdp

## Overview

##### Project type and purpose
- This is a research code demo for “SGDP: A Stream-Graph Neural Network Based Data Prefetcher.”
- It is not a user-facing full-stack app, but a standalone Python framework that ingests block I/O traces, builds stream-graph representations, trains/tests a graph neural network model, and simulates a cache to measure prefetching performance.

##### File structure
- Top-level files:
- cache.py        – cache simulator class
- cachetest.py    – entry point for cache tests (single-step & rolling prefetching)
- data_process.py – trace ingestion and stream conversion for training/testing
- main.py         – orchestrates end-to-end training and evaluation based on arguments
- model.py        – defines the SGDP graph neural network, training, testing, prediction routines
- pred_list_gene.py – builds local/global/hybrid connection matrices, produces prefetch lists, computes HR/EPR
- utils.py        – shared routines (I/O, graph building helpers, metric functions)
- readme.md       – project overview, instructions
- cachetest.py & cache.py – simulate how predicted addresses are fed to the cache

##### README for additional insights
- Datasets are block I/O traces in streaming form
- Workflow phases: data processing → graph construction → model train/test → cache simulation → metric computation
- Key technologies: Python, graph neural networks, gated graph modules, attention mechanism

## Diagram (Mermaid)

```mermaid
flowchart TD
    %% Nodes
    Dataset["Dataset Storage\n(Block I/O traces)"]:::external
    DataProcessing["Data Processing Module\n(data_process.py, utils.py)"]:::processing
    GraphConstruction["Graph Construction Module\n(pred_list_gene.py, utils.py)"]:::processing
    Model["SGDP Model Module\n(model.py)\n(main.py orchestration)"]:::model
    CacheSimulator["Cache Simulator & Evaluation Module\n(cache.py, cachetest.py)"]:::simulator
    Metrics["Output Metrics & Evaluation Routines\n(HR/EPR)"]:::metrics

    %% Flow
    Dataset -->|ingest traces| DataProcessing
    DataProcessing -->|build stream graphs| GraphConstruction
    GraphConstruction -->|generate prefetch lists| Model
    Model -->|predicted addresses| CacheSimulator
    CacheSimulator -->|compute metrics| Metrics
    Metrics -->|feedback parameters| Model

    %% Click Events
    click DataProcessing "https://github.com/yyysjz1997/sgdp/blob/main/data_process.py"
    click DataProcessing "https://github.com/yyysjz1997/sgdp/blob/main/utils.py"
    click GraphConstruction "https://github.com/yyysjz1997/sgdp/blob/main/pred_list_gene.py"
    click GraphConstruction "https://github.com/yyysjz1997/sgdp/blob/main/utils.py"
    click Model "https://github.com/yyysjz1997/sgdp/blob/main/model.py"
    click Model "https://github.com/yyysjz1997/sgdp/blob/main/main.py"
    click CacheSimulator "https://github.com/yyysjz1997/sgdp/blob/main/cache.py"
    click CacheSimulator "https://github.com/yyysjz1997/sgdp/blob/main/cachetest.py"
    click Metrics "https://github.com/yyysjz1997/sgdp/blob/main/pred_list_gene.py"
    click Metrics "https://github.com/yyysjz1997/sgdp/blob/main/utils.py"

    %% Styles
    classDef external fill:#f9f,stroke:#333,stroke-width:2px
    classDef processing fill:#bbf,stroke:#333,stroke-width:2px
    classDef model fill:#bfb,stroke:#333,stroke-width:2px
    classDef simulator fill:#fbf,stroke:#333,stroke-width:2px
    classDef metrics fill:#ffb,stroke:#333,stroke-width:2px
```
