提交 9fa9d6b7 编写于 作者: H hong19860320 提交者: GitHub

[NPU] add NPU supporting for Java API (#1915)

* [NPU] add NPU supporting for Java API
test=develop

* [NPU] refine build script for NPU compiling
test=develop

* [NPU] fix compiling script for NPU
test=develop
上级 14b60b81
...@@ -21,7 +21,7 @@ public class Place { ...@@ -21,7 +21,7 @@ public class Place {
/** Place hardware target type. */ /** Place hardware target type. */
public enum TargetType { public enum TargetType {
UNKNOWN(0), HOST(1), X86(2), CUDA(3), ARM(4), OPEN_CL(5), ANY(6); UNKNOWN(0), HOST(1), X86(2), CUDA(3), ARM(4), OPEN_CL(5), FPGA(7), NPU(8), ANY(6);
public final int value; public final int value;
...@@ -32,7 +32,7 @@ public class Place { ...@@ -32,7 +32,7 @@ public class Place {
/** Place precision type */ /** Place precision type */
public enum PrecisionType { public enum PrecisionType {
UNKNOWN(0), FLOAT(1), INT8(2), INT32(3), ANY(4); UNKNOWN(0), FLOAT(1), INT8(2), FP16(5), INT32(3), ANY(4), BOOL(6);
public final int value; public final int value;
...@@ -43,7 +43,7 @@ public class Place { ...@@ -43,7 +43,7 @@ public class Place {
/** Place data layout type */ /** Place data layout type */
public enum DataLayoutType { public enum DataLayoutType {
UNKNOWN(0), NCHW(1), ANY(2); UNKNOWN(0), NCHW(1), NHWC(3), ANY(2);
public final int value; public final int value;
......
...@@ -7,7 +7,7 @@ function print_usage { ...@@ -7,7 +7,7 @@ function print_usage {
echo "----------------------------------------" echo "----------------------------------------"
echo -e "--arm_os=<os> android only yet." echo -e "--arm_os=<os> android only yet."
echo -e "--arm_abi=<abi> armv8, armv7 yet." echo -e "--arm_abi=<abi> armv8, armv7 yet."
echo -e "--arm_stl=<shared> shared or static" echo -e "--android_stl=<shared> shared or static"
echo -e "--arm_lang=<gcc> " echo -e "--arm_lang=<gcc> "
echo -e "--ddk_root=<hiai_ddk_root> " echo -e "--ddk_root=<hiai_ddk_root> "
echo -e "--test_name=<test_name>" echo -e "--test_name=<test_name>"
...@@ -67,6 +67,7 @@ function cmake_npu { ...@@ -67,6 +67,7 @@ function cmake_npu {
-DWITH_ARM_DOTPROD=ON \ -DWITH_ARM_DOTPROD=ON \
-DLITE_WITH_LIGHT_WEIGHT_FRAMEWORK=ON \ -DLITE_WITH_LIGHT_WEIGHT_FRAMEWORK=ON \
-DWITH_TESTING=ON \ -DWITH_TESTING=ON \
-DLITE_WITH_JAVA=ON \
-DLITE_WITH_NPU=ON \ -DLITE_WITH_NPU=ON \
-DANDROID_API_LEVEL=24 \ -DANDROID_API_LEVEL=24 \
-DARM_TARGET_OS=$1 \ -DARM_TARGET_OS=$1 \
...@@ -88,23 +89,23 @@ function build_npu { ...@@ -88,23 +89,23 @@ function build_npu {
local test_name=test_npu_pass local test_name=test_npu_pass
prepare_thirdparty prepare_thirdparty
if [[ $# -ge 1 ]]; then if [ "x${ARM_OS}" != "x" ]; then
os=$1 os=$ARM_OS
fi fi
if [[ $# -ge 2 ]]; then if [[ "x${ARM_ABI}" != "x" ]]; then
abi=$2 abi=$ARM_ABI
fi fi
if [[ $# -ge 3 ]]; then if [[ "x${ARM_LANG}" != "x" ]]; then
lang=$3 lang=$ARM_LANG
fi fi
if [[ $# -ge 4 ]]; then if [[ "x${ANDROID_STL}" != "x" ]]; then
stl=$4 stl=$ANDROID_STL
fi fi
if [[ $# -ge 5 ]]; then if [[ "x${DDK_ROOT}" != "x" ]]; then
ddk_root=$5 ddk_root=$DDK_ROOT
fi fi
if [[ $# -ge 6 ]]; then if [[ $# -ge 1 ]]; then
test_name=$6 test_name=$1
fi fi
# the c++ symbol is not recognized by the bundled script # the c++ symbol is not recognized by the bundled script
...@@ -149,8 +150,20 @@ function main { ...@@ -149,8 +150,20 @@ function main {
ARM_LANG="${i#*=}" ARM_LANG="${i#*=}"
shift shift
;; ;;
--android_stl=*)
ANDROID_STL="${i#*=}"
shift
;;
--ddk_root=*)
DDK_ROOT="${i#*=}"
shift
;;
build) build)
build_npu ${os} ${abi} ${lang} ${stl} ${ddk_root} ${test_name} build_npu $TEST_NAME
shift
;;
full_publish)
build_npu publish_inference
shift shift
;; ;;
*) *)
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册