cornell-zhang/hcl-dialect

CMake errors in Installation

Closed this issue · 3 comments

I am using a clean environment to compile the code: Ubuntu 20.04.3 LTS with gcc version 9.3.0

LLVM/MLIR has built successfully under /root/llvm-project/build/ and then installed under /usr/local

Here is the error I got from CMake

export PREFIX=/usr/local/
export BUILD_DIR=/root/llvm-project/build/
root@fdf4f2c8cc83:~/hcl-dialect-prototype/build# cmake -G "Unix Makefiles" ..    -DMLIR_DIR=$PREFIX/lib/cmake/mlir    -DLLVM_EXTERNAL_LIT=$BUILD_DIR/bin/llvm-lit
-- Using MLIRConfig.cmake in: /usr/local//lib/cmake/mlir
-- Using LLVMConfig.cmake in: /usr/local/lib/cmake/llvm
-- Building with -fPIC
-- Configuring done
CMake Error at /usr/local/lib/cmake/llvm/AddLLVM.cmake:1801 (add_dependencies):
  The dependency target "FileCheck" of target "check-heterocl-memory" does
  not exist.
Call Stack (most recent call first):
  /usr/local/lib/cmake/llvm/AddLLVM.cmake:1853 (add_lit_target)
  test/CMakeLists.txt:20 (add_lit_testsuites)

But even with these CMake errors, I am still able to compile hcl-opt and run through the test cases successfully.

Updated README. Please set -DLLVM_INSTALL_UTILS=ON when compiling LLVM, which can install FileCheck.

@chhzh123 another HEADER_NOT_FOUND error.

[ 92%] Building CXX object include/hcl/Bindings/Python/CMakeFiles/HCLMLIRPythonModules.extension._hcl.dso.dir/__/__/__/__/lib/Bindings/Python/HCLModule.cpp.o
/root/hcl-dialect-prototype/lib/Bindings/Python/HCLModule.cpp:16:10: fatal error: mlir/../../lib/Bindings/Python/IRModule.h: No such file or directory
 #include "mlir/../../lib/Bindings/Python/IRModule.h"
          ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
compilation terminated.
make[2]: *** [include/hcl/Bindings/Python/CMakeFiles/HCLMLIRPythonModules.extension._hcl.dso.dir/build.make:76: include/hcl/Bindings/Python/CMakeFiles/HCLMLIRPythonModules.extension._hcl.dso.dir/__/__/__/__/lib/Bindings/Python/HCLModule.cpp.o] Error 1
make[2]: *** Waiting for unfinished jobs....
make[1]: *** [CMakeFiles/Makefile2:834: include/hcl/Bindings/Python/CMakeFiles/HCLMLIRPythonModules.extension._hcl.dso.dir/all] Error 2
make[1]: *** Waiting for unfinished jobs....

Here is the dockerfile I used to build the dialect

FROM centos:latest
ENV DEBIAN_FRONTEND=noninteractive

# build essentials
RUN yum update -y && yum install -y python3-devel git wget cmake vim gdb gcc gcc-c++ kernel-devel make

# install conda env
WORKDIR /root/
RUN wget https://repo.anaconda.com/miniconda/Miniconda3-latest-Linux-x86_64.sh -O ~/miniconda.sh && \
    bash ~/miniconda.sh -b -p $HOME/miniconda && \
    eval "$(~/miniconda/bin/conda shell.bash hook)" && \
    conda create --name hcl-dev python=3.8 -y && \
    conda activate hcl-dev

RUN cd /root/ && git clone https://github.com/llvm/llvm-project.git && \
    cd llvm-project && \
    git checkout tags/llvmorg-13.0.0 -b v13.0.0 && \
    python3 -m pip install --upgrade pip && \
    python3 -m pip install -r mlir/python/requirements.txt && \
    mkdir build && cd build && \
    cmake -G "Unix Makefiles" ../llvm -DLLVM_ENABLE_PROJECTS=mlir \
        -DLLVM_BUILD_EXAMPLES=ON -DLLVM_TARGETS_TO_BUILD="X86" \
        -DCMAKE_BUILD_TYPE=Release -DLLVM_ENABLE_ASSERTIONS=ON \
        -DLLVM_INSTALL_UTILS=ON -DMLIR_ENABLE_BINDINGS_PYTHON=ON \
        -DPython3_EXECUTABLE=`which python3` && \
    mkdir tools/mlir/python/dialects && \
    make -j`nproc` && make install
ENV PYTHONPATH /root/llvm-project/build/tools/mlir/python_packages/mlir_core:${PYTHONPATH}

# build HeteroCL dialect
RUN cd /root/ && export TOKEN="github personal token" && \
    export BUILD_DIR=/root/llvm-project/build && \
    export PREFIX=/usr/local && \
    git clone https://$TOKEN@github.com/cornell-zhang/hcl-dialect-prototype.git && \
    cd hcl-dialect-prototype && mkdir build && cd build && \
    cmake -G "Unix Makefiles" .. \
        -DMLIR_DIR=$PREFIX/lib/cmake/mlir \
        -DLLVM_EXTERNAL_LIT=$BUILD_DIR/bin/llvm-lit \
        -DPYTHON_BINDING=ON \
        -DPython3_EXECUTABLE=`which python3` && \
    make -j`nproc`
ENV PYTHONPATH /root/hcl-dialect-prototype/build/tools/hcl/python_packages/hcl_core:${PYTHONPATH}

# test
RUN cmake --build . --target check-hcl
RUN ./bin/hcl-translate --emit-hlscpp ../test/memory/buffer_conv.mlir

Fixed in #2