Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

samsung backend v3.1 update for the master branch #811

Merged
merged 4 commits into from
Nov 8, 2023
Merged
Show file tree
Hide file tree
Changes from 3 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 2 additions & 0 deletions mobile_back_samsung/samsung/lib/BUILD
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,7 @@ pbtxt2header(
"public/include/mbe_config_2100.pbtxt",
"public/include/mbe_config_2200.pbtxt",
"public/include/mbe_config_2300.pbtxt",
"public/include/mbe_config_2400.pbtxt",
],
)

Expand All @@ -34,6 +35,7 @@ cc_library(
"public/include/mbe_config_2100.hpp",
"public/include/mbe_config_2200.hpp",
"public/include/mbe_config_2300.hpp",
"public/include/mbe_config_2400.hpp",
"public/include/mbe_core_holder.hpp",
"public/include/mbe_helper.hpp",
"public/include/mbe_loader.hpp",
Expand Down
3 changes: 2 additions & 1 deletion mobile_back_samsung/samsung/lib/checksums.txt
Original file line number Diff line number Diff line change
@@ -1,9 +1,10 @@
e2f78216c1a3e0d925e17e4d6e7befbc1a2a853867864c6f30e553bf971f2a42 internal/libc++.so
34ce517c63720a6a858d4e0237247a4e6db857cc4a1f6dffe7210916b96fdc3b internal/libeden_nn_on_system.so
10eac88456890b89dd20c3acc636467366b7e16e9a9cc0e57f4d8a9079a6633c internal/libenn_extension.so
f8a6c9d5c0e094c8ef84468ee535ff2f4604d9e59064925aa38cfdd200a06392 internal/libenn_extension.so
97202acb183aa26d83f393d185f0f3cd94f648678916c6b27d91a8445f354472 internal/libenn_public_api_cpp.so
6c15a0660334a81561342337500ad431441e68cb85aa26fd297e77f3c97b1f79 internal/libmbe1200_core.so
109c4ea03357d7a0f901a44c86281f6fd6a0a84ea855ccdfef09aee06092a0ff internal/libmbe2100_core.so
180800b085d01098205599da04544fd5c666d1d6984e11fae51ea80bd392a52c internal/libmbe2200_core.so
0ba0fa2f8eb5d46116ed20d792134e6bacbff662a2a248596c953a7201a32a8d internal/libmbe2300_core.so
90f2b3b3c130ef71109ade8ab1d667fe8311c6a32030196c0f12a28d65b892cb internal/libmbe2400_core.so
cc921615cd844b47871646b30f146048044b55cdb9bf17d3bd9c5f4569ec2efe internal/libofi_rt_framework_user_vendor.so
Original file line number Diff line number Diff line change
Expand Up @@ -28,4 +28,5 @@ limitations under the License.
#include "mbe_config_2100.hpp"
#include "mbe_config_2200.hpp"
#include "mbe_config_2300.hpp"
#include "mbe_config_2400.hpp"
#endif
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
/* Copyright 2020-2023 Samsung System LSI. All Rights Reserved.

Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at

http://www.apache.org/licenses/LICENSE-2.0

Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.
==============================================================================*/
#ifndef MBE_CONFIG_2400_H
#define MBE_CONFIG_2400_H
#include <mbe_config_2400.pbtxt.h>
#endif
221 changes: 221 additions & 0 deletions mobile_back_samsung/samsung/lib/public/include/mbe_config_2400.pbtxt
Original file line number Diff line number Diff line change
@@ -0,0 +1,221 @@
# proto-file: flutter/cpp/proto/backend_setting.proto
# proto-message: BackendSetting

common_setting {
id: "num_threads"
name: "Number of threads"
value {
value: "4"
name: "4 threads"
}
}

benchmark_setting {
benchmark_id: "image_classification"
framework: "ENN"
delegate_choice: {
delegate_name: "ENN_NPU"
accelerator_name: "samsung_npu"
accelerator_desc: "NPU"
custom_setting {
id: "preset"
value: "1005"
}
custom_setting {
id: "i_type"
value: "Uint8"
}
custom_setting {
id: "o_type"
value: "Float32"
}
custom_setting {
id: "extension"
value: "true"
}
custom_setting {
id: "lazy_mode"
value: "true"
}
model_path: "https://github.com/mlcommons/mobile_models/raw/main/v3_1/samsung/ic.nnc"
model_checksum: "1756e790704bea5be37431877a196ea1"
}
delegate_selected: "ENN_NPU"
single_stream_expected_latency_ns: 200000
}

benchmark_setting {
benchmark_id: "image_segmentation_v2"
framework: "ENN"
delegate_choice: {
delegate_name: "ENN_NPU"
accelerator_name: "samsung_npu"
accelerator_desc: "NPU"
custom_setting {
id: "preset"
value: "1005"
}
custom_setting {
id: "i_type"
value: "Uint8"
}
custom_setting {
id: "o_type"
value: "Uint8"
}
custom_setting {
id: "extension"
value: "true"
}
custom_setting {
id: "lazy_mode"
value: "true"
}
model_path: "https://github.com/mlcommons/mobile_models/raw/main/v3_1/samsung/sm_uint8.nnc"
model_checksum: "c58979294a01c1a8b7306cbf213ffd42"
}
delegate_selected: "ENN_NPU"
single_stream_expected_latency_ns: 500000
}

benchmark_setting {
benchmark_id: "object_detection"
framework: "ENN"
delegate_choice: {
delegate_name: "ENN_NPU"
accelerator_name: "samsung_npu"
accelerator_desc: "NPU"
custom_setting {
id: "preset"
value: "1005"
}
custom_setting {
id: "i_type"
value: "Uint8"
}
custom_setting {
id: "o_type"
value: "Float32"
}
custom_setting {
id: "extension"
value: "true"
}
custom_setting {
id: "lazy_mode"
value: "true"
}
model_path: "https://github.com/mlcommons/mobile_models/raw/main/v3_1/samsung/od.nnc"
model_checksum: "6ec9c58af2b1cd772fb45ac51db07c31"
}
delegate_selected: "ENN_NPU"
single_stream_expected_latency_ns: 450000
}

benchmark_setting {
benchmark_id: "super_resolution"
framework: "ENN"
delegate_choice: {
delegate_name: "ENN_NPU"
accelerator_name: "samsung_npu"
accelerator_desc: "NPU"
custom_setting {
id: "preset"
value: "1005"
}
custom_setting {
id: "i_type"
value: "Uint8"
}
custom_setting {
id: "o_type"
value: "Int8"
}
custom_setting {
id: "extension"
value: "true"
}
custom_setting {
id: "lazy_mode"
value: "true"
}
model_path: "https://github.com/mlcommons/mobile_models/raw/main/v3_1/samsung/sr.nnc"
model_checksum: "2542bd74108b286822fcd1fc4b8bc316"
}
delegate_selected: "ENN_NPU"
single_stream_expected_latency_ns: 990000
}

benchmark_setting {
benchmark_id: "natural_language_processing"
framework: "ENN"
delegate_choice: {
delegate_name: "ENN_NPU"
accelerator_name: "npu"
accelerator_desc: "npu"
custom_setting {
id: "preset"
value: "1005"
}
custom_setting {
id: "i_type"
value: "Int32"
}
custom_setting {
id: "o_type"
value: "Float32"
}
custom_setting {
id: "extension"
value: "true"
}
custom_setting {
id: "lazy_mode"
value: "true"
}
model_path: "https://github.com/mlcommons/mobile_models/raw/main/v3_1/samsung/mobile_bert.nnc"
model_checksum: "82dee62592db68a095396da3caacf67b"
}
delegate_selected: "ENN_NPU"
single_stream_expected_latency_ns: 990000
}

benchmark_setting {
benchmark_id: "image_classification_offline"
framework: "ENN"
delegate_choice: {
delegate_name: "ENN_NPU"
accelerator_name: "samsung_npu"
accelerator_desc: "npu"
batch_size: 6144
custom_setting {
id: "scenario"
value: "offline"
}
custom_setting {
id: "preset"
value: "1003"
}
custom_setting {
id: "i_type"
value: "Uint8"
}
custom_setting {
id: "o_type"
value: "Float32"
}
custom_setting {
id: "extension"
value: "false"
}
custom_setting {
id: "lazy_mode"
value: "false"
}
model_path: "https://github.com/mlcommons/mobile_models/raw/main/v3_1/samsung/ic_offline.nnc"
model_checksum: "0c4c08850eb790dcaa7c77cc352dbfc1"
}
delegate_selected: "ENN_NPU"

single_stream_expected_latency_ns: 140000
}
Original file line number Diff line number Diff line change
Expand Up @@ -29,10 +29,8 @@ limitations under the License.

namespace mbe {
std::string mbe_core_libs[CORE_MAX] = {
"libmbe1200_core.so",
"libmbe2100_core.so",
"libmbe2200_core.so",
"libmbe2300_core.so",
"libmbe1200_core.so", "libmbe2100_core.so", "libmbe2200_core.so",
"libmbe2300_core.so", "libmbe2400_core.so",
};

void* load_symbol(void* dl_handle, const char* name) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -31,6 +31,7 @@ enum DEVICE_ID {
SOC_2100,
SOC_2200,
SOC_2300,
SOC_2400,
CORE_MAX
};

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -81,6 +81,11 @@ static int get_core_id_from_model(const char *model) {
else if (strstr((char *)model, "ERD9935") ||
strstr((char *)model, "S5E9935") || strstr((char *)model, "S919O"))
core_id = SOC_2300;
else if (strstr((char *)model, "ERD9945") ||
strstr((char *)model, "S5E9945") || strstr((char *)model, "MU3S") ||
strstr((char *)model, "S921") || strstr((char *)model, "S926") ||
strstr((char *)model, "S928"))
core_id = SOC_2400;
else
return CORE_INVALID;
return retrieve_model_surfix(model, core_id) ? core_id : CORE_INVALID;
Expand All @@ -98,6 +103,8 @@ static int get_core_id_from_hardware(const char *hardware) {
core_id = SOC_2200;
else if (strstr((char *)hardware, "9935"))
core_id = SOC_2300;
else if (strstr((char *)hardware, "9945"))
core_id = SOC_2400;
else
return CORE_INVALID;
return core_id;
Expand Down Expand Up @@ -125,6 +132,8 @@ const char *core_ctrl::get_benchmark_config(int core_id) {
settings = mbe_config_2200_pbtxt.c_str();
} else if (core_id == SOC_2300) {
settings = mbe_config_2300_pbtxt.c_str();
} else if (core_id == SOC_2400) {
settings = mbe_config_2400_pbtxt.c_str();
}
return settings;
}
Expand Down
1 change: 1 addition & 0 deletions mobile_back_samsung/samsung_backend.mk
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,7 @@ ifeq (${WITH_SAMSUNG},1)
${MOBILE_BACK_SAMSUNG_LIB_ROOT}/internal/libenn_public_api_cpp.so \
${MOBILE_BACK_SAMSUNG_LIB_ROOT}/internal/libenn_extension.so \
${MOBILE_BACK_SAMSUNG_LIB_ROOT}/internal/libmbe2300_core.so \
${MOBILE_BACK_SAMSUNG_LIB_ROOT}/internal/libmbe2400_core.so \
${MOBILE_BACK_SAMSUNG_LIB_ROOT}/internal/libmbe2200_core.so \
${MOBILE_BACK_SAMSUNG_LIB_ROOT}/internal/libmbe2100_core.so \
${MOBILE_BACK_SAMSUNG_LIB_ROOT}/internal/libmbe1200_core.so \
Expand Down
Loading