Skip to main content

MPACT retargetable ML compiler

Project description

The MPACT Project

Introduction

The MPACT project's main objective is to dramatically reduce the effort required to create highly optimizing HPC and ML compilers for a large class of architectures using LLVM and MLIR. We do this by providing a declarative language-based mechanism for collecting and expressing critical aspects of a target architecture in a way that can be reasoned about and leveraged by all passes in both MLIR and LLVM.

Building the MPACT compiler

To build and run the MPACT compiler from source (for developers), please follow the steps below.

Check out code and sync submodules

Use the following commands to clone the MPACT compiler repository.

git clone https://github.com/MPACT-ORG/mpact-compiler.git
cd mpact-compiler
git submodule update --init --recursive --progress

All following commands assume you remain in the mpact-compiler directory.

Setup Python virtual environment

The following commands initialize a virtual environment.

python3.11 -m venv mpact_venv  # one time set up
source mpact_venv/bin/activate # for each session

Also make sure to set the Python paths as follows.

export PYTHONPATH=`pwd`/build/tools/mpact/python_packages/mpact

Install build requirements

Note that currently we rely on torch-mlir requirements defined in the submodule to ensure all the build requirements are consistent.

python -m pip install --upgrade pip
python -m pip install -r externals/torch-mlir/requirements.txt
python -m pip install -r externals/torch-mlir/torchvision-requirements.txt

Building the MPACT compiler in-tree

The following command generates configuration files to build the MPACT compiler project completely in-tree, which means that both LLVM as well as torch-mlir are built from source.

cmake -GNinja -Bbuild \
  -DCMAKE_BUILD_TYPE=Release \
  -DPython3_FIND_VIRTUALENV=ONLY \
  -DLLVM_ENABLE_PROJECTS=mlir \
  -DLLVM_EXTERNAL_PROJECTS="torch-mlir;mpact" \
  -DLLVM_EXTERNAL_TORCH_MLIR_SOURCE_DIR="${PWD}/externals/torch-mlir" \
  -DLLVM_EXTERNAL_MPACT_SOURCE_DIR="${PWD}" \
  -DLLVM_TARGETS_TO_BUILD=host \
  -DMLIR_ENABLE_BINDINGS_PYTHON=ON \
  externals/torch-mlir/externals/llvm-project/llvm

Run the following to ensure the MPACT compiler builds and runs correctly.

cmake --build build --target check-mpact

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distributions

No source distribution files available for this release.See tutorial on generating distribution archives.

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

mpact-20240607-cp310-cp310-manylinux_2_17_x86_64.manylinux2014_x86_64.whl (53.3 MB view details)

Uploaded CPython 3.10manylinux: glibc 2.17+ x86-64

File details

Details for the file mpact-20240607-cp310-cp310-manylinux_2_17_x86_64.manylinux2014_x86_64.whl.

File metadata

File hashes

Hashes for mpact-20240607-cp310-cp310-manylinux_2_17_x86_64.manylinux2014_x86_64.whl
Algorithm Hash digest
SHA256 805a05affb2e3c90e198bea36c767c865ac9c0a1a9bed8a85c6b1acaa3ebd4a1
MD5 0574263129910a696bd8f1b2a7451f50
BLAKE2b-256 5f9e6ce8b0f51b31b8dae568d52aa0ffb3f9e297250b0e25fa3990e7a537b48a

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page