Adapting oneDNN for KDNN
This section describes how to adapt oneDNN for KDNN. Misoperations may introduce undefined behaviors. Exercise caution when performing this operation.
Adaptation Procedure
- Obtain the oneDNN adaptation code. Assume that /path/to is the directory where the source code is cloned.
git clone -b v3.0.0 https://gitee.com/openeuler/kail_dnn_adapter cd kail_dnn_adapter git submodule update --init --recursive cd oneDNN-open ulimit -n 262144 patch -p1 < ../0001-kdnn-adapter.patch
- Access /path/to/kail_dnn_adapter and compile oneDNN.
- For Kunpeng 920 7280Z:
cd /path/to/kail_dnn_adapter sh build.sh --use_static_kdnn=off
The --use_static_kdnn=on/off option specifies whether to use the KDNN static library or dynamic library during compilation. The default value is off.
- For new Kunpeng 920 processor model (the following example is based on the BiSheng Compiler):
cd /path/to/kail_dnn_adapter sh build.sh --compiler=clang
Path of the compilation product:
Path of libdnnl.so: out/oneDNN-open/build/src/
Paths to the dependency libraries:- Path to .so files related to ACL: out/ComputeLibrary-23.11/build/
- Path to .so files related to KAIL: /usr/local/kdnn/lib/omp/libkdnn.so
You can use all interfaces of oneDNN v3.4.0 by linking against libdnnl.so.
In the compile command, --compiler=clang indicates that the BiSheng Compiler is used. By default, GCC is used.
- For Kunpeng 920 7280Z:
Verification After Adaptation
After compiling oneDNN, use the test cases included in the software package to verify the adaptation.
- Go to the /path/to/kail_dnn_adapter/out/llt/scripts directory.
cd /path/to/kail_dnn_adapter/out/llt/scripts
- Run the test cases.
python run_daily_build.py --working_dir=../../oneDNN-open/build/tests/benchdnn
If all results returned passed and the following information is displayed, oneDNN is successfully adapted.

Parent topic: Using KAIL