Skip to main content
QUICK REVIEW

[论文解读] Portability Analysis for Axiomatic Memory Models. PORTHOS: One Tool for all Models

Hernán Ponce-de-León, Florian Furbach|arXiv (Cornell University)|Feb 22, 2017
Formal Methods in Verification参考文献 27被引用 3
一句话总结

porthos 是首个通过分析不同弱内存模型之间的一致性,来检测性能关键代码中移植错误的工具。它使用基于 SMT 求解的有界模型检测技术,检测在目标架构(如 Power)上有效但在源架构(如 TSO)上无效的执行路径,通过存在性查询高效编码递归内存模型语义和量词交替。

ABSTRACT

We present Porthos, the first tool that discovers porting bugs in performance-critical code. Porthos takes as input a program and the memory models of the source architecture for which the program has been developed and the target model to which it is ported. If the code is not portable, Porthos finds a bug in the form of an unexpected execution - an execution that is consistent with the target but inconsistent with the source memory model. Technically, Porthos implements a bounded model checking method that reduces the portability analysis problem to satisfiability modulo theories (SMT). There are two main problems in the reduction that we present novel and efficient solutions for. First, the formulation of the portability problem contains a quantifier alternation (consistent + inconsistent). We introduce a formula that encodes both in a single existential query. Second, the supported memory models (e.g., Power) contain recursive definitions. We compute the required least fixed point semantics for recursion (a problem that was left open in [47]) efficiently in SMT. Finally we present the first experimental analysis of portability from TSO to Power.

研究动机与目标

  • 解决在不同内存模型的架构之间迁移性能关键代码时,检测移植错误的挑战。
  • 提供一种可扩展的自动化方法,验证所有目标架构上的执行在源架构的内存模型下也均有效。
  • 解决两个关键技术挑战:在可移植性检查中高效编码量词交替,以及在递归内存模型定义中高效计算最小不动点。
  • 在因架构特定编译导致低层代码差异的情况下,实现高层程序可移植性的验证。

提出的方法

  • porthos 将可移植性分析问题归约为可满足性模逻辑(SMT),使用单个存在性查询来编码目标一致性与源不一致性之间的交替。
  • 它提出一种新颖的 SMT 编码方法,用于递归内存模型定义(如 Power 模型)中的最小不动点,利用整数差分逻辑避免昂贵的展开操作。
  • 该工具通过函数 hlinst 将低层执行映射回高层程序事件,确保编译后代码与源代码之间的语义对应。
  • 它将执行投影(execproj)表述为一组约束的合取,确保事件映射、关系保持(rf, co)和完备性。
  • 该方法通过引入辅助变量来猜测循环,避免了对环路的不可满足性检查,将环路检测简化为可满足性检查。
  • 它支持用户自定义的以 CAT 语言表达的内存模型,支持对 x86(TSO)和 Power 等多样化架构的分析。

实验结果

研究问题

  • RQ1一个单一工具能否通过验证所有目标架构上的执行在源架构上也有效,来检测跨不同弱内存模型的移植错误?
  • RQ2如何在 SMT 中高效编码可移植性检查中的量词交替(即目标上一致,源上不一致)?
  • RQ3在递归内存模型定义(如 Power 内存模型)中,如何高效地用 SMT 编码计算最小不动点?
  • RQ4低层编译差异在多大程度上影响可移植性?如何在分析中保持高层语义?

主要发现

  • porthos 通过识别在目标内存模型(如 Power)上有效但在源模型(如 TSO)上无效的执行路径,成功检测出移植错误。
  • 该工具在递归内存模型中计算最小不动点的 SMT 编码,相比朴素展开方法显著更高效,实现了可扩展的验证。
  • 该方法将可移植性检查简化为单个存在性 SMT 查询,避免了嵌套量词求解或不可满足性检查的需要。
  • 实验分析证实,通过辅助变量实现的环路检测编码在实际中既正确又高效。
  • 研究表明,基于状态的可移植性在算法上更困难(超出 SAT 范畴),但所提出的基于执行的定义在实践中可产生相当的结果。

更好的研究,从现在开始

从阅读论文到最终审阅,大幅缩短您的研究时间。

无需绑定信用卡

本解读由 AI 生成,并经人工编辑审核。