# asuan99/prefill-layer-alloc architecture

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

- Interactive diagram: https://gitdiagram.com/asuan99/prefill-layer-alloc
- Repository: https://github.com/asuan99/prefill-layer-alloc

## Overview

This repository is a research codebase for characterizing GPU execution of LLM attention/SSM workloads and evaluating multiplexing and serving policies. The main workflow configures model and sweep parameters, builds and measures GPU workloads, records latency/bandwidth and SM-scaling behavior, then analyzes results and renders figures. A separate engine-port area contains model implementations and multiplexing controllers; serving-eval provides a serving-focused evaluation branch. The README is empty, and several runners are unsampled, so those subsystems are represented without asserting unverified call paths.

Main entry points: [`workspace/characterization/experiments/common/kernels.py`](https://github.com/asuan99/prefill-layer-alloc/blob/main/workspace/characterization/experiments/common/kernels.py) (Kernel Builders), [`workspace/characterization/experiments/common/bw_probe.py`](https://github.com/asuan99/prefill-layer-alloc/blob/main/workspace/characterization/experiments/common/bw_probe.py) (Bandwidth Probe), [`workspace/characterization/decode_sm_scaling`](https://github.com/asuan99/prefill-layer-alloc/tree/main/workspace/characterization/decode_sm_scaling) (Decode Sweep), [`workspace/characterization/experiments`](https://github.com/asuan99/prefill-layer-alloc/tree/main/workspace/characterization/experiments) (Experiment Runners)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_characterization["GPU Characterization"]
  node_experiment_runners["Experiment Runners"]
  node_decode_sweep["Decode Sweep"]
  node_crossover_analysis["Crossover Analysis"]
  node_kernel_builders["Kernel Builders<br/>[kernels.py]"]
  node_bandwidth_probe["Bandwidth Probe<br/>[bw_probe.py]"]
  node_wave_model["Wave Model<br/>[wave_model.py]"]
  node_sweep_spec["Sweep Specification<br/>[sweep_spec.py]"]
  node_shared_loaders["Shared Loaders<br/>[loaders.py]"]
  node_layer_runner["Layer Runner<br/>[layer_runner.py]"]
  node_profiling_metrics["Profiling Metrics<br/>[metrics.py]"]
  node_sm_control["SM Controller"]
end

subgraph group_runtime["Serving Runtime"]
  node_engine_models["Engine Models"]
  node_multiplex_controller["Multiplex Controller<br/>[controller.py]"]
  node_multiplex_profile["Runtime Profile<br/>[profile.py]"]
end

subgraph group_evaluation["Serving Evaluation"]
  node_serving_runner["Serving Runner<br/>[run_serving.py]"]
  node_serving_trace["Serving Trace<br/>[trace.py]"]
end

subgraph group_reporting["Reports and Figures"]
  node_figure_renderer["Figure Renderer<br/>[make_figures.py]"]
  node_figure_canon["Figure Data<br/>[canon.py]"]
  node_figure_style["Figure Style<br/>[style.py]"]
  node_dashboard["Research Dashboard<br/>[make_dashboard.py]"]
end

node_gpu(("GPU"))

node_experiment_runners -->|"builds kernels"| node_kernel_builders
node_experiment_runners -->|"measures bandwidth"| node_bandwidth_probe
node_experiment_runners -->|"uses metrics"| node_profiling_metrics
node_decode_sweep -->|"builds kernels"| node_kernel_builders
node_decode_sweep -->|"measures bandwidth"| node_bandwidth_probe
node_decode_sweep -->|"restricts SMs"| node_sm_control
node_kernel_builders -->|"loads configs"| node_shared_loaders
node_kernel_builders -->|"uses wave model"| node_wave_model
node_kernel_builders -->|"uses byte counts"| node_bandwidth_probe
node_bandwidth_probe -->|"reads ceiling"| node_sweep_spec
node_bandwidth_probe -->|"uses estimator"| node_profiling_metrics
node_layer_runner -->|"uses controller"| node_sm_control
node_layer_runner -->|"measures metrics"| node_profiling_metrics
node_layer_runner -->|"loads model code"| node_engine_models
node_sm_control -->|"partitions SMs"| node_gpu
node_multiplex_controller -->|"uses estimates"| node_multiplex_profile
node_serving_runner -.->|"records traces"| node_serving_trace
node_decode_sweep -.->|"informs analysis"| node_crossover_analysis
node_figure_renderer -->|"reads data"| node_figure_canon
node_figure_renderer -->|"uses styles"| node_figure_style
node_dashboard -->|"reads data"| node_figure_canon
node_dashboard -->|"uses styles"| node_figure_style
node_dashboard -->|"reuses figures"| node_figure_renderer

click node_experiment_runners "https://github.com/asuan99/prefill-layer-alloc/tree/main/workspace/characterization/experiments"
click node_decode_sweep "https://github.com/asuan99/prefill-layer-alloc/tree/main/workspace/characterization/decode_sm_scaling"
click node_crossover_analysis "https://github.com/asuan99/prefill-layer-alloc/blob/main/workspace/characterization/decode_crossover/compute_crossover.py"
click node_kernel_builders "https://github.com/asuan99/prefill-layer-alloc/blob/main/workspace/characterization/experiments/common/kernels.py"
click node_bandwidth_probe "https://github.com/asuan99/prefill-layer-alloc/blob/main/workspace/characterization/experiments/common/bw_probe.py"
click node_wave_model "https://github.com/asuan99/prefill-layer-alloc/blob/main/workspace/characterization/experiments/common/wave_model.py"
click node_sweep_spec "https://github.com/asuan99/prefill-layer-alloc/blob/main/workspace/shared/sweep_spec.py"
click node_shared_loaders "https://github.com/asuan99/prefill-layer-alloc/blob/main/workspace/shared/loaders.py"
click node_layer_runner "https://github.com/asuan99/prefill-layer-alloc/blob/main/workspace/characterization/src/models/layer_runner.py"
click node_profiling_metrics "https://github.com/asuan99/prefill-layer-alloc/blob/main/workspace/characterization/src/profiling/metrics.py"
click node_sm_control "https://github.com/asuan99/prefill-layer-alloc/blob/main/workspace/characterization/src/smctrl/green_ctx_controller.py"
click node_engine_models "https://github.com/asuan99/prefill-layer-alloc/tree/main/workspace/engine-port/src/models"
click node_multiplex_controller "https://github.com/asuan99/prefill-layer-alloc/blob/main/workspace/engine-port/src/multiplex/controller.py"
click node_multiplex_profile "https://github.com/asuan99/prefill-layer-alloc/blob/main/workspace/engine-port/src/multiplex/profile.py"
click node_serving_runner "https://github.com/asuan99/prefill-layer-alloc/blob/main/workspace/serving-eval/run_serving.py"
click node_serving_trace "https://github.com/asuan99/prefill-layer-alloc/blob/main/workspace/serving-eval/src/trace.py"
click node_figure_renderer "https://github.com/asuan99/prefill-layer-alloc/blob/main/reports/figures/make_figures.py"
click node_figure_canon "https://github.com/asuan99/prefill-layer-alloc/blob/main/reports/figures/canon.py"
click node_figure_style "https://github.com/asuan99/prefill-layer-alloc/blob/main/reports/figures/style.py"
click node_dashboard "https://github.com/asuan99/prefill-layer-alloc/blob/main/reports/figures/make_dashboard.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_experiment_runners,node_decode_sweep,node_crossover_analysis,node_kernel_builders,node_bandwidth_probe,node_wave_model,node_sweep_spec,node_shared_loaders,node_layer_runner,node_profiling_metrics,node_sm_control toneBlue
class node_engine_models,node_multiplex_controller,node_multiplex_profile toneAmber
class node_serving_runner,node_serving_trace toneMint
class node_figure_renderer,node_figure_canon,node_figure_style,node_dashboard toneRose
class node_gpu toneIndigo
```

## Components

### GPU Characterization

- [Experiment Runners](https://github.com/asuan99/prefill-layer-alloc/tree/main/workspace/characterization/experiments): `workspace/characterization/experiments`
- [Decode Sweep](https://github.com/asuan99/prefill-layer-alloc/tree/main/workspace/characterization/decode_sm_scaling): `workspace/characterization/decode_sm_scaling`
- [Crossover Analysis](https://github.com/asuan99/prefill-layer-alloc/blob/main/workspace/characterization/decode_crossover/compute_crossover.py): `workspace/characterization/decode_crossover/compute_crossover.py`
- [Kernel Builders](https://github.com/asuan99/prefill-layer-alloc/blob/main/workspace/characterization/experiments/common/kernels.py): `workspace/characterization/experiments/common/kernels.py`
- [Bandwidth Probe](https://github.com/asuan99/prefill-layer-alloc/blob/main/workspace/characterization/experiments/common/bw_probe.py): `workspace/characterization/experiments/common/bw_probe.py`
- [Wave Model](https://github.com/asuan99/prefill-layer-alloc/blob/main/workspace/characterization/experiments/common/wave_model.py): `workspace/characterization/experiments/common/wave_model.py`
- [Sweep Specification](https://github.com/asuan99/prefill-layer-alloc/blob/main/workspace/shared/sweep_spec.py): `workspace/shared/sweep_spec.py`
- [Shared Loaders](https://github.com/asuan99/prefill-layer-alloc/blob/main/workspace/shared/loaders.py): `workspace/shared/loaders.py`
- [Layer Runner](https://github.com/asuan99/prefill-layer-alloc/blob/main/workspace/characterization/src/models/layer_runner.py): `workspace/characterization/src/models/layer_runner.py`
- [Profiling Metrics](https://github.com/asuan99/prefill-layer-alloc/blob/main/workspace/characterization/src/profiling/metrics.py): `workspace/characterization/src/profiling/metrics.py`
- [SM Controller](https://github.com/asuan99/prefill-layer-alloc/blob/main/workspace/characterization/src/smctrl/green_ctx_controller.py): `workspace/characterization/src/smctrl/green_ctx_controller.py`

### Serving Runtime

- [Engine Models](https://github.com/asuan99/prefill-layer-alloc/tree/main/workspace/engine-port/src/models): `workspace/engine-port/src/models`
- [Multiplex Controller](https://github.com/asuan99/prefill-layer-alloc/blob/main/workspace/engine-port/src/multiplex/controller.py): `workspace/engine-port/src/multiplex/controller.py`
- [Runtime Profile](https://github.com/asuan99/prefill-layer-alloc/blob/main/workspace/engine-port/src/multiplex/profile.py): `workspace/engine-port/src/multiplex/profile.py`

### Serving Evaluation

- [Serving Runner](https://github.com/asuan99/prefill-layer-alloc/blob/main/workspace/serving-eval/run_serving.py): `workspace/serving-eval/run_serving.py`
- [Serving Trace](https://github.com/asuan99/prefill-layer-alloc/blob/main/workspace/serving-eval/src/trace.py): `workspace/serving-eval/src/trace.py`

### Reports and Figures

- [Figure Renderer](https://github.com/asuan99/prefill-layer-alloc/blob/main/reports/figures/make_figures.py): `reports/figures/make_figures.py`
- [Figure Data](https://github.com/asuan99/prefill-layer-alloc/blob/main/reports/figures/canon.py): `reports/figures/canon.py`
- [Figure Style](https://github.com/asuan99/prefill-layer-alloc/blob/main/reports/figures/style.py): `reports/figures/style.py`
- [Research Dashboard](https://github.com/asuan99/prefill-layer-alloc/blob/main/reports/figures/make_dashboard.py): `reports/figures/make_dashboard.py`

### Other components

- **GPU**

## Connections

- Experiment Runners → Kernel Builders: builds kernels (evidence: `workspace/characterization/experiments/e1_prefill_decomp/_e1_worker.py`)
- Experiment Runners → Bandwidth Probe: measures bandwidth (evidence: `workspace/characterization/experiments/e1_prefill_decomp/_e1_worker.py`)
- Experiment Runners → Profiling Metrics: uses metrics (evidence: `workspace/characterization/experiments/e1_prefill_decomp/_e1_worker.py`)
- Decode Sweep → Kernel Builders: builds kernels
- Decode Sweep → Bandwidth Probe: measures bandwidth
- Decode Sweep → SM Controller: restricts SMs (evidence: `workspace/characterization/decode_sm_scaling/_decode_worker.py`)
- Kernel Builders → Shared Loaders: loads configs (evidence: `workspace/characterization/experiments/common/kernels.py`)
- Kernel Builders → Wave Model: uses wave model (evidence: `workspace/characterization/experiments/common/kernels.py`)
- Kernel Builders → Bandwidth Probe: uses byte counts (evidence: `workspace/characterization/experiments/common/kernels.py`)
- Bandwidth Probe → Sweep Specification: reads ceiling (evidence: `workspace/characterization/experiments/common/bw_probe.py`)
- Bandwidth Probe → Profiling Metrics: uses estimator (evidence: `workspace/characterization/experiments/common/bw_probe.py`)
- Layer Runner → SM Controller: uses controller (evidence: `workspace/characterization/src/models/layer_runner.py`)
- Layer Runner → Profiling Metrics: measures metrics (evidence: `workspace/characterization/src/models/layer_runner.py`)
- Layer Runner → Engine Models: loads model code (evidence: `workspace/characterization/src/models/layer_runner.py`)
- SM Controller → GPU: partitions SMs (evidence: `workspace/characterization/src/smctrl/green_ctx_controller.py`)
- Multiplex Controller → Runtime Profile: uses estimates (evidence: `workspace/engine-port/src/multiplex/controller.py`)
- Serving Runner → Serving Trace: records traces
- Decode Sweep → Crossover Analysis: informs analysis (evidence: `workspace/characterization/decode_sm_scaling/_decode_worker.py`)
- Figure Renderer → Figure Data: reads data (evidence: `reports/figures/make_figures.py`)
- Figure Renderer → Figure Style: uses styles (evidence: `reports/figures/make_figures.py`)
- Research Dashboard → Figure Data: reads data (evidence: `reports/figures/make_dashboard.py`)
- Research Dashboard → Figure Style: uses styles (evidence: `reports/figures/make_dashboard.py`)
- Research Dashboard → Figure Renderer: reuses figures (evidence: `reports/figures/make_dashboard.py`)
