Binding-time analysis determines when variables and expressions in a program can be bound to their values, distinguishing between early (compile-time) and late (run-time) binding. Binding-time information can be used by compilers to produce more efficient target programs by partially evaluating programs at compile-time. Binding-time analysis has been formulated in abstract interpretation contexts and more recently in a type-theoretic setting.In a type-theoretic setting binding-time analysis is a type inference problem: the problem of inferring a completion of a λ-term e with binding-time annotations such that e satisfies the typing rules. Nielson and Nielson and Schmidt have shown that every simply typed λ-term has a unique completionê that minimizes late binding in TML, a monomorphic type system with explicit binding-time annotations, and they present exponential time algorithms for computing such minimal completions. 1 Gomard proves the same results for a variant of his two-level λ-calculus without a so-called "lifting" rule. He presents another algorithm for inferring completions in this somewhat restricted type system and states that it can be implemented in time O(n 3 ). He conjectures that the completions computed are minimal.In this paper we expand and improve on Gomard's work in the following ways.• We identify the combinatorial core of type inference for binding-time analysis in Gomard's type system with "lifting" by effectively characterizing it as solving a specific class of constraints on type expressions.• We present normalizing transformations on these constraints that preserve their solution sets, and we use the resultant normal forms to prove constructively the existence of minimal solutions, which yield minimal completions; this sharpens the minimal completion result of Gomard and extends it to the full type system with "lifting".• We devise a very efficient algorithm for computing minimal completions. It is a refinement of a fast unification algorithm, and an amortization argument shows that a fast union/find-based implementation executes in almost-linear time, O(nα(n, n)
1Our results are for the two-level type system of Gomard, but we believe they are also adaptable to the Nielsons' TML. Our algorithm improves the computational complexity of computing minimal completions from exponential time to almost-linear time. It also improves on Gomard's polynomial time completion algorithm by a quadratic factor and as such appears to be the first efficient algorithm that provably computes minimal completions.
Abstract. Binding time analysis is an important part of off-line partial evaluation, annotating expressions as being safely evaluable from known data or possibly depending on unknown data. Polymorphism gives a much simpler definition than the known polyvariant schemes allowing us to reason formally about the system and prove it correct. This paper is based on work in [14].
Futhark is a purely functional data-parallel array language that offers a machine-neutral programming model and an optimising compiler that generates OpenCL code for GPUs.
This paper presents the design and implementation of three key features of Futhark that seek a suitable middle ground with imperative approaches.
First, in order to express efficient code inside the parallel constructs, we introduce a simple type system for in-place updates that ensures referential transparency and supports equational reasoning.
Second, we furnish Futhark with parallel operators capable of expressing efficient strength-reduced code, along with their fusion rules.
Third, we present a flattening transformation aimed at enhancing the degree of parallelism that (i) builds on loop interchange and distribution but uses higher-order reasoning rather than array-dependence analysis, and (ii) still allows further locality-of-reference optimisations. Finally, an evaluation on 16 benchmarks demonstrates the impact of the language and compiler features and shows application-level performance competitive with hand-written GPU code.
scite is a Brooklyn-based organization that helps researchers better discover and understand research articles through Smart Citations–citations that display the context of the citation and describe whether the article provides supporting or contrasting evidence. scite is used by students and researchers from around the world and is funded in part by the National Science Foundation and the National Institute on Drug Abuse of the National Institutes of Health.