Model debugging
This page covers enabling gem5 debug output, where to read logs, and the order in which to investigate common MI300X model problems. The complete issue list is Known issues.
Enabling gem5 Debug Output
Debug flag |
What it shows |
|---|---|
|
vfio-user messages, listener and interrupt interaction. |
|
MMIO register reads and writes, ROM accesses and IH pointers. |
|
PM4 packet decoding and processing. |
|
SDMA operations and completion paths. |
|
SDMA packet data details. |
|
GPU memory manager allocation and access. |
|
SystemHub accesses. |
|
xGMI routing in in-process multi-GPU mode. |
Enable flags through the device args.gem5_debug_flags in YAML; the adapter renders them as gem5 --debug-flags=.... When invoking gem5 directly, pass --debug-flags and use --debug-file to choose the output file. The default output is stdout, so launcher-managed sessions capture it in output.log.
templates:
mi300x:
kind: gem5-mi300x
args:
gem5_debug_flags: [MI300XCosim, AMDGPUDevice, PM4PacketProcessor]
Log Locations
Location |
Contents |
|---|---|
|
gem5 standard output and standard error, including debug output and warnings. |
|
gem5 statistics and output directory. |
|
Guest serial log for observing driver-side behavior. |
|
Session result; read it first to decide which component failed. |
|
gem5 container and screen logs under the legacy shell launcher. |
Common Model Problems
Symptom |
First check |
Action |
|---|---|---|
Many |
Shared VRAM offsets, PTE contents and whether the gem5 binary is current |
Confirm the pool offsets match the memory layout; occasional warnings are normal, but a continuous flood indicates a page-table or offset problem. |
|
The dataSelect value used by the driver |
The model implements 0, 1, 2 and 3; other values need an extension in |
Unknown PM4 opcode |
The opcode number |
|
SDMA ring test returns |
|
Confirm |
All MMIO reads return zero |
Whether gem5 connected and whether |
Check the readiness marker and socket; enable only |
BAR layout probe error |
BAR region descriptions and sizes |
Check the BAR setup in |
Timer overflow crash |
Whether RTC and PIT events are disabled |
|
Debugging Workflow
Run
cosim run --dry-runfirst to confirm the rendered gem5 arguments, socket, pool offsets and VRAM size.Enable one dimension of flags in
args.gem5_debug_flags, rerun and inspectoutput.log.Read
verdict.jsonto identify the failing process, then narrow down layer by layer:MI300XCosimfor protocol,AMDGPUDevicefor registers,PM4PacketProcessorandSDMAEnginefor commands.Run
just test-gem5-mi300xfor the QEMU-free model self-test that checks pool ownership and the GPU_VIPER protocol.After changing the model, rebuild incrementally with
just build-gem5 1and rerun the session.
Common Commands
# Rerun the session with the development build
just run-topology-dev resources/machines/single-gpu.yaml
# Filter protocol, address translation and fatal errors
grep -E "MI300XCosim|GART|panic|unimplemented" .cosim/<name>/m0/mi300x-0/output.log
# QEMU-free model self-test (pool ownership and GPU_VIPER)
just test-gem5-mi300x
# Incremental gem5 build
just build-gem5 1
Sources
Debug flag definitions:
third_party/gem5/src/dev/amdgpu/SConscript.vfio-user server:
third_party/gem5/src/dev/amdgpu/mi300x_vfio_user.cc.PM4 and SDMA:
third_party/gem5/src/dev/amdgpu/pm4_packet_processor.ccandsdma_engine.cc.Model self-test:
third_party/gem5/tests/mi300x/verify.py.Debug options:
--debug-flags,--debug-fileand--outdirinthird_party/gem5/src/python/m5/main.py.