Reproducing the AL-token experiments
These files accompany Blocked dispatch and execution time on Zen 4 and Zen 5.
Download the standalone experiment files (.zip)
The archive contains the assembly kernel, runner, plotting script, raw captures, four SVG figures, and a README. Unzip it and work from the al-token-experiments directory.
Rendering the figures
Rendering requires Python 3, Pycairo, and DejaVu Sans.
python3 -B -c 'import plot; plot.capacity()'
The four SVGs are written next to the script.
Original mknes profile
The original mknes benchmark’s dispatch-token group recorded 7,519,289,700 AL stall cycles out of 31,455,464,253 core cycles, or 23.90%. The follow-up dependency rewrite brought the share to 11–12%, with a reported performance difference of 0.1%. The captures below are from the later standalone experiments.
Rerunning the measurements
Use Linux x86-64, Python 3, GNU binutils, and access to the AMD core PMU through perf stat. Run each command on the indicated architecture. Adjust the CPU and controller numbers for your host. The runners collect unscaled user-mode counts and require full counter coverage.
mkdir -p rerun
# On Zen 5
python3 -B synthetic.py --arch zen5 --cpu 9 --controller 11 > rerun/zen5-raw.json
# On Zen 4
python3 -B synthetic.py --arch zen4 --cpu 7 --controller 8 > rerun/zen4-raw.json
The recorded runs used CPU 9 on Zen 5 and isolated CPU 7 on Zen 4. Each load-dependent case runs 200,000 iterations of 128 LEAs between two independently addressed loads from flushed cache lines, with CPUID between iterations. The runner also collects arithmetic-chain measurements.
The main counter group records core cycles, retired instructions and operations, integer physical register file stalls, and back-end dispatch slots lost. It also records AL stall cycles on Zen 5. A second pinned group on Zen 4 records core cycles, retired operations, and the four queue-specific masks for event 0xaf. The Zen 4 figures take core cycles and the largest individual queue stall count from that group. The figures use separate medians for stall cycles and core cycles.
Plot a rerun
Copy the two bundled captures and replace either or both with your reruns.
mkdir -p rerun/figures
cp plot.py zen4-raw.json zen5-raw.json rerun/figures/
cp rerun/*-raw.json rerun/figures/
(cd rerun/figures && python3 -B -c 'import plot; plot.capacity()')
Source and scripts
Raw measurements
The captures record CPU affinity, SMT topology, kernel, microcode, boost state, and governor.
| Capture | Figures |
|---|---|
| Zen 5, three rounds | AL-token stalls · Iteration time |
| Zen 4, three rounds | Queue stalls · Iteration time |