Skip to main content
QUICK REVIEW

[Paper Review] DLVM: A modern compiler infrastructure for deep learning

Richard Wei, Vikram Adve|arXiv (Cornell University)|Nov 8, 2017
Parallel Computing and Optimization TechniquesComputer Science2 citations
TL;DR

DLVM is a modern, modular compiler infrastructure for deep learning that uses a linear algebra intermediate representation, adjoint code generation for automatic differentiation, domain-specific optimizations, and LLVM-based GPU code generation. Built as a staged DSL in Swift, it enables safe, high-performance, and composable deep learning frameworks with strong type safety and expressivity.

ABSTRACT

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.

Motivation & Objective

  • To address the limitations of existing deep learning frameworks, which are often unsafe, monolithic, and built as Python DSLs with runtime interpretation.
  • To design a modular and extensible compiler infrastructure inspired by LLVM, supporting high-level tensor DSLs with strong type safety.
  • To enable efficient, correct, and portable code generation for GPUs using LLVM's optimization and code generation pipeline.
  • To support algorithmic differentiation via adjoint code generation, ensuring correctness and performance in gradient computation.
  • To demonstrate that a staged DSL in Swift can achieve both high expressivity and performance in deep learning systems.

Proposed method

  • Designing a linear algebra intermediate representation (IR) that natively expresses tensor operations and enables high-level optimizations.
  • Implementing algorithmic differentiation through adjoint code generation, which systematically derives gradient code from forward computation.
  • Integrating domain-specific optimizations such as fusion, layout transformation, and tiling to improve performance.
  • Leveraging LLVM's infrastructure for code generation, enabling portable and efficient GPU kernel compilation.
  • Building a staged DSL embedded in Swift to express deep learning models with full type safety and modularity.
  • Using a modular compiler pipeline where each phase (frontend, IR, optimization, code generation) is composable and reusable.

Experimental results

Research questions

  • RQ1Can a compiler infrastructure based on a linear algebra IR achieve both high performance and high expressivity in deep learning workloads?
  • RQ2How does adjoint code generation compare to other automatic differentiation techniques in terms of correctness and performance?
  • RQ3To what extent can domain-specific optimizations in a modular compiler stack improve inference and training efficiency?
  • RQ4Can a staged DSL in a systems language like Swift provide the safety and performance of low-level code while retaining the productivity of high-level DSLs?
  • RQ5How does DLVM's modularity and generality compare to monolithic deep learning frameworks in practice?

Key findings

  • DLVM's linear algebra IR enables high-level, composable, and optimizable representations of deep learning models with strong type safety.
  • Adjoint code generation ensures correct and efficient gradient computation, avoiding common pitfalls of source-to-source or operator-overloading AD.
  • Domain-specific optimizations such as computation fusion and layout-aware transformations significantly improve kernel performance on GPU.
  • The staged DSL in Swift demonstrates that high-level, safe, and performant deep learning frameworks are achievable without sacrificing expressivity.
  • By reusing LLVM's optimization and code generation pipeline, DLVM achieves portable and efficient GPU code generation with competitive performance.

Read this paper

Open the full text in the Nubint reader and ask about any passage as you read.

Read this paper on Nubint

This review was generated by AI from the original paper. Please check the paper before citing it.