diff --git a/README.md b/README.md index 8211bbea11a6600af683a9429358b21906c70d53..9636e021be439b18c71744e69446aae4ceeed0e5 100644 --- a/README.md +++ b/README.md @@ -21,12 +21,14 @@ HPVM is currently at version 0.5. For more about what HPVM is, see [our website] ## Dependencies The following components are required to be installed on your machine to build HPVM. -* GCC (>=5.1.0) -* CMake (>=3.17.0) -* Python (>=2.7) -* GNU Make (>=3.79.1) -* OpenCL (>=1.0.0) or CUDA (>=9.1, only required for GPU support) - +* GCC (>=5.1) + * In addition, each version of CUDA-nvcc requires GCC to be not newer than a certain version. + See [here](https://gist.github.com/ax3l/9489132) for the support matrix. +* CMake (>=3.17) +* Python (>=3.7) with Pip +* GNU Make (>=3.79) +* OpenCL (>=1.0.0) +* CUDA (>=9.1) ## Supported Targets Supported/tested CPU architectures: @@ -45,17 +47,20 @@ HPVM has not been tested but might work on other CPUs supported by LLVM Backend, Checkout HPVM: ```shell -git clone https://gitlab.engr.illinois.edu/llvm/hpvm-release.git/ +git clone --recursive https://gitlab.engr.illinois.edu/llvm/hpvm-release.git/ cd hpvm-release/hpvm ``` -Before installing HPVM, some paths must be set for installation to succeed. The following variables in set_paths.sh must be set: +HPVM needs to be able to find CUDA. +If CUDA is installed in your system's $PATH (e.g. if it was installed at the default location), +HPVM can find CUDA automatically. +Otherwise, some environment variables are required: -* CUDA_TOOLKIT_PATH --- Path to the CUDA toolkit -* CUDA_INCLUDE_PATH --- Path to the CUDA headers -* CUDA_LIB_PATH -- Path to CUDA libraries +* `CUDA_TOOLKIT_PATH` --- Path to the CUDA toolkit +* `CUDA_INCLUDE_PATH` --- Path to the CUDA headers +* `CUDA_LIB_PATH` --- Path to CUDA libraries -Once the aforementioned variables in set_paths.sh have been specified, run the script. +`hpvm/set_paths.sh` can be used for this. Modify the values of these variables in set_paths.sh and source the script: ```shell source set_paths.sh ``` @@ -78,6 +83,9 @@ mkdir build cd build cmake ../llvm [options] ``` +**Note** that if the installer script was not used, +you must _manually add `build/bin` directory to your $PATH variable_ (as absolute path). + Some common options that can be used with CMake are: * -DCMAKE_INSTALL_PREFIX=directory --- Specify for directory the full pathname of where you want the HPVM tools and libraries to be installed. @@ -112,5 +120,3 @@ We are also providing [unit tests](/hpvm/test/unitTests) and [regression tests]( ## Support All questions can be directed to [hpvm-dev@lists.cs.illinois.edu](mailto:hpvm-dev@lists.cs.illinois.edu). - - diff --git a/hpvm/docs/tradeoff-curves/alexnet_imagenet.pdf b/hpvm/docs/tradeoff-curves/alexnet_imagenet.pdf index c8e433e37e8ac7414bdcaec24c40f776b44705ac..b0e0ec99473c01e4e2809fc16a298fe81e993376 100644 Binary files a/hpvm/docs/tradeoff-curves/alexnet_imagenet.pdf and b/hpvm/docs/tradeoff-curves/alexnet_imagenet.pdf differ diff --git a/hpvm/docs/tradeoff-curves/alexnet_imagenet_tradeoff.pdf b/hpvm/docs/tradeoff-curves/alexnet_imagenet_tradeoff.pdf new file mode 100644 index 0000000000000000000000000000000000000000..b3bcc6e53b091d0c8ac317fe8f3d9cfb6a79fb80 Binary files /dev/null and b/hpvm/docs/tradeoff-curves/alexnet_imagenet_tradeoff.pdf differ diff --git a/hpvm/docs/tradeoff-curves/resnet50_imagenet.pdf b/hpvm/docs/tradeoff-curves/resnet50_imagenet.pdf index 20e72078a2a119a0679d4f8b5be59c6d3df6738c..6d3be5c8ad19198902b15ff818f2984644026ae0 100644 Binary files a/hpvm/docs/tradeoff-curves/resnet50_imagenet.pdf and b/hpvm/docs/tradeoff-curves/resnet50_imagenet.pdf differ diff --git a/hpvm/docs/tradeoff-curves/resnet50_imagenet_tradeoff.pdf b/hpvm/docs/tradeoff-curves/resnet50_imagenet_tradeoff.pdf new file mode 100644 index 0000000000000000000000000000000000000000..67d3651bf15ab0b7c1350988846072fd712f4b4f Binary files /dev/null and b/hpvm/docs/tradeoff-curves/resnet50_imagenet_tradeoff.pdf differ diff --git a/hpvm/scripts/llvm_installer.sh b/hpvm/scripts/llvm_installer.sh index f9600b8fc3b83a93585338f6863d7cafcedd8f79..3ed7fd3a951d27dedc9b84adf82835a0eedbd1e2 100755 --- a/hpvm/scripts/llvm_installer.sh +++ b/hpvm/scripts/llvm_installer.sh @@ -231,6 +231,8 @@ if [ ! -d $INSTALL_DIR ]; then mkdir -p $INSTALL_DIR fi +export PATH=$BUILD_DIR/bin:$PATH + cd $BUILD_DIR echo cmake ../$LLVM_SRC -DCMAKE_C_COMPILER=gcc -DCMAKE_CXX_COMPILER=g++ -DLLVM_TARGETS_TO_BUILD=$TARGET -DCMAKE_INSTALL_PREFIX=$INSTALL_DIR cmake ../$LLVM_SRC -DCMAKE_C_COMPILER=gcc -DCMAKE_CXX_COMPILER=g++ -DLLVM_TARGETS_TO_BUILD=$TARGET -DCMAKE_INSTALL_PREFIX=$INSTALL_DIR diff --git a/hpvm/tools/py-approxhpvm/CMakeLists.txt b/hpvm/tools/py-approxhpvm/CMakeLists.txt index 0d6a7fe71bd78f987dfcd7e7f5c6831154c065e7..e46c45623f13034e1cb4c5b1ed2434ec40d4c12c 100644 --- a/hpvm/tools/py-approxhpvm/CMakeLists.txt +++ b/hpvm/tools/py-approxhpvm/CMakeLists.txt @@ -52,8 +52,8 @@ set( ) add_custom_command( OUTPUT ${PROJECT_BINARY_DIR}/bin/approxhpvm.py - COMMAND mv ${CMAKE_CURRENT_BINARY_DIR}/main.py ${PROJECT_BINARY_DIR}/bin/approxhpvm.py + COMMAND cp ${CMAKE_CURRENT_BINARY_DIR}/main.py ${PROJECT_BINARY_DIR}/bin/approxhpvm.py COMMAND chmod +x ${PROJECT_BINARY_DIR}/bin/approxhpvm.py DEPENDS ${DEPS} ${CMAKE_CURRENT_BINARY_DIR}/main.py ) -add_custom_target(approxhpvm.py DEPENDS ${PROJECT_BINARY_DIR}/bin/approxhpvm.py) +add_custom_target(approxhpvm.py ALL DEPENDS ${PROJECT_BINARY_DIR}/bin/approxhpvm.py) diff --git a/hpvm/tools/py-approxhpvm/main.py.in b/hpvm/tools/py-approxhpvm/main.py.in index 9305b8a25a18541f545a1925947b1abe4465a3f8..752a7609ca0831838949b037ac7b8c0323ac8871 100644 --- a/hpvm/tools/py-approxhpvm/main.py.in +++ b/hpvm/tools/py-approxhpvm/main.py.in @@ -1,4 +1,4 @@ -#!/usr/bin/env python +#!/usr/bin/env python3 import argparse import os from pathlib import Path @@ -7,7 +7,7 @@ from typing import List, Union, Optional PathLike = Union[Path, str] HPVM_PROJECT_DIR = Path("@LLVM_PROJECT_DIR@") / "tools/hpvm" -LLVM_BUILD_DIR = Path("@LLVM_BUILD_DIR@") +LLVM_BUILD_DIR = Path("@LLVM_BUILD_DIR@") / "bin" CUDA_TOOLKIT_ROOT_DIR = Path("@CUDA_TOOLKIT_ROOT_DIR@") TENSOR_RUNTIME_LIBS = "@TENSOR_RUNTIME_LIBS@".split(";") AVAILABLE_PASSES = "@AVAILABLE_PASSES@".split(";") @@ -74,7 +74,7 @@ def hpvm_c_to_ll( includes = [f"-I{path}" for path in INCLUDE_DIRS + extra_includes] flags = [f"-{flg}" for flg in (flags or []) + COMPILE_FLAGS] return [ - "clang++", *includes, *flags, "-emit-llvm", "-S", + str(LLVM_BUILD_DIR / "clang++"), *includes, *flags, "-emit-llvm", "-S", str(src_file), "-o", str(target_file) ] @@ -114,14 +114,14 @@ def opt_codegen_tensor( def link_hpvm_rt(src_file: PathLike, target_file: PathLike) -> List[str]: - return ["llvm-link", str(src_file), HPVM_RT_PATH, "-o", str(target_file)] + return [str(LLVM_BUILD_DIR / "llvm-link"), str(src_file), HPVM_RT_PATH, "-o", str(target_file)] def link_binary(src_file: PathLike, target_file: PathLike) -> List[str]: linker_dir_flags = [f"-L{path}" for path in LINK_DIRS] linker_lib_flags = [f"-l{lib}" for lib in LINK_LIBS] return [ - "clang++", str(src_file), *TENSOR_RUNTIME_LIBS, "-o", str(target_file), + str(LLVM_BUILD_DIR / "clang++"), str(src_file), *TENSOR_RUNTIME_LIBS, "-o", str(target_file), *linker_dir_flags, *linker_lib_flags ] @@ -138,7 +138,7 @@ def _run_opt( load_passes_strs = [s for pass_ in pass_names for s in ["-load", f"{pass_}.so"]] pass_flags_strs = [f"-{flag}" for flag in pass_flags] return [ - "opt", *load_passes_strs, *pass_flags_strs, + str(LLVM_BUILD_DIR / "opt"), *load_passes_strs, *pass_flags_strs, "-S", str(src_file), "-o", str(target_file) ]