Memory Consistency and Program Transformations

Akshay GopalakrishnanMcGill University, Clark VerbruggeMcGill University, Mark BattyUniversity of Kent
{"title":"Memory Consistency and Program Transformations","authors":"Akshay GopalakrishnanMcGill University, Clark VerbruggeMcGill University, Mark BattyUniversity of Kent","doi":"arxiv-2409.12013","DOIUrl":null,"url":null,"abstract":"A memory consistency model specifies the allowed behaviors of shared memory\nconcurrent programs. At the language level, these models are known to have a\nnon-trivial impact on the safety of program optimizations, limiting the ability\nto rearrange/refactor code without introducing new behaviors. Existing\nprogramming language memory models try to address this by permitting more\n(relaxed/weak) concurrent behaviors but are still unable to allow all the\ndesired optimizations. A core problem is that weaker consistency models may\nalso render optimizations unsafe, a conclusion that goes against the intuition\nof them allowing more behaviors. This exposes an open problem of the\ncompositional interaction between memory consistency semantics and\noptimizations: which parts of the semantics correspond to allowing/disallowing\nwhich set of optimizations is unclear. In this work, we establish a formal\nfoundation suitable enough to understand this compositional nature, decomposing\noptimizations into a finite set of elementary effects on program execution\ntraces, over which aspects of safety can be assessed. We use this decomposition\nto identify a desirable compositional property (complete) that would guarantee\nthe safety of optimizations from one memory model to another. We showcase its\npracticality by proving such a property between Sequential Consistency (SC) and\n$SC_{RR}$, the latter allowing independent read-read reordering over $SC$. Our\nwork potentially paves way to a new design methodology of programming-language\nmemory models, one that places emphasis on the optimizations desired to be\nperformed.","PeriodicalId":501197,"journal":{"name":"arXiv - CS - Programming Languages","volume":null,"pages":null},"PeriodicalIF":0.0000,"publicationDate":"2024-09-18","publicationTypes":"Journal Article","fieldsOfStudy":null,"isOpenAccess":false,"openAccessPdf":"","citationCount":"0","resultStr":null,"platform":"Semanticscholar","paperid":null,"PeriodicalName":"arXiv - CS - Programming Languages","FirstCategoryId":"1085","ListUrlMain":"https://doi.org/arxiv-2409.12013","RegionNum":0,"RegionCategory":null,"ArticlePicture":[],"TitleCN":null,"AbstractTextCN":null,"PMCID":null,"EPubDate":"","PubModel":"","JCR":"","JCRName":"","Score":null,"Total":0}
引用次数: 0

Abstract

A memory consistency model specifies the allowed behaviors of shared memory concurrent programs. At the language level, these models are known to have a non-trivial impact on the safety of program optimizations, limiting the ability to rearrange/refactor code without introducing new behaviors. Existing programming language memory models try to address this by permitting more (relaxed/weak) concurrent behaviors but are still unable to allow all the desired optimizations. A core problem is that weaker consistency models may also render optimizations unsafe, a conclusion that goes against the intuition of them allowing more behaviors. This exposes an open problem of the compositional interaction between memory consistency semantics and optimizations: which parts of the semantics correspond to allowing/disallowing which set of optimizations is unclear. In this work, we establish a formal foundation suitable enough to understand this compositional nature, decomposing optimizations into a finite set of elementary effects on program execution traces, over which aspects of safety can be assessed. We use this decomposition to identify a desirable compositional property (complete) that would guarantee the safety of optimizations from one memory model to another. We showcase its practicality by proving such a property between Sequential Consistency (SC) and $SC_{RR}$, the latter allowing independent read-read reordering over $SC$. Our work potentially paves way to a new design methodology of programming-language memory models, one that places emphasis on the optimizations desired to be performed.
查看原文
分享 分享
微信好友 朋友圈 QQ好友 复制链接
本刊更多论文
内存一致性和程序转换
内存一致性模型规定了共享内存并发程序允许的行为。众所周知,在语言层面,这些模型会对程序优化的安全性产生非同小可的影响,从而限制了在不引入新行为的情况下重新排列/重构代码的能力。现有的编程语言内存模型试图通过允许更多并发行为(宽松/弱化)来解决这个问题,但仍然无法实现所有期望的优化。一个核心问题是,较弱的一致性模型也可能使优化变得不安全,而这一结论与允许更多行为的直觉相悖。这就暴露了内存一致性语义和优化之间的组合交互这一未决问题:语义的哪些部分对应于允许/不允许哪一组优化,这一点并不清楚。在这项工作中,我们建立了一个足以理解这种组合性质的形式基础,将优化分解为对程序执行轨迹的一系列有限的基本影响,通过这些影响可以评估安全性的各个方面。我们利用这种分解来确定一种理想的组合特性(完全性),它可以保证从一种内存模型到另一种内存模型的优化的安全性。我们通过证明连续一致性(SC)和$SC_{RR}$之间的这种属性来展示它的实用性,后者允许在$SC$上进行独立的读取重排序。我们的工作有可能为编程语言内存模型的新设计方法铺平道路,这种方法的重点是希望实现的优化。
本文章由计算机程序翻译,如有差异,请以英文原文为准。
求助全文
约1分钟内获得全文 去求助
来源期刊
自引率
0.00%
发文量
0
期刊最新文献
Memory Consistency and Program Transformations No Saved Kaleidosope: an 100% Jitted Neural Network Coding Language with Pythonic Syntax Towards Quantum Multiparty Session Types The Incredible Shrinking Context... in a decompiler near you Scheme Pearl: Quantum Continuations
×
引用
GB/T 7714-2015
复制
MLA
复制
APA
复制
导出至
BibTeX EndNote RefMan NoteFirst NoteExpress
×
×
提示
您的信息不完整,为了账户安全,请先补充。
现在去补充
×
提示
您因"违规操作"
具体请查看互助需知
我知道了
×
提示
现在去查看 取消
×
提示
确定
0
微信
客服QQ
Book学术公众号 扫码关注我们
反馈
×
意见反馈
请填写您的意见或建议
请填写您的手机或邮箱
已复制链接
已复制链接
快去分享给好友吧!
我知道了
×
扫码分享
扫码分享
Book学术官方微信
Book学术文献互助
Book学术文献互助群
群 号:481959085
Book学术
文献互助 智能选刊 最新文献 互助须知 联系我们:info@booksci.cn
Book学术提供免费学术资源搜索服务,方便国内外学者检索中英文文献。致力于提供最便捷和优质的服务体验。
Copyright © 2023 Book学术 All rights reserved.
ghs 京公网安备 11010802042870号 京ICP备2023020795号-1