• Stars
    star
    481
  • Rank 91,384 (Top 2 %)
  • Language
    C++
  • License
    Other
  • Created over 4 years ago
  • Updated 2 months ago

Reviews

There are no reviews yet. Be the first to send feedback to the community and the maintainers!

Repository Details

C/C++ frontend for MLIR. Also features polyhedral optimizations, parallel optimizations, and more!

Build instructions

Requirements

  • Working C and C++ toolchains(compiler, linker)
  • cmake
  • make or ninja

1. Clone Polygeist

git clone --recursive https://github.com/llvm/Polygeist
cd Polygeist

2. Install LLVM, MLIR, Clang, and Polygeist

Option 1: Using pre-built LLVM, MLIR, and Clang

Polygeist can be built by providing paths to a pre-built MLIR and Clang toolchain.

  1. Build LLVM, MLIR, and Clang:
mkdir llvm-project/build
cd llvm-project/build
cmake -G Ninja ../llvm \
  -DLLVM_ENABLE_PROJECTS="mlir;clang" \
  -DLLVM_TARGETS_TO_BUILD="host" \
  -DLLVM_ENABLE_ASSERTIONS=ON \
  -DCMAKE_BUILD_TYPE=DEBUG
ninja
ninja check-mlir

To enable compilation to cuda add -DMLIR_ENABLE_CUDA_RUNNER=1 and remove -DLLVM_TARGETS_TO_BUILD="host" from the cmake arguments. (You may need to specify CUDACXX, CUDA_PATH, and/or -DCMAKE_CUDA_COMPILER)

To enable the ROCM backend add -DMLIR_ENABLE_ROCM_RUNNER=1 and remove -DLLVM_TARGETS_TO_BUILD="host" from the cmake arguments. (You may need to specify -DHIP_CLANG_INCLUDE_PATH, and/or ROCM_PATH)

For faster compilation we recommend using -DLLVM_USE_LINKER=lld.

  1. Build Polygeist:
mkdir build
cd build
cmake -G Ninja .. \
  -DMLIR_DIR=$PWD/../llvm-project/build/lib/cmake/mlir \
  -DCLANG_DIR=$PWD/../llvm-project/build/lib/cmake/clang \
  -DLLVM_TARGETS_TO_BUILD="host" \
  -DLLVM_ENABLE_ASSERTIONS=ON \
  -DCMAKE_BUILD_TYPE=DEBUG
ninja
ninja check-polygeist-opt && ninja check-cgeist

To enable compilation to cuda add -DPOLYGEIST_ENABLE_CUDA=1

To enable the ROCM backend add -DPOLYGEIST_ENABLE_ROCM=1

For faster compilation we recommend using -DPOLYGEIST_USE_LINKER=lld.

Option 2: Using unified LLVM, MLIR, Clang, and Polygeist build

Polygeist can also be built as an external LLVM project using LLVM_EXTERNAL_PROJECTS.

  1. Build LLVM, MLIR, Clang, and Polygeist:
mkdir build
cd build
cmake -G Ninja ../llvm-project/llvm \
  -DLLVM_ENABLE_PROJECTS="clang;mlir" \
  -DLLVM_EXTERNAL_PROJECTS="polygeist" \
  -DLLVM_EXTERNAL_POLYGEIST_SOURCE_DIR=.. \
  -DLLVM_TARGETS_TO_BUILD="host" \
  -DLLVM_ENABLE_ASSERTIONS=ON \
  -DCMAKE_BUILD_TYPE=DEBUG
ninja
ninja check-polygeist-opt && ninja check-cgeist

ninja check-polygeist-opt runs the tests in Polygeist/test/polygeist-opt ninja check-cgeist runs the tests in Polygeist/tools/cgeist/Test

More Repositories

1

llvm-project

The LLVM Project is a collection of modular and reusable compiler and toolchain technologies.
LLVM
28,809
star
2

circt

Circuit IR Compilers and Tools
C++
1,527
star
3

torch-mlir

The Torch-MLIR project aims to provide first class support from the PyTorch ecosystem to the MLIR ecosystem.
C++
1,344
star
4

clangir

A new (MLIR based) high-level IR for clang.
LLVM
377
star
5

llvm-test-suite

Logos
130
star
6

mlir-www

SCSS
60
star
7

llvm-zorg

Python
51
star
8

vscode-mlir

TypeScript
45
star
9

llvm-www

HTML
28
star
10

llvm-blog-www

The LLVM Project Blog
HTML
23
star
11

clangd-www

Markdown
22
star
12

llvm-lnt

Python
21
star
13

llvm-iwg

The LLVM Infrastructure Working Group
18
star
14

circt-www

CIRCT website
SCSS
10
star
15

llvm-project-staging

Staging repository for https://github.com/llvm/llvm-project. Used for official contributions to the LLVM project that LLVM contributors will collaboratively split up for regular patch review.
10
star
16

llvm-project-release-prs

Repository for pull requests used for testing release branch backports in llvm/llvm-project
9
star
17

llvm-www-pubs

HTML
9
star
18

actions

TypeScript
8
star
19

llvm-archive

Archive of old/discontinued llvm projects, converted from SVN.
7
star
20

wg-hlsl

HLSL Working Group documentation and task tracking.
Python
7
star
21

llvm-foundation-www

LLVM Foundation Website
SCSS
6
star
22

www-releases

HTML
5
star
23

llvm-bugzilla-archive

4
star
24

llvm-project-legacy-branches

Miscellaneous unofficial branches and tags converted from svn.
C++
3
star
25

llvm-admin

Internal repository for LLVM admin scripts
Python
3
star
26

torch-mlir-release

Automated releases for torch-mlir
3
star
27

temp-issue-tester

Repository for testing GitHub issue features
Python
2
star
28

Community.o

Community.o website and other resources
1
star
29

llvm-project-ci-bridge

llvm/llvm-project mirrior to facilitate the integration between Phabricator and Buildkite.
1
star
30

llvm-security-test-repo

Repo to test filing security issues
1
star