Mocking a ROCm Environment
AIPerf collects AMD GPU telemetry through the amdsmi collector
(GPUTelemetryCollectorType.AMDSMI), a local collector that calls the amdsmi
Python bindings shipped with ROCm. Those bindings are not pip-installable and
require a real AMD GPU plus driver, so the AMD telemetry path — the amd_*
metrics and the console/CSV/plot plumbing — cannot otherwise be exercised on
developer machines, in CI, or on NVIDIA hardware.
The aiperf-mock-amdsmi package (under tests/aiperf_mock_amdsmi/) installs a
fake top-level amdsmi module that implements exactly the API surface the
collector consumes and returns static, per-model readings. AIPerf imports it
transparently — nothing in src/aiperf changes — so you can benchmark “as if on
an AMD server.”
Unlike the NVIDIA DCGM path (an HTTP Prometheus endpoint faked by the mock
server’s /dcgm{N}/metrics), the AMD collector is local-library-based and cannot
be pointed at an HTTP endpoint. Faking the bindings is therefore the way to drive
the real collector off AMD hardware.
Install
It is intentionally not part of the default make install.
Do not install on real AMD hardware. Installing this package places a top-level
amdsmimodule in your virtualenv that shadows the real ROCm bindings at the import level. Even with the dormancy gate active (i.e.AIPERF_MOCK_AMDSMIunset),import amdsmiwill raiseOSErrorinstead of loading the real driver bindings, silently suppressing real AMD telemetry.
Dormancy gate
Even when installed, import amdsmi raises OSError unless AIPERF_MOCK_AMDSMI
is truthy. This mirrors the real “ROCm wheel installed without a working
libamd_smi.so” failure that the collector already tolerates
(except (ImportError, OSError)), so an installed-but-unactivated fake degrades
to “amdsmi unavailable” rather than silently claiming AMD GPUs exist.
Configuration
All settings are read from the environment at amdsmi_init() time:
Readings are static per model — they do not vary with benchmark traffic. The one
exception is the energy accumulator, which advances monotonically per read so the
cumulative amd_energy_consumption delta metric (baseline -> final) is non-zero.
Example
The console summary and JSON/CSV exports will show populated amd_* metrics
and platform: "amd".