This commit is contained in:
wejoncy 2023-03-15 09:30:01 +08:00 committed by JiCheng
parent cc15ceef4e
commit 32533dd1c2
4 changed files with 6 additions and 6 deletions

View file

@ -54,7 +54,7 @@ Status BaseOpBuilder::AddToModelBuilder(ModelBuilder& model_builder, const NodeU
ORT_RETURN_IF_NOT(IsOpSupported(model_builder.GetInitializerTensors(), node_unit, params),
"Unsupported operator ", node_unit.OpType());
#ifndef NDEBUG
model_builder.SetDebugTrackNode(node_unit.Index());
model_builder.SetDebugCurrentOnnxNodeIndex(node_unit.Index());
#endif
ORT_RETURN_IF_ERROR(AddToModelBuilderImpl(model_builder, node_unit));
LOGS_DEFAULT(VERBOSE) << "Operator name: [" << node_unit.Name()

View file

@ -479,7 +479,7 @@ Status ModelBuilder::AddOperation(int op, const InlinedVector<uint32_t>& input_i
const std::vector<std::string>& output_names,
const std::vector<OperandType>& output_types) {
#ifndef NDEBUG
operations_recorder_.emplace_back(track_node_index_, op);
operations_recorder_.emplace_back(current_onnx_node_index_, op);
#endif
InlinedVector<uint32_t> output_indices;
for (size_t i = 0; i < output_types.size(); i++) {

View file

@ -111,8 +111,8 @@ class ModelBuilder {
// ONNX node and NNAPI node are not a 1:1 mapping, like batch-normalization.
// We use this to track a specific ONNX node which we are processing and record the detail mapping relationship.
// So we can log out each NNAPI OP status during model-building and compiling.
void SetDebugTrackNode(const size_t node_index) {
track_node_index_ = node_index;
void SetDebugCurrentOnnxNodeIndex(const size_t node_index) {
current_onnx_node_index_ = node_index;
}
#endif
private:
@ -168,7 +168,7 @@ class ModelBuilder {
#ifndef NDEBUG
// To track and record current node index for debugging
size_t track_node_index_ = 0;
size_t current_onnx_node_index_ = 0;
// <ONNX node index ,nnapi operation index>
// An ONNX node might be decomposed into multiple nnapi operations
// <1,1> <1,2> <1,3>

View file

@ -113,7 +113,7 @@ Status GetTargetDevices(const NnApi& nnapi_handle, TargetDeviceOption target_dev
// and exclude nnapi-reference for better performance if possible.
// 3) We can easily log the detail of how op was assigned on NNAPI devices which is helpful for debugging.
// Related doc and code https://source.android.com/docs/core/interaction/neural-networks#cpu-usage
// and https://android.googlesource.com/platform/frameworks/ml/+/master/nn/runtime/ExecutionPlan.cpp#2303
// and https://android.googlesource.com/platform/frameworks/ml/+/5b525d4d9100819d87447bd2c2a0bcfdd62899ee/nn/runtime/ExecutionPlan.cpp#2303
if (cpu_index != -1 && cpu_index != static_cast<int32_t>(devices.size()) - 1) {
std::swap(devices[devices.size() - 1], devices[cpu_index]);
}