Adapting oneDNN for KAIL_DNN
This section describes how to adapt oneDNN for KAIL_DNN. Misoperations may introduce undefined behaviors. Exercise caution when performing this operation.
Adaptation Procedure
- Obtain the adaptation code of KAIL_DNN v2.0.0.
git clone -b v2.0.0 https://gitee.com/openeuler/kail_dnn_adapter
- Access kail_dnn_adapter and compile oneDNN.
- Kunpeng 920 7285Z
cd kail_dnn_adapter sh build.sh --kml_dir=/path/to/HPCKit/latest/kml/gcc
Path to libdnnl.so: out/oneDNN-3.4/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 the AI library: /usr/local/kail/lib/libkdnn.so
- Paths to .so files related to KML:
- /path/to/HPCKit/latest/gcc/kml/lib/sve/kblas/multi/libkblas_armv9p_v25.0.0.so
- /path/to/HPCKit/latest/gcc/kml/lib/noarch/kvml/multi/libkvml.so.25.0.0
- /path/to/HPCKit/latest/gcc/kml/lib/noarch/libkm.so.25.0.0
You can use all interfaces of oneDNN v3.4.0 by linking libdnnl.so.
The --kml_dir option in the compilation command specifies the installation path of KML.
In the .so paths related to KML, /path/to/ indicates the HPCKit installation path.
- Kunpeng 920 72F8 (using BiSheng Compiler as an example)
cd kail_dnn_adapter sh build.sh --enable_hbm=on --compiler=clang --kml_dir=/path/to/HPCKit/latest/kml/bisheng/
Path to libdnnl.so: out/oneDNN-3.4/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 the AI library: /usr/local/kail/lib/libkdnn.so
- Paths to .so files related to KML:
- /path/to/HPCKit/latest/bisheng/kml/lib/sme/kblas/multi/libkblas_armv9p_v25.0.0.so
- /path/to/HPCKit/latest/bisheng/kml/lib/noarch/kvml/multi/libkvml.so.25.0.0
- /path/to/HPCKit/latest/bisheng/kml/lib/noarch/libkm.so.25.0.0
You can use all interfaces of oneDNN v3.4.0 by linking libdnnl.so.
In the compilation command, --enable_hbm=on enables HBM (disabled by default), --compiler=clang specifies BiSheng Compiler (GCC by default), and --kml_dir specifies the installation path of KML.
In the .so paths related to KML, /path/to/ indicates the HPCKit installation path.
- Kunpeng 920 7285Z
Verification After Adaptation
After compiling oneDNN, use the test case included in the software package to check whether the adaptation is successful.
- Go to the /path/to/kail_dnn_adapter/out/oneDNN-3.4/build directory.
cd /path/to/kail_dnn_adapter/out/oneDNN-3.4/build
- Run the test case.
- Kunpeng 920 7285Z
ctest
If the execution results of all tests are passed, the oneDNN compilation is successful.

- Kunpeng 920 72F8
MEMKIND_HBW_NODES=16-31 MEM_TYPE=HBM taskset -c 0-37 ctest
If the execution results of all tests are passed, the oneDNN compilation is successful.

If HBM is not used, you can use export KML_BLAS_NOT_USE_HBM=1 to set the environment variable.
You are advised to use export KML_BLAS_THREAD_TYPE=OMP to specify the OMP thread control mode for KML.
- Kunpeng 920 7285Z