Skip to content
Snippets Groups Projects
  • Siarhei Siamashka's avatar
    6fd9baed
    Enforce strict order of writes in C benchmarks via volatile keyword · 6fd9baed
    Siarhei Siamashka authored
    The C compiler may attempt to reorder read and write operations when
    accessing the source and destination buffers. So instead of sequential
    memory accesses we may get something like a "drunk master style"
    memory access pattern. Certain processors, such as ARM Cortex-A7,
    do not like such memory access pattern very much and it causes
    a major performance drop. The actual access pattern is unpredictable
    and is sensitive to the compiler version, optimization flags and
    even sometimes on some changes in unrelated parts of source code.
    
    So use the volatile keyword for the destination pointer in order
    to resolve this problem and make C benchmarks more deterministic.
    
    See https://github.com/ssvb/tinymembench/issues/7
    6fd9baed
    History
    Enforce strict order of writes in C benchmarks via volatile keyword
    Siarhei Siamashka authored
    The C compiler may attempt to reorder read and write operations when
    accessing the source and destination buffers. So instead of sequential
    memory accesses we may get something like a "drunk master style"
    memory access pattern. Certain processors, such as ARM Cortex-A7,
    do not like such memory access pattern very much and it causes
    a major performance drop. The actual access pattern is unpredictable
    and is sensitive to the compiler version, optimization flags and
    even sometimes on some changes in unrelated parts of source code.
    
    So use the volatile keyword for the destination pointer in order
    to resolve this problem and make C benchmarks more deterministic.
    
    See https://github.com/ssvb/tinymembench/issues/7