Investigation of the influence of call stack depth on Return Address Stack prediction accuracy in AMD Zen 4 processors

Authors

  • K.A. Bezuglyi Донецкий национальный технический университет
  • R. V. Malcheva Донецкий национальный технический университет

Keywords:

microarchitecture, branch predictor, Return Address Stack, AMD Zen 4, hardware performance counters, perf_event_open, Zig

Abstract

The dependence between recursive call depth and the number of Return Address Stack (RAS) prediction misses in the AMD Zen 4 microarchitecture is investigated. A microbenchmark in the Zig language was developed, using hardware performance counters via the perf_event_open system call to measure branch events, branch prediction misses, and RAS misses. The RAS buffer overflow boundary between call depths of 24 and 64 on an AMD Ryzen 7 7840HS processor was experimentally determined. An analysis of the disassembled code and the mechanism of interaction with the Linux kernel perf subsystem is presented.

References

Орлов, С. А. Организация ЭВМ и систем : учебник для вузов. 4-е изд. Фундаментальный курс по архитектуре и структуре современных компьютерных средств / С. А. Орлов. – СПб. – М. – Минск : «Питер», 2024. – 682 с.

AMD. Software Optimization Guide for the AMD Zen 4 Microarchitecture. – Publication No. 57647. – Rev. 1.00. – 2023.

Fog A. The microarchitecture of Intel, AMD, and VIA CPUs: An optimization guide for assembly programmers and compiler makers. – Copenhagen University College of Engineering, 2024. [Electronic resource] – URL: https://www.agner.org/optimize/microarchitecture.pdf

AMD. Open-Source Register Reference for AMD Family 19h Processors. – Event 0xC9. – [Electronic resource]. - URL: https://github.com/torvalds/linux/blob/v6.17-rc7/tools/perf/pmu-events/arch/x86/amdzen4/branch.json

Zig Programming Language [Electronic resource]. – URL: https://ziglang.org/

Linux Kernel Documentation. perf_event_open(2) – Linux manual page [Electronic resource]. – URL: https://man7.org/linux/man-pages/man2/perf_event_open.2.html

Исходный код проекта ras-influence. – URL: https://github.com/fidelicura/uarch/ras-influence

Published

2026-05-20

How to Cite

Bezuglyi К. А., & Malcheva Р. (2026). Investigation of the influence of call stack depth on Return Address Stack prediction accuracy in AMD Zen 4 processors. Informatics and Cybernetics, (4 (42), 5–10. Retrieved from https://ojs.donntu.ru/infcyb/article/view/844

Issue

Section

Информатика и вычислительная техника