Weak Memory Demands Model-based Compiler Testing (2401.09474v1)
Abstract: A compiler bug arises if the behaviour of a compiled concurrent program, as allowed by its architecture memory model, is not a behaviour permitted by the source program under its source model. One might reasonably think that most compiler bugs have been found in the decade since the introduction of the C/C++ memory model. We observe that processor implementations are increasingly exploiting the behaviour of relaxed architecture models. As such, compiled programs may exhibit bugs not seen on older hardware. To account for this we require model-based compiler testing. While this observation is not surprising, its implications are broad. Compilers and their testing tools will need to be updated to follow hardware relaxations, concurrent test generators will need to be improved, and assumptions of prior work will need revisiting. We explore these ideas using a compiler toolchain bug we reported in LLVM.
- Fences in Weak Memory Models (Extended Version). Form. Methods Syst. Des. 40, 2 (Apr. 2012), 170–205.
- Arm-Limited. Arm Architecture Reference Manual. Addison-Wesley Longman Publishing Co., Inc., Boston, MA, USA, 2023.
- Armv8 AArch64 Memory Model. https://github.com/herd/herdtools7/blob/master/herd/libdir/aarch64.cat, 2021.
- Geeson, L. [AArch64]: Atomic Exchange Allows Reordering past Acquire Fence . https://github.com/llvm/llvm-project/issues/68428, 2023.
- Compiler testing with relaxed memory models. https://arxiv.org/abs/2310.12337, 2023. To appear In Proceedings of the 2024 International Symposium on Code Generation and Optimization.
- ISO-C-Std, O. ISO/IEC 9899:201x. https://www.open-std.org/jtc1/sc22/wg14/www/docs/n2912.pdf, 2022. Accessed: 2023-11-10.
- LLVM. AArch64 Dead register definitions. https://llvm.org/docs/doxygen/AArch64DeadRegisterDefinitionsPass_8cpp_source.html.
- Compiler Testing via a Theory of Sound Optimisations in the C11/C++11 Memory Model. In Proceedings of the 34th ACM SIGPLAN Conference on Programming Language Design and Implementation (New York, NY, USA, 2013), PLDI ’13, ACM, pp. 187–196.
- Nikoleris, N. Restore architectural intent for aarch64 swp/cas that return to zr. https://github.com/herd/herdtools7/pull/683.
- Luke Geeson (3 papers)