Skip to content

Latest commit

 

History

History
248 lines (183 loc) · 13.7 KB

File metadata and controls

248 lines (183 loc) · 13.7 KB

Driver Compiler Build FAQ & Troubleshooting Guide

Corresponding Commits Required for OpenVINO and NPU-Plugin

When building the Driver Compiler for Linux, ensure you use a supported OpenVINO version.

You can find the required OpenVINO version in the release notes under "OpenVINO built from source" or in the Linux NPU driver source.

Common Clone Failure Issues

If you encounter errors like the following when cloning repositories, you may need to configure your proxy:

fatal: unable to access 'https://github.com/your-repo.git/': Could not resolve host: github.com
fatal: unable to access 'https://github.com/your-repo.git/': Failed to connect to github.com port 443: Connection timed out
fatal: unable to access 'https://github.com/your-repo.git/': Received HTTP code 407 from proxy after CONNECT
Set up proxy
# Linux
export http_proxy=<http://proxy_link:port>
export https_proxy=<http://proxy_link:port>
export no_proxy=<no_proxy>

# Windows
set http_proxy=<http://proxy_link:port>
set https_proxy=<http://proxy_link:port>
set no_proxy=<no_proxy>

Common Build and Install Issues

For installation, it is not recommended to use cmake --install . --prefix /usr --component CiD as this will also install elf, compilerTest, and other CiD targets which are unnecessary.

Linux Build Issues

  • Error: c++: internal compiler error: Killed (program cc1plus)
    Cause: Usually due to insufficient memory.
    Solution: Reduce the number of parallel build jobs (e.g., use -j4 instead of -j8), or increase swap space.

Windows Build Issues

  1. Clone error: filename too long
    Run: git config --global core.longpaths true and enable the long path feature on Windows as follows or this image: Open the Registry Editor, go to HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Control\FileSystem, and set the DWORD value LongPathsEnabled to 1.
  2. MT/MD mismatch error:
    If your commit is earlier than d0719b79c5847 (2024-08-28), do not add -D CMAKE_TOOLCHAIN_FILE=%OPENVINO_HOME%\cmake\toolchains\onecoreuap.toolchain.cmake.
  3. Ccache is required for Windows build preset:
    If ccache is not installed, you may see CreateProcess failed: The system cannot find the file specified during the cmake --build ... step.

TBB-Related Questions

Choosing the Right TBB (Linux & Windows)

  • OpenVINO auto-download: OpenVINO will automatically download a prebuilt oneTBB (see ${OPENVINO_HOME}/temp/tbb), if
    1. ENABLE_SYSTEM_TBB is set to OFF, and
    2. CMake option -D TBBROOT=/path/to/alternative/oneTBB is not passed, and
    3. Environment variable TBBROOT is not set.
  • System oneTBB: To use the system TBB, set -D ENABLE_SYSTEM_TBB=ON for CMake.
  • Custom oneTBB: Download or build your own oneTBB from the oneTBB Project and set TBBROOT environment variable.

Note: If you plan to use the sideloading feature on Windows, we recommend using the OneCore version of TBB. The official release version of TBB does not support OneCore, so please manually compile it according to the documentation. For instructions on how to build OneCore TBB, please see how to build OneCore TBB.

  • No TBB: Not recommended, as build speed will decrease. You can set -D THREADING=SEQ for CMake to disable TBB.

Windows OneCore TBB Build

  • Build OneCore oneTBB by yourself. You must build hwloc first, then build oneTBB. See the detailed steps below.

    1. Clone repository and build hwloc

    The hwloc library is a dependency of the tbbbind_2_5 binary, so its version must be determined before proceeding with the build. The correct version can be confirmed by dumping the tbbbind_2_5_debug.lib binary. The corresponding hwloc version is 2.8.0 for oneTBB library v2021.2.5.

    Download the ZIP folder from here, unzip, build the library or follow the commands below. Next, clone oneTBB and build oneTBB with MultiThreaded,

    set WORKDIR=%cd%
    
    curl -L -o hwloc-2.8.0.zip https://github.com/open-mpi/hwloc/archive/refs/tags/hwloc-2.8.0.zip
    tar -xf hwloc-2.8.0.zip
    cd hwloc-hwloc-2.8.0\contrib\windows-cmake
    cmake -A X64 --install-prefix=%cd%\install -DHWLOC_SKIP_TOOLS=ON -DHWLOC_WITH_LIBXML2=OFF -DBUILD_SHARED_LIBS=ON -D CMAKE_MSVC_RUNTIME_LIBRARY="MultiThreaded" -B build
    cmake --build build --parallel --config Release
    cmake --install build --config Release
    
    set HWLOC_INSTALL_DIR=%WORKDIR%\hwloc-hwloc-2.8.0\contrib\windows-cmake\install
    
    cd %WORKDIR%
    git clone https://github.com/uxlfoundation/oneTBB.git oneTBB-2021.2.5-static
    cd oneTBB-2021.2.5-static
    git checkout v2021.2.5
    @REM Use another directory for dynamic build
    cd ..
    xcopy oneTBB-2021.2.5-static oneTBB-2021.2.5-dynamic /E /H /I /Q
    
    @REM set command build option environment variable.
    @REM CMAKE_MSVC_RUNTIME_LIBRARY="MultiThreaded" build with MT
    set buildOption=-D CMAKE_INSTALL_PREFIX=%cd%\install ^
        -D CMAKE_HWLOC_2_5_LIBRARY_PATH=%HWLOC_INSTALL_DIR%\lib\hwloc.lib ^
        -D CMAKE_HWLOC_2_5_INCLUDE_PATH=%HWLOC_INSTALL_DIR%\include ^
        -D CMAKE_HWLOC_2_5_DLL_PATH=%HWLOC_INSTALL_DIR%\bin\hwloc.dll ^
        -D TBB_TEST=OFF ^
        -D CMAKE_MSVC_RUNTIME_LIBRARY="MultiThreaded"
    2. Static oneTBB build
    set TBB_HOME=%WORKDIR%\oneTBB-2021.2.5-static
    cd %TBB_HOME%
    
    mkdir build_static
    cd build_static
    
    cmake ^
        -G "Visual Studio 16 2019" -A X64 ^
        -D BUILD_SHARED_LIBS=OFF ^
        %buildOption% ^
        ..
    
    cmake --build . --config Release
    cmake --install . --config Release
    cmake --build . --config Debug
    cmake --install . --config Debug
    
    copy ..\LICENSE.txt install\LICENSE
    copy %HWLOC_INSTALL_DIR%\bin\hwloc.dll install\lib

    All static oneTBB .lib libraries will be found in the build_static\install folder.

    3. Dynamic oneTBB build
    set TBB_HOME=%WORKDIR%\oneTBB-2021.2.5-dynamic
    
    cd %TBB_HOME%
    mkdir build_dynamic
    cd build_dynamic
    
    cmake ^
        -G "Visual Studio 16 2019" -A X64 ^
        -D BUILD_SHARED_LIBS=ON ^
        %buildOption% ^
        ..
    
    cmake --build . --config Release
    cmake --install . --config Release
    cmake --build . --config Debug
    cmake --install . --config Debug
    
    copy ..\LICENSE.txt install\LICENSE
    copy %HWLOC_INSTALL_DIR%\bin\hwloc.dll install\bin

    All dynamic oneTBB .lib and .dll libraries will be found in the build_dynamic\install folder.

TBB Settings for CMake Presets

  • You can set TBBROOT via environment variable or in the preset's cacheVariables.

    Add TBBROOT option to Cmake Preset

    Adding the path to TBBROOT in cacheVariables, under cid preset, as shown below:

    "name": "cid",
    "cacheVariables": {
        "TBBROOT": {
            "type": "FILEPATH",
            "value": "/path/to/alternative/oneTBB"
        }
    }

    Linux Cmake Preset usage is listed here. Windows Cmake Preset usage is listed here.

  • To disable TBB, set THREADING=SEQ.

    Disable oneTBB commands

    To build Driver Compiler without using oneTBB library (longer model compile time), replace "value": "TBB" with "value": "SEQ" for THREADING in cacheVariables under cid (see here).

    "name": "cid",
    "cacheVariables": {
        "THREADING": {
            "type": "STRING",
            "value": "SEQ"
        },
    },

    Refer to this document for information related to SEQ threading.

TBB Usage with LLVM Cache

  • Any TBB version can be used when generating the LLVM cache, but when building with the cache, the parameters must match those in build_manifest.txt.
  • Please note that when using sideloading on Windows, you must use the OneCore version of oneTBB.

VCL Related Questions

VCL BuildFlags and Compilation Options

General Format: "--inputs_precisions=\"input1:P1 input2:P2 input3:P3 ... inputN:PN\" --inputs_layouts=\"input1:L1 input2:L2 input3:L3 ... inputN:LN\" --outputs_precisions=\"output1:P1 output2:P2 output3:P3 ... outputN:PN\" --outputs_layouts=\"output1:L1 output2:L2 output3:L3 ... outputN:LN\" --config [CONFIG_OPTIONS]

Example: "--inputs_precisions=\"input_node_name:fp16\" --inputs_layouts=\"input_node_name:NCHW\" --outputs_precisions=\"output_node_name:fp16\" --outputs_layouts=\"output_node_name:NC\" --config NPU_PLATFORM=\"4000\" [OTHER_OPTIONS]

List of supported precisions and supported layouts.

The BuildFlags, which is also the options member from vcl_executable_desc_t struct, consists of 2 main parts, which are the I/O Layout & Precisions, and config (such as log level, NPU Platform). In the current VCL API, I/O layouts and I/O precisions are no longer mandatory for all models. Hence, it is not recommended to pass I/O Layouts & I/O Precisions manually unless absolutely necessary.

Only for IRv10 models, users are allowed to override the original values by passing different I/O Layouts and I/O Precisions manually (For example forcing an IRV10 FP32 model to run in FP16). Passing different I/O Layouts and I/O Precisions values to an IRv11 model will not override the original value.

BuildFlag format

The options member from vcl_executable_desc_t struct corresponds to the configuration of the legacy usage of compilerTest. If you pass a config file to compilerTest, the options should match the content of your config file. Alternatively, you can also construct the options string directly. In order to generate the options for vcl_executable_desc_t struct you should do the following:

  • Use XML file of IR model to get the options content (It is recommended to use this method to obtain the input configuration. For output node names, see the next section for a more convenient approach):

  • Find the input layer with type Parameter, e.g., "". Take the name attribute as input node name.

  • Find the output layer with type Result, e.g., "", then locate its preceding node to determine the output node name. The reason for using the name of the node preceding the Result node in the config file is based on the code. The final string format of options should be "--inputs_precisions=\"input:fp16\" --inputs_layouts=\"input:C\" --outputs_precisions=\"output:fp16\" --outputs_layouts=\"output:C\" --config NPU_PLATFORM=\"4000\"". - For multiple inputs or outputs, separate each entry with a space, e.g., --inputs_precisions=/"input1:fp16 input2:u8/" --inputs_layouts=/"input1:C input2:C/" --outputs_precisions=/"output1:fp16 output2:fp32/" --outputs_layouts=/"output1:C output2:C/" --config NPU_PLATFORM=/"4000/"

    • For config-related content, you can refer to this README.md to see the supported properties.
  • Use a visualization tool (such as Netron) to easily find the output node names:

  • For example, using Netron: - Enter the URL, click Open Model..., then select the model you want to use and click open. Wait for the network visualization to load. - Press Ctrl + F to search for ‘result’ nodes. Click on these nodes, and the corresponding node will be displayed directly. Click the node preceding the result node to view its attributes in the sidebar. Find the name attribute, which is the name of the output node to use in the config.

  • Use benchmark_app to obtain the options member. If you have the benchmark_app tool from OpenVINO Project, you can also use this method to generate the content of the options. Please refer to the legacy test method.

Additional Notes

If you need further clarification or have additional questions, please refer to the main documentation in this repo or contact the development team.