MI300X model
This page describes the components, command and interrupt paths, and timing-related implementation choices of the gem5 MI300X model. The PCI interface is in MI300X PCI interface and address translation is in GPU address translation.
System Composition
flowchart TD
Q[Host QEMU] -->|vfio-user| V[MI300XVfioUser]
V --> A[AMDGPUDevice]
A --> P[PM4PacketProcessor]
A --> S[SDMAEngine]
A --> I[InterruptHandler]
A --> M[AMDGPUVM]
A --> H[NBIO / SystemHub / SMU]
P --> G[Shader and CU arrays]
S --> R[Ruby Disjoint_VIPER]
G --> R
Arguments Passed by the Launcher
The gem5-mi300x adapter passes the following arguments to the configuration script; values come from the memory layout and the device args.
Argument |
Effect |
|---|---|
|
Places |
|
Optional gem5 debug flags from |
|
Disables the gem5 interactive listener. |
|
The vfio-user Unix socket. |
|
The machine pool file shared by guest RAM and VRAM. |
|
Offset of this GPU VRAM region in the pool. |
|
VRAM size of this GPU from the memory layout. |
|
Guest RAM size. |
|
JSON description of guest physical ranges and pool offsets. |
|
Compute units per GPU from |
|
The YAML adapter starts one GPU per process. |
Component Responsibilities
Component |
Source |
Responsibility |
|---|---|---|
|
|
Configuration space, BARs, DMA mappings and interrupts as a libvfio-user server. |
|
|
MMIO decoding, ROM reads, doorbell handling, IP block register dispatch and |
|
|
PM4 packet decoding, |
|
|
SDMA packet execution, reads and writes, rptr writeback and VRAM address handling. |
|
|
Writes IH ring records, advances the write pointer and requests interrupts. |
|
|
AGP, GART, MMHUB and user-context translation; shared VRAM fallback. |
Shader and CU arrays |
|
The CU count per GPU comes from |
Ruby |
|
GPU caches and memory hierarchy, retaining Ruby request handling and cache behavior. |
Command and Interrupt Paths
sequenceDiagram
participant Guest as Guest driver
participant Host as QEMU host
participant GPU as gem5 device
participant RAM as Shared RAM/VRAM
Guest->>RAM: write ring and descriptors
Guest->>Host: write doorbell BAR
Host->>GPU: vfio-user BAR write
GPU->>RAM: read commands and data
GPU->>GPU: PM4, SDMA and shader work
GPU->>RAM: write completion and IH record
GPU->>Host: notify IRQ eventfd
Host->>Guest: inject interrupt
Guest->>RAM: read completion
PM4 and SDMA choose the device-memory or system-memory path from the address and VM context. System-memory operations use shared guest memory, and device-memory operations use the VRAM region.
After completion values and IH records are written to shared memory,
AMDGPUDevice::intrPost()reaches the IRQ eventfd throughMI300XVfioUser.The guest reads IH records and completion values from shared memory and does not depend on private gem5 data structures.
Not Modeled
PSP, SMU/power management, audio and RAS are not modeled. SMU-prefixed registers are handled by
AMDGPUSmubut there is no real power management behavior.There is no x86 kernel and no BIOS discovery flow on the gem5 side; the guest must write the VBIOS into shared memory.
PCIe switches, machine-to-machine fabric and multi-machine interconnects are outside the current model. In-process multi-GPU and XGMI are described in Multi-GPU and XGMI.
Sources
Configuration script:
third_party/gem5/configs/example/gpufs/mi300_cosim.py.Device model directory:
third_party/gem5/src/dev/amdgpu/.Debug flag definitions:
third_party/gem5/src/dev/amdgpu/SConscript.Model self-test:
just test-gem5-mi300xrunsthird_party/gem5/tests/mi300x/verify.py.