How rocm/rocr-runtime works
ROCR Runtime provides the HSA API for AMD GPU applications and uses ROCt/libhsakmt to reach the ROCk kernel driver. The principal workflow is: an application calls HSA APIs, the runtime discovers agents and memory, loads executable code, creates queues and signals, dispatches work through a selected device backend, and returns status or results. Image operations, profiling, and alternate VirtIO/XDNA backends are additional runtime branches. The graph reflects sampled implementation paths and README-documented layering; unsampled internals are represented conservatively.
Main entry points: runtime.cpp Runtime Core · driver.cpp Driver Manager · libhsakmt.c ROCt Thunk · hsa.cpp Runtime Entry
Components 22
HSA API
- HSA API
runtime/hsa-runtime/inc/hsa.h - Runtime Entry
runtime/hsa-runtime/core/runtime/hsa.cpp
Runtime Core
- Runtime Core
runtime/hsa-runtime/core/runtime/runtime.cpp - Agent Topology
runtime/hsa-runtime/core/runtime/amd_topology.cpp - Memory Regions
runtime/hsa-runtime/core/runtime/amd_memory_region.cpp - AQL Queues
runtime/hsa-runtime/core/runtime/amd_aql_queue.cpp - Signals
runtime/hsa-runtime/core/runtime/signal.cpp - Code Loader
runtime/hsa-runtime/loader/executable.cpp - Loader Context
runtime/hsa-runtime/core/runtime/amd_loader_context.cpp
Device Backends
- Driver Manager
runtime/hsa-runtime/core/driver/driver.cpp - KFD Backend
runtime/hsa-runtime/core/driver/kfd/amd_kfd_driver.cpp - ROCt Thunk
libhsakmt/src/libhsakmt.c - Virtual Memory
libhsakmt/src/fmm.c - VirtIO Backend
runtime/hsa-runtime/core/driver/virtio/amd_kfd_virtio_driver.cpp - XDNA Backend
runtime/hsa-runtime/core/driver/xdna/amd_xdna_driver.cpp
Runtime Extensions
- Image Runtime
runtime/hsa-runtime/image/image_runtime.cpp - ASIC Image Backends
runtime/hsa-runtime/image - PC Sampling
runtime/hsa-runtime/pcs/pcs_runtime.cpp
Other components
- GPU Application
- ROCK Kernel
- DRM Device
- AMD GPU
Connections 22
- GPU Application → HSA API: calls
- HSA API → Runtime Entry: enters
- Runtime Entry → Runtime Core: dispatches
- Runtime Core → Agent Topology: discovers
- Runtime Core → Memory Regions: allocates
- Runtime Core → Code Loader: loads
- Runtime Core → AQL Queues: submits
- Runtime Core → Signals: synchronizes
- Runtime Core → Driver Manager: selects
- Runtime Core → Image Runtime: manages
- Runtime Core → PC Sampling: profiles
- Code Loader → Loader Context: uses
- Driver Manager → KFD Backend: selects
- Driver Manager → VirtIO Backend: selects
- Driver Manager → XDNA Backend: selects
- KFD Backend → ROCt Thunk: calls
- ROCt Thunk → Virtual Memory: manages
- ROCt Thunk → ROCK Kernel: issues IOCTLs
- ROCt Thunk → DRM Device: opens
- ROCK Kernel → AMD GPU: dispatches
- Image Runtime → ASIC Image Backends: formats
- Runtime Entry → GPU Application: returns status