diff --git a/CMakePresets.json b/CMakePresets.json index f48d991b27..6a0559cbf7 100644 --- a/CMakePresets.json +++ b/CMakePresets.json @@ -213,7 +213,7 @@ }, { - "name": "Cid", + "name": "cid", "hidden": true, "description": "Cid build necessary options. Please note the path of NPU plugin when use.", "cacheVariables": { @@ -233,86 +233,113 @@ } }, { - "name": "NpuCidRelease", - "description": "Default configuration for NPU Driver Compiler target build. Please note: 1) Please make sure that NPU_PLUGIN_HOME environment variable is set to NPU plugin path. 2) build Cid is a static build which only build related targets and not include other unrelated options and targets to avoid getting big generated files.", + "name": "npuCidReleaseLinux", + "description": "Default configuration for NPU Driver Compiler target build on Linux. Please note: 1) Please make sure that NPU_PLUGIN_HOME environment variable is set to NPU plugin path. 2) build Cid is a static build which only build related targets and not include other unrelated options and targets to avoid getting big generated files.", "binaryDir": "${sourceDir}/build-x86_64/Release", - "displayName": "NpuCidRelease", - "inherits": ["Cid", "BuildOptimization", "Disabler"], + "displayName": "npuCidRelease", + "inherits": ["cid", "BuildOptimization", "Disabler"], "cacheVariables": { "CMAKE_BUILD_TYPE": { "type": "STRING", "value": "Release" }, - "ENABLE_MULTI": false, - "ENABLE_AUTO": false, - "ENABLE_AUTO_BATCH": false, - "ENABLE_PROXY": false, - "ENABLE_HETERO": false, - "ENABLE_INTEL_CPU": false, - "ENABLE_INTEL_GPU": false, - "ENABLE_TEMPLATE": false, + "ENABLE_LTO": false, + "ENABLE_FASTER_BUILD": false, + "ENABLE_CPPLINT": false, + + "ENABLE_TESTS": false, + "ENABLE_FUNCTIONAL_TESTS": false, + "ENABLE_SAMPLES": false, + + "ENABLE_JS": false, + + "ENABLE_PYTHON": false, + "ENABLE_PYTHON_PACKAGING": false, + "ENABLE_WHEEL": false, "ENABLE_OV_ONNX_FRONTEND": false, "ENABLE_OV_PADDLE_FRONTEND": false, "ENABLE_OV_PYTORCH_FRONTEND": false, "ENABLE_OV_TF_FRONTEND": false, "ENABLE_OV_TF_LITE_FRONTEND": false, + "ENABLE_OV_JAX_FRONTEND": false, + "ENABLE_SYSTEM_TBB": false, + "ENABLE_TBB_RELEASE_ONLY": false, "ENABLE_OPENCV": false, - "ENABLE_BLOB_DUMP": false, - "ENABLE_TESTS": false, - "ENABLE_FUNCTIONAL_TESTS": false, + "ENABLE_MULTI": false, + "ENABLE_AUTO": false, + "ENABLE_AUTO_BATCH": false, + "ENABLE_PROXY": false, + "ENABLE_HETERO": false, + "ENABLE_INTEL_CPU": false, + "ENABLE_INTEL_GPU": false, + "ENABLE_TEMPLATE": false, - "ENABLE_SYSTEM_TBB": false, - "ENABLE_TBB_RELEASE_ONLY": false, - "ENABLE_JS": false, - "ENABLE_NPU_PROTOPIPE": false + "ENABLE_ZEROAPI_BACKEND": false, + "ENABLE_DRIVER_COMPILER_ADAPTER": false, + "ENABLE_INTEL_NPU_INTERNAL": false, + + "ENABLE_NPU_PROTOPIPE": false, + "ENABLE_NPU_LSP_SERVER":false } }, { - "name": "ovNpuCidRelease", - "description": "Default configuration for NPU Driver Compiler target build. Please note: 1) it builds NPU plugin in OpenVINO project tree. Please make sure that NPU plugin is located inside OpenVINO repo in modules/vpux folder. 2) build Cid is a static build which only build related targets and not include other unrelated options and targets to avoid getting big generated files.", + "name": "npuCidReleaseWindows", + "description": "Default configuration for NPU Driver Compiler target build on Windows. Please note: 1) Please make sure that NPU_PLUGIN_HOME environment variable is set to NPU plugin path. 2) build Cid is a static build which only build related targets and not include other unrelated options and targets to avoid getting big generated files.", "binaryDir": "${sourceDir}/build-x86_64/Release", - "displayName": "ovNpuCidRelease", - "inherits": ["Cid", "BuildOptimization", "Disabler"], + "displayName": "npuCidRelease", + "inherits": ["cid", "BuildOptimization", "Disabler"], "cacheVariables": { "CMAKE_BUILD_TYPE": { "type": "STRING", "value": "Release" }, - "ENABLE_MULTI": false, - "ENABLE_AUTO": false, - "ENABLE_AUTO_BATCH": false, - "ENABLE_PROXY": false, - "ENABLE_HETERO": false, - "ENABLE_INTEL_CPU": false, - "ENABLE_INTEL_GPU": false, - "ENABLE_TEMPLATE": false, + "CMAKE_TOOLCHAIN_FILE":"${sourceDir}\\cmake\\toolchains\\onecoreuap.toolchain.cmake", + + "ENABLE_LTO": false, + "ENABLE_FASTER_BUILD": false, + "ENABLE_CPPLINT": false, + + "ENABLE_TESTS": false, + "ENABLE_FUNCTIONAL_TESTS": false, + "ENABLE_SAMPLES": false, + + "ENABLE_JS": false, + + "ENABLE_PYTHON": false, + "ENABLE_PYTHON_PACKAGING": false, + "ENABLE_WHEEL": false, "ENABLE_OV_ONNX_FRONTEND": false, "ENABLE_OV_PADDLE_FRONTEND": false, "ENABLE_OV_PYTORCH_FRONTEND": false, "ENABLE_OV_TF_FRONTEND": false, "ENABLE_OV_TF_LITE_FRONTEND": false, + "ENABLE_OV_JAX_FRONTEND": false, + "ENABLE_SYSTEM_TBB": false, + "ENABLE_TBB_RELEASE_ONLY": false, "ENABLE_OPENCV": false, - "ENABLE_BLOB_DUMP": false, - "ENABLE_TESTS": false, - "ENABLE_FUNCTIONAL_TESTS": false, + "ENABLE_MULTI": false, + "ENABLE_AUTO": false, + "ENABLE_AUTO_BATCH": false, + "ENABLE_PROXY": false, + "ENABLE_HETERO": false, + "ENABLE_INTEL_CPU": false, + "ENABLE_INTEL_GPU": false, + "ENABLE_TEMPLATE": false, - "ENABLE_SYSTEM_TBB": false, - "ENABLE_TBB_RELEASE_ONLY": false, - "ENABLE_JS": false, - "ENABLE_NPU_PROTOPIPE": false, + "ENABLE_ZEROAPI_BACKEND": false, + "ENABLE_DRIVER_COMPILER_ADAPTER": false, + "ENABLE_INTEL_NPU_INTERNAL": false, - "OPENVINO_EXTRA_MODULES": { - "type": "FILEPATH", - "value": "./modules/vpux" - } + "ENABLE_NPU_PROTOPIPE": false, + "ENABLE_NPU_LSP_SERVER":false } }, { diff --git a/src/vpux_driver_compiler/README.md b/src/vpux_driver_compiler/README.md index 6ea4966689..679d77eafd 100644 --- a/src/vpux_driver_compiler/README.md +++ b/src/vpux_driver_compiler/README.md @@ -59,27 +59,15 @@ vclCompilerDestroy ## How to build related targets locally -Driver Compiler provides npu_driver_compiler, compilerTest, profilingTest and loaderTest to compile network and test. To build Driver Compiler related targets locally, refer to [How to build driver compiler](./docs/how_to_build_driver_compiler.md). +Driver Compiler provides npu_driver_compiler, compilerTest, profilingTest and loaderTest to compile network and test. To build Driver Compiler related targets locally, refer to +- (Recommended) build using CMake Presets, requiring CMake version 3.19 or higher. + - [linux](./docs/how_to_build_driver_compiler_withCmakePresets_on_linux.md) + - [windows](./docs/how_to_build_driver_compiler_withCmakePresets_on_windows.md) -## How to release Driver Compiler package - -Unlike local build of Driver Compiler related targets, we need to apply some patches to [OpenVINO Project] and [NPU-Plugin Project] and also pack the elf, pdb and tbb files together to meet driver requirements. - -To get more info about Driver Compiler package, refer to [introduction of Driver Compiler package](https://github.com/intel-innersource/applications.ai.vpu-accelerators.flex-cid-tools/blob/develop/docs/introductio-of-driver_compiler_package.md) in [CiD project] repo. - -To build Driver Compiler package, refer to [How to Release Driver Compiler package.md](https://github.com/intel-innersource/applications.ai.vpu-accelerators.flex-cid-tools/blob/develop/docs/how-to-release-package.md) in [CiD project] repo. - - -## How to test - -Please refer to [How to test](./docs/how_to_test.md). - - -## How to debug - -Please refer to [How to debug](./docs/how_to_debug.md). +- build with cmake options + - [linux](./docs/how_to_build_driver_compiler_on_linux.md) + - [windows](./docs/how_to_build_driver_compiler_on_windows.md) [OpenVINO Project]: https://github.com/openvinotoolkit/openvino [NPU-Plugin Project]: https://github.com/intel-innersource/applications.ai.vpu-accelerators.vpux-plugin -[CiD Project]: https://github.com/intel-innersource/applications.ai.vpu-accelerators.flex-cid-tools diff --git a/src/vpux_driver_compiler/docs/how_to_build_driver_compiler.md b/src/vpux_driver_compiler/docs/how_to_build_driver_compiler.md deleted file mode 100644 index 4c9cffd61a..0000000000 --- a/src/vpux_driver_compiler/docs/how_to_build_driver_compiler.md +++ /dev/null @@ -1,316 +0,0 @@ -# How to build Driver Compiler - -## Dependencies - -Please refer -* [System requirements](https://docs.openvino.ai/2024/get-started/install-openvino/install-openvino-linux.html) -* [OpenVINO software requirements](https://github.com/openvinotoolkit/openvino/blob/master/docs/dev/build_linux.md) -* [How to build](../../../guides/how-to-build.md) in [NPU-Plugin Project] - - -## Using Cmake command - -Driver Compiler is built with OpenVINO static runtime. To build the library and related tests (npu_driver_compiler, npu_elf, compilerTest, profilingTest, loaderTest) using following commands : - -1. Clone repos. - - Clone [OpenVINO Project] repo and [NPU-Plugin Project] repo to special location. **Or** just unpack OPENVINO and NPU-Plugin source code to special location. - -
- clone command - - ```sh - # set the proxy, if required. - # export/set http_proxy=xxxx - # export/set https_proxy=xxxx - - cd /path/to/workspace - git clone https://github.com/openvinotoolkit/openvino.git - cd openvino - git checkout -b master origin/master (Just an example, you could use your own branch/tag/commit.) - git submodule update --init --recursive - - cd /path/to/workspace - git clone https://github.com/intel-innersource/applications.ai.vpu-accelerators.vpux-plugin - cd applications.ai.vpu-accelerators.vpux-plugin - git checkout -b master origin/master (Just an example, you could use your own branch/tag/commit.) - git submodule update --init --recursive - ``` -
- - -2. Set `NPU_PLUGIN_HOME` environment variable. - - On Ubuntu: - ```sh - export NPU_PLUGIN_HOME=/path/to/applications.ai.vpu-accelerators.vpux-plugin - ``` - - On `x64 Native Tools Command Prompt for VS XXXX` on Windows: - ```bat - set NPU_PLUGIN_HOME=/path/to/applications.ai.vpu-accelerators.vpux-plugin - ``` - -3. Create build folder and run build commands. - -
- on Ubuntu - - ```sh - cd /path/to/openvino/ - mkdir build-x86_64 - cd build-x86_64 - cmake \ - -D CMAKE_BUILD_TYPE=Release \ - -D BUILD_SHARED_LIBS=OFF \ - -D OPENVINO_EXTRA_MODULES=$NPU_PLUGIN_HOME \ - -D ENABLE_TESTS=OFF \ - -D ENABLE_BLOB_DUMP=OFF \ - -D ENABLE_HETERO=OFF \ - -D ENABLE_MULTI=OFF \ - -D ENABLE_AUTO=OFF \ - -D ENABLE_AUTO_BATCH=OFF \ - -D ENABLE_TEMPLATE=OFF \ - -D ENABLE_OV_ONNX_FRONTEND=OFF \ - -D ENABLE_OV_PYTORCH_FRONTEND=OFF \ - -D ENABLE_OV_PADDLE_FRONTEND=OFF \ - -D ENABLE_OV_TF_FRONTEND=OFF \ - -D ENABLE_OV_TF_LITE_FRONTEND=OFF \ - -D ENABLE_INTEL_CPU=OFF \ - -D ENABLE_INTEL_GPU=OFF \ - -D ENABLE_PROXY=OFF \ - -D ENABLE_OV_IR_FRONTEND=ON \ - -D THREADING=TBB \ - -D ENABLE_TBBBIND_2_5=OFF \ - -D ENABLE_SYSTEM_TBB=OFF \ - -D ENABLE_TBB_RELEASE_ONLY=OFF \ - -D ENABLE_JS=OFF \ - -D BUILD_COMPILER_FOR_DRIVER=ON \ - -D ENABLE_NPU_PROTOPIPE=OFF \ - .. - - cmake --build . --config Release --target gtest_main gtest ov_dev_targets compilerTest profilingTest vpuxCompilerL0Test loaderTest -j8 - # or just use - cmake --build . --config Release --target compilerTest profilingTest vpuxCompilerL0Test loaderTest -j8 - ``` - > Notice: If you encounter the following error during building `c++: internal compiler error: Killed (program cc1plus)`. You should consider decreasing the number of threads during compiling. For example, you could consider using `-j4` decrease the thread number to 4 or a smaller value. -
- -
- x64 Native Tools Command Prompt for VS XXXX on Winodws - - ```bat - cd \path\to\openvino\ - md build-x86_64 - cd build-x86_64 - cmake ^ - -D CMAKE_BUILD_TYPE=Release ^ - -D BUILD_SHARED_LIBS=OFF ^ - -D OPENVINO_EXTRA_MODULES=%NPU_PLUGIN_HOME% ^ - -D ENABLE_TESTS=OFF ^ - -D ENABLE_BLOB_DUMP=OFF ^ - -D ENABLE_HETERO=OFF ^ - -D ENABLE_MULTI=OFF ^ - -D ENABLE_AUTO=OFF ^ - -D ENABLE_AUTO_BATCH=OFF ^ - -D ENABLE_TEMPLATE=OFF ^ - -D ENABLE_OV_ONNX_FRONTEND=OFF ^ - -D ENABLE_OV_PYTORCH_FRONTEND=OFF ^ - -D ENABLE_OV_PADDLE_FRONTEND=OFF ^ - -D ENABLE_OV_TF_FRONTEND=OFF ^ - -D ENABLE_OV_TF_LITE_FRONTEND=OFF ^ - -D ENABLE_INTEL_CPU=OFF ^ - -D ENABLE_INTEL_GPU=OFF ^ - -D ENABLE_PROXY=OFF ^ - -D ENABLE_OV_IR_FRONTEND=ON ^ - -D THREADING=TBB ^ - -D ENABLE_TBBBIND_2_5=OFF ^ - -D ENABLE_SYSTEM_TBB=OFF ^ - -D ENABLE_TBB_RELEASE_ONLY=OFF ^ - -D ENABLE_JS=OFF ^ - -D BUILD_COMPILER_FOR_DRIVER=ON ^ - -D ENABLE_NPU_PROTOPIPE=OFF ^ - .. - - cmake --build . --config Release --target gtest_main gtest ov_dev_targets compilerTest profilingTest vpuxCompilerL0Test loaderTest -j8 - # or just use - cmake --build . --config Release --target compilerTest profilingTest vpuxCompilerL0Test loaderTest -j8 - ``` -
- -### See also - -Follow the blow guide to build the Driver Compiler library and test targets with Ninja: - * `Using ninja` section of [how-to-build.md](../../../guides/how-to-build.md) of [NPU-Plugin Project]. - -Driver compiler build is a static build, to get a static build of [NPU-Plugin Project] repo, please see - * [how to build static](../../../guides/how-to-build-static.md). - -To learn more about the Driver Compiler package, please see - * [introduction of Driver Compiler package](https://github.com/intel-innersource/applications.ai.vpu-accelerators.flex-cid-tools/blob/develop/docs/introductio-of-driver_compiler_package.md). - * [how to Release Driver Compiler package.md](https://github.com/intel-innersource/applications.ai.vpu-accelerators.flex-cid-tools/blob/develop/docs/how-to-release-package.md). - - -## Using CMakePresets - -### Using CMakePresets as an extra module of OpenVINO -Here provides a default pre-configured CMake presets for users named: "NpuCidRelease". The setting is to build [NPU-Plugin Project] as an extra module of [OpenVINO Project]. In this case, `NPU_PLUGIN_HOME` environment variable must be set. - -1. Clone repos -
- clone command - - ```sh - # set the proxy, if required. - # export/set http_proxy=xxxx - # export/set https_proxy=xxxx - - cd /path/to/workspace - git clone https://github.com/openvinotoolkit/openvino.git - cd openvino - git checkout -b master origin/master (Just an example, you could use your own branch/tag/commit.) - git submodule update --init --recursive - - cd /path/to/workspace - git clone https://github.com/intel-innersource/applications.ai.vpu-accelerators.vpux-plugin - cd applications.ai.vpu-accelerators.vpux-plugin - git checkout -b master origin/master (Just an example, you could use your own branch/tag/commit.) - git submodule update --init --recursive - ``` -
- -2. Set environment variables and create a symlink for a preset file in OpenVINO Project root: -
- on Ubuntu - - ```sh - export OPENVINO_HOME=/path/to/openvino - export NPU_PLUGIN_HOME=/path/to/applications.ai.vpu-accelerators.vpux-plugin - cd $OPENVINO_HOME - ln -s $NPU_PLUGIN_HOME/CMakePresets.json ./CMakePresets.json - ``` -
- -
- x64 Native Tools Command Prompt for VS XXXX on Windows(run as administrator) - - ```bat - set OPENVINO_HOME=\path\to\openvino - set NPU_PLUGIN_HOME=\path\to\applications.ai.vpu-accelerators.vpux-plugin - cd %OPENVINO_HOME% - mklink .\CMakePresets.json %NPU_PLUGIN_HOME%\CMakePresets.json - ``` -
- -3. Build with the following commands: - -
- on Ubuntu - - ```sh - cmake --preset NpuCidRelease - cd build-x86_64/Release/ - cmake --build ./ --target compilerTest profilingTest vpuxCompilerL0Test loaderTest - ``` -
- -
- x64 Native Tools Command Prompt for VS XXXX on Windows - - ```bat - cmake --preset NpuCidRelease - cd build-x86_64\Release\ - cmake --build .\ --target compilerTest profilingTest vpuxCompilerL0Test loaderTest - ``` -
- - -### Using CMakePresets in a single tree with OpenVINO - -Here provides a default pre-configured CMake presets for users named: "ovNpuCidRelease". The setting is to build [NPU-Plugin Project] as part of [OpenVINO Project]. In this case, NPU-plugin is considered as an OpenVINO module. - -1. Clone repos -
- clone command - - ```sh - # set the proxy, if required. - # export/set http_proxy=xxxx - # export/set https_proxy=xxxx - - cd /path/to/workspace - git clone https://github.com/openvinotoolkit/openvino.git - cd openvino - git checkout -b master origin/master (Just an example, you could use your own branch/tag/commit.) - git submodule update --init --recursive - - cd /path/to/workspace - git clone https://github.com/intel-innersource/applications.ai.vpu-accelerators.vpux-plugin - cd applications.ai.vpu-accelerators.vpux-plugin - git checkout -b master origin/master (Just an example, you could use your own branch/tag/commit.) - git submodule update --init --recursive - ``` -
- -2. Set environment variables, put NPU Plugin Project into `$OPENVINO_HOME/modules/vpux`and create a symlink for a preset file in OpenVINO Project root. -
- on Ubuntu - - ```sh - export OPENVINO_HOME=/path/to/openvino - export NPU_PLUGIN_HOME=/path/to/applications.ai.vpu-accelerators.vpux-plugin - - mkdir $OPENVINO_HOME/modules - mv $NPU_PLUGIN_HOME $OPENVINO_HOME/modules/vpux - - cd $OPENVINO_HOME - ln -s ./modules/vpux/CMakePresets.json ./CMakePresets.json - ``` -
- -
- x64 Native Tools Command Prompt for VS XXXX on Windows - - ```bat - set OPENVINO_HOME=\path\to\openvino - set NPU_PLUGIN_HOME=\path\to\applications.ai.vpu-accelerators.vpux-plugin - - md %OPENVINO_HOME%\modules - move %NPU_PLUGIN_HOME% %OPENVINO_HOME%\modules\vpux - - cd %OPENVINO_HOME% - mklink .\CMakePresets.json .\modules\vpux\CMakePresets.json - ``` -
- -3. Build with the following commands: -
- on Ubuntu - - ```sh - cmake --preset ovNpuCidRelease - cd build-x86_64/Release/ - cmake --build ./ --target compilerTest profilingTest vpuxCompilerL0Test loaderTest - ``` -
- -
- x64 Native Tools Command Prompt for VS XXXX on Windows - - ```bat - cmake --preset ovNpuCidRelease - cd build-x86_64\Release\ - cmake --build .\ --target compilerTest profilingTest vpuxCompilerL0Test loaderTest - ``` -
- -### Note - -1. Presets step for "NpuCidRelease" and "ovNpuCidRelease" need to be built in [OpenVINO Project] folder. -2. The presets for "NpuCidRelease" and "ovNpuCidRelease" define the build directory build-x86_64/Release. -3. The presets are configured to use Ninja as default generator, so installing Ninja package is an extra requirement. -4. Currently Presets for "NpuCidRelease" and "ovNpuCidRelease" will build the smallest size targrts of Driver Compiler. If the user wishes to build Driver Compiler and other targets, can driectly inherit "Cid" preset and enable the needed build option to self configuration presets. - -[OpenVINO Project]: https://github.com/openvinotoolkit/openvino -[NPU-Plugin Project]: https://github.com/intel-innersource/applications.ai.vpu-accelerators.vpux-plugin -[CiD Project]: https://github.com/intel-innersource/applications.ai.vpu-accelerators.flex-cid-tools diff --git a/src/vpux_driver_compiler/docs/how_to_build_driver_compiler_on_linux.md b/src/vpux_driver_compiler/docs/how_to_build_driver_compiler_on_linux.md new file mode 100644 index 0000000000..2b82b17b3a --- /dev/null +++ b/src/vpux_driver_compiler/docs/how_to_build_driver_compiler_on_linux.md @@ -0,0 +1,257 @@ +# How to build Driver Compiler on Linux + +## Dependencies + +Before you start to build Driver Compiler targets, please check the necessary components. +- Hardware + - Minimum requirements: 32GB RAM +- Software + - [CMake](https://cmake.org/download/) 3.22.1 for Ubuntu 22.04 (version 3.13 or higher) + - GCC 11.4.0 for Ubuntu 22.04 (version 7.5 or higher) + - Python 3.9 - 3.12 + - Git for Linux (requires installing `git lfs`) + - Ninja (optional, used for this documentation installation part) + +> Notice: RAM is not mandatory either. If your RAM is less than 32GB, you can compensate by reducing the number of threads during the build or by increasing the swap memory. + +## Using Cmake Options + +Driver Compiler is built with OpenVINO static runtime. To build the library and related tests (npu_driver_compiler, npu_elf, compilerTest, profilingTest, loaderTest) using following commands: + +1. Clone repos: + + Clone [OpenVINO Project] repo and [NPU-Plugin Project] repo to special location. **Or** just unpack OPENVINO and NPU-Plugin source code to special location. + +
+ Instructions + + ```sh + # set the proxy, if required. + # export http_proxy=xxxx + # export https_proxy=xxxx + + cd /home/useraccount/workspace (Just an example, you should use your own path.) + git clone https://github.com/openvinotoolkit/openvino.git + cd openvino + git checkout -b master origin/master (Just an example, you could use your own branch/tag/commit.) + git submodule update --init --recursiv + + + cd /home/useraccount/workspace (Just an example, you should use your own path.) + git clone https://github.com/openvinotoolkit/npu_plugin.git + cd npu_plugin + git checkout -b develop origin/develop (Just an example, you could use your own branch/tag/commit.) + git submodule update --init --recursive + + export OPENVINO_HOME=/home/useraccount/workspace/openvino (need change to your own path) + export NPU_PLUGIN_HOME=/home/useraccount/workspace/npu_plugin (need change to your own path) + ``` +
+ + > Notice: If you are building the Driver Compiler targets with the goal of composing the Linux driver, it is important to pay attention to the version or commit of the [OpenVino Project] being used. Make sure to check the current supported version of the [OpenVino Project] from `OpenVINO built from source` entry in the table under the `Common` section in the [release notes](https://github.com/intel/linux-npu-driver/releases/) or within the [Linux NPU driver code](https://github.com/intel/linux-npu-driver/blob/main/compiler/compiler_source.cmake#L20). + +2. Create build folder and run build instructions: + + 2.1 Build instructions: + + Before build with the following instructions, please make sure `OPENVINO_HOME` and `NPU_PLUGIN_HOME` enviroment variables have been set. + +
+ Instructions + + ```sh + cd $OPENVINO_HOME + mkdir build-x86_64 + cd build-x86_64 + + cmake \ + -D CMAKE_BUILD_TYPE=Release \ + -D BUILD_SHARED_LIBS=OFF \ + -D OPENVINO_EXTRA_MODULES=$NPU_PLUGIN_HOME \ + -D ENABLE_LTO=OFF \ + -D ENABLE_FASTER_BUILD=OFF \ + -D ENABLE_CPPLINT=OFF \ + -D ENABLE_TESTS=OFF \ + -D ENABLE_FUNCTIONAL_TESTS=OFF \ + -D ENABLE_SAMPLES=OFF \ + -D ENABLE_JS=OFF \ + -D ENABLE_PYTHON=OFF \ + -D ENABLE_PYTHON_PACKAGING=OFF \ + -D ENABLE_WHEEL=OFF \ + -D ENABLE_OV_ONNX_FRONTEND=OFF \ + -D ENABLE_OV_PYTORCH_FRONTEND=OFF \ + -D ENABLE_OV_PADDLE_FRONTEND=OFF \ + -D ENABLE_OV_TF_FRONTEND=OFF \ + -D ENABLE_OV_TF_LITE_FRONTEND=OFF \ + -D ENABLE_OV_JAX_FRONTEND=OFF \ + -D ENABLE_OV_IR_FRONTEND=ON \ + -D THREADING=TBB \ + -D ENABLE_TBBBIND_2_5=OFF \ + -D ENABLE_SYSTEM_TBB=OFF \ + -D ENABLE_TBB_RELEASE_ONLY=OFF \ + -D ENABLE_HETERO=OFF \ + -D ENABLE_MULTI=OFF \ + -D ENABLE_AUTO=OFF \ + -D ENABLE_AUTO_BATCH=OFF \ + -D ENABLE_TEMPLATE=OFF \ + -D ENABLE_PROXY=OFF \ + -D ENABLE_INTEL_CPU=OFF \ + -D ENABLE_INTEL_GPU=OFF \ + -D ENABLE_ZEROAPI_BACKEND=OFF \ + -D ENABLE_DRIVER_COMPILER_ADAPTER=OFF \ + -D ENABLE_INTEL_NPU_INTERNAL=OFF \ + -D BUILD_COMPILER_FOR_DRIVER=ON \ + -D ENABLE_NPU_PROTOPIPE=OFF \ + -D ENABLE_NPU_LSP_SERVER=OFF \ + .. + + cmake --build . --config Release --target compilerTest profilingTest vpuxCompilerL0Test loaderTest -j8 + ``` +
+ + > Notice: If you encounter the following error during building `c++: internal compiler error: Killed (program cc1plus)`, you should consider decreasing the number of threads during compiling or try increasing the swap file size. For instance, to decrease the thread count, you could consider using `-j4` to decrease the thread number to 4 or a smaller value. + + 2.2 Build instructions notes: + + Many build options are listed here. To clarify these options, the following explains the list of CMake parameters. + +
+ 2.2.1 Common build option + + ```sh + # Build type + CMAKE_BUILD_TYPE + + # Build library type + BUILD_SHARED_LIBS + ``` + +
+ +
+ 2.2.2 Build option list in OpenVino Project + + For more details on the build options, please refer to this [OpenVino features.cmake](https://github.com/openvinotoolkit/openvino/blob/0ebff040fd22daa37612a82fdf930ffce4ebb099/cmake/features.cmake) and this [NPU features.cmake](https://github.com/openvinotoolkit/openvino/blob/0ebff040fd22daa37612a82fdf930ffce4ebb099/src/plugins/intel_npu/cmake/features.cmake) in [OpenVINO Project], which provides explanations for all the available build options. + + ```sh + # Specify external repo + OPENVINO_EXTRA_MODULES + + # Build optimization option + ENABLE_LTO + ENABLE_FASTER_BUILD + + # Cpplint checks during build time + ENABLE_CPPLINT + + # Tests and samples + ENABLE_TESTS + ENABLE_FUNCTIONAL_TESTS + ENABLE_SAMPLES + + # Enable JS API + ENABLE_JS + + # Enable Python API and generate python binary + ENABLE_PYTHON + ENABLE_PYTHON_PACKAGING + ENABLE_WHEEL + + # Frontend + ENABLE_OV_ONNX_FRONTEND + ENABLE_OV_PYTORCH_FRONTEND + ENABLE_OV_PADDLE_FRONTEND + ENABLE_OV_TF_FRONTEND + ENABLE_OV_TF_LITE_FRONTEND + ENABLE_OV_JAX_FRONTEND + ENABLE_OV_IR_FRONTEND + + # TBB related option + THREADING + ENABLE_TBBBIND_2_5 + ENABLE_SYSTEM_TBB + ENABLE_TBB_RELEASE_ONLY + + # Plugin platform + ENABLE_HETERO + ENABLE_MULTI + ENABLE_AUTO + ENABLE_AUTO_BATCH + ENABLE_PROXY + ENABLE_INTEL_CPU + ENABLE_INTEL_GPU + + # NPU plugin and its tools related options + ENABLE_ZEROAPI_BACKEND + ENABLE_DRIVER_COMPILER_ADAPTER + ENABLE_INTEL_NPU_INTERNAL + BUILD_COMPILER_FOR_DRIVER + ``` +
+ +
+ 2.2.3 Build option list in NPU-Plugin Project + + For more details on the build options, please refer to this [features.cmake](https://github.com/openvinotoolkit/npu_plugin.git/blob/develop/cmake/features.cmake) file in [NPU-Plugin Project], which provides explanations for all the available build options. + + ```sh + # Build Driver Compiler Targets + BUILD_COMPILER_FOR_DRIVER + + # Compiler tool + ENABLE_NPU_PROTOPIPE + ENABLE_NPU_LSP_SERVER + ``` +
+ + 2.3 (Optional) Instruction notes about TBB: + +
+ 2.3.1 Default build mode + + Nowadays the Driver Compiler is building with TBB mode as default using `-D THREADING=TBB`. + + You can also use Sequential mode `-D THREADING=SEQ` to compile. More info about SEQ mode, please refer to this [file](https://github.com/openvinotoolkit/openvino/blob/0ebff040fd22daa37612a82fdf930ffce4ebb099/docs/dev/cmake_options_for_custom_compilation.md#options-affecting-binary-size). + +
+ +
+ 2.3.2 Use different TBB version + + When use TBB mode in build option, the default TBB is downloaded by [OpenVINO Project], located in `$OPENVINO_HME/temp/tbb`. + + If you wish to build with a specific version of TBB, you can download it from [oneTBB Project] and unzip its [release package](https://github.com/oneapi-src/oneTBB/releases). Then, use the `-D ENABLE_SYSTEM_TBB=OFF -D TBBROOT=/home/username/path/to/downloaded/tbb` option o build. + + If you would like to build TBB on your own, please refer to [INSTALL.md](https://github.com/oneapi-src/oneTBB/blob/master/INSTALL.md#build-onetbb) in [oneTBB Project]. + +
+ +3. (Optional) Prepare final Driver Compiler package for driver: + +
+ Instructions + + All Driver Compiler related targets have now been generated in `$OPENVINO_HOME/bin/intel/Release` folder, where the binary libnpu_driver_compiler.so can be found. The following instructions are provided to pack Driver Compiler related targets to the specified location. + + ```sh + #install Driver compiler related targets to current path. A `cid` folder will be generated to `$OPENVINO_HOME/build-x86_64/`. + cd $OPENVINO_HOME/build-x86_64 + cmake --install . --prefix $PWD/ --component CiD + + # or to get a related compressed file. A RELEASE-CiD.tar.gz compressed file will be generated to `$OPENVINO_HOME/build-x86_64/`. + cpack -D CPACK_COMPONENTS_ALL=CiD -D CPACK_CMAKE_GENERATOR=Ninja -D CPACK_PACKAGE_FILE_NAME="RELEASE" -G "TGZ" + ``` +
+ + > Notice: It is not recommended to use `cmake --install . --prefix /usr --component CiD` to install the Driver Compiler targets on the system, as this will not only install `libnpu_driver_compiler.so` but also many other related targets (such as `elf`, `compilerTest`) to the specified folder. + + +### See also + +To use cmake presets and ninja to build, please see +* [how to build Driver Compiler with Cmake Presets on Linux](./how_to_build_driver_compiler_withCmakePresets_on_linux.md) + + +[OpenVINO Project]: https://github.com/openvinotoolkit/openvino +[NPU-Plugin Project]: https://github.com/openvinotoolkit/npu_plugin +[oneTBB Project]: https://github.com/oneapi-src/oneTBB diff --git a/src/vpux_driver_compiler/docs/how_to_build_driver_compiler_on_windows.md b/src/vpux_driver_compiler/docs/how_to_build_driver_compiler_on_windows.md new file mode 100644 index 0000000000..bc8cf6b481 --- /dev/null +++ b/src/vpux_driver_compiler/docs/how_to_build_driver_compiler_on_windows.md @@ -0,0 +1,259 @@ +# How to build Driver Compiler on Windows + +## Dependencies + +Before you start to build Driver Compiler targets, please ensure that you have installed the necessary components. After installation, please make sure they are available from system enviroment path. + +- Hardware: + - Minimum requirements: 40 GB of disk space. + +- Software: + - [CMake](https://cmake.org/download/) 3.13 or higher + - Microsoft Visual Studio 2019 (recommended) or higher, version 16.3 or later + > Notice: Windows SDK and spectre libraries are required for building OpenVINO and NPU-Plugin. Install them via Visual Studio Installer: Modify -> Individual components -> Search components: "Windows SDK" and "Spectre x64/x86 latest". + - Python 3.9 - 3.12 + - Git for Windows (requires installing `git lfs`) + - Ninja (optional, used for this documentation installation part) + +Before you start building, please refer to the notes to avoid potential build issue. + +## Using Cmake Options + +Driver Compiler is built with OpenVINO static runtime. To build the library and related tests (npu_driver_compiler, npu_elf, compilerTest, profilingTest, loaderTest) using following commands: + +All instructions are perfromed on **x64 Native Tools Command Prompt for VS XXXX**. + +1. Clone repos and set environment variables: + + Clone [OpenVINO Project] repo and [NPU-Plugin Project] repo to special location. + +
+ Executed in x64 Native Tools Command Prompt for VS XXXX + + ```sh + # set the proxy, if required. + # set http_proxy=xxxx + # set https_proxy=xxxx + + cd C:\Users\Local_Admin\workspace (Just an example, you should use your own path.) + git clone https://github.com/openvinotoolkit/openvino.git + cd openvino + git checkout -b master origin/master (Just an example, you could use your own branch/tag/commit.) + git submodule update --init --recursive + + cd C:\Users\Local_Admin\workspace (Just an example, you should use your own path.) + git clone https://github.com/openvinotoolkit/npu_plugin.git + cd npu_plugin + git checkout -b develop origin/develop (Just an example, you could use your own branch/tag/commit.) + git submodule update --init --recursive + + set OPENVINO_HOME=C:\Users\Local_Admin\workspace\openvino (need change to your own path) + set NPU_PLUGIN_HOME=C:\Users\Local_Admin\workspace\npu_plugin (need change to your own path) + ``` +
+ + > Notice: Please place the cloned repositories in the shortest possible path. + +2. Create build folder and run build commands: + + 2.1 Build instructions + +
+ Executed in x64 Native Tools Command Prompt for VS XXXX + + ```sh + cd %OPENVINO_HOME% + md build-x86_64 + + cd build-x86_64 + cmake ^ + -D CMAKE_BUILD_TYPE=Release ^ + -D BUILD_SHARED_LIBS=OFF ^ + -D OPENVINO_EXTRA_MODULES=%NPU_PLUGIN_HOME% ^ + -D ENABLE_LTO=OFF ^ + -D ENABLE_FASTER_BUILD=OFF ^ + -D ENABLE_CPPLINT=OFF ^ + -D ENABLE_TESTS=OFF ^ + -D ENABLE_FUNCTIONAL_TESTS=OFF ^ + -D ENABLE_SAMPLES=OFF ^ + -D ENABLE_JS=OFF ^ + -D ENABLE_PYTHON=OFF ^ + -D ENABLE_PYTHON_PACKAGING=OFF ^ + -D ENABLE_WHEEL=OFF ^ + -D ENABLE_OV_ONNX_FRONTEND=OFF ^ + -D ENABLE_OV_PYTORCH_FRONTEND=OFF ^ + -D ENABLE_OV_PADDLE_FRONTEND=OFF ^ + -D ENABLE_OV_TF_FRONTEND=OFF ^ + -D ENABLE_OV_TF_LITE_FRONTEND=OFF ^ + -D ENABLE_OV_JAX_FRONTEND=OFF ^ + -D ENABLE_OV_IR_FRONTEND=ON ^ + -D THREADING=TBB ^ + -D ENABLE_TBBBIND_2_5=OFF ^ + -D ENABLE_SYSTEM_TBB=OFF ^ + -D ENABLE_TBB_RELEASE_ONLY=OFF ^ + -D ENABLE_HETERO=OFF ^ + -D ENABLE_MULTI=OFF ^ + -D ENABLE_AUTO=OFF ^ + -D ENABLE_AUTO_BATCH=OFF ^ + -D ENABLE_TEMPLATE=OFF ^ + -D ENABLE_PROXY=OFF ^ + -D ENABLE_INTEL_CPU=OFF ^ + -D ENABLE_INTEL_GPU=OFF ^ + -D ENABLE_ZEROAPI_BACKEND=OFF ^ + -D ENABLE_DRIVER_COMPILER_ADAPTER=OFF ^ + -D ENABLE_INTEL_NPU_INTERNAL=OFF ^ + -D BUILD_COMPILER_FOR_DRIVER=ON ^ + -D ENABLE_NPU_PROTOPIPE=OFF ^ + -D ENABLE_NPU_LSP_SERVER=OFF ^ + -D CMAKE_TOOLCHAIN_FILE=%OPENVINO_HOME%\cmake\toolchains\onecoreuap.toolchain.cmake ^ + .. + + cmake --build . --config Release --target compilerTest profilingTest vpuxCompilerL0Test loaderTest -j8 + ``` +
+ + 2.2 Build instructions notes: + + Many build options are listed here. To clarify these options, the following explains the list of CMake parameters. + +
+ 2.2.1 Common build option + + ```sh + # Build type + CMAKE_BUILD_TYPE + + # Build library type + BUILD_SHARED_LIBS + + # specifies locations for compilers and toolchain utilities, + CMAKE_TOOLCHAIN_FILE + ``` + +
+ + +
+ 2.2.2 Build option list in OpenVino Project + + For more details on the build options, please refer to this [OpenVino features.cmake](https://github.com/openvinotoolkit/openvino/blob/0ebff040fd22daa37612a82fdf930ffce4ebb099/cmake/features.cmake) and this [NPU features.cmake](https://github.com/openvinotoolkit/openvino/blob/0ebff040fd22daa37612a82fdf930ffce4ebb099/src/plugins/intel_npu/cmake/features.cmake) in [OpenVINO Project], which provides explanations for all the available build options. + + ```sh + # Specify external repo + OPENVINO_EXTRA_MODULES + + # Build optimization option + ENABLE_LTO + ENABLE_FASTER_BUILD + + # Cpplint checks during build time + ENABLE_CPPLINT + + # Tests and samples + ENABLE_TESTS + ENABLE_FUNCTIONAL_TESTS + ENABLE_SAMPLES + + # Enable JS API + ENABLE_JS + + # Enable Python API and generate python binary + ENABLE_PYTHON + ENABLE_PYTHON_PACKAGING + ENABLE_WHEEL + + # Frontend + ENABLE_OV_ONNX_FRONTEND + ENABLE_OV_PYTORCH_FRONTEND + ENABLE_OV_PADDLE_FRONTEND + ENABLE_OV_TF_FRONTEND + ENABLE_OV_TF_LITE_FRONTEND + ENABLE_OV_JAX_FRONTEND + ENABLE_OV_IR_FRONTEND + + # TBB related option + THREADING + ENABLE_TBBBIND_2_5 + ENABLE_SYSTEM_TBB + ENABLE_TBB_RELEASE_ONLY + + # Plugin platform + ENABLE_HETERO + ENABLE_MULTI + ENABLE_AUTO + ENABLE_AUTO_BATCH + ENABLE_PROXY + ENABLE_TEMPLATE + ENABLE_INTEL_CPU + ENABLE_INTEL_GPU + + # NPU plugin and its tools related options + ENABLE_ZEROAPI_BACKEND + ENABLE_DRIVER_COMPILER_ADAPTER + ENABLE_INTEL_NPU_INTERNAL + BUILD_COMPILER_FOR_DRIVER + ``` +
+ +
+ 2.2.3 Build option list in NPU-Plugin Project + + For more details on the build options, please refer to this [features.cmake](../../../cmake/features.cmake) file in [NPU-Plugin Project], which provides explanations for all the available build options. + + ```sh + # Build Driver Compiler Targets + BUILD_COMPILER_FOR_DRIVER + + # Compiler tool + ENABLE_NPU_PROTOPIPE + ENABLE_NPU_LSP_SERVER + ``` +
+ + 2.3 (Optional) Instruction notes about TBB: + +
+ 2.3.1 Default build mode + + Nowadays the Driver Compiler is building with TBB mode as default using `-D THREADING=TBB`. + + You can also use Sequential mode `-D THREADING=SEQ` to compile. More info about SEQ mode, please refer to this [file](https://github.com/openvinotoolkit/openvino/blob/0ebff040fd22daa37612a82fdf930ffce4ebb099/docs/dev/cmake_options_for_custom_compilation.md#options-affecting-binary-size). + +
+ +
+ 2.3.2 Use different TBB version + + When use TBB mode in build option, the default TBB is downloaded by [OpenVINO Project], located in `%OPENVINO_HME%\temp\tbb`. + + If you wish to build with a specific version of TBB, you can download it from [oneTBB Project] and unzip its [release package](https://github.com/oneapi-src/oneTBB/releases). Then, use the `-D ENABLE_SYSTEM_TBB=OFF -D TBBROOT=C:\Users\Local_Admin\workspace\path\to\downloaded\tbb` option to build. + + If you would like to build TBB on your own, please refer to [INSTALL.md](https://github.com/oneapi-src/oneTBB/blob/master/INSTALL.md#build-onetbb) in [oneTBB Project] and add `-D CMAKE_MSVC_RUNTIME_LIBRARY="MultiThreaded"` in build option. + +
+ +3. (Optional) Prepare final Driver Compiler package for driver: + +
+ Instructions + + All Driver Compiler related targets have now been generated in `%OPENVINO_HOME%\bin\intel\Release` folder, where the binary npu_driver_compiler.dll can be found. The following instructions are provided to pack Driver Compiler related targets to the specified location. + + ```sh + #install Driver compiler related targets to current path. A `cid` folder will be generated to `%OPENVINO_HOME%\build-x86_64\`. + cd %OPENVINO_HOME%\build-x86_64 + cmake --install .\ --prefix .\ --component CiD + + # or to get a related compressed file. A RELEASE-CiD.zip compressed file will be generated to `%OPENVINO_HOME%\build-x86_64\`. + cpack -D CPACK_COMPONENTS_ALL=CiD -D CPACK_CMAKE_GENERATOR=Ninja -D CPACK_PACKAGE_FILE_NAME="RELEASE" -G "ZIP" + ``` +
+ +### See also + +To use cmake presets and ninja to build, please see +* [how to build Driver Compiler with Cmake Presets on Windows](./how_to_build_driver_compiler_withCmakePresets_on_windows.md) + +[OpenVINO Project]: https://github.com/openvinotoolkit/openvino +[NPU-Plugin Project]: https://github.com/openvinotoolkit/npu_plugin +[oneTBB Project]: https://github.com/oneapi-src/oneTBB \ No newline at end of file diff --git a/src/vpux_driver_compiler/docs/how_to_build_driver_compiler_withCmakePresets_on_linux.md b/src/vpux_driver_compiler/docs/how_to_build_driver_compiler_withCmakePresets_on_linux.md new file mode 100644 index 0000000000..6fad81d387 --- /dev/null +++ b/src/vpux_driver_compiler/docs/how_to_build_driver_compiler_withCmakePresets_on_linux.md @@ -0,0 +1,135 @@ +# How to build Driver Compiler with cmake presets on Linux + +## Dependencies + +Before you start to build Driver Compiler targets, please check the necessary components. +- Hardware + - Minimum requirements: 32GB RAM +- Software + - [CMake](https://cmake.org/download/) 3.22.1 for Ubuntu 22.04 (version 3.19 or higher) + - GCC 11.4.0 for Ubuntu 22.04 (version 7.5 or higher) + - Python 3.9 - 3.12 + - Git for Linux (requires installing `git lfs`) + - Ccache + - Ninja + +> Notice: RAM is not mandatory either. If your RAM is less than 32GB, you can compensate by reducing the number of threads during the build or by increasing the swap memory. + +> Notice: Ccache and Ninja are required for the build options defined in the CMake Presets. Therefore, both of these tools are necessary. If you are unable to install them, please remove and update the relevant sections in [CMakePresets.json](../../../CMakePresets.json#L5). + +## Using CMakePresets to build + +#### Using CMakePresets to build and using NPU-Plugin as an extra module of OpenVINO + +Here provides a default pre-configured CMake presets for users named: "npuCidReleaseXXX", `npuCidReleaseLinux` for Linux and `npuCidReleaseWindows` for Windows. The setting is to build [NPU-Plugin Project] as an extra module of [OpenVINO Project]. In this case, `NPU_PLUGIN_HOME` environment variable must be set. + +1. Clone repos: + +
+ Instructions + + ```sh + # set the proxy, if required. + # export http_proxy=xxxx + # export https_proxy=xxxx + + cd /home/useraccount/workspace (Just an example, you could use your own branch/tag/commit.) + git clone https://github.com/openvinotoolkit/openvino.git + cd openvino + git checkout -b master origin/master (Just an example, you could use your own branch/tag/commit.) + git submodule update --init --recursive + + cd /home/useraccount/workspace (Just an example, you could use your own branch/tag/commit.) + git clone https://github.com/openvinotoolkit/npu_plugin.git + cd npu_plugin + git checkout -b develop origin/develop (Just an example, you could use your own branch/tag/commit.) + git submodule update --init --recursive + ``` +
+ + > Notice: If you are building the Driver Compiler targets with the goal of composing the Linux driver, it is important to pay attention to the version or commit of the [OpenVino Project] being used. Make sure to check the current supported version of the [OpenVino Project] from `OpenVINO built from source` entry in the table under the `Common` section in the [release notes](https://github.com/intel/linux-npu-driver/releases/) or within the [Linux NPU driver code](https://github.com/intel/linux-npu-driver/blob/main/compiler/compiler_source.cmake#L20). + +2. Set environment variables and create a symlink for a preset file in OpenVINO Project root: + +
+ Instructions + + ```sh + # set the enviroment variables + export OPENVINO_HOME=/home/useraccount/workspace/openvino (need change to your own path) + export NPU_PLUGIN_HOME=/home/useraccount/workspace/npu_plugin (need change to your own path) + + cd $OPENVINO_HOME + ln -s $NPU_PLUGIN_HOME/CMakePresets.json ./CMakePresets.json + ``` +
+ +3. Build with the following commands: + + Before build with the following instructions, please make sure you have sset `OPENVINO_HOME` and `NPU_PLUGIN_HOME` enviroment variables. + +
+ Instructions + + ```sh + cd $OPENVINO_HOME + cmake --preset npuCidReleaseLinux + cd build-x86_64/Release/ + cmake --build ./ --target compilerTest profilingTest vpuxCompilerL0Test loaderTest -j8 + ``` +
+ + The defined build option for npuCidReleaseLinux Cmake Preset is listed [here](../../../CMakePresets.json#L238). For additional information about its build options, please refer to section `2.2 Build instructions notes` in [how to build Driver Compiler on linux](./how_to_build_driver_compiler_on_linux.md). + +4. (Optional) Prepare final Driver Compiler package for driver: + +
+ Instructions + + All Driver Compiler related targets have now been generated in `$OPENVINO_HOME/bin/intel/Release` folder, where the binary libnpu_driver_compiler.so can be found. The following instructions are provided to pack Driver Compiler related targets to the specified location. + + ```sh + #install Driver compiler related targets to current path. A `cid` folder will be generated to `$OPENVINO_HOME/build-x86_64/`. + cd $OPENVINO_HOME/build-x86_64 + cmake --install . --prefix $PWD/ --component CiD + + + # or to get a related compressed file. A RELEASE-CiD.tar.gz compressed file will be generated to `$OPENVINO_HOME/build-x86_64/`. + cpack -D CPACK_COMPONENTS_ALL=CiD -D CPACK_CMAKE_GENERATOR=Ninja -D CPACK_PACKAGE_FILE_NAME="RELEASE" -G "TGZ" + ``` +
+ + > Notice: It is not recommended to use `cmake --install . --prefix /usr --component CiD` to install the Driver Compiler targets on the system, as this will not only install `libnpu_driver_compiler.so` but also many other related targets (such as `elf`, `compilerTest`) to the specified folder. + + +5. (Optional) Instruction notes about TBB: + +
+ 5.1 Default build mode + + Nowadays the Driver Compiler is building with TBB mode as default using `-D THREADING=TBB`. + + You can also use Sequential mode `-D THREADING=SEQ` to compile. More info about SEQ mode, please refer to this [file](https://github.com/openvinotoolkit/openvino/blob/0ebff040fd22daa37612a82fdf930ffce4ebb099/docs/dev/cmake_options_for_custom_compilation.md#options-affecting-binary-size). + +
+ +
+ 5.2 Use different TBB version + + When use TBB mode in build option, the default TBB is downloaded by [OpenVINO Project], located in `$OPENVINO_HME/temp/tbb`. + + If you wish to build with a specific version of TBB, you can download it from [oneTBB Project] and unzip its [release package](https://github.com/oneapi-src/oneTBB/releases). Then, use the `-D ENABLE_SYSTEM_TBB=OFF -D TBBROOT=/home/username/path/to/downloaded/tbb` option o build. + + If you would like to build TBB on your own, please refer to [INSTALL.md](https://github.com/oneapi-src/oneTBB/blob/master/INSTALL.md#build-onetbb) in [oneTBB Project]. + +
+ +### Note + +1. Presets step for "npuCidReleaseLinux" need to be built in [OpenVINO Project] folder. The defined build directory for "npuCidReleaseLinux" preset is %OPENVINO_HOME%\build-x86_64\Release. +2. The presets are configured to use `Ninja` as default generator, so installing Ninja package is an extra requirement. +3. Currently, presets for "npuCidReleaseLinux" will build the smallest size targrts of Driver Compiler. If the user wishes to build Driver Compiler and other targets, can driectly inherit "cid" preset and enable the needed build option to self configuration presets. + +[OpenVINO Project]: https://github.com/openvinotoolkit/openvino +[NPU-Plugin Project]: https://github.com/openvinotoolkit/npu_plugin +[oneTBB Project]: https://github.com/oneapi-src/oneTBB diff --git a/src/vpux_driver_compiler/docs/how_to_build_driver_compiler_withCmakePresets_on_windows.md b/src/vpux_driver_compiler/docs/how_to_build_driver_compiler_withCmakePresets_on_windows.md new file mode 100644 index 0000000000..8d16c273c0 --- /dev/null +++ b/src/vpux_driver_compiler/docs/how_to_build_driver_compiler_withCmakePresets_on_windows.md @@ -0,0 +1,138 @@ +# How to build Driver Compiler with cmake presets on Windows + +## Dependencies + +Before you start to build Driver Compiler targets, please make sure you have installed the necessary components. After installation, please make sure they are available from system enviroment path. + +- Hardware: + - Minimum requirements: 40 GB of disk space. + +- Software: + - [CMake](https://cmake.org/download/) 3.13 or higher + - Microsoft Visual Studio 2019 (recommended) or higher, version 16.3 or later + > **Notice**: Windows SDK and spectre libraries are required for building OpenVINO and NPU-Plugin. Install them via Visual Studio Installer: Modify -> Individual components -> Search components: "Windows SDK" and "Spectre x64/x86 latest". + - Python 3.9 - 3.12 + - Git for Windows (requires installing `git lfs`) + - Ccache (Download latest version of ccache binaries or build from source code on this [link](https://github.com/ccache/ccache/releases)) + - Ninja (Install it via Visual Studio Installer or "Getting Ninja" section on this [link](https://ninja-build.org/)) + +> Notice: Ccache and Ninja are required for the build options defined in the CMake Presets. Therefore, both of these tools are necessary. If you are unable to install them, please remove and update the relevant sections in [CMakePresets.json](../../../CMakePresets.json#L5). + + +## Using CMakePresets to build + +#### Using CMakePresets to build and using NPU-Plugin as an extra module of OpenVINO + +Here provides a default pre-configured CMake presets for users named: "npuCidReleaseXXX", `npuCidReleaseLinux` for Linux and `npuCidReleaseWindows` for Windows. The setting is to build [NPU-Plugin Project] as an extra module of [OpenVINO Project]. In this case, `NPU_PLUGIN_HOME` environment variable must be set. + +All instructions are perfromed on **x64 Native Tools Command Prompt for VS XXXX(run as administrator)**. + +1. Clone repos: +
+ Executed in x64 Native Tools Command Prompt for VS XXXX(run as administrator) + + ```sh + # set the proxy, if required. + # set http_proxy=xxxx + # set https_proxy=xxxx + + cd C:\workspace(Just an example, you could use your own branch/tag/commit.) + git clone https://github.com/openvinotoolkit/openvino.git + cd openvino + git checkout -b master origin/master (Just an example, you could use your own branch/tag/commit.) + git submodule update --init --recursive + + cd C:\workspace (Just an example, you could use your own branch/tag/commit.) + git clone https://github.com/openvinotoolkit/npu_plugin.git + cd npu_plugin + git checkout -b develop origin/develop (Just an example, you could use your own branch/tag/commit.) + git submodule update --init --recursive + ``` +
+ + > Notice: Please place the cloned repositories in the shortest possible path. + +2. Set environment variables and create a symlink for a preset file in OpenVINO Project root: +
+ Executed in x64 Native Tools Command Prompt for VS XXXX(run as administrator) + + ```sh + # set the enviroment variables + set OPENVINO_HOME=C:\workspace\openvino (need change to your own path) + set NPU_PLUGIN_HOME=C:\workspace\npu_plugin (need change to your own path) + + cd %OPENVINO_HOME% + mklink .\CMakePresets.json %NPU_PLUGIN_HOME%\CMakePresets.json + ``` +
+ + > Notice: Please make sure you do not have CMakePresets.json before you use `mklink .\CMakePresets.json %NPU_PLUGIN_HOME%\CMakePresets.json`. + +3. Build with the following commands: + + Before build with the following instructions, please make sure `OPENVINO_HOME` and `NPU_PLUGIN_HOME` enviroment variables have been set.. + +
+ Executed in x64 Native Tools Command Prompt for VS XXXX + + ```sh + cd %OPENVINO_HOME% + cmake --preset npuCidReleaseWindows + cd build-x86_64\Release\ + cmake --build .\ --target compilerTest profilingTest vpuxCompilerL0Test loaderTest + ``` +
+ + The defined build option for npuCidReleaseWindows cmake preset is listed [here](../../../CMakePresets.json#L280). For additional information about its build options, please refer to section `2.2 Build instructions notes` in [how to build Driver Compiler on windows](./how_to_build_driver_compiler_on_windows.md). + + > Notice: If you build Driver compiler using cmake presets and ccache is not installed on this device, the build will fail with the error: `CreateProcess failed: The system cannot find the file specified`during `cmake --build ...` on Windows. + +4. (Optional) Prepare final Driver Compiler package for driver: + +
+ Instructions + + All Driver Compiler related targets have now been generated in `%OPENVINO_HOME%\bin\intel\Release` folder, where the binary npu_driver_compiler.dll can be found. The following instructions are provided to pack Driver Compiler related targets to the specified location. + + ```sh + #install Driver compiler related targets to current path. A `cid` folder will be generated to `%OPENVINO_HOME%\build-x86_64`. + cd %OPENVINO_HOME%\build-x86_64 + cmake --install .\ --prefix .\ --component CiD + + + # or to get a related compressed file. A RELEASE-CiD.zip compressed file will be generated to `%OPENVINO_HOME%\build-x86_64\`. + cpack -D CPACK_COMPONENTS_ALL=CiD -D CPACK_CMAKE_GENERATOR=Ninja -D CPACK_PACKAGE_FILE_NAME="RELEASE" -G "ZIP" + ``` +
+ +5. (Optional) Instruction notes about TBB: + +
+ 5.1 Default build mode + + Nowadays the Driver Compiler is building with TBB mode as default using `-D THREADING=TBB`. + + You can also use Sequential mode `-D THREADING=SEQ` to compile. More info about SEQ mode, please refer to this [file](https://github.com/openvinotoolkit/openvino/blob/0ebff040fd22daa37612a82fdf930ffce4ebb099/docs/dev/cmake_options_for_custom_compilation.md#options-affecting-binary-size). + +
+ +
+ 5.2 Use different TBB version + + When use TBB mode in build option, the default TBB is downloaded by [OpenVINO Project], located in `%OPENVINO_HME%\temp\tbb`. + + If you wish to build with a specific version of TBB, you can download it from [oneTBB Project] and unzip its [release package](https://github.com/oneapi-src/oneTBB/releases). Then, use the `-D ENABLE_SYSTEM_TBB=OFF -D TBBROOT=C:\Users\Local_Admin\workspace\path\to\downloaded\tbb` option to build. + + If you would like to build TBB on your own, please refer to [INSTALL.md](https://github.com/oneapi-src/oneTBB/blob/master/INSTALL.md#build-onetbb) in [oneTBB Project] and add `-D CMAKE_MSVC_RUNTIME_LIBRARY="MultiThreaded"` in build option. + +
+ +### Note + +1. Presets step for "npuCidReleaseWindows" need to be built in [OpenVINO Project] folder. The defined build directory for "npuCidReleaseWindows" preset is %OPENVINO_HOME%\build-x86_64\Release. +2. The presets are configured to use Ninja as default generator, so installing Ninja package is an extra requirement. +3. Currently, preset for "npuCidReleaseWindows" will build the smallest size targrts of Driver Compiler. If the user wishes to build Driver Compiler and other targets, can driectly inherit "cid" preset and enable the needed build option to self configuration presets. + +[OpenVINO Project]: https://github.com/openvinotoolkit/openvino +[NPU-Plugin Project]: https://github.com/openvinotoolkit/npu_plugin +[oneTBB Project]: https://github.com/oneapi-src/oneTBB diff --git a/src/vpux_driver_compiler/docs/how_to_debug.md b/src/vpux_driver_compiler/docs/how_to_debug.md deleted file mode 100644 index 3b9819fedf..0000000000 --- a/src/vpux_driver_compiler/docs/how_to_debug.md +++ /dev/null @@ -1,81 +0,0 @@ -# How to debug - -## Logs - -To change the compiler behavior a config file can be provided to the `compilerTest` tool. For example, to change the logging level, use: -``` -LOG_LEVEL="LOG_TRACE" -``` - -A full config for googlenet-v1 is as follow: -``` bash ---inputs_precisions="input:fp16" --inputs_layouts="input:NCHW" --outputs_precisions="InceptionV1/Logits/Predictions/Softmax:fp16" --outputs_layouts="InceptionV1/Logits/Predictions/Softmax:NC" --config NPU_PLATFORM="3720" DEVICE_ID="NPU.3720" LOG_LEVEL="LOG_TRACE" NPU_COMPILATION_MODE="DefaultHW" NPU_COMPILATION_MODE_PARAMS="swap-transpose-with-fq=1 force-z-major-concat=1 quant-dequant-removal=1 propagate-quant-dequant=0" - -``` - - -## Other tools - -One can also use the tools from [NPU-Plugin Project] and [OpenVINO Project]. - -### compile_tool - -`compile_tool` can compile network to blob. If you test it for Driver Compiler, you need set the config option in config file. - -The general command on git bash is: -``` bash -./compile_tool -m -d NPU.3720 -c -``` - -Here is an example: -```bash -./compile_tool -m path/to/googlenet-v1.xml -d NPU.3720 -c /path/to/config.txt -``` -where the content of config.txt is: -```bash -NPU_COMPILER_TYPE DRIVER -``` - - -### benchmark_app - -`benchmark_app` is used to estimate inference performance. If you test it for Driver Compiler, you need set the config option in config file. - -The general command in git bash: -```bash -./benchmark_app -m -load_config= -d NPU.3720 -``` - -Here is an example: -``` bash -./benchmark_app -m /path/to/mobilenet-v2.xml -load_config=/path/to/config.txt -d NPU -``` -where the content of config.txt is: -``` -{ "NPU": { "NPU_COMPILER_TYPE":"DRIVER", "NPU_PLATFORM":"3720", "LOG_LEVEL":"LOG_INFO" } } -``` - -### timetest suite - -`timetest suite` is used to measure both total and partial execution time. You can install timetest suite as following the [time_tests/README.md](https://github.com/openvinotoolkit/openvino/blob/master/tests/time_tests/README.md). If you test it for Driver Compiler, you need set the config option in config file. - -The general command in git bash: -```bash -python3 ./scripts/run_timetest.py ../../bin/intel64/Release/timetest_infer_api_2.exe -m -d NPU.3720 -f -``` - -Here is an example: -```bash -python3 scripts\run_timetest.py build\src\timetests\Release\timetest_infer.exe -m googlenet-v1.xml -d NPU.3720 -f config.txt -``` -where the content of config.txt is: -``` -NPU_COMPILER_TYPE DRIVER -``` - ->Note: For more debug method and detil, refer to **[how to debug](../../vpux_compiler/docs/guides/how_to_debug.md)** in vpux_compiler part. - - -[OpenVINO Project]: https://github.com/openvinotoolkit/openvino -[NPU-Plugin Project]: https://github.com/intel-innersource/applications.ai.vpu-accelerators.vpux-plugin -[CiD Project]: https://github.com/intel-innersource/applications.ai.vpu-accelerators.flex-cid-tools diff --git a/src/vpux_driver_compiler/docs/how_to_test.md b/src/vpux_driver_compiler/docs/how_to_test.md deleted file mode 100644 index 56507ecaab..0000000000 --- a/src/vpux_driver_compiler/docs/how_to_test.md +++ /dev/null @@ -1,89 +0,0 @@ -# How to test - -## compilerTest - -`compilerTest` can check full Driver Compiler API demo. -Typically, use four models to test, googlenet-v1, mobilenet-v2, resnet-50-pytorch and yolo_v4_subgraph. You can use the models and configs from the [CiD Project] repo. You can test it in git bash on windows or linux shell. - -Gerenal command: -```bash -./compilerTest .xml .bin output.net -./compilerTest .xml .bin output.net config.file -``` - -For example, a config for googlenet-v1 is as follows: -``` ---inputs_precisions="input:fp16" --inputs_layouts="input:NCHW" --outputs_precisions="InceptionV1/Logits/Predictions/Softmax:fp16" --outputs_layouts="InceptionV1/Logits/Predictions/Softmax:NC" --config NPU_PLATFORM="3720" DEVICE_ID="NPU.3720" NPU_COMPILATION_MODE="DefaultHW" NPU_COMPILATION_MODE_PARAMS="swap-transpose-with-fq=1 force-z-major-concat=1 quant-dequant-removal=1 propagate-quant-dequant=0" -``` - -In the config, the necessary command params are (need to be passed in order): -- `inputs_precisions`: Precision of input node. -- `inputs_layouts`: Layout of input node. -- `outputs_precisions`: Precision of output node. -- `outputs_layouts`: Layout of output node. - -The optional command params are: -- `config`: set device info, log level and other properties defined in [`Supported Properties` part](https://github.com/openvinotoolkit/openvino/blob/master/src/plugins/intel_npu/README.md#supported-properties). -- `NPU_COMPILATION_MODE_PARAMS`: set compile config defined in [here](../../../src/vpux_compiler/include/vpux/compiler/core/pipelines_options.hpp). - -To get a entire config file for a model, refer to this [link](https://github.com/intel-innersource/applications.ai.vpu-accelerators.flex-cid-tools/blob/develop/docs/how-to-test-and-debug.md#compilerTest). - - -## profilingTest - -`profilingTest` is used to output profiling information. You can test it in git bash on windows or linux shell. - -Gerenal command: -```bash -./profilingTest .blob profiling-0.bin -``` - -To get the .blob, please use the compilerTest or [compile_tool](https://github.com/intel-innersource/applications.ai.vpu-accelerators.vpux-plugin/tree/master/tools/compile_tool) of [NPU-Plugin Project]. - -To get the profiling-0.bin and more profiling detail, please see **[how to use profiling.md](../../../guides/how-to-use-profiling.md)** in [NPU-Plugin Project]. - - -## loaderTest - -`loaderTest` is used to check driver compiler header whether is available. You can test it in git bash on windows or linux shell. - -Gerenal command: -```bash -./loaderTest -v=1 -./loaderTest -v=0 -``` - - -## vpuxCompilerL0Test - -`vpuxCompilerL0Test` is the test suit of the driver compiler. Its test range is defined in [release-tools/CiD Project](https://github.com/intel-innersource/applications.ai.vpu-accelerators.flex-cid-tools/tree/master/release-tools). You can test it in git bash on windows or linux shell. - -To run vpuxCompilerL0Test, you need to set `POR_PATH` manually. Here use this [POR model](https://af01p-ir.devtools.intel.com/artifactory/ir-public-models-ir-local/20230703_vpu-models-mtl-por-ir_v11_ov_2023.0.0-10926-b4452d56304.tar.gz) as example to test with the following command: - -```bash -#copy and unpack POR model to special location. -tar -zxvf path/to/por_model -export POR_PATH=/path/to/por_model -``` - -You also need to set `CID_TOOL` manually to load the config for testing. `CID_TOOL` is the release-tools folder of [CiD Project] repo. Set `CID_TOOL` with the following command: -```bash -export CID_TOOL=/path/to/CiD-Repo/release-tools -``` - -You can run all the test suit of the driver compiler with the following command: -```bash -./vpuxCompilerL0Test -``` -Or you can run the tests via the gtest_filter, e.g., if you want to test the resnet-50-pytorch, you can run: -```bash -./vpuxCompilerL0Test --gtest_filter=*resnet*50*pytorch* -``` - - ->Note: For more debug method and detail, refer to **[how to debug](../../vpux_compiler/docs/guides/how_to_debug.md)** in vpux_compiler part. - - -[OpenVINO Project]: https://github.com/openvinotoolkit/openvino -[NPU-Plugin Project]: https://github.com/intel-innersource/applications.ai.vpu-accelerators.vpux-plugin -[CiD Project]: https://github.com/intel-innersource/applications.ai.vpu-accelerators.flex-cid-tools