How sub-mod/amd-gpu-mock works
amd-gpu-mock simulates AMD GPU control-plane surfaces on CPU-only Kubernetes nodes. The primary workflow loads a profile into the node agent, renders host-visible GPU topology and device artifacts, then exposes controls and telemetry for dashboards and cluster consumers. Users can inject faults, change profiles, or view simulated metrics; Kubernetes integrations discover the mock through sysfs, AMD SMI, and CDI. The README documents device-plugin and DRA consumer paths, but their implementations are external to this repository; those links are documented at a high level.
Main entry points: main.go Node agent · api.go Control API · renderer.go Sysfs renderer · profiles GPU profiles
Components 22
Node Agent
- GPU profiles
profiles - Node agent
cmd/node-agent/main.go
GPU Surfaces
- Sysfs renderer
pkg/gpu/kfd/renderer.go - KFD topology
pkg/gpu/kfd/renderer.go - PCI and DRM
pkg/gpu/kfd/renderer.go - Device nodes
cmd/node-agent/main.go - CDI generator
pkg/gpu/kfd/cdi.go - CDI specs
pkg/gpu/kfd/cdi.go - AMD SMI mock
pkg/mocksmi/mock_amdsmi.c - SMI type contract
pkg/mocksmi/amdsmi_types.h - SMI stubs
pkg/mocksmi/stubs.c
Fleet Control
- Fleet state
pkg/gpu/kfd/state.go - Dynamic metrics
pkg/gpu/kfd/dynamic.go - Control API
pkg/gpu/kfd/api.go - Web dashboard
pkg/gpu/kfd/dashboard.go
Consumer Integrations
- NRI injector
cmd/nri-plugin/main.go - Kubernetes workloads
- AMD device plugin
- AMD DRA driver
- Prometheus
- Grafana
Other components
- Cluster operator
Connections 24
- Cluster operator → GPU profiles: selects
README.md - GPU profiles → Node agent: configures
cmd/node-agent/main.go - Node agent → Sysfs renderer: renders
cmd/node-agent/main.go - Sysfs renderer → KFD topology: writes
pkg/gpu/kfd/renderer.go - Sysfs renderer → PCI and DRM: writes
pkg/gpu/kfd/renderer.go - Node agent → Device nodes: creates
cmd/node-agent/main.go - Node agent → CDI generator: generates
cmd/node-agent/main.go - CDI generator → CDI specs: writes
pkg/gpu/kfd/cdi.go - Node agent → Fleet state: initializes
cmd/node-agent/main.go - Node agent → Dynamic metrics: starts
cmd/node-agent/main.go - Node agent → Control API: starts
cmd/node-agent/main.go - Control API → Fleet state: updates
pkg/gpu/kfd/api.go - Control API → Sysfs renderer: syncs sysfs
pkg/gpu/kfd/api.go - Web dashboard → Control API: requests
pkg/gpu/kfd/dashboard.go - Cluster operator → Web dashboard: views controls
README.md - NRI injector → Kubernetes workloads: injects mounts
cmd/nri-plugin/main.go - AMD device plugin → KFD topology: discovers GPUs
README.md - AMD device plugin → Device nodes: exposes devices
README.md - AMD DRA driver → CDI specs: uses allocation specs
README.md - Prometheus → Control API: scrapes metrics
README.md - Grafana → Prometheus: visualizes telemetry
README.md - AMD SMI mock → SMI type contract: implements contract
pkg/mocksmi/mock_amdsmi.c - SMI stubs → SMI type contract: uses types
pkg/mocksmi/stubs.c - Cluster operator → Control API: injects faults
README.md