• 中国计算机学会会刊
  • 中国科技核心期刊
  • 中文核心期刊

计算机工程与科学 ›› 2025, Vol. 47 ›› Issue (7): 1141-1151.

• 高性能计算 • 上一篇    下一篇

Rubyphi:面向gem5的Cache一致性协议自动化模型检验

徐学政,方健,梁少杰,王璐,黄安文,隋京高,李琼   

  1. (军事科学院国防科技创新研究院,北京 100071)
  • 收稿日期:2024-10-12 修回日期:2025-11-15 出版日期:2025-07-25 发布日期:2025-08-25
  • 基金资助:
    国家自然科学基金(62102439)

Rubyphi:Automated model checking for Cache coherence protocols in gem5

XU Xuezheng,FANG Jian,LIANG Shaojie,WANG Lu,HUANG Anwen,SUI Jinggao,LI Qiong#br#   

  1. (Defense Innovation Institute,Academy of Military Sciences,Beijing 100071,China)

  • Received:2024-10-12 Revised:2025-11-15 Online:2025-07-25 Published:2025-08-25

摘要: Cache一致性协议是多核系统数据一致性的保障,也直接影响内存子系统的性能,一直是微处理器设计和验证的重点。Cache一致性协议的设计和优化通常需借助gem5等软件模拟器快速实现。同时,由于协议设计中存在的错误在仿真测试中具有难触发、难定位和难修复的特点,需借助Murphi等模型检验工具进行形式化验证。然而,基于模拟器的协议设计优化和基于模型检验的协议验证在编程语言和抽象层次上存在巨大差异,设计者需要分别进行模拟器实现和模型检验建模,这不仅增加了时间成本,也为二者的等价性带来了隐患。设计并实现了面向gem5模拟器的Cache一致性协议自动化模型检验方法Rubyphi,通过提取gem5中实现的协议,自动完成基于Murphi的模型检验建模,进而对协议进行形式化验证。实验表明,Rubyphi能够有效地完成gem5中一致性协议的建模和验证,并成功发现了2个gem5现有协议中存在的错误,相关问题和解决方案已得到社区确认。

关键词: Cache一致性协议, 多核处理器, 模型检验, 形式化验证

Abstract:

Cache coherence protocols serve as the cornerstone for ensuring data consistency in multi-core systems and directly impact the performance of the memory subsystem,making it a longstanding focal point in microprocessor design and verification.The design and optimization of coherence protocols typically rely on software simulators like gem5 for rapid implementation.Additionally,errors in protocols are difficult to trigger,locate,and repair during simulation,necessitating the use of model checking tools such as Murphi for formal verification.However,there is a significant difference in programming languages and levels of abstraction between simulator-based protocol design and optimization and model-checking-based protocol verification.Designers are required to separately implement simulator code and construct model-checking frameworks,which not only increases time cost but also introduces potential discrepancies in equivalence between the two approaches.To address this challenge,this paper designs and implements Rubyphi,an automated model checking method for Cache coherence protocols targeting the gem5 simulator.By extracting and translating the protocol descriptions and implementations from gem5,Rubyphi automatically generates Murphi-based model checking framework to conduct formal verification.Experimental results demonstrate that Rubyphi effectively accomplishes the modeling and verification of coherence protocols in gem5,successfully uncovering two existing bugs in gem5 s protocols.The related issues and patches have been confirmed  by the community.


Key words: Cache coherence protocol, multi-core processor, model checking, formal verification