In this paper, we introduce DELAM, a dependent layered modal type theory which enables meta-programming in Martin-L & ouml;f type theory (MLTT) with recursion principles on open code. DELAM includes three layers: ...
详细信息
In this paper, we introduce DELAM, a dependent layered modal type theory which enables meta-programming in Martin-L & ouml;f type theory (MLTT) with recursion principles on open code. DELAM includes three layers: the layer of static syntax objects of MLTT without any computation, the layer of pure MLTT with the computational behaviors, and the meta-programming layer, which extends MLTT with support for quoting an open MLTT code object, composing, and analyzing open code using recursion. We can also execute a code object at the meta-programming layer. The expressive power strictly increases as we move up in a given layer. In particular, while code objects only describe static syntax, we allow computation at the MLTT and meta-programming layer. As a result, DELAM provides a dependently typed foundation for meta-programming that supports both type-safe code generation and code analysis. We prove the weak normalization of DELAM and the decidability of convertibility using Kripke logical relations.
meta-programming is the art of writing programs that produce or manipulate other programs. This allows programmers to automate error-prone or repetitive tasks, and exploit domain-specific knowledge to customize the ge...
详细信息
ISBN:
(纸本)9798400713507
meta-programming is the art of writing programs that produce or manipulate other programs. This allows programmers to automate error-prone or repetitive tasks, and exploit domain-specific knowledge to customize the generated code. Unfortunately, writing safe meta-programs remains very challenging, since errors in the generated code are usually only detected when running it, but not at the time when code is generated. How can we design a flexible and expressive meta-programming framework where we provide a range of safety guarantees about the code that is being generated and the code generator itself? We revisit Cocon, a type-theoretic framework for certified meta-programming. Cocon is two-level type theory: at its base is the logical framework LF where we can represent domain-specific languages (DSL) ranging from simply-typed to polymorphic languages;on top sits a Martin-L of type theory where we can write recursive programs and proofs about those DSLs using pattern matching. In particular, when the DSL is contained in Martin-L of type theory we can use reflection and leverage MLTT's evaluation to execute programs written in a given DSL. Hence, we can derive type-safe meta-programming systems for a range of DSLs.
We report our experience with exploring a new point in the design space for formal reasoning systems: the development of the programming language Omega mega. Omega mega is intended as both a practical programming lang...
详细信息
We report our experience with exploring a new point in the design space for formal reasoning systems: the development of the programming language Omega mega. Omega mega is intended as both a practical programming language and a logic. The main goal of Omega mega is to allow programmers to describe and reason about semantic properties of programs from within the programming language itself, mainly by using a powerful type system. We illustrate the main features of Omega mega by developing an interesting meta-programming example. First, we show how to encode a set of well-typed simply typed lambda- calculus terms as an Omega mega data-type. Then, we show how to implement a substitution operation on these terms that is guaranteed by the Omega mega type system to preserve their well-typedness.
Transforming models based on their textual representation is a cumbersome task. This is particularly the case for Event-B, where the predominant representation is a set of XML files. As a consequence, tool support is ...
详细信息
ISBN:
(纸本)9783031637896;9783031637902
Transforming models based on their textual representation is a cumbersome task. This is particularly the case for Event-B, where the predominant representation is a set of XML files. As a consequence, tool support is lacking, even for minor refactoring operations. The contribution of this paper extends the lisb library with a front and backend based on Event-B. The aim is to bring benefits, that have been demonstrated for classical B, such as an easily transformable data representation of formal specifications as well as creation of custom DSLs and tooling, to Event-B. We see great benefits of such a meta-programming approach for formal specifications and advocate that similar mechanisms will be sensible extensions to the expressiveness of formal methods. Ultimately, our work facilitates language extensions (e.g., re-introducing if-then-else constructs to Event-B which generate multiple events or a proper macro system to avoid code duplication) and tool support (e.g., refactoring tools or automatic refinement).
Writing high performance GPGPU code is often difficult and time-consuming, potentially requiring laborious manual tuning of low-level details. Despite these challenges, the cost in ignoring GPUs in high performance co...
详细信息
ISBN:
(纸本)9781450338073
Writing high performance GPGPU code is often difficult and time-consuming, potentially requiring laborious manual tuning of low-level details. Despite these challenges, the cost in ignoring GPUs in high performance computing is increasingly large. Auto-tuning is a potential solution to the problem of tedious manual tuning. We present a framework for auto-tuning GPU kernels which are expressed in an embedded DSL, and which expose compile-time parameters for tuning. Our framework allows for kernels to be polymorphic over what search strategy will tune them, and allows search strategies to be implemented in the same metalanguage as the kernel-generation code (Haskell). Further, we show how to use functional programming abstractions to enforce regular (hyper-rectangular) search spaces. We also evaluate several common search strategies on a variety of kernels, and demonstrate that the framework can tune both EDSL and ordinary CUDA code.
Many modern application domains crucially rely on tensor operations. The optimization of programs that operate on tensors poses difficulties that are not adequately addressed by existing languages and tools. Framework...
详细信息
ISBN:
(纸本)9781450360456
Many modern application domains crucially rely on tensor operations. The optimization of programs that operate on tensors poses difficulties that are not adequately addressed by existing languages and tools. Frameworks such as TensorFlow offer good abstractions for tensor operations, but target a specific domain, i.e. machine learning, and their optimization strategies cannot easily be adjusted to other domains. General-purpose optimization tools such as Pluto and existing meta-languages offer more flexibility in applying optimizations but lack abstractions for tensors. This work closes the gap between domain-specific tensor languages and general-purpose optimization tools by proposing the Tensor optimizations meta-Language (TEML). Ton offers high-level abstractions for both tensor operations and loop transformations, and enables flexible composition of transformations into effective optimization paths. This compositionality is built into TEML's design, as our formal language specification will reveal. We also show that TEML can express tensor computations as comfortably as TensorFlow and that it can reproduce Pluto's optimization paths. Thus, optimized programs generated by TEML execute at least as fast as the corresponding Pluto programs. In addition, TEML enables optimization paths that often allow outperforming Pluto.
Continuing advances in heterogeneous and parallel computing enable massive performance gains in domains such as AI and HPC. Such gains often involve using hardware accelerators, such as FPGAs and GPUs, to speed up spe...
详细信息
ISBN:
(纸本)9781450396608
Continuing advances in heterogeneous and parallel computing enable massive performance gains in domains such as AI and HPC. Such gains often involve using hardware accelerators, such as FPGAs and GPUs, to speed up specific workloads. However, to make effective use of emerging heterogeneous architectures, optimisation is typically done manually by highly-skilled developers with in-depth understanding of the target hardware. The process is tedious, error-prone, and must be repeated for each new application. This paper introduces Design-Flow Patterns, which capture modular, recurring application-agnostic elements involved in mapping and optimising application descriptions onto efficient CPU and GPU targets. Our approach is the first to codify and programmatically coordinate these elements into fully automated, customisable, and reusable end-to-end design-flows. We implement key design-flow patterns using the meta-programming tool Artisan, and evaluate automated design-flows applied to three sequential C++ applications. Compared to single-threaded implementations, our approach generates multi-threaded OpenMP CPU designs achieving up to 18 times speedup on a CPU platform with 32-threads, as well as HIP GPU designs achieving up to 1184 times speedup on an NVIDIA GeForce RTX 2080 Ti GPU.
In this paper, we construct inequivalent Hadamard matrices based on several new and old full orthogonal designs, using circulant and symmetric block matrices. Not all orthogonal designs produce inequivalent Hadamard m...
详细信息
In this paper, we construct inequivalent Hadamard matrices based on several new and old full orthogonal designs, using circulant and symmetric block matrices. Not all orthogonal designs produce inequivalent Hadamard matrices, because the corresponding systems of equations do not possess solutions. In addition, we give some new constructions for orthogonal designs derived from sequences with zero autocorrelation. The orthogonal designs used to construct the inequivalent Hadamard matrices are produced from theoretical and algorithmic constructions. (C) 2009 IMACS. Published by Elsevier By. All rights reserved.
This paper provides the first program logic for homogeneous generative run-time meta-programming using a variant of MiniML(e)(square) by Davies and Pfenning as its underlying on language. We show the applicability of ...
详细信息
This paper provides the first program logic for homogeneous generative run-time meta-programming using a variant of MiniML(e)(square) by Davies and Pfenning as its underlying on language. We show the applicability of our approach by reasoning about example meta-programs from the literature. We also demonstrate that our logics are relatively complete in the sense of Cook, enable the inductive derivation of characteristic formulae, and exactly capture the observational properties induced by the operational semantics.
By allowing the programmer to write code that can generate code at run-time, meta-programming offers a powerful approach to program construction. For instance, meta-programming can often be employed to enhance program...
详细信息
ISBN:
(纸本)9781581137569
By allowing the programmer to write code that can generate code at run-time, meta-programming offers a powerful approach to program construction. For instance, meta-programming can often be employed to enhance program efficiency and facilitate the construction of generic programs. However, meta-programming, especially in an untyped setting, is notoriously error-prone. In this paper, we aim at making meta-programming less error-prone by providing a type system to facilitate the construction of correct meta-programs. We first introduce some code constructors for constructing typeful code representation in which program variables are replaced with deBruijn indices, and then formally demonstrate how such typeful code representation can be used to support meta-programming. The main contribution of the paper lies in recognition and then formalization of a novel approach to typed meta-programming that is practical, general and flexible.
暂无评论