Skip to content

kumasento/polsca

Repository files navigation

POLSCA: Polyhedral High-Level Synthesis in MLIR

Build and Test GitHub release (latest by date) GitHub GitHub issues GitHub pull requests

POLSCA used to be called Phism. There are still references to Phism in this repository. We will potentially fix them in the future.

What is Phism?

Phism is an HLS tool: it transforms C programs to hardware designs.

Phism leverages MLIR and enjoys the progressive lowering idea to build the full compilation pipeline. The ability to apply a full range of compilation transformations in an organized, layered way is what Phism stands out from other tools.

Phism optimises hardware design generation through polyhedral modelling, a powerful technique that especially good at transforming statically scheduled nested loops for better parallelism and locality.

How to build?

Prerequisites

Please find how to setup the prerequisites here.

Build LLVM

Phism uses Polygeist to process C/C++ code into MLIR. But before we built Polygeist, we need to build the LLVM package within Polygeist (polygeist/llvm-project). This LLVM package will be shared by Polygeist, Polymer (later), and Phism.

First of all, make sure you've initialized all the submodules.

git submodule update --init --recursive

You may see many submodules being synced -- don't worry, they are simply required by Pluto, the polyhedral optimizer that Phism uses.

To build LLVM, Just run the following script. It should take care of everything you need.

./scripts/build-llvm.sh

Build Polygeist

It is another one-liner:

./scripts/build-polygeist.sh

Build Polymer

Polymer provides the functionality to interact MLIR code with polyhedral scheduler.

There is also a script for you -

./scripts/build-polymer.sh

Build Phism

Finally, you're all prepared to build Phism! Just type in the following commands:

./scripts/build-phism.sh

It should run the Phism regression test in the end. And if all the tests passed, hooray!

Usage

Using Docker

This doc gives an introduction on how to run Phism with docker.

Evaluation and benchmarking

Polybench

Polybench is the major benchmark we look at. It contains 30 different examples covering programs that can be potentially optimised by polyhedral transformation. The benchmark suite is located at example/polybench, and you can find our report here.