Link Search Menu Expand Document

Buddy Compiler

Buddy Compiler is a domain-specific compiler infrastructure. We use “buddy” as the name because we want to build a buddy system to help users easily design, implement, and evaluate domain-specific compilers.

Buddy Compiler community is an open source community, where we explore intriguing features and implement ideas for compiler infrastructure by working together. Join us through this slack link if you want to contribute.

Buddy Compiler As A Service (Buddy-CAAS) is an online platform that serves users and developers to configure the pass pipeline and demonstrate on multiple backends quickly and smoothly. Click here to explore and experiment with our online platform. For more details, please see Buddy-CAAS documentation.

GitHub

Motivation

Our goal is to address the challenges of combining domain-specific languages (DSLs) and domain-specific architectures (DSAs) by providing our compiler-level infrastructure, Buddy Compiler. Built on top of MLIR and RISC-V, Buddy Compiler aims to create a unified ecosystem that unlocks more software-hardware co-design opportunities. Such ecosystem can simplify the development process and accelerate optimize performance, making it easy for users to develop their own compilers.

With the rapid development of applications demanded for high computing power, general-purpose processors can not meet computing needs in the context of expiration of Moore’s Law. By utilizing DSLs and DSAs, developers can leverage the benefits of both to optimize the performance and efficiency of the computations within a targeted domain. However, Combining DSLs and DSAs presents some challenges in various aspects, including development complexity, performance trade-offs, and tooling support. Our goal is to provide an infrastructure at the compiler level to explore solutions to these problems.

The combined DSL-DSA solutions involve various software-hardware co-design techniques. We claim that a unified ecosystem can get more opportunities for co-design, and we particularly embrace the MLIR and RISC-V ecosystem. MLIR is a revolutionary multi-level intermediate representation and compiler infrastructure that provides reusable and extensible mechanisms. RISC-V is an open-sourced instruction set architecture with a modular design for custom extensions. Both MLIR and RISC-V have extensible concepts to maximize the reuse of base parts, which is suitable for domain-specific design. Buddy Compiler is based on MLIR and has specific support for RISC-V, especially with respect to vectorization.

For more information, please see our documents and open projects.

Overview

Currently, the buddy compiler contains the following two modules:

  • buddy-mlir (get started from here)

The buddy-mlir is the main framework of Buddy Compiler. We use MLIR as the cornerstone and explore how to build a domain-specific compiler on top of it. Our research in this framework includes DSL frontend support, IR-level optimization, DSA backend code generation, MLIR-related development tools, etc.

  • buddy-benchmark (get started from here)

The buddy-benchmark is a benchmark framework to evaluate domain-specific compilers and libraries. Evaluation is an essential step in developing a compiler. We can hardly find a unified benchmark to evaluate compiler or optimization in some domains. We thus propose an extensible benchmark framework to collect domain-specific evaluation cases.

The graph below shows the modules of the buddy compiler.

overview

Publications and Presentations

  • Compiler Technologies in Deep Learning Co-Design: A Survey - Link
  • AutoConfig: A Configuration-Driven Automated Mechanism for Deep Learning Compilation Optimization - Link
  • Buddy Compiler @ CGO C4ML Workshop 2024 - Poster / Link
  • Buddy Compiler @ EuroLLVM 2023
    • Buddy Compiler: An MLIR-based Compilation Framework for Deep Learning Co-design - Link
    • RISC-V Vector Extension Support in MLIR: Motivation, Abstraction, and Application - Link
    • Image Processing Ops as first class citizens in MLIR: write once, vectorize everywhere! - Link
    • Buddy-CAAS: Compiler As A Service for MLIR - Link

Next Steps

If you are interested in our project, you can play around with examples in buddy-mlir and buddy-benchmark. Then you can see if there are projects in the list that appeal to you; feel free to contact us via slack for more details. We also provide a contributor guide for you if you want to contribute your code.