apache / tvm

Open deep learning compiler stack for cpu, gpu and specialized accelerators
https://tvm.apache.org/
Apache License 2.0
11.83k stars 3.48k forks source link

[Bug] bundle_deploy examples no longer work, cannot get rid of "CRT not found" errors #17105

Open oleggolev opened 5 months ago

oleggolev commented 5 months ago

Expected behavior

I am following the instructions for AoT compilation of AI models here. Specifically, I built tvm from source with set(USE_LLVM ON), set(USE_MICRO ON), and set(USE_MICRO_STANDALONE_RUNTIME ON). I should expect to be able to run make inside the tvm/apps/bundle_deploy directory to compile some example inference code into standalone executables.

Actual behavior

Always getting the following error:

ls: ../../build/standalone_crt: No such file or directory
Makefile:24: *** "CRT not found. Ensure you have built the standalone_crt target and try again".  Stop.

The following are the contents of my build directory after building tvm with set(USE_LLVM ON), set(USE_MICRO ON), and set(USE_MICRO_STANDALONE_RUNTIME ON) changed in tvm/cmake/config.cmake:

CMakeCache.txt                  DartConfiguration.tcl           Testing                         cpptest[1]_include.cmake        libtvm_runtime.dylib
CMakeFiles                      Makefile                        cmake_install.cmake             libbacktrace                    temp_config_file.cmake
CTestTestfile.cmake             TVMBuildOptions.txt             compile_commands.json           libtvm.dylib                    tvmConfig.cmake

Environment

I tried doing this on bare metal Intel MacOS as well as via the below Dockerfile with the same results / error.

Steps to reproduce

  1. Pull down tvm locally.
  2. Edit tvm/cmake/config.smake to enable set(USE_LLVM ON), set(USE_MICRO ON), set(USE_MICRO_STANDALONE_RUNTIME ON)
  3. Build the image with docker build -f Dockerfile.tvm -t tvm-bundle-test .

Here is the reference Dockerfile:

FROM ubuntu:22.04

ENV http_proxy $HTTPS_PROXY
ENV https_proxy $HTTPS_PROXY
ENV DEBIAN_FRONTEND=noninteractive 

RUN apt-get update
RUN apt-get install -y software-properties-common && add-apt-repository ppa:deadsnakes/ppa && apt-get update && apt-get install -y \
    python3.8 \
    python3-pip \
    && rm -rf /var/lib/apt/lists/*

# Copy the current directory contents into the container at /app.
WORKDIR /app
COPY . /app

# Install CMake and enable dev packaging from third-party source: https://apt.kitware.com/
RUN apt-get update
RUN apt-get -y install gpg wget ca-certificates
RUN wget -O - https://apt.kitware.com/keys/kitware-archive-latest.asc 2>/dev/null | gpg --dearmor - | tee /usr/share/keyrings/kitware-archive-keyring.gpg >/dev/null
RUN echo 'deb [signed-by=/usr/share/keyrings/kitware-archive-keyring.gpg] https://apt.kitware.com/ubuntu/ jammy main' | tee /etc/apt/sources.list.d/kitware.list >/dev/null
RUN apt-get update
RUN test -f /usr/share/doc/kitware-archive-keyring/copyright || rm /usr/share/keyrings/kitware-archive-keyring.gpg
RUN apt-get install kitware-archive-keyring
RUN apt-get -y install cmake

# Get other TVM dependencies.
RUN apt-get install -y python3 python3-dev python3-setuptools gcc libtinfo-dev zlib1g-dev build-essential libedit-dev libxml2-dev llvm

# Actually build TVM.
WORKDIR /app/tvm
RUN cmake -DCMAKE_BUILD_TYPE=Release -S . -B build
RUN make -j4 -C build

Triage

Please refer to the list of label tags here to find the relevant tags and add them below in a bullet format (example below).

2448900355 commented 5 months ago

版本问题

xgdgsc commented 2 months ago

I set set(USE_MICRO ON), and set(USE_MICRO_STANDALONE_RUNTIME ON) and it can proceed but ends with a

python3 build_model.py -o build
make: *** [build/model_cpp.o] Bus error