[CPU] Re-enable Selective build on oneDNN2.6 (#12074)

* update submodule onednn26 selective build

* onednn code review

* merge onednn selective build

* fix bug in cc onednn26

Co-authored-by: zihan wu <zihan.wu@intel.com>
This commit is contained in:
Tingqian Li 2022-07-08 11:48:12 +08:00 committed by GitHub
parent 2500ad120e
commit bc34fa0934
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 102 additions and 1 deletions

View File

@ -0,0 +1,101 @@
# Selective Compile
## Introduction
Selective build or conditional compile is a function which permits
## Work Flow
Onednn path in OpenVINO:
./src/plugins/intel_cpu/thirdparty/onednn/
The selective build carries on under the instruction of:
./src/common/conditional_compilation/CMakeLists.txt
### **First build**
The first build collects the information and generate a CSV file which component is goint to be used in the selected build.
* For the first build, cmake with option "-DENABLE_PROFILING_ITT=ON -DSELECTIVE_BUILD=COLLECT"
```
cd ./build
cmake .. \
-DCMAKE_BUILD_TYPE=Release \
-DCMAKE_BUILD_TYPE=Release \
-DENABLE_CPU_DEBUG_CAPS=ON \
-DENABLE_PROFILING_ITT=ON \
-DSELECTIVE_BUILD=COLLECT \
-DCMAKE_INSTALL_PREFIX=`pwd`/install \
-DCMAKE_INSTALL_RPATH=`pwd`/install/runtime/3rdparty/tbb/lib:`pwd`/install/runtime/3rdparty/hddl/lib:`pwd`/install/runtime/lib/intel64
cmake --build . --config Release -j 8
```
Then generate statistics files (CSV):
* Need to build manually to get libIntelSEAPI.so with the following step first.
```
# in ./build
cd ./thirdparty/itt_collector && make
```
```
cd ../../../bin/intel64/Release/
python ../../../thirdparty/itt_collector/runtool/sea_runtool.py \
--bindir ./lib -o models_statistics_dir ! \
./benchmark_app -niter 1 -nireq 1 \
-m <model_path>
```
### **Second build**
The second build takes the CSV file to indicate the build and only build the components in the CSV file.
The generated CSV file could be found in folder:
openvino/bin/intel64/Release/
This time, cmake with option "-DSELECTIVE_BUILD=ON"
```
cd ../../../build
cmake .. \
-DCMAKE_BUILD_TYPE=Release \
-DENABLE_CPU_DEBUG_CAPS=ON \
-DENABLE_DEBUG_CAPS=ON \
-DSELECTIVE_BUILD=ON \
-DSELECTIVE_BUILD_STAT=<CSV_PATH> \
-DPYTHON_EXECUTABLE=/usr/bin/python3.7 \
-DCMAKE_INSTALL_PREFIX=`pwd`/install \
-DCMAKE_INSTALL_RPATH=`pwd`/install/runtime/3rdparty/tbb/lib:`pwd`/install/runtime/3rdparty/hddl/lib:`pwd`/install/runtime/lib/intel64
cmake --build . --config Release -j 8
```
As shown in
./src/common/conditional_compilation/CMakeLists.txt
CSV file works as a SELECTIVE_BUILD_STAT and is first interpreted into a c++ head file:
./build/src/common/conditional_compilation/conditional_compilation_gen.h
It is generated by ccheader.py and can indicate if selective build analyse (first build) works correctly.
### **Test selective compile with benchmark**
```
cd ./bin/intel64/Release
./benchmark_app -niter 1 -nireq 1 \
-m <model_path> -d CPU
```
## Reference
https://github.com/openvinotoolkit/openvino/wiki/ConditionalCompilation
https://github.com/openvinotoolkit/openvino/commit/ec48fcb29bef94cca480573110a598afc3515019#
https://github.com/openvinotoolkit/openvino/commit/1f96ddfbf9030e765aa0ca0a6aafb1ae2b8c3e98#diff-de6f7126342889fe9d0b505b0ac391db2275400488d5bab9194c2542a4f4d1fe

@ -1 +1 @@
Subproject commit e3c6cbacf7ba33e3d72c22d6db29b5741d4ab195
Subproject commit 2a749c577f8a841a396d4bd46eaf311b7e7dc089