首页 > 最新文献

Proceedings of the 44th ACM SIGPLAN Symposium on Principles of Programming Languages最新文献

英文 中文
Complexity verification using guided theorem enumeration 使用引导定理枚举的复杂度验证
Akhilesh Srikanth, Burak Sahin, William R. Harris
Determining if a given program satisfies a given bound on the amount of resources that it may use is a fundamental problem with critical practical applications. Conventional automatic verifiers for safety properties cannot be applied to address this problem directly because such verifiers target properties expressed in decidable theories; however, many practical bounds are expressed in nonlinear theories, which are undecidable. In this work, we introduce an automatic verification algorithm, CAMPY, that determines if a given program P satisfies a given resource bound B, which may be expressed using polynomial, exponential, and logarithmic terms. The key technical contribution behind our verifier is an interpolating theorem prover for non-linear theories that lazily learns a sufficiently accurate approximation of non-linear theories by selectively grounding theorems of the nonlinear theory that are relevant to proving that P satisfies B. To evaluate CAMPY, we implemented it to target Java Virtual Machine bytecode. We applied CAMPY to verify that over 20 solutions submitted for programming problems hosted on popular online coding platforms satisfy or do not satisfy expected complexity bounds.
确定给定程序是否满足其可能使用的资源量的给定界限是关键实际应用中的一个基本问题。传统的安全属性自动验证器不能直接用于解决这一问题,因为此类验证器的目标是用可确定的理论表示的属性;然而,许多实际边界是用非线性理论表示的,这是不可确定的。在这项工作中,我们引入了一种自动验证算法CAMPY,它确定给定的程序P是否满足给定的资源界B,该资源界B可以用多项式,指数和对数项表示。我们的验证器背后的关键技术贡献是非线性理论的插值定理证明器,它通过选择性地建立与证明P满足b相关的非线性理论定理,惰性地学习非线性理论的足够精确的近似值。为了评估CAMPY,我们将其实现为Java虚拟机字节码。我们应用CAMPY验证了在流行的在线编码平台上托管的编程问题提交的20多个解决方案满足或不满足预期的复杂性界限。
{"title":"Complexity verification using guided theorem enumeration","authors":"Akhilesh Srikanth, Burak Sahin, William R. Harris","doi":"10.1145/3009837.3009864","DOIUrl":"https://doi.org/10.1145/3009837.3009864","url":null,"abstract":"Determining if a given program satisfies a given bound on the amount of resources that it may use is a fundamental problem with critical practical applications. Conventional automatic verifiers for safety properties cannot be applied to address this problem directly because such verifiers target properties expressed in decidable theories; however, many practical bounds are expressed in nonlinear theories, which are undecidable. In this work, we introduce an automatic verification algorithm, CAMPY, that determines if a given program P satisfies a given resource bound B, which may be expressed using polynomial, exponential, and logarithmic terms. The key technical contribution behind our verifier is an interpolating theorem prover for non-linear theories that lazily learns a sufficiently accurate approximation of non-linear theories by selectively grounding theorems of the nonlinear theory that are relevant to proving that P satisfies B. To evaluate CAMPY, we implemented it to target Java Virtual Machine bytecode. We applied CAMPY to verify that over 20 solutions submitted for programming problems hosted on popular online coding platforms satisfy or do not satisfy expected complexity bounds.","PeriodicalId":20657,"journal":{"name":"Proceedings of the 44th ACM SIGPLAN Symposium on Principles of Programming Languages","volume":"70 1","pages":""},"PeriodicalIF":0.0,"publicationDate":"2017-01-01","publicationTypes":"Journal Article","fieldsOfStudy":null,"isOpenAccess":false,"openAccessPdf":"","citationCount":null,"resultStr":null,"platform":"Semanticscholar","paperid":"74116567","PeriodicalName":null,"FirstCategoryId":null,"ListUrlMain":null,"RegionNum":0,"RegionCategory":"","ArticlePicture":[],"TitleCN":null,"AbstractTextCN":null,"PMCID":"","EPubDate":null,"PubModel":null,"JCR":null,"JCRName":null,"Score":null,"Total":0}
引用次数: 23
Modules, abstraction, and parametric polymorphism 模块、抽象和参数多态性
Karl Crary
Reynolds's Abstraction theorem forms the mathematical foundation for data abstraction. His setting was the polymorphic lambda calculus. Today, many modern languages, such as the ML family, employ rich module systems designed to give more expressive support for data abstraction than the polymorphic lambda calculus, but analogues of the Abstraction theorem for such module systems have lagged far behind. We give an account of the Abstraction theorem for a modern module calculus supporting generative and applicative functors, higher-order functors, sealing, and translucent signatures. The main issues to be overcome are: (1) the fact that modules combine both types and terms, so they must be treated as both simultaneously, (2) the effect discipline that models the distinction between transparent and opaque modules, and (3) a very rich language of type constructors supporting singleton kinds. We define logical equivalence for modules and show that it coincides with contextual equivalence. This substantiates the folk theorem that modules are good for data abstraction. All our proofs are formalized in Coq.
雷诺兹抽象定理构成了数据抽象的数学基础。他的背景是多态λ演算。今天,许多现代语言,如ML家族,采用丰富的模块系统,旨在为数据抽象提供比多态lambda演算更有表现力的支持,但是类似于抽象定理的模块系统远远落后。我们给出了一个支持生成和应用函子、高阶函子、密封和半透明签名的现代模块演算的抽象定理。需要克服的主要问题是:(1)模块结合了类型和术语的事实,因此它们必须同时被视为两者,(2)为透明和不透明模块之间的区别建模的效果原则,以及(3)支持单例类型的非常丰富的类型构造函数语言。我们定义了模块的逻辑等价,并证明它与上下文等价是一致的。这证实了模块有利于数据抽象的民间定理。我们所有的证明都是用Coq形式化的。
{"title":"Modules, abstraction, and parametric polymorphism","authors":"Karl Crary","doi":"10.1145/3009837.3009892","DOIUrl":"https://doi.org/10.1145/3009837.3009892","url":null,"abstract":"Reynolds's Abstraction theorem forms the mathematical foundation for data abstraction. His setting was the polymorphic lambda calculus. Today, many modern languages, such as the ML family, employ rich module systems designed to give more expressive support for data abstraction than the polymorphic lambda calculus, but analogues of the Abstraction theorem for such module systems have lagged far behind. We give an account of the Abstraction theorem for a modern module calculus supporting generative and applicative functors, higher-order functors, sealing, and translucent signatures. The main issues to be overcome are: (1) the fact that modules combine both types and terms, so they must be treated as both simultaneously, (2) the effect discipline that models the distinction between transparent and opaque modules, and (3) a very rich language of type constructors supporting singleton kinds. We define logical equivalence for modules and show that it coincides with contextual equivalence. This substantiates the folk theorem that modules are good for data abstraction. All our proofs are formalized in Coq.","PeriodicalId":20657,"journal":{"name":"Proceedings of the 44th ACM SIGPLAN Symposium on Principles of Programming Languages","volume":"50 1","pages":""},"PeriodicalIF":0.0,"publicationDate":"2017-01-01","publicationTypes":"Journal Article","fieldsOfStudy":null,"isOpenAccess":false,"openAccessPdf":"","citationCount":null,"resultStr":null,"platform":"Semanticscholar","paperid":"88155288","PeriodicalName":null,"FirstCategoryId":null,"ListUrlMain":null,"RegionNum":0,"RegionCategory":"","ArticlePicture":[],"TitleCN":null,"AbstractTextCN":null,"PMCID":"","EPubDate":null,"PubModel":null,"JCR":null,"JCRName":null,"Score":null,"Total":0}
引用次数: 19
Type directed compilation of row-typed algebraic effects 行类型代数效应的类型定向编译
Daan Leijen
Algebraic effect handlers, introduced by Plotkin and Power in 2002, are recently gaining in popularity as a purely functional approach to modeling effects. In this article, we give a full overview of practical algebraic effects in the context of a compiled implementation in the Koka language. In particular, we show how algebraic effects generalize over common constructs like exception handling, state, iterators and async-await. We give an effective type inference algorithm based on extensible effect rows using scoped labels, and a direct operational semantics. Finally, we show an efficient compilation scheme to common runtime platforms (like JavaScript) using a type directed selective CPS translation.
由Plotkin和Power于2002年引入的代数效果处理程序,最近作为一种纯功能的建模效果方法而受到欢迎。在本文中,我们将全面概述在Koka语言的编译实现上下文中的实际代数效果。特别是,我们展示了代数效果是如何泛化到异常处理、状态、迭代器和async-await等常见结构上的。给出了一种有效的基于可扩展效果行的类型推断算法,该算法使用了范围标签,并给出了一种直接的操作语义。最后,我们将展示一种针对常见运行时平台(如JavaScript)的高效编译方案,该方案使用类型导向的选择性CPS翻译。
{"title":"Type directed compilation of row-typed algebraic effects","authors":"Daan Leijen","doi":"10.1145/3009837.3009872","DOIUrl":"https://doi.org/10.1145/3009837.3009872","url":null,"abstract":"Algebraic effect handlers, introduced by Plotkin and Power in 2002, are recently gaining in popularity as a purely functional approach to modeling effects. In this article, we give a full overview of practical algebraic effects in the context of a compiled implementation in the Koka language. In particular, we show how algebraic effects generalize over common constructs like exception handling, state, iterators and async-await. We give an effective type inference algorithm based on extensible effect rows using scoped labels, and a direct operational semantics. Finally, we show an efficient compilation scheme to common runtime platforms (like JavaScript) using a type directed selective CPS translation.","PeriodicalId":20657,"journal":{"name":"Proceedings of the 44th ACM SIGPLAN Symposium on Principles of Programming Languages","volume":"21 1","pages":""},"PeriodicalIF":0.0,"publicationDate":"2017-01-01","publicationTypes":"Journal Article","fieldsOfStudy":null,"isOpenAccess":false,"openAccessPdf":"","citationCount":null,"resultStr":null,"platform":"Semanticscholar","paperid":"85110159","PeriodicalName":null,"FirstCategoryId":null,"ListUrlMain":null,"RegionNum":0,"RegionCategory":"","ArticlePicture":[],"TitleCN":null,"AbstractTextCN":null,"PMCID":"","EPubDate":null,"PubModel":null,"JCR":null,"JCRName":null,"Score":null,"Total":0}
引用次数: 113
Dynamic race detection for C++11 c++ 11的动态竞争检测
Christopher Lidbury, A. Donaldson
The intricate rules for memory ordering and synchronisation associated with the C/C++11 memory model mean that data races can be difficult to eliminate from concurrent programs. Dynamic data race analysis can pinpoint races in large and complex applications, but the state-of-the-art ThreadSanitizer (tsan) tool for C/C++ considers only sequentially consistent program executions, and does not correctly model synchronisation between C/C++11 atomic operations. We present a scalable dynamic data race analysis for C/C++11 that correctly captures C/C++11 synchronisation, and uses instrumentation to support exploration of a class of non sequentially consistent executions. We concisely define the memory model fragment captured by our instrumentation via a restricted axiomatic semantics, and show that the axiomatic semantics permits exactly those executions explored by our instrumentation. We have implemented our analysis in tsan, and evaluate its effectiveness on benchmark programs, enabling a comparison with the CDSChecker tool, and on two large and highly concurrent applications: the Firefox and Chromium web browsers. Our results show that our method can detect races that are beyond the scope of the original tsan tool, and that the overhead associated with applying our enhanced instrumentation to large applications is tolerable.
与C/ c++ 11内存模型相关的内存排序和同步的复杂规则意味着数据竞争很难从并发程序中消除。动态数据竞争分析可以确定大型复杂应用程序中的竞争,但是C/ c++最先进的ThreadSanitizer (tsan)工具只考虑顺序一致的程序执行,并且不能正确地模拟C/ c++ 11原子操作之间的同步。我们为C/ c++ 11提供了一个可扩展的动态数据竞争分析,它可以正确捕获C/ c++ 11的同步,并使用工具来支持对一类非顺序一致执行的探索。我们通过一个受限制的公理语义简明地定义了由我们的工具捕获的内存模型片段,并表明公理语义恰恰允许我们的工具所探索的那些执行。我们已经在tsan中实现了我们的分析,并在基准程序上评估了它的有效性,以便与CDSChecker工具以及两个大型且高度并发的应用程序(Firefox和Chromium web浏览器)进行比较。我们的结果表明,我们的方法可以检测超出原始tsan工具范围的竞争,并且将我们的增强检测应用于大型应用程序的开销是可以忍受的。
{"title":"Dynamic race detection for C++11","authors":"Christopher Lidbury, A. Donaldson","doi":"10.1145/3009837.3009857","DOIUrl":"https://doi.org/10.1145/3009837.3009857","url":null,"abstract":"The intricate rules for memory ordering and synchronisation associated with the C/C++11 memory model mean that data races can be difficult to eliminate from concurrent programs. Dynamic data race analysis can pinpoint races in large and complex applications, but the state-of-the-art ThreadSanitizer (tsan) tool for C/C++ considers only sequentially consistent program executions, and does not correctly model synchronisation between C/C++11 atomic operations. We present a scalable dynamic data race analysis for C/C++11 that correctly captures C/C++11 synchronisation, and uses instrumentation to support exploration of a class of non sequentially consistent executions. We concisely define the memory model fragment captured by our instrumentation via a restricted axiomatic semantics, and show that the axiomatic semantics permits exactly those executions explored by our instrumentation. We have implemented our analysis in tsan, and evaluate its effectiveness on benchmark programs, enabling a comparison with the CDSChecker tool, and on two large and highly concurrent applications: the Firefox and Chromium web browsers. Our results show that our method can detect races that are beyond the scope of the original tsan tool, and that the overhead associated with applying our enhanced instrumentation to large applications is tolerable.","PeriodicalId":20657,"journal":{"name":"Proceedings of the 44th ACM SIGPLAN Symposium on Principles of Programming Languages","volume":"56 1","pages":""},"PeriodicalIF":0.0,"publicationDate":"2017-01-01","publicationTypes":"Journal Article","fieldsOfStudy":null,"isOpenAccess":false,"openAccessPdf":"","citationCount":null,"resultStr":null,"platform":"Semanticscholar","paperid":"90770608","PeriodicalName":null,"FirstCategoryId":null,"ListUrlMain":null,"RegionNum":0,"RegionCategory":"","ArticlePicture":[],"TitleCN":null,"AbstractTextCN":null,"PMCID":"","EPubDate":null,"PubModel":null,"JCR":null,"JCRName":null,"Score":null,"Total":0}
引用次数: 21
A promising semantics for relaxed-memory concurrency 一种很有前途的松弛内存并发语义
Jeehoon Kang, C. Hur, O. Lahav, Viktor Vafeiadis, Derek Dreyer
Despite many years of research, it has proven very difficult to develop a memory model for concurrent programming languages that adequately balances the conflicting desiderata of programmers, compilers, and hardware. In this paper, we propose the first relaxed memory model that (1) accounts for a broad spectrum of features from the C++11 concurrency model, (2) is implementable, in the sense that it provably validates many standard compiler optimizations and reorderings, as well as standard compilation schemes to x86-TSO and Power, (3) justifies simple invariant-based reasoning, thus demonstrating the absence of bad "out-of-thin-air" behaviors, (4) supports "DRF" guarantees, ensuring that programmers who use sufficient synchronization need not understand the full complexities of relaxed-memory semantics, and (5) defines the semantics of racy programs without relying on undefined behaviors, which is a prerequisite for applicability to type-safe languages like Java. The key novel idea behind our model is the notion of *promises*: a thread may promise to execute a write in the future, thus enabling other threads to read from that write out of order. Crucially, to prevent out-of-thin-air behaviors, a promise step requires a thread-local certification that it will be possible to execute the promised write even in the absence of the promise. To establish confidence in our model, we have formalized most of our key results in Coq.
尽管经过多年的研究,为并发编程语言开发一种能够充分平衡程序员、编译器和硬件之间相互冲突的内存模型已经被证明是非常困难的。在本文中,我们提出了第一个宽松内存模型,它(1)考虑了c++ 11并发模型的广泛特性,(2)是可实现的,从某种意义上说,它可证明验证了许多标准编译器优化和重新排序,以及x86-TSO和Power的标准编译方案,(3)证明了简单的基于不变量的推理,从而证明没有坏的“凭空”行为,(4)支持“DRF”保证,确保使用充分同步的程序员不需要理解松弛内存语义的全部复杂性,并且(5)在不依赖于未定义行为的情况下定义了动态程序的语义,这是适用于Java等类型安全语言的先决条件。我们的模型背后的关键新颖思想是“承诺”的概念:一个线程可以承诺在将来执行一个写操作,从而允许其他线程无序地从这个写操作中读取数据。至关重要的是,为了防止不切实际的行为,承诺步骤需要一个线程本地认证,证明即使在没有承诺的情况下也可以执行承诺的写操作。为了在我们的模型中建立信心,我们已经在Coq中形式化了我们的大多数关键结果。
{"title":"A promising semantics for relaxed-memory concurrency","authors":"Jeehoon Kang, C. Hur, O. Lahav, Viktor Vafeiadis, Derek Dreyer","doi":"10.1145/3009837.3009850","DOIUrl":"https://doi.org/10.1145/3009837.3009850","url":null,"abstract":"Despite many years of research, it has proven very difficult to develop a memory model for concurrent programming languages that adequately balances the conflicting desiderata of programmers, compilers, and hardware. In this paper, we propose the first relaxed memory model that (1) accounts for a broad spectrum of features from the C++11 concurrency model, (2) is implementable, in the sense that it provably validates many standard compiler optimizations and reorderings, as well as standard compilation schemes to x86-TSO and Power, (3) justifies simple invariant-based reasoning, thus demonstrating the absence of bad \"out-of-thin-air\" behaviors, (4) supports \"DRF\" guarantees, ensuring that programmers who use sufficient synchronization need not understand the full complexities of relaxed-memory semantics, and (5) defines the semantics of racy programs without relying on undefined behaviors, which is a prerequisite for applicability to type-safe languages like Java. The key novel idea behind our model is the notion of *promises*: a thread may promise to execute a write in the future, thus enabling other threads to read from that write out of order. Crucially, to prevent out-of-thin-air behaviors, a promise step requires a thread-local certification that it will be possible to execute the promised write even in the absence of the promise. To establish confidence in our model, we have formalized most of our key results in Coq.","PeriodicalId":20657,"journal":{"name":"Proceedings of the 44th ACM SIGPLAN Symposium on Principles of Programming Languages","volume":"38 1","pages":""},"PeriodicalIF":0.0,"publicationDate":"2017-01-01","publicationTypes":"Journal Article","fieldsOfStudy":null,"isOpenAccess":false,"openAccessPdf":"","citationCount":null,"resultStr":null,"platform":"Semanticscholar","paperid":"89829799","PeriodicalName":null,"FirstCategoryId":null,"ListUrlMain":null,"RegionNum":0,"RegionCategory":"","ArticlePicture":[],"TitleCN":null,"AbstractTextCN":null,"PMCID":"","EPubDate":null,"PubModel":null,"JCR":null,"JCRName":null,"Score":null,"Total":0}
引用次数: 151
Relational cost analysis 关系成本分析
Ezgi Çiçek, G. Barthe, Marco Gaboardi, Deepak Garg, Jan Hoffmann
Establishing quantitative bounds on the execution cost of programs is essential in many areas of computer science such as complexity analysis, compiler optimizations, security and privacy. Techniques based on program analysis, type systems and abstract interpretation are well-studied, but methods for analyzing how the execution costs of two programs compare to each other have not received attention. Naively combining the worst and best case execution costs of the two programs does not work well in many cases because such analysis forgets the similarities between the programs or the inputs. In this work, we propose a relational cost analysis technique that is capable of establishing precise bounds on the difference in the execution cost of two programs by making use of relational properties of programs and inputs. We develop , a refinement type and effect system for a higher-order functional language with recursion and subtyping. The key novelty of our technique is the combination of relational refinements with two modes of typing-relational typing for reasoning about similar computations/inputs and unary typing for reasoning about unrelated computations/inputs. This combination allows us to analyze the execution cost difference of two programs more precisely than a naive non-relational approach. We prove our type system sound using a semantic model based on step-indexed unary and binary logical relations accounting for non-relational and relational reasoning principles with their respective costs. We demonstrate the precision and generality of our technique through examples.
在计算机科学的许多领域,如复杂性分析、编译器优化、安全和隐私,建立程序执行成本的定量界限是必不可少的。基于程序分析、类型系统和抽象解释的技术已经得到了很好的研究,但是分析两个程序的执行成本如何相互比较的方法还没有得到关注。在许多情况下,天真地将两个程序的最坏情况和最佳情况的执行成本结合起来并不能很好地工作,因为这种分析忘记了程序或输入之间的相似性。在这项工作中,我们提出了一种关系成本分析技术,该技术能够通过利用程序和输入的关系属性来建立两个程序执行成本差异的精确界限。本文开发了一种具有递归和子类型的高阶函数式语言的细化类型和效果系统。我们技术的关键新颖之处在于将关系细化与两种类型模式相结合——用于推理类似计算/输入的关系类型和用于推理不相关计算/输入的一元类型。这种组合使我们能够比简单的非关系方法更精确地分析两个程序的执行成本差异。我们使用基于阶跃索引一元和二元逻辑关系的语义模型来证明我们的类型系统是健全的,这种逻辑关系考虑了非关系和关系推理原则及其各自的成本。我们通过实例证明了我们的技术的精确性和通用性。
{"title":"Relational cost analysis","authors":"Ezgi Çiçek, G. Barthe, Marco Gaboardi, Deepak Garg, Jan Hoffmann","doi":"10.1145/3009837.3009858","DOIUrl":"https://doi.org/10.1145/3009837.3009858","url":null,"abstract":"Establishing quantitative bounds on the execution cost of programs is essential in many areas of computer science such as complexity analysis, compiler optimizations, security and privacy. Techniques based on program analysis, type systems and abstract interpretation are well-studied, but methods for analyzing how the execution costs of two programs compare to each other have not received attention. Naively combining the worst and best case execution costs of the two programs does not work well in many cases because such analysis forgets the similarities between the programs or the inputs. In this work, we propose a relational cost analysis technique that is capable of establishing precise bounds on the difference in the execution cost of two programs by making use of relational properties of programs and inputs. We develop , a refinement type and effect system for a higher-order functional language with recursion and subtyping. The key novelty of our technique is the combination of relational refinements with two modes of typing-relational typing for reasoning about similar computations/inputs and unary typing for reasoning about unrelated computations/inputs. This combination allows us to analyze the execution cost difference of two programs more precisely than a naive non-relational approach. We prove our type system sound using a semantic model based on step-indexed unary and binary logical relations accounting for non-relational and relational reasoning principles with their respective costs. We demonstrate the precision and generality of our technique through examples.","PeriodicalId":20657,"journal":{"name":"Proceedings of the 44th ACM SIGPLAN Symposium on Principles of Programming Languages","volume":"31 1","pages":""},"PeriodicalIF":0.0,"publicationDate":"2017-01-01","publicationTypes":"Journal Article","fieldsOfStudy":null,"isOpenAccess":false,"openAccessPdf":"","citationCount":null,"resultStr":null,"platform":"Semanticscholar","paperid":"88871409","PeriodicalName":null,"FirstCategoryId":null,"ListUrlMain":null,"RegionNum":0,"RegionCategory":"","ArticlePicture":[],"TitleCN":null,"AbstractTextCN":null,"PMCID":"","EPubDate":null,"PubModel":null,"JCR":null,"JCRName":null,"Score":null,"Total":0}
引用次数: 65
Automatically comparing memory consistency models 自动比较内存一致性模型
John Wickerson, Mark Batty, Tyler Sorensen, G. Constantinides
A memory consistency model (MCM) is the part of a programming language or computer architecture specification that defines which values can legally be read from shared memory locations. Because MCMs take into account various optimisations employed by architectures and compilers, they are often complex and counterintuitive, which makes them challenging to design and to understand. We identify four tasks involved in designing and understanding MCMs: generating conformance tests, distinguishing two MCMs, checking compiler optimisations, and checking compiler mappings. We show that all four tasks are instances of a general constraint-satisfaction problem to which the solution is either a program or a pair of programs. Although this problem is intractable for automatic solvers when phrased over programs directly, we show how to solve analogous constraints over program executions, and then construct programs that satisfy the original constraints. Our technique, which is implemented in the Alloy modelling framework, is illustrated on several software- and architecture-level MCMs, both axiomatically and operationally defined. We automatically recreate several known results, often in a simpler form, including: distinctions between variants of the C11 MCM; a failure of the "SC-DRF guarantee" in an early C11 draft; that x86 is "multi-copy atomic" and Power is not; bugs in common C11 compiler optimisations; and bugs in a compiler mapping from OpenCL to AMD-style GPUs. We also use our technique to develop and validate a new MCM for NVIDIA GPUs that supports a natural mapping from OpenCL.
内存一致性模型(MCM)是编程语言或计算机体系结构规范的一部分,它定义了哪些值可以合法地从共享内存位置读取。由于mcm考虑了体系结构和编译器所采用的各种优化,因此它们通常是复杂和违反直觉的,这使得它们对设计和理解具有挑战性。我们确定了设计和理解mcm所涉及的四个任务:生成一致性测试、区分两个mcm、检查编译器优化和检查编译器映射。我们表明,所有四个任务都是一般约束满足问题的实例,其解决方案要么是一个程序,要么是一对程序。虽然这个问题对于直接处理程序的自动求解器来说是难以处理的,但我们展示了如何解决程序执行中的类似约束,然后构造满足原始约束的程序。我们的技术是在Alloy建模框架中实现的,在几个软件和架构级mcm上进行了说明,这些mcm都是公理和操作定义的。我们自动重建了几个已知的结果,通常以更简单的形式,包括:C11 MCM变体之间的区别;C11早期草案中“SC-DRF担保”的失败;x86是“多副本原子”的,而Power不是;常见C11编译器优化中的bug;以及从OpenCL到amd风格gpu的编译器映射中的bug。我们还使用我们的技术开发和验证了NVIDIA gpu的新MCM,该MCM支持OpenCL的自然映射。
{"title":"Automatically comparing memory consistency models","authors":"John Wickerson, Mark Batty, Tyler Sorensen, G. Constantinides","doi":"10.1145/3009837.3009838","DOIUrl":"https://doi.org/10.1145/3009837.3009838","url":null,"abstract":"A memory consistency model (MCM) is the part of a programming language or computer architecture specification that defines which values can legally be read from shared memory locations. Because MCMs take into account various optimisations employed by architectures and compilers, they are often complex and counterintuitive, which makes them challenging to design and to understand. We identify four tasks involved in designing and understanding MCMs: generating conformance tests, distinguishing two MCMs, checking compiler optimisations, and checking compiler mappings. We show that all four tasks are instances of a general constraint-satisfaction problem to which the solution is either a program or a pair of programs. Although this problem is intractable for automatic solvers when phrased over programs directly, we show how to solve analogous constraints over program executions, and then construct programs that satisfy the original constraints. Our technique, which is implemented in the Alloy modelling framework, is illustrated on several software- and architecture-level MCMs, both axiomatically and operationally defined. We automatically recreate several known results, often in a simpler form, including: distinctions between variants of the C11 MCM; a failure of the \"SC-DRF guarantee\" in an early C11 draft; that x86 is \"multi-copy atomic\" and Power is not; bugs in common C11 compiler optimisations; and bugs in a compiler mapping from OpenCL to AMD-style GPUs. We also use our technique to develop and validate a new MCM for NVIDIA GPUs that supports a natural mapping from OpenCL.","PeriodicalId":20657,"journal":{"name":"Proceedings of the 44th ACM SIGPLAN Symposium on Principles of Programming Languages","volume":"23 12","pages":""},"PeriodicalIF":0.0,"publicationDate":"2017-01-01","publicationTypes":"Journal Article","fieldsOfStudy":null,"isOpenAccess":false,"openAccessPdf":"","citationCount":null,"resultStr":null,"platform":"Semanticscholar","paperid":"91479645","PeriodicalName":null,"FirstCategoryId":null,"ListUrlMain":null,"RegionNum":0,"RegionCategory":"","ArticlePicture":[],"TitleCN":null,"AbstractTextCN":null,"PMCID":"","EPubDate":null,"PubModel":null,"JCR":null,"JCRName":null,"Score":null,"Total":0}
引用次数: 108
LOIS: syntax and semantics LOIS:语法和语义
Eryk Kopczynski, Szymon Toruńczyk
We present the semantics of an imperative programming language called LOIS (Looping Over Infinite Sets), which allows iterating through certain infinite sets, in finite time. Our semantics intuitively correspond to execution of infinitely many threads in parallel. This allows to merge the power of abstract mathematical constructions into imperative programming. Infinite sets are internally represented using first order formulas over some underlying logical structure, and SMT solvers are employed to evaluate programs.
我们提出了一种称为LOIS (loop Over Infinite Sets)的命令式编程语言的语义,它允许在有限时间内迭代某些无限集。我们的语义直观地对应于并行执行无限多个线程。这允许将抽象数学结构的力量合并到命令式编程中。无限集在内部用一阶公式在一些底层逻辑结构上表示,并使用SMT求解器对程序求值。
{"title":"LOIS: syntax and semantics","authors":"Eryk Kopczynski, Szymon Toruńczyk","doi":"10.1145/3009837.3009876","DOIUrl":"https://doi.org/10.1145/3009837.3009876","url":null,"abstract":"We present the semantics of an imperative programming language called LOIS (Looping Over Infinite Sets), which allows iterating through certain infinite sets, in finite time. Our semantics intuitively correspond to execution of infinitely many threads in parallel. This allows to merge the power of abstract mathematical constructions into imperative programming. Infinite sets are internally represented using first order formulas over some underlying logical structure, and SMT solvers are employed to evaluate programs.","PeriodicalId":20657,"journal":{"name":"Proceedings of the 44th ACM SIGPLAN Symposium on Principles of Programming Languages","volume":"42 1","pages":""},"PeriodicalIF":0.0,"publicationDate":"2017-01-01","publicationTypes":"Journal Article","fieldsOfStudy":null,"isOpenAccess":false,"openAccessPdf":"","citationCount":null,"resultStr":null,"platform":"Semanticscholar","paperid":"75676763","PeriodicalName":null,"FirstCategoryId":null,"ListUrlMain":null,"RegionNum":0,"RegionCategory":"","ArticlePicture":[],"TitleCN":null,"AbstractTextCN":null,"PMCID":"","EPubDate":null,"PubModel":null,"JCR":null,"JCRName":null,"Score":null,"Total":0}
引用次数: 16
Invariants of quantum programs: characterisations and generation 量子程序的不变量:表征和生成
M. Ying, Shenggang Ying, Xiaodi Wu
Program invariant is a fundamental notion widely used in program verification and analysis. The aim of this paper is twofold: (i) find an appropriate definition of invariants for quantum programs; and (ii) develop an effective technique of invariant generation for verification and analysis of quantum programs. Interestingly, the notion of invariant can be defined for quantum programs in two different ways -- additive invariants and multiplicative invariants -- corresponding to two interpretations of implication in a continuous valued logic: the Lukasiewicz implication and the Godel implication. It is shown that both of them can be used to establish partial correctness of quantum programs. The problem of generating additive invariants of quantum programs is addressed by reducing it to an SDP (Semidefinite Programming) problem. This approach is applied with an SDP solver to generate invariants of two important quantum algorithms -- quantum walk and quantum Metropolis sampling. Our examples show that the generated invariants can be used to verify correctness of these algorithms and are helpful in optimising quantum Metropolis sampling. To our knowledge, this paper is the first attempt to define the notion of invariant and to develop a method of invariant generation for quantum programs.
程序不变性是一个广泛应用于程序验证和分析的基本概念。本文的目的是双重的:(i)找到量子程序的不变量的适当定义;(ii)开发一种有效的不变量生成技术,用于量子程序的验证和分析。有趣的是,对于量子程序,不变量的概念可以用两种不同的方式定义——加性不变量和乘性不变量——对应于连续值逻辑中蕴涵的两种解释:Lukasiewicz蕴涵和哥德尔蕴涵。结果表明,这两种方法都可以用来建立量子程序的部分正确性。将量子规划的可加不变量的生成问题简化为半定规划问题。该方法与SDP求解器一起用于生成两种重要的量子算法——量子行走和量子Metropolis抽样的不变量。我们的例子表明,所生成的不变量可以用来验证这些算法的正确性,并有助于优化量子Metropolis采样。据我们所知,本文是第一次尝试定义不变量的概念,并开发一种量子程序的不变量生成方法。
{"title":"Invariants of quantum programs: characterisations and generation","authors":"M. Ying, Shenggang Ying, Xiaodi Wu","doi":"10.1145/3009837.3009840","DOIUrl":"https://doi.org/10.1145/3009837.3009840","url":null,"abstract":"Program invariant is a fundamental notion widely used in program verification and analysis. The aim of this paper is twofold: (i) find an appropriate definition of invariants for quantum programs; and (ii) develop an effective technique of invariant generation for verification and analysis of quantum programs. Interestingly, the notion of invariant can be defined for quantum programs in two different ways -- additive invariants and multiplicative invariants -- corresponding to two interpretations of implication in a continuous valued logic: the Lukasiewicz implication and the Godel implication. It is shown that both of them can be used to establish partial correctness of quantum programs. The problem of generating additive invariants of quantum programs is addressed by reducing it to an SDP (Semidefinite Programming) problem. This approach is applied with an SDP solver to generate invariants of two important quantum algorithms -- quantum walk and quantum Metropolis sampling. Our examples show that the generated invariants can be used to verify correctness of these algorithms and are helpful in optimising quantum Metropolis sampling. To our knowledge, this paper is the first attempt to define the notion of invariant and to develop a method of invariant generation for quantum programs.","PeriodicalId":20657,"journal":{"name":"Proceedings of the 44th ACM SIGPLAN Symposium on Principles of Programming Languages","volume":"28 1","pages":""},"PeriodicalIF":0.0,"publicationDate":"2017-01-01","publicationTypes":"Journal Article","fieldsOfStudy":null,"isOpenAccess":false,"openAccessPdf":"","citationCount":null,"resultStr":null,"platform":"Semanticscholar","paperid":"88236776","PeriodicalName":null,"FirstCategoryId":null,"ListUrlMain":null,"RegionNum":0,"RegionCategory":"","ArticlePicture":[],"TitleCN":null,"AbstractTextCN":null,"PMCID":"","EPubDate":null,"PubModel":null,"JCR":null,"JCRName":null,"Score":null,"Total":0}
引用次数: 40
Big types in little runtime: open-world soundness and collaborative blame for gradual type systems 大类型在短时间内运行:开放世界的稳定性和渐进类型系统的协作责备
Michael M. Vitousek, Cameron Swords, Jeremy G. Siek
Gradual typing combines static and dynamic typing in the same language, offering programmers the error detection and strong guarantees of static types and the rapid prototyping and flexible programming idioms of dynamic types. Many gradually typed languages are implemented by translation into an untyped target language (e.g., Typed Clojure, TypeScript, Gradualtalk, and Reticulated Python). For such languages, it is desirable to support arbitrary interaction between translated code and legacy code in the untyped language while maintaining the type soundness of the translated code. In this paper we formalize this goal in the form of the open-world soundness criterion. We discuss why it is challenging to achieve open-world soundness using the traditional proxy-based approach for higher-order casts. However, the transient design satisfies open-world soundness. Indeed, we present a formal semantics for the transient design and prove that our semantics satisfies open-world soundness. In this paper we also solve a challenging problem for the transient design: how to provide blame tracking without proxies. We define a semantics for blame and prove the Blame Theorem. We also prove that the Gradual Guarantee holds for this system, ensuring that programs can be evolved freely between static and dynamic typing. Finally, we demonstrate that the runtime overhead of the transient approach is low in the context of Reticulated Python, an implementation of gradual typing for Python.
渐进类型在同一语言中结合了静态类型和动态类型,为程序员提供了静态类型的错误检测和强有力的保证,以及动态类型的快速原型和灵活的编程习惯。许多渐进式类型语言是通过翻译成非类型化的目标语言来实现的(例如,typed Clojure, TypeScript, Gradualtalk和Reticulated Python)。对于这样的语言,在保持已翻译代码的类型稳健性的同时,支持未类型化语言中已翻译代码和遗留代码之间的任意交互是可取的。在本文中,我们将这一目标形式化为开放世界稳健性准则。我们讨论了为什么使用传统的基于代理的方法来实现高阶转换的开放世界稳健性是具有挑战性的。然而,瞬态设计满足开放世界稳健性。实际上,我们给出了暂态设计的形式化语义,并证明了该语义满足开放世界完备性。本文还解决了暂态设计中一个具有挑战性的问题:如何在没有代理的情况下提供故障跟踪。我们定义了一个责备的语义,并证明了责备定理。我们还证明渐进式保证适用于这个系统,确保程序可以在静态类型和动态类型之间自由地演化。最后,我们证明了瞬态方法在网状Python上下文中的运行时开销很低,网状Python是Python渐进类型的实现。
{"title":"Big types in little runtime: open-world soundness and collaborative blame for gradual type systems","authors":"Michael M. Vitousek, Cameron Swords, Jeremy G. Siek","doi":"10.1145/3009837.3009849","DOIUrl":"https://doi.org/10.1145/3009837.3009849","url":null,"abstract":"Gradual typing combines static and dynamic typing in the same language, offering programmers the error detection and strong guarantees of static types and the rapid prototyping and flexible programming idioms of dynamic types. Many gradually typed languages are implemented by translation into an untyped target language (e.g., Typed Clojure, TypeScript, Gradualtalk, and Reticulated Python). For such languages, it is desirable to support arbitrary interaction between translated code and legacy code in the untyped language while maintaining the type soundness of the translated code. In this paper we formalize this goal in the form of the open-world soundness criterion. We discuss why it is challenging to achieve open-world soundness using the traditional proxy-based approach for higher-order casts. However, the transient design satisfies open-world soundness. Indeed, we present a formal semantics for the transient design and prove that our semantics satisfies open-world soundness. In this paper we also solve a challenging problem for the transient design: how to provide blame tracking without proxies. We define a semantics for blame and prove the Blame Theorem. We also prove that the Gradual Guarantee holds for this system, ensuring that programs can be evolved freely between static and dynamic typing. Finally, we demonstrate that the runtime overhead of the transient approach is low in the context of Reticulated Python, an implementation of gradual typing for Python.","PeriodicalId":20657,"journal":{"name":"Proceedings of the 44th ACM SIGPLAN Symposium on Principles of Programming Languages","volume":"81 1","pages":""},"PeriodicalIF":0.0,"publicationDate":"2017-01-01","publicationTypes":"Journal Article","fieldsOfStudy":null,"isOpenAccess":false,"openAccessPdf":"","citationCount":null,"resultStr":null,"platform":"Semanticscholar","paperid":"74515322","PeriodicalName":null,"FirstCategoryId":null,"ListUrlMain":null,"RegionNum":0,"RegionCategory":"","ArticlePicture":[],"TitleCN":null,"AbstractTextCN":null,"PMCID":"","EPubDate":null,"PubModel":null,"JCR":null,"JCRName":null,"Score":null,"Total":0}
引用次数: 45
期刊
Proceedings of the 44th ACM SIGPLAN Symposium on Principles of Programming Languages
全部 Acc. Chem. Res. ACS Applied Bio Materials ACS Appl. Electron. Mater. ACS Appl. Energy Mater. ACS Appl. Mater. Interfaces ACS Appl. Nano Mater. ACS Appl. Polym. Mater. ACS BIOMATER-SCI ENG ACS Catal. ACS Cent. Sci. ACS Chem. Biol. ACS Chemical Health & Safety ACS Chem. Neurosci. ACS Comb. Sci. ACS Earth Space Chem. ACS Energy Lett. ACS Infect. Dis. ACS Macro Lett. ACS Mater. Lett. ACS Med. Chem. Lett. ACS Nano ACS Omega ACS Photonics ACS Sens. ACS Sustainable Chem. Eng. ACS Synth. Biol. Anal. Chem. BIOCHEMISTRY-US Bioconjugate Chem. BIOMACROMOLECULES Chem. Res. Toxicol. Chem. Rev. Chem. Mater. CRYST GROWTH DES ENERG FUEL Environ. Sci. Technol. Environ. Sci. Technol. Lett. Eur. J. Inorg. Chem. IND ENG CHEM RES Inorg. Chem. J. Agric. Food. Chem. J. Chem. Eng. Data J. Chem. Educ. J. Chem. Inf. Model. J. Chem. Theory Comput. J. Med. Chem. J. Nat. Prod. J PROTEOME RES J. Am. Chem. Soc. LANGMUIR MACROMOLECULES Mol. Pharmaceutics Nano Lett. Org. Lett. ORG PROCESS RES DEV ORGANOMETALLICS J. Org. Chem. J. Phys. Chem. J. Phys. Chem. A J. Phys. Chem. B J. Phys. Chem. C J. Phys. Chem. Lett. Analyst Anal. Methods Biomater. Sci. Catal. Sci. Technol. Chem. Commun. Chem. Soc. Rev. CHEM EDUC RES PRACT CRYSTENGCOMM Dalton Trans. Energy Environ. Sci. ENVIRON SCI-NANO ENVIRON SCI-PROC IMP ENVIRON SCI-WAT RES Faraday Discuss. Food Funct. Green Chem. Inorg. Chem. Front. Integr. Biol. J. Anal. At. Spectrom. J. Mater. Chem. A J. Mater. Chem. B J. Mater. Chem. C Lab Chip Mater. Chem. Front. Mater. Horiz. MEDCHEMCOMM Metallomics Mol. Biosyst. Mol. Syst. Des. Eng. Nanoscale Nanoscale Horiz. Nat. Prod. Rep. New J. Chem. Org. Biomol. Chem. Org. Chem. Front. PHOTOCH PHOTOBIO SCI PCCP Polym. Chem.
×
引用
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