DLVM
Modern Compiler Infrastructure for Deep Learning Systems
Introduction
Deep learning software demands reliability and performance. However, many of the existing deep learning frameworks are software libraries that act as an unsafe DSL in Python and a computation graph interpreter.
We present DLVM, a design and implementation of a compiler infrastructure with a linear algebra intermediate representation, algorithmic differentiation by adjoint code generation, domain-specific optimizations, and a code generator targeting GPU via LLVM.
Designed as a modern compiler infrastructure inspired by LLVM, DLVM is more modular and more generic than existing deep learning compiler frameworks, and supports tensor DSLs with high expressivity. With our prototypical staged DSL embedded in Swift, we argue that the DLVM system enables a form of modular, safe, and performant frameworks for deep learning.
DLVM started as a research project at University of Illinois at Urbana-Champaign.
Update: The authors of this project are no longer maintaining DLVM, but instead developing Swift for TensorFlow, a project providing first-class language and compiler support for machine learning in Swift. Watch the TensorFlow Dev Summit 2018 video for more information.
Swift for TensorFlow is now open-source! Visit the documentation repository for more details.
Demos
NNKit is a staged DSL embedded in Swift. It:
- Features a natural expression for tensor computations
- Is type-safe, leveraging Swift’s static type system
- Uses lightweight modular staging to perform JIT compilation to DLVM IR
The DLVM Intermediate Representation (IR) is the core language of the DLVM system. It:
- Uses static single assignment (SSA) form
- Has high-level types, including a first-class tensor type
- Features linear algebra operators, along with a general-purpose instruction set
- Supports many domain-specific transformations (e.g. reverse-mode AD, algebra simplification)
The Swift code above is JIT compiled by NNKit to the following DLVM IR:
More information about NNKit and DLVM IR will be published soon.
Publications
- “A modern compiler framework for neural network DSLs”
- Richard Wei, Lane Schwartz and Vikram Adve
- ML Systems Workshop at NIPS 2017 - slides
- “A modern compiler infrastructure for deep learning systems with adjoint code generation in a domain-specific IR”
- Richard Wei, Lane Schwartz and Vikram Adve
- Autodiff Workshop at NIPS 2017
- “DLVM: A modern compiler infrastructure for deep learning systems”
- Richard Wei, Lane Schwartz and Vikram Adve
- Pre-print
Projects
All projects are written in Swift.
- DLVM Core
- The core compiler infrastructure: IR, analyses, automatic differentiation, optimization passes, and back-end code generator.
- NNKit
- A “tagless-final” neural network DSL embedded in Swift, representing a form of deep learning toolkits focusing on safety and developer experience.
- The Tensor Expression Language (TEL)
- A standalone DSL for declaratively building neural network computation graphs, with a compiler that emits DLVM IR and generates a Swift interface.