# intel/pti-gpu architecture

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

- Interactive diagram: https://gitdiagram.com/intel/pti-gpu
- Repository: https://github.com/intel/pti-gpu

## Overview

PTI for GPU is a profiling library and tool suite for Intel GPUs. A typical application uses PTI to enable tracing or metrics collection; runtime-specific collectors observe API calls and device activity, and PTI exposes collected records through its view and callback interfaces. The README also documents PC sampling, code annotation, binary/source correlation, and system-management tools. The graph emphasizes the SDK and unified tracer; relationships to some unsampled implementations are omitted or marked unverified rather than inferred from filenames.

Main entry points: [`sdk/src/view_handler.h`](https://github.com/intel/pti-gpu/blob/master/sdk/src/view_handler.h) (View handler), [`sdk/src/pti_lib_handler.h`](https://github.com/intel/pti-gpu/blob/master/sdk/src/pti_lib_handler.h) (Library handler), [`tools/unitrace/src/unitrace.cc`](https://github.com/intel/pti-gpu/blob/master/tools/unitrace/src/unitrace.cc) (Unified tracer), [`sdk/include/pti/pti_view.h`](https://github.com/intel/pti-gpu/blob/master/sdk/include/pti/pti_view.h) (View records API)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_api["Public interfaces"]
  node_pti_api["PTI API<br/>[pti.h]"]
  node_view_api["View records API<br/>[pti_view.h]"]
  node_callback_api["Callback API<br/>[pti_callback.h]"]
  node_metrics_api["Metrics API<br/>[pti_metrics.h]"]
  node_pc_api["PC sampling API<br/>[pti_pc_sampling.h]"]
end

subgraph group_collect["Tracing collection"]
  node_runtime_handler["Library handler<br/>[pti_lib_handler.h]"]
  node_l0_collector["Level Zero collector<br/>[ze_collector.h]"]
  node_sycl_collector["SYCL collector<br/>[sycl_collector.h]"]
  node_itt_collector["ITT collector<br/>[itt_collector.h]"]
  node_xpti_adapter["XPTI adapter<br/>[xpti_adapter.cc]"]
  node_graph_storage[("Graph metadata<br/>[ze_graph_storage.h]")]
end

subgraph group_analysis["Metrics and sampling"]
  node_metric_state["Metric state"]
  node_metric_handler["Metric collection<br/>[metrics_handler.h]"]
  node_pc_collector["PC sampling collector"]
  node_pc_aggregator["PC sample aggregation"]
end

subgraph group_records["Record delivery"]
  node_view_handler["View handler<br/>[view_handler.h]"]
  node_view_buffer["View buffers<br/>[view_buffer.h]"]
  node_consumer_thread["Buffer consumer<br/>[consumer_thread.h]"]
end

subgraph group_tools["Profiling tools"]
  node_unitrace["Unified tracer<br/>[unitrace.cc]"]
  node_unitrace_tracer["Unified tracing<br/>[tracer.cc]"]
  node_opencl_callbacks["OpenCL callbacks<br/>[cl_api_callbacks.h]"]
  node_elf_parser["Binary source mapping<br/>[elf_parser.cpp]"]
  node_gpuinfo["GPU information<br/>[main.cc]"]
  node_sysmon["GPU monitoring<br/>[main.cc]"]
end

node_application(("Profiling application"))

node_application -->|"uses"| node_pti_api
node_application -->|"runs"| node_unitrace
node_runtime_handler -->|"exposes"| node_view_api
node_runtime_handler -->|"exposes"| node_metrics_api
node_runtime_handler -->|"exposes"| node_callback_api
node_runtime_handler -->|"exposes"| node_pc_api
node_view_handler -->|"formats records"| node_view_api
node_view_handler -->|"refreshes buffers"| node_view_buffer
node_view_handler -->|"uses consumer"| node_consumer_thread
node_view_handler -->|"dispatches to"| node_l0_collector
node_view_handler -->|"dispatches to"| node_sycl_collector
node_view_handler -->|"dispatches to"| node_itt_collector
node_metric_state -->|"implements state"| node_metrics_api
node_metric_handler -.->|"implements collection"| node_metrics_api
node_pc_collector -.->|"aggregates samples"| node_pc_aggregator
node_l0_collector -->|"reads graph metadata"| node_graph_storage
node_unitrace -.->|"starts tracing"| node_unitrace_tracer
node_unitrace_tracer -->|"uses callbacks"| node_opencl_callbacks
node_unitrace -.->|"correlates binaries"| node_elf_parser
node_application -->|"runs"| node_gpuinfo
node_application -->|"runs"| node_sysmon
node_unitrace -.->|"emits profiling data"| node_view_api

click node_pti_api "https://github.com/intel/pti-gpu/blob/master/sdk/include/pti/pti.h"
click node_view_api "https://github.com/intel/pti-gpu/blob/master/sdk/include/pti/pti_view.h"
click node_callback_api "https://github.com/intel/pti-gpu/blob/master/sdk/include/pti/pti_callback.h"
click node_metrics_api "https://github.com/intel/pti-gpu/blob/master/sdk/include/pti/pti_metrics.h"
click node_pc_api "https://github.com/intel/pti-gpu/blob/master/sdk/include/pti/pti_pc_sampling.h"
click node_runtime_handler "https://github.com/intel/pti-gpu/blob/master/sdk/src/pti_lib_handler.h"
click node_view_handler "https://github.com/intel/pti-gpu/blob/master/sdk/src/view_handler.h"
click node_l0_collector "https://github.com/intel/pti-gpu/blob/master/sdk/src/levelzero/ze_collector.h"
click node_sycl_collector "https://github.com/intel/pti-gpu/blob/master/sdk/src/sycl/sycl_collector.h"
click node_itt_collector "https://github.com/intel/pti-gpu/blob/master/sdk/src/itt/itt_collector.h"
click node_xpti_adapter "https://github.com/intel/pti-gpu/blob/master/sdk/src/xpti_adapter.cc"
click node_metric_state "https://github.com/intel/pti-gpu/blob/master/sdk/src/metrics/metric_state_manager.cc"
click node_metric_handler "https://github.com/intel/pti-gpu/blob/master/sdk/src/metrics/metrics_handler.h"
click node_pc_collector "https://github.com/intel/pti-gpu/blob/master/sdk/src/pc_sampling/pti_pc_sampling_collector.cc"
click node_pc_aggregator "https://github.com/intel/pti-gpu/blob/master/sdk/src/pc_sampling/pti_pc_sampling_aggregator.cc"
click node_graph_storage "https://github.com/intel/pti-gpu/blob/master/sdk/src/levelzero/ze_graph_storage.h"
click node_view_buffer "https://github.com/intel/pti-gpu/blob/master/sdk/src/view_buffer.h"
click node_consumer_thread "https://github.com/intel/pti-gpu/blob/master/sdk/src/consumer_thread.h"
click node_unitrace "https://github.com/intel/pti-gpu/blob/master/tools/unitrace/src/unitrace.cc"
click node_unitrace_tracer "https://github.com/intel/pti-gpu/blob/master/tools/unitrace/src/tracer.cc"
click node_opencl_callbacks "https://github.com/intel/pti-gpu/blob/master/tools/unitrace/src/opencl/cl_api_callbacks.h"
click node_elf_parser "https://github.com/intel/pti-gpu/blob/master/utils/gpu_elf_parser/src/elf_parser.cpp"
click node_gpuinfo "https://github.com/intel/pti-gpu/blob/master/tools/gpuinfo/main.cc"
click node_sysmon "https://github.com/intel/pti-gpu/blob/master/tools/sysmon/main.cc"

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_pti_api,node_view_api,node_callback_api,node_metrics_api,node_pc_api toneBlue
class node_runtime_handler,node_l0_collector,node_sycl_collector,node_itt_collector,node_xpti_adapter,node_graph_storage toneAmber
class node_metric_state,node_metric_handler,node_pc_collector,node_pc_aggregator toneMint
class node_view_handler,node_view_buffer,node_consumer_thread toneRose
class node_unitrace,node_unitrace_tracer,node_opencl_callbacks,node_elf_parser,node_gpuinfo,node_sysmon,node_application toneIndigo
```

## Components

### Public interfaces

- [PTI API](https://github.com/intel/pti-gpu/blob/master/sdk/include/pti/pti.h): `sdk/include/pti/pti.h`
- [View records API](https://github.com/intel/pti-gpu/blob/master/sdk/include/pti/pti_view.h): `sdk/include/pti/pti_view.h`
- [Callback API](https://github.com/intel/pti-gpu/blob/master/sdk/include/pti/pti_callback.h): `sdk/include/pti/pti_callback.h`
- [Metrics API](https://github.com/intel/pti-gpu/blob/master/sdk/include/pti/pti_metrics.h): `sdk/include/pti/pti_metrics.h`
- [PC sampling API](https://github.com/intel/pti-gpu/blob/master/sdk/include/pti/pti_pc_sampling.h): `sdk/include/pti/pti_pc_sampling.h`

### Tracing collection

- [Library handler](https://github.com/intel/pti-gpu/blob/master/sdk/src/pti_lib_handler.h): `sdk/src/pti_lib_handler.h`
- [Level Zero collector](https://github.com/intel/pti-gpu/blob/master/sdk/src/levelzero/ze_collector.h): `sdk/src/levelzero/ze_collector.h`
- [SYCL collector](https://github.com/intel/pti-gpu/blob/master/sdk/src/sycl/sycl_collector.h): `sdk/src/sycl/sycl_collector.h`
- [ITT collector](https://github.com/intel/pti-gpu/blob/master/sdk/src/itt/itt_collector.h): `sdk/src/itt/itt_collector.h`
- [XPTI adapter](https://github.com/intel/pti-gpu/blob/master/sdk/src/xpti_adapter.cc): `sdk/src/xpti_adapter.cc`
- [Graph metadata](https://github.com/intel/pti-gpu/blob/master/sdk/src/levelzero/ze_graph_storage.h): `sdk/src/levelzero/ze_graph_storage.h`

### Metrics and sampling

- [Metric state](https://github.com/intel/pti-gpu/blob/master/sdk/src/metrics/metric_state_manager.cc): `sdk/src/metrics/metric_state_manager.cc`
- [Metric collection](https://github.com/intel/pti-gpu/blob/master/sdk/src/metrics/metrics_handler.h): `sdk/src/metrics/metrics_handler.h`
- [PC sampling collector](https://github.com/intel/pti-gpu/blob/master/sdk/src/pc_sampling/pti_pc_sampling_collector.cc): `sdk/src/pc_sampling/pti_pc_sampling_collector.cc`
- [PC sample aggregation](https://github.com/intel/pti-gpu/blob/master/sdk/src/pc_sampling/pti_pc_sampling_aggregator.cc): `sdk/src/pc_sampling/pti_pc_sampling_aggregator.cc`

### Record delivery

- [View handler](https://github.com/intel/pti-gpu/blob/master/sdk/src/view_handler.h): `sdk/src/view_handler.h`
- [View buffers](https://github.com/intel/pti-gpu/blob/master/sdk/src/view_buffer.h): `sdk/src/view_buffer.h`
- [Buffer consumer](https://github.com/intel/pti-gpu/blob/master/sdk/src/consumer_thread.h): `sdk/src/consumer_thread.h`

### Profiling tools

- [Unified tracer](https://github.com/intel/pti-gpu/blob/master/tools/unitrace/src/unitrace.cc): `tools/unitrace/src/unitrace.cc`
- [Unified tracing](https://github.com/intel/pti-gpu/blob/master/tools/unitrace/src/tracer.cc): `tools/unitrace/src/tracer.cc`
- [OpenCL callbacks](https://github.com/intel/pti-gpu/blob/master/tools/unitrace/src/opencl/cl_api_callbacks.h): `tools/unitrace/src/opencl/cl_api_callbacks.h`
- [Binary source mapping](https://github.com/intel/pti-gpu/blob/master/utils/gpu_elf_parser/src/elf_parser.cpp): `utils/gpu_elf_parser/src/elf_parser.cpp`
- [GPU information](https://github.com/intel/pti-gpu/blob/master/tools/gpuinfo/main.cc): `tools/gpuinfo/main.cc`
- [GPU monitoring](https://github.com/intel/pti-gpu/blob/master/tools/sysmon/main.cc): `tools/sysmon/main.cc`

### Other components

- **Profiling application**

## Connections

- Profiling application → PTI API: uses (evidence: `README.md`)
- Profiling application → Unified tracer: runs (evidence: `README.md`)
- Library handler → View records API: exposes (evidence: `sdk/src/pti_lib_handler.h`)
- Library handler → Metrics API: exposes (evidence: `sdk/src/pti_lib_handler.h`)
- Library handler → Callback API: exposes (evidence: `sdk/src/pti_lib_handler.h`)
- Library handler → PC sampling API: exposes (evidence: `sdk/src/pti_lib_handler.h`)
- View handler → View records API: formats records (evidence: `sdk/src/view_handler.h`)
- View handler → View buffers: refreshes buffers (evidence: `sdk/src/view_handler.h`)
- View handler → Buffer consumer: uses consumer (evidence: `sdk/src/view_handler.h`)
- View handler → Level Zero collector: dispatches to (evidence: `sdk/src/view_handler.h`)
- View handler → SYCL collector: dispatches to (evidence: `sdk/src/view_handler.h`)
- View handler → ITT collector: dispatches to (evidence: `sdk/src/view_handler.h`)
- Metric state → Metrics API: implements state (evidence: `sdk/src/metrics/metric_state_manager.cc`)
- Metric collection → Metrics API: implements collection
- PC sampling collector → PC sample aggregation: aggregates samples
- Level Zero collector → Graph metadata: reads graph metadata (evidence: `sdk/src/levelzero/ze_graph_storage.h`)
- Unified tracer → Unified tracing: starts tracing
- Unified tracing → OpenCL callbacks: uses callbacks (evidence: `tools/unitrace/src/opencl/cl_api_callbacks.h`)
- Unified tracer → Binary source mapping: correlates binaries (evidence: `README.md`)
- Profiling application → GPU information: runs (evidence: `README.md`)
- Profiling application → GPU monitoring: runs (evidence: `README.md`)
- Unified tracer → View records API: emits profiling data (evidence: `README.md`)
