From 093a836a87f2b7f2d057af51cd3dc41516a621a5 Mon Sep 17 00:00:00 2001 From: Yanqingshang Date: Tue, 20 Oct 2020 20:09:11 +0800 Subject: [PATCH] add new code inc 20201019 --- .../opskernel/ops_kernel_builder.h} | 60 +- inc/common/opskernel/ops_kernel_info_types.h | 2 + inc/common/optimizer/graph_optimizer.h | 3 + inc/common/proto/dump_task.proto | 111 + inc/common/proto/fusion_model.proto | 23 +- inc/common/proto/fwk_adapter.proto | 37 + inc/common/proto/ge_api.proto | 103 - inc/common/proto/ge_ir.proto | 15 - inc/common/proto/insert_op.proto | 57 +- inc/common/proto/om.proto | 18 +- inc/common/proto/op_mapping_info.proto | 26 +- inc/common/proto/optimizer_priority.proto | 22 - .../proto/proto_inner}/ge_onnx.proto | 0 inc/common/proto/task.proto | 18 +- .../ai_core/common/aicore_util_attr_define.h | 18 +- .../util/ai_core/common/aicore_util_types.h | 77 +- inc/common/util/ai_core/common/graph_comm.h | 93 +- inc/common/util/ai_core/common/json_util.h | 49 + .../util/ai_core/common/scope_allocator.h | 22 +- .../param_calculate/aicore_param_calculator.h | 15 +- .../param_calculate/tensorsize_calculator.h | 31 +- inc/common/util/compress/compress.h | 24 +- inc/common/util/compress/compress_weight.h | 17 +- inc/common/util/error_manager/error_manager.h | 2 + inc/common/util/platform_info.h | 81 +- inc/common/util/platform_info_def.h | 192 +- inc/external/ge/ge_api.h | 121 -- inc/external/ge/ge_api_error_codes.h | 76 - inc/external/ge/ge_api_types.h | 335 --- inc/external/ge/ge_ir_build.h | 93 - .../graph/ascend_string.h} | 36 +- inc/external/graph/ge_error_codes.h | 1 + inc/external/graph/gnode.h | 130 ++ inc/external/graph/graph.h | 31 +- inc/external/graph/operator.h | 6 +- inc/external/graph/operator_reg.h | 2 + inc/external/register/register.h | 31 + .../scope/scope_fusion_pass_register.h | 81 +- inc/framework/common/ge_inner_error_codes.h | 7 +- inc/framework/common/ge_types.h | 37 +- inc/framework/common/helper/model_helper.h | 1 + inc/framework/common/op/attr_value_util.h | 1 - inc/framework/common/op/ge_op_utils.h | 3 +- inc/framework/common/string_util.h | 6 +- inc/framework/common/types.h | 5 +- inc/framework/common/util.h | 28 +- inc/framework/engine/dnnengine.h | 1 + inc/framework/executor/ge_executor.h | 17 +- inc/framework/ge_runtime/davinci_model.h | 14 +- inc/framework/ge_runtime/model_runner.h | 7 +- inc/framework/ge_runtime/task_info.h | 11 +- inc/framework/generator/ge_generator.h | 2 + inc/framework/memory/memory_api.h | 18 +- inc/framework/memory/memory_assigner.h | 2 +- inc/framework/omg/omg.h | 3 - inc/framework/omg/omg_inner_types.h | 18 +- inc/framework/omg/parser/model_parser.h | 2 +- inc/framework/omg/parser/op_parser.h | 2 +- inc/framework/omg/parser/parser_factory.h | 2 +- inc/framework/omg/parser/parser_inner_ctx.h | 25 + inc/framework/omg/parser/parser_types.h | 508 +++++ inc/graph/compute_graph.h | 3 + inc/graph/debug/ge_attr_define.h | 31 +- inc/graph/ge_context.h | 2 +- inc/graph/node.h | 5 + inc/graph/op_desc.h | 19 +- inc/graph/op_kernel_bin.h | 1 + inc/graph/opsproto_manager.h | 6 +- inc/graph/runtime_inference_context.h | 3 + inc/graph/tuning_utils.h | 133 ++ inc/graph/utils/graph_utils.h | 98 +- .../utils/node_adapter.h} | 35 +- inc/graph/utils/node_utils.h | 34 +- inc/graph/utils/op_desc_utils.h | 3 +- inc/graph/utils/type_utils.h | 1 + inc/hccl/base.h | 86 +- inc/hccl/hccl_op_base.h | 132 -- inc/hccl/hcom.h | 100 +- inc/mmpa/mmpa_api.h | 129 ++ inc/mmpa/sub_inc/mmpa_linux.h | 519 +++++ inc/mmpa/sub_inc/mmpa_typedef_linux.h | 98 + .../sub_inc/mmpa_typedef_win.h} | 99 +- inc/mmpa/sub_inc/mmpa_win.h | 541 +++++ .../buffer_fusion/buffer_fusion_constant.h | 74 - .../buffer_fusion/buffer_fusion_pass_base.h | 36 - .../buffer_fusion_pass_registry.h | 66 - .../buffer_fusion/buffer_fusion_pattern.h | 74 - .../fusion_common/graph_pass_util.h | 250 --- .../fusion_common/pattern_fusion_base_pass.h | 106 - .../fusion_pass_registry.h | 63 - .../graph_fusion/fusion_pattern.h | 172 -- .../graph_fusion/graph_fusion_pass_base.h | 113 -- .../graph_optimizer/graph_fusion/graph_pass.h | 39 - .../graph_optimizer/graph_fusion/pass.h | 48 - .../graph_optimize_register_error_codes.h | 50 - inc/register/op_registry.h | 4 + inc/register/op_tiling.h | 133 -- inc/register/proto/caffe/caffe.proto | 1802 ----------------- .../proto/tensorflow/attr_value.proto | 62 - inc/register/proto/tensorflow/function.proto | 100 - inc/register/proto/tensorflow/graph.proto | 56 - inc/register/proto/tensorflow/node_def.proto | 63 - inc/register/proto/tensorflow/op_def.proto | 164 -- .../proto/tensorflow/resource_handle.proto | 29 - inc/register/proto/tensorflow/tensor.proto | 94 - .../proto/tensorflow/tensor_shape.proto | 45 - inc/register/proto/tensorflow/types.proto | 74 - inc/register/proto/tensorflow/versions.proto | 31 - inc/register/register.h | 53 - inc/register/register_format_transfer.h | 79 - inc/register/scope/scope_graph_impl.h | 143 -- inc/register/scope/scope_pass_impl.h | 61 - inc/register/scope/scope_pattern_impl.h | 105 - inc/register/tensor_assign.h | 103 - inc/runtime/base.h | 601 ++++++ inc/runtime/config.h | 192 ++ inc/runtime/context.h | 164 ++ inc/runtime/dev.h | 363 ++++ inc/{hccl/cltm.h => runtime/dvfsprofile.h} | 73 +- inc/runtime/event.h | 236 +++ inc/runtime/kernel.h | 537 +++++ inc/runtime/mem.h | 542 +++++ inc/{tdt/train_mode.h => runtime/rt.h} | 35 +- inc/runtime/rt_model.h | 456 +++++ inc/runtime/stream.h | 195 ++ inc/soft_dp/ExternalSoftDp.h | 38 +- inc/tdt/status.h | 4 + inc/tdt/tdt_device.h | 53 - inc/tdt/tdt_host_interface.h | 87 + inc/tdt/tdt_server.h | 83 - inc/tdt/tsd.h | 99 - inc/toolchain/adx_datadump_server.h | 36 + inc/toolchain/bbox/bbox_ddr_data.h | 126 -- inc/toolchain/bbox/bbox_ddr_data_cloud.h | 1183 ----------- inc/toolchain/bbox/bbox_ddr_data_dc.h | 458 ----- inc/toolchain/bbox/bbox_ddr_data_mdc.h | 474 ----- inc/toolchain/bbox/bbox_ddr_data_mini.h | 1278 ------------ inc/toolchain/bbox/bbox_proxy.h | 57 - inc/toolchain/bbox/bbox_proxy_config.h | 95 - inc/toolchain/bbox/bbox_proxy_config_dc.h | 268 --- inc/toolchain/bbox/bbox_proxy_config_mdc.h | 400 ---- inc/toolchain/bbox/device/bbox_pub.h | 320 --- inc/toolchain/bbox/device/bbox_pub_cloud.h | 288 --- inc/toolchain/bbox/device/bbox_pub_mini.h | 288 --- inc/toolchain/bbox/device/bbox_types.h | 66 - inc/toolchain/ide_daemon_api.h | 177 -- inc/toolchain/ide_tlv.h | 79 - inc/toolchain/prof_acl_api.h | 51 - inc/toolchain/profiler_client.h | 102 - 149 files changed, 6736 insertions(+), 11917 deletions(-) rename inc/{register/scope/scope_pass_registry_impl.h => common/opskernel/ops_kernel_builder.h} (33%) create mode 100644 inc/common/proto/dump_task.proto create mode 100644 inc/common/proto/fwk_adapter.proto delete mode 100644 inc/common/proto/ge_api.proto delete mode 100644 inc/common/proto/optimizer_priority.proto rename inc/{register/proto/onnx => common/proto/proto_inner}/ge_onnx.proto (100%) create mode 100644 inc/common/util/ai_core/common/json_util.h delete mode 100644 inc/external/ge/ge_api.h delete mode 100644 inc/external/ge/ge_api_error_codes.h delete mode 100644 inc/external/ge/ge_api_types.h delete mode 100644 inc/external/ge/ge_ir_build.h rename inc/{toolchain/stackcore/stackcore.h => external/graph/ascend_string.h} (59%) create mode 100644 inc/external/graph/gnode.h create mode 100644 inc/framework/omg/parser/parser_types.h create mode 100644 inc/graph/tuning_utils.h rename inc/{hccl/hvd_adapter_pub.h => graph/utils/node_adapter.h} (52%) delete mode 100644 inc/hccl/hccl_op_base.h create mode 100644 inc/mmpa/mmpa_api.h create mode 100644 inc/mmpa/sub_inc/mmpa_linux.h create mode 100644 inc/mmpa/sub_inc/mmpa_typedef_linux.h rename inc/{hccl/hcom_ops_stores.h => mmpa/sub_inc/mmpa_typedef_win.h} (31%) create mode 100644 inc/mmpa/sub_inc/mmpa_win.h delete mode 100644 inc/register/graph_optimizer/buffer_fusion/buffer_fusion_constant.h delete mode 100644 inc/register/graph_optimizer/buffer_fusion/buffer_fusion_pass_base.h delete mode 100644 inc/register/graph_optimizer/buffer_fusion/buffer_fusion_pass_registry.h delete mode 100644 inc/register/graph_optimizer/buffer_fusion/buffer_fusion_pattern.h delete mode 100644 inc/register/graph_optimizer/fusion_common/graph_pass_util.h delete mode 100644 inc/register/graph_optimizer/fusion_common/pattern_fusion_base_pass.h delete mode 100644 inc/register/graph_optimizer/graph_fusion/fusion_pass_manager/fusion_pass_registry.h delete mode 100644 inc/register/graph_optimizer/graph_fusion/fusion_pattern.h delete mode 100644 inc/register/graph_optimizer/graph_fusion/graph_fusion_pass_base.h delete mode 100644 inc/register/graph_optimizer/graph_fusion/graph_pass.h delete mode 100644 inc/register/graph_optimizer/graph_fusion/pass.h delete mode 100644 inc/register/graph_optimizer/graph_optimize_register_error_codes.h delete mode 100644 inc/register/op_tiling.h delete mode 100644 inc/register/proto/caffe/caffe.proto delete mode 100644 inc/register/proto/tensorflow/attr_value.proto delete mode 100644 inc/register/proto/tensorflow/function.proto delete mode 100644 inc/register/proto/tensorflow/graph.proto delete mode 100644 inc/register/proto/tensorflow/node_def.proto delete mode 100644 inc/register/proto/tensorflow/op_def.proto delete mode 100644 inc/register/proto/tensorflow/resource_handle.proto delete mode 100644 inc/register/proto/tensorflow/tensor.proto delete mode 100644 inc/register/proto/tensorflow/tensor_shape.proto delete mode 100644 inc/register/proto/tensorflow/types.proto delete mode 100644 inc/register/proto/tensorflow/versions.proto delete mode 100644 inc/register/register.h delete mode 100644 inc/register/register_format_transfer.h delete mode 100644 inc/register/scope/scope_graph_impl.h delete mode 100644 inc/register/scope/scope_pass_impl.h delete mode 100644 inc/register/scope/scope_pattern_impl.h delete mode 100644 inc/register/tensor_assign.h create mode 100644 inc/runtime/base.h create mode 100644 inc/runtime/config.h create mode 100644 inc/runtime/context.h create mode 100644 inc/runtime/dev.h rename inc/{hccl/cltm.h => runtime/dvfsprofile.h} (32%) create mode 100644 inc/runtime/event.h create mode 100644 inc/runtime/kernel.h create mode 100644 inc/runtime/mem.h rename inc/{tdt/train_mode.h => runtime/rt.h} (62%) create mode 100644 inc/runtime/rt_model.h create mode 100644 inc/runtime/stream.h delete mode 100644 inc/tdt/tdt_device.h delete mode 100644 inc/tdt/tdt_server.h delete mode 100644 inc/tdt/tsd.h create mode 100644 inc/toolchain/adx_datadump_server.h delete mode 100644 inc/toolchain/bbox/bbox_ddr_data.h delete mode 100644 inc/toolchain/bbox/bbox_ddr_data_cloud.h delete mode 100644 inc/toolchain/bbox/bbox_ddr_data_dc.h delete mode 100644 inc/toolchain/bbox/bbox_ddr_data_mdc.h delete mode 100644 inc/toolchain/bbox/bbox_ddr_data_mini.h delete mode 100644 inc/toolchain/bbox/bbox_proxy.h delete mode 100644 inc/toolchain/bbox/bbox_proxy_config.h delete mode 100644 inc/toolchain/bbox/bbox_proxy_config_dc.h delete mode 100644 inc/toolchain/bbox/bbox_proxy_config_mdc.h delete mode 100644 inc/toolchain/bbox/device/bbox_pub.h delete mode 100644 inc/toolchain/bbox/device/bbox_pub_cloud.h delete mode 100644 inc/toolchain/bbox/device/bbox_pub_mini.h delete mode 100644 inc/toolchain/bbox/device/bbox_types.h delete mode 100644 inc/toolchain/ide_daemon_api.h delete mode 100644 inc/toolchain/ide_tlv.h delete mode 100644 inc/toolchain/prof_acl_api.h delete mode 100644 inc/toolchain/profiler_client.h diff --git a/inc/register/scope/scope_pass_registry_impl.h b/inc/common/opskernel/ops_kernel_builder.h similarity index 33% rename from inc/register/scope/scope_pass_registry_impl.h rename to inc/common/opskernel/ops_kernel_builder.h index 9e68dba06..169f27f84 100644 --- a/inc/register/scope/scope_pass_registry_impl.h +++ b/inc/common/opskernel/ops_kernel_builder.h @@ -1,40 +1,56 @@ /** * Copyright 2020 Huawei Technologies Co., Ltd - * + * 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 REGISTER_SCOPE_SCOPE_REGISTRY_IMPL_H_ -#define REGISTER_SCOPE_SCOPE_REGISTRY_IMPL_H_ +#ifndef INC_COMMON_OPSKERNELUTILS_OPS_KERNEL_INFO_UTILS_H_ +#define INC_COMMON_OPSKERNELUTILS_OPS_KERNEL_INFO_UTILS_H_ -#include "external/register/scope/scope_fusion_pass_register.h" -#include +#include "external/ge/ge_api_error_codes.h" +#include "cce/aicpu_engine_struct.h" +#include "common/opskernel/ops_kernel_info_types.h" +#include "graph/node.h" +#include "proto/task.pb.h" namespace ge { -struct CreatePassFnPack; -class ScopeFusionPassRegistry::ScopeFusionPassRegistryImpl { +class OpsKernelBuilder { public: - void RegisterScopeFusionPass(const std::string &pass_name, ScopeFusionPassRegistry::CreateFn create_fn, - bool is_general); - ScopeFusionPassRegistry::CreateFn GetCreateFn(const std::string &pass_name); - std::unique_ptr CreateScopeFusionPass(const std::string &pass_name); - std::vector GetAllRegisteredPasses(); - bool SetPassEnableFlag(const std::string pass_name, const bool flag); - - private: - std::mutex mu_; - std::vector pass_names_; // In the order of user registration - std::map create_fn_packs_; + OpsKernelBuilder() = default; + virtual ~OpsKernelBuilder() = default; + + // initialize OpsKernelBuilder + virtual Status Initialize(const std::map &options) = 0; + + // finalize OpsKernelBuilder + virtual Status Finalize() = 0; + + // memory allocation requirement + virtual Status CalcOpRunningParam(Node &node) = 0; + + // generate task for op + virtual Status GenerateTask(const Node &node, RunContext &context, + std::vector &tasks) = 0; + + // only call aicpu interface to generate task struct + virtual Status GenSingleOpRunTask(const NodePtr &node, STR_FWK_OP_KERNEL &task, string &task_info) { + return FAILED; + } + + // only call aicpu interface to generate task struct + virtual Status GenMemCopyTask(uint64_t count, STR_FWK_OP_KERNEL &task, string &task_info) { + return FAILED; + } }; } // namespace ge -#endif // REGISTER_SCOPE_SCOPE_REGISTRY_IMPL_H_ \ No newline at end of file +#endif // INC_COMMON_OPSKERNELUTILS_OPS_KERNEL_INFO_UTILS_H_ diff --git a/inc/common/opskernel/ops_kernel_info_types.h b/inc/common/opskernel/ops_kernel_info_types.h index 6dbf5ff76..9fc5a49d0 100644 --- a/inc/common/opskernel/ops_kernel_info_types.h +++ b/inc/common/opskernel/ops_kernel_info_types.h @@ -33,6 +33,8 @@ struct RunContext { uint64_t sessionId; uint64_t dataMemSize; uint8_t *dataMemBase; + std::map mem_type_data_mem_size; + std::map mem_type_data_mem_base; uint64_t weightMemSize; uint8_t *weightMemBase; ge::Buffer weightsBuffer; diff --git a/inc/common/optimizer/graph_optimizer.h b/inc/common/optimizer/graph_optimizer.h index 8361a8dfc..9865df145 100644 --- a/inc/common/optimizer/graph_optimizer.h +++ b/inc/common/optimizer/graph_optimizer.h @@ -68,6 +68,9 @@ class GraphOptimizer { // optimize streamed Graph virtual Status OptimizeStreamGraph(ComputeGraph &graph, const RunContext &context) { return SUCCESS; } + + // op compile + virtual Status OptimizeFusedGraphAfterGraphSlice(ComputeGraph &graph) { return SUCCESS; } }; } // namespace ge /*lint +e148*/ diff --git a/inc/common/proto/dump_task.proto b/inc/common/proto/dump_task.proto new file mode 100644 index 000000000..b1e346cd2 --- /dev/null +++ b/inc/common/proto/dump_task.proto @@ -0,0 +1,111 @@ +syntax = "proto3"; +package toolkit.dumpdata; + +enum OutputDataType { + DT_UNDEFINED = 0; + DT_FLOAT = 1; + DT_FLOAT16 = 2; + DT_INT8 = 3; + DT_UINT8 = 4; + DT_INT16 = 5; + DT_UINT16 = 6; + DT_INT32 = 7; + DT_INT64 = 8; + DT_UINT32 = 9; + DT_UINT64 = 10; + DT_BOOL = 11; + DT_DOUBLE = 12; + DT_STRING = 13; + DT_DUAL_SUB_INT8 = 14; + DT_DUAL_SUB_UINT8 = 15; + DT_COMPLEX64 = 16; + DT_COMPLEX128 = 17; + DT_QINT8 = 18; + DT_QINT16 = 19; + DT_QINT32 = 20; + DT_QUINT8 = 21; + DT_QUINT16 = 22; + DT_RESOURCE = 23; + DT_STRING_REF = 24; + DT_DUAL = 25; +} + +enum OutputFormat { + FORMAT_NCHW = 0; + FORMAT_NHWC = 1; + FORMAT_ND = 2; + FORMAT_NC1HWC0 = 3; + FORMAT_FRACTAL_Z = 4; + FORMAT_NC1C0HWPAD = 5; + FORMAT_NHWC1C0 = 6; + FORMAT_FSR_NCHW = 7; + FORMAT_FRACTAL_DECONV = 8; + FORMAT_C1HWNC0 = 9; + FORMAT_FRACTAL_DECONV_TRANSPOSE = 10; + FORMAT_FRACTAL_DECONV_SP_STRIDE_TRANS = 11; + FORMAT_NC1HWC0_C04 = 12; + FORMAT_FRACTAL_Z_C04 = 13; + FORMAT_CHWN = 14; + FORMAT_FRACTAL_DECONV_SP_STRIDE8_TRANS = 15; + FORMAT_HWCN = 16; + FORMAT_NC1KHKWHWC0 = 17; + FORMAT_BN_WEIGHT = 18; + FORMAT_FILTER_HWCK = 19; + FORMAT_HASHTABLE_LOOKUP_LOOKUPS=20; + FORMAT_HASHTABLE_LOOKUP_KEYS = 21; + FORMAT_HASHTABLE_LOOKUP_VALUE = 22; + FORMAT_HASHTABLE_LOOKUP_OUTPUT = 23; + FORMAT_HASHTABLE_LOOKUP_HITS=24; + FORMAT_C1HWNCoC0 = 25; + FORMAT_MD = 26; + FORMAT_NDHWC = 27; + FORMAT_FRACTAL_ZZ = 28; + FORMAT_FRACTAL_NZ = 29; + FORMAT_RESERVED = 30; +} + +message OriginalOp { + string name = 1; + uint32 output_index = 2; + OutputDataType data_type = 3; + OutputFormat format = 4; +} + +message Shape { + repeated uint64 dim = 1; +} + +message OpOutput { + OutputDataType data_type = 1; + OutputFormat format = 2; + Shape shape = 3; + OriginalOp original_op = 4; // the original op corresponding to the output + bytes data = 5; + uint64 size = 6; +} + +message OpInput { + OutputDataType data_type = 1; + OutputFormat format = 2; + Shape shape = 3; + bytes data = 4; + uint64 size = 5; +} + +enum BufferType { + L1 = 0; +} + +message OpBuffer { + BufferType buffer_type = 1; + bytes data = 2; + uint64 size = 3; +} + +message DumpData{ + string version = 1; + uint64 dump_time = 2; + repeated OpOutput output = 3; + repeated OpInput input = 4; + repeated OpBuffer buffer = 5; +} diff --git a/inc/common/proto/fusion_model.proto b/inc/common/proto/fusion_model.proto index fab31788e..c92c5581a 100644 --- a/inc/common/proto/fusion_model.proto +++ b/inc/common/proto/fusion_model.proto @@ -1,24 +1,21 @@ -/** - * Copyright 2019-2020 Huawei Technologies Co., Ltd +/* Copyright (C) 2018. Huawei Technologies Co., Ltd. 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 + * This program is free software; you can redistribute it and/or modify + * it under the terms of the Apache License Version 2.0.You may not use this file except in compliance with the License. * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * Apache License for more details 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. */ syntax = "proto3"; -import "vendor/hisi/npu/cce/graph_old/proto/om.proto"; +import "om.proto"; + package domi; message FusionModelDef { string version = 1; repeated OpDef fusion_op = 2; -} +} \ No newline at end of file diff --git a/inc/common/proto/fwk_adapter.proto b/inc/common/proto/fwk_adapter.proto new file mode 100644 index 000000000..9335c9263 --- /dev/null +++ b/inc/common/proto/fwk_adapter.proto @@ -0,0 +1,37 @@ +/* Copyright (C) 2018. Huawei Technologies Co., Ltd. All rights reserved. + * + * This program is free software; you can redistribute it and/or modify + * it under the terms of the Apache License Version 2.0.You may not use this file except in compliance with the License. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * Apache License for more details at + * http://www.apache.org/licenses/LICENSE-2.0 + */ +syntax = "proto3"; + +package aicpu.FWKAdapter; +option cc_enable_arenas = true; + + +// Defines an struct for input and output. +message TensorDataInfo { + + // value DataType + uint32 dtype = 1; + + // shape dim + repeated int64 dim = 2; + + // data point addr + int64 data_addr = 3; +} + +message KernelRunParam { + // input + repeated TensorDataInfo input = 1; + // output + repeated TensorDataInfo output = 2; +} + diff --git a/inc/common/proto/ge_api.proto b/inc/common/proto/ge_api.proto deleted file mode 100644 index 59be2e5a9..000000000 --- a/inc/common/proto/ge_api.proto +++ /dev/null @@ -1,103 +0,0 @@ -/* - * Copyright 2019-2020 Huawei Technologies Co., Ltd - * - * 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. - */ -syntax = "proto3"; -package ge.api_pb; - -import "ge_ir.proto"; - -// GE initialize -message GEInitialize { - map options = 1; -}; - -// initialize response -message GEInitializeResponse { - uint32 status = 1; - uint32 clientId = 2; -}; - -// GE finalize -message GEFinalize { - bool final = 1; - uint32 clientId = 2; -}; - -message GEFinalizeResponse { - uint32 status = 1; -}; - -// GE Session -message CreateSession{ - map options = 1; -}; - -message CreateSessionResponse { - uint32 status = 1; - uint64 sessionId = 2; -}; - -//GE AddGraph -//model serialize :: serializegraph -message SessionAddGraph{ - uint32 graphId = 1; - uint64 sessionId = 2; - ge.proto.GraphDef graph = 3; -}; - -message SessionAddGraphResponse { - uint32 status = 1; -}; - -//GE SessionRemoveGraph -message SessionRemoveGraph{ - uint32 graphId = 1; - uint64 sessionId = 2; -}; - -message SessionRemoveGraphResponse { - uint32 status = 1; -}; - -message SessionRunGraph{ - uint32 graphId = 1; - uint64 sessionId = 2; - repeated ge.proto.TensorDef tensor = 3; -}; - -message SessionBuildGraph{ - uint32 graphId = 1; - uint64 sessionId = 2; - repeated ge.proto.TensorDef tensor = 3; - string savePath = 4; -}; - -message SessionRunGraphResponse { - uint32 status = 1; - repeated ge.proto.TensorDef tensor = 2; -}; - -message SessionBuildGraphResponse { - uint32 status = 1; -}; - -message DestroySession{ - bool final = 1; - uint64 sessionId = 2; -}; - -message DestroySessionResponse { - uint32 status = 1; -}; diff --git a/inc/common/proto/ge_ir.proto b/inc/common/proto/ge_ir.proto index 225a4adb8..ab21f6723 100644 --- a/inc/common/proto/ge_ir.proto +++ b/inc/common/proto/ge_ir.proto @@ -1,18 +1,3 @@ -/** - * Copyright 2019-2020 Huawei Technologies Co., Ltd - * - * 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. - */ syntax = "proto3"; package ge.proto; diff --git a/inc/common/proto/insert_op.proto b/inc/common/proto/insert_op.proto index ac6a4162f..e28d65326 100644 --- a/inc/common/proto/insert_op.proto +++ b/inc/common/proto/insert_op.proto @@ -1,18 +1,3 @@ -/** - * Copyright 2019-2020 Huawei Technologies Co., Ltd - * - * 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. - */ syntax = "proto3"; package domi; @@ -39,6 +24,12 @@ message AippOpParams { RAW12 = 12; RAW16 = 13; RAW24 = 14; + RGB16 = 15; + RGB20 = 16; + RGB24 = 17; + RGB8_IR = 18; + RGB16_IR = 19; + RGB24_IR = 20; } enum AippMode { @@ -47,28 +38,28 @@ message AippOpParams { dynamic = 2; } - // AIPPģʽ�����־�̬AIPP�Ͷ�̬AIPP + // AIPPģʽ־̬AIPPͶ̬AIPP AippMode aipp_mode = 1; - // related_input_rank����Ϊ�������Ϊ���ͣ����÷�Χ>=0, <=����Data���ӵĸ�����Ĭ��ֵΪ0�� - // ��ʶ��ģ�͵ĵڼ���������AIPP����������ģ�����������룬��Ҫ�Ե�2��������AIPP��������related_input_rankΪ1�� + // related_input_rankΪΪͣ÷Χ>=0, <=DataӵĸĬֵΪ0 + // ʶģ͵ĵڼAIPPģ룬ҪԵ2AIPPrelated_input_rankΪ1 uint32 related_input_rank = 2; - // input_edge_idx����Ϊ��ѡ������Ϊ���ͣ����÷�ΧΪ>=0�� - // ���øò��������ã����ڶ�Data���Ӳ�ͬ���������ͬ��AIPP����������ò���û�����ã�Ĭ�϶�related_input_rankָ����ģ������������������AIPP�� - // ����ֵ <= Data��������ߵĸ����� + // input_edge_idxΪѡΪͣ÷ΧΪ>=0 + // øòãڶDataӲͬͬAIPPòûãĬ϶related_input_rankָģAIPP + // ֵ <= Dataߵĸ repeated uint32 input_edge_idx = 3; - // [Begin] ��̬AIPP���������þ�̬AIPPʱ��Ч + // [Begin] ̬AIPPþ̬AIPPʱЧ uint32 max_src_image_size = 4; - // �Ƿ�֧����ת��Ĭ�ϲ�֧�֣�����֧����תʱ�����ж���Ŀռ��������ʧ + // Ƿ֧תĬϲ֧֣֧תʱжĿռʧ bool support_rotation = 5; - // [End] ��̬AIPP���� + // [End] ̬AIPP - // [Begin] ��̬AIPP���������ö�̬AIPPʱ��Ч + // [Begin] ̬AIPPö̬AIPPʱЧ InputFormat input_format = 51; bool csc_switch = 52; float cpadding_value = 53; @@ -124,18 +115,22 @@ message AippOpParams { repeated int32 input_bias_1 = 43; repeated int32 input_bias_2 = 44; - // [End] ��̬AIPP���� + // [End] ̬AIPP + + // The n number that is used for raw/rgbir data into f16 transformation. + // The transformation equation is x/(2^n). If set to 0, no transform is performed. + uint32 raw_rgbir_to_f16_n = 45; } message MultiShapeOpParams { enum MultiShapeMode { - batch = 0; //��̬batch - resolution = 1; //��̬�ֱ��ʣ���չ�� + batch = 0; //̬batch + resolution = 1; //ֱ̬ʣչ } - MultiShapeMode mode = 1; //����ģʽ - uint32 related_input_rank = 2; //�������Ӳ��뵽�ĸ����� + MultiShapeMode mode = 1; //ģʽ + uint32 related_input_rank = 2; //Ӳ뵽ĸ - repeated uint32 batch_list = 11; //batch_listֵ��batch_list�ĸ�����2��8֮�� + repeated uint32 batch_list = 11; //batch_listֵbatch_listĸ28֮ } diff --git a/inc/common/proto/om.proto b/inc/common/proto/om.proto index 2f7fa86dd..e15e5f808 100644 --- a/inc/common/proto/om.proto +++ b/inc/common/proto/om.proto @@ -1,17 +1,13 @@ -/** - * Copyright 2019-2020 Huawei Technologies Co., Ltd +/* Copyright (C) 2018. Huawei Technologies Co., Ltd. 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 + * This program is free software; you can redistribute it and/or modify + * it under the terms of the Apache License Version 2.0.You may not use this file except in compliance with the License. * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * Apache License for more details 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. */ syntax = "proto3"; diff --git a/inc/common/proto/op_mapping_info.proto b/inc/common/proto/op_mapping_info.proto index 7511f8b8a..e23b7ebea 100644 --- a/inc/common/proto/op_mapping_info.proto +++ b/inc/common/proto/op_mapping_info.proto @@ -1,18 +1,3 @@ -/** - * Copyright 2019-2020 Huawei Technologies Co., Ltd - * - * 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. - */ syntax = "proto3"; package aicpu.dump; @@ -40,6 +25,16 @@ message Input { uint64 size = 5; } +enum BufferType { + L1 = 0; +} + +message OpBuffer { + BufferType buffer_type = 1; + uint64 address = 2; + uint64 size = 3; +} + message Op { string op_name = 1; string op_type = 2; @@ -52,6 +47,7 @@ message Task { repeated Output output = 4; bool end_graph = 5; repeated Input input = 6; + repeated OpBuffer buffer = 7; } message OpMappingInfo { diff --git a/inc/common/proto/optimizer_priority.proto b/inc/common/proto/optimizer_priority.proto deleted file mode 100644 index 383752803..000000000 --- a/inc/common/proto/optimizer_priority.proto +++ /dev/null @@ -1,22 +0,0 @@ -/** - * Copyright 2019-2020 Huawei Technologies Co., Ltd - * - * 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. - */ -syntax = "proto3"; -package ge.optimizers; - -// Default: GE>FE>AICPU -message Priority{ - repeated string optimizer = 1; -} \ No newline at end of file diff --git a/inc/register/proto/onnx/ge_onnx.proto b/inc/common/proto/proto_inner/ge_onnx.proto similarity index 100% rename from inc/register/proto/onnx/ge_onnx.proto rename to inc/common/proto/proto_inner/ge_onnx.proto diff --git a/inc/common/proto/task.proto b/inc/common/proto/task.proto index 1bb4e1995..d0c09840e 100644 --- a/inc/common/proto/task.proto +++ b/inc/common/proto/task.proto @@ -1,17 +1,13 @@ -/** - * Copyright 2019-2020 Huawei Technologies Co., Ltd +/* Copyright (C) 2018. Huawei Technologies Co., Ltd. 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 + * This program is free software; you can redistribute it and/or modify + * it under the terms of the Apache License Version 2.0.You may not use this file except in compliance with the License. * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * Apache License for more details 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. */ syntax = "proto3"; diff --git a/inc/common/util/ai_core/common/aicore_util_attr_define.h b/inc/common/util/ai_core/common/aicore_util_attr_define.h index 7ad009a96..f3556cb50 100644 --- a/inc/common/util/ai_core/common/aicore_util_attr_define.h +++ b/inc/common/util/ai_core/common/aicore_util_attr_define.h @@ -1,19 +1,13 @@ /** - * Copyright 2019 Huawei Technologies Co., Ltd + * @file aicore_util_attr_define.h * - * 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 + * Copyright (c) Huawei Technologies Co., Ltd. 2019-2019. All rights reserved. * - * http://www.apache.org/licenses/LICENSE-2.0 + * @brief attribute define + * + * @version 1.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 INC_COMMON_UTILS_AI_CORE_COMMON_ATTR_DEFINE_H_ #define INC_COMMON_UTILS_AI_CORE_COMMON_ATTR_DEFINE_H_ @@ -37,5 +31,7 @@ static const std::string ATTR_NAME_L2_FUSION_EXTEND_PTR = static const std::string L1_OPTIMIZED = "l1_optimized"; static const std::string L2_OPTIMIZED = "l2_optimized"; + +static const std::string OP_SLICE_INFO = "_op_slice_info"; } // namespace fe #endif diff --git a/inc/common/util/ai_core/common/aicore_util_types.h b/inc/common/util/ai_core/common/aicore_util_types.h index 16855190e..e57dbca71 100644 --- a/inc/common/util/ai_core/common/aicore_util_types.h +++ b/inc/common/util/ai_core/common/aicore_util_types.h @@ -1,17 +1,12 @@ /** - * Copyright 2019 Huawei Technologies Co., Ltd + * @file aicore_util_types.h * - * 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 + * Copyright (c) Huawei Technologies Co., Ltd. 2019-2019. All rights reserved. * - * http://www.apache.org/licenses/LICENSE-2.0 + * @brief struct\enuum + * + * @version 1.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 INC_COMMON_UTILS_AI_CORE_COMMON_TYPES_H_ @@ -42,48 +37,62 @@ struct FusionDataFlow { std::pair node_dataindex_pair; }; -typedef struct tagL2FusionData { +typedef struct tag_l2_fusion_data { uint32_t l2Index; uint64_t l2Addr; uint64_t l2PageNum; } L2FusionData_t; typedef std::map L2FusionDataMap_t; -typedef struct tagFeSmDesc { +typedef struct tag_fe_sm_desc { rtL2Ctrl_t l2ctrl; - std::string nodeName[8]; - uint8_t outputIndex[8]; -} feSmDesc_t; + std::string node_name[8]; + uint8_t output_index[8]; +} fe_sm_desc_t; typedef struct TagTaskL2FusionInfo { - std::string nodeName; - feSmDesc_t l2Info; + std::string node_name; + fe_sm_desc_t l2_info; L2FusionDataMap_t input; L2FusionDataMap_t output; - uint32_t isUsed; + uint32_t is_used; } TaskL2FusionInfo_t; using L2FusionInfoPtr = std::shared_ptr; typedef struct ToOpStruct { - int64_t opL1Space = 0; - std::vector opL1FusionType; - int64_t opL1WorkspaceFlag = 0; // for workspace flag - int64_t opL1WorkspaceSize = 0; - std::vector> validInputShape; - std::vector> validOutputShape; + int64_t op_l1_space = 0; + std::vector op_l1_fusion_type; + int64_t op_l1_workspace_flag = 0; // for workspace flag + int64_t op_l1_workspace_size = 0; + std::vector> valid_input_shape; + std::vector> valid_output_shape; std::vector> - sliceInputOffset; // conv & pooling & ReadSelect - std::vector> sliceOutputOffset; // WriteSelect - std::vector totalShape; - uint32_t splitIndex = 0; + slice_input_offset; // conv & pooling & ReadSelect + std::vector> slice_output_offset; // WriteSelect + std::vector total_shape; + uint32_t split_index = 0; ToOpStruct() { // set invalid value for essential variable - opL1Space = -1; - opL1WorkspaceSize = -1; + op_l1_space = -1; + op_l1_workspace_size = -1; } } ToOpStruct_t; +enum SlicePattern { + ELEMENT_WISE = 0, + ELEMENT_WISE_BROADCAST, + BROADCAST, + SLIDING_WINDOW, + SLIDING_WINDOW_DECONV, + CUBE_MATMUL, + SLICE_PATTERN_REDUCE, + SLICE_PATTERN_RESIZE, + SLICE_PATTERN_SCATTER, + SLICE_PATTERN_SEGMENT, + PATTERN_RESERVED +}; + enum OpImplType { EN_IMPL_CUSTOM_CONSTANT_CCE = 0, // custom constant op EN_IMPL_CUSTOM_TIK, // custom tik op @@ -116,5 +125,13 @@ static const std::map DATATYPE_SIZE_MAP{ {ge::DT_DUAL, sizeof(float) + sizeof(int8_t)}, {ge::DT_DUAL_SUB_UINT8, sizeof(int8_t)}, {ge::DT_DUAL_SUB_INT8, sizeof(int8_t)}}; + +enum OpReduceType { + REDUCE_MEAN = 0, + REDUCE_ADD, + REDUCE_MAX, + REDUCE_MIN, +}; + } #endif diff --git a/inc/common/util/ai_core/common/graph_comm.h b/inc/common/util/ai_core/common/graph_comm.h index 5ebe20435..5f5d42cdc 100644 --- a/inc/common/util/ai_core/common/graph_comm.h +++ b/inc/common/util/ai_core/common/graph_comm.h @@ -1,17 +1,12 @@ /** - * Copyright 2019 Huawei Technologies Co., Ltd + * @file graph_comm.h * - * 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 + * Copyright(C), 2017 - 2017, Huawei Tech. Co., Ltd. ALL RIGHTS RESERVED. * - * http://www.apache.org/licenses/LICENSE-2.0 + * @brief graph builder + * + * @version 1.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 INC_COMMON_UTILS_AI_CORE_COMMON_GRAPH_COMMON_H_ @@ -28,44 +23,40 @@ namespace fe { -using kScopeNodeMap_t = std::map>; -using kScopeNodePair_t = std::pair>; +using k_scope_node_map_t = std::map>; +using k_scope_node_pair_t = std::pair>; class GraphCommImpl; using GraphCommImplPtr = std::unique_ptr; class GraphComm { public: - GraphComm(const string &engineName); + GraphComm(const string &engine_name); virtual ~GraphComm(); GraphComm(const GraphComm &in) = delete; GraphComm &operator=(const GraphComm &in) = delete; - Status CreateFusionGraph(ge::ComputeGraph &modelGraph, - ge::ComputeGraph &fusionGraph, - const bool &isMapOpIndex); - - Status GetscopeNodeMap(ge::ComputeGraph &graph, kScopeNodeMap_t &fusionMap); + Status GetscopeNodeMap(ge::ComputeGraph &graph, k_scope_node_map_t &fusion_map); - Status CopyFusionOpNodes(vector &fusInputEdgeList, - vector &fusOutputEdgeList, - vector &fusNodelist, - ge::OpDescPtr fusionOpDesc, - ge::ComputeGraphPtr fusionGraph); + Status CopyFusionOpNodes(vector &fus_input_edge_list, + vector &fus_output_edge_list, + vector &fus_nodelist, + ge::OpDescPtr fusion_op_desc, + ge::ComputeGraphPtr fusion_graph); - Status CopyFusionOpEdges(ge::OpDescPtr fusionOpDesc, - ge::ComputeGraph &origGraph, - ge::ComputeGraphPtr fusionGraph); + Status CopyFusionOpEdges(ge::OpDescPtr fusion_op_desc, + ge::ComputeGraph &orig_graph, + ge::ComputeGraphPtr fusion_graph); Status GetNodeDataFlowMap( - const ge::NodePtr &fusNode, + const ge::NodePtr &fus_node, std::map> - &fusionOpAnchorsMap, - ge::kFusionDataFlowVec_t &fusDataflowList, const int &mapType); + &fusion_op_anchors_map, + ge::kFusionDataFlowVec_t &fus_dataflow_list, const int &map_type); - Status GetFusionNodeEdgeList(std::vector &fusNodelist, - std::vector &fusInputEdgeList, - std::vector &fusOutputEdgeList); + Status GetFusionNodeEdgeList(std::vector &fus_nodelist, + std::vector &fus_input_edge_list, + std::vector &fus_output_edge_list); void ClearFusionSrc(); void ClearFusionDst(); @@ -89,33 +80,33 @@ public: int32_t &fusion_src_index, int32_t &fusion_dst_index); Status - GetFusionNodeCtrlEdgeList(vector &fusNodelist, - vector &fusInputCtrlEdgeList, - vector &fusOutputCtrlEdgeList); + GetFusionNodeCtrlEdgeList(vector &fus_nodelist, + vector &fus_input_ctrl_edge_list, + vector &fus_output_ctrl_edge_list); - Status MergeFusionNodeEdgeList(ge::NodePtr &fusNode, - vector &fusNodelist, - vector &fusInputEdgeList, - vector &fusOutputEdgeList); + Status MergeFusionNodeEdgeList(ge::NodePtr &fus_node, + vector &fus_nodelist, + vector &fus_input_edge_list, + vector &fus_output_edge_list); - Status MergeFusionNodeCtrlEdgeList(ge::NodePtr &fusNode, - vector &fusNodelist, - vector &fusInputEdgeList, - vector &fusOutputEdgeList); + Status MergeFusionNodeCtrlEdgeList(ge::NodePtr &fus_node, + vector &fus_nodelist, + vector &fus_input_edge_list, + vector &fus_output_edge_list); string GetEngineName(); private: Status - MergeFusionNodeInputEdgeList(ge::NodePtr fusNode, - std::vector &fusNodelist, - std::vector &fusInputEdgeList); + MergeFusionNodeInputEdgeList(ge::NodePtr fus_node, + std::vector &fus_nodelist, + std::vector &fus_input_edge_list); Status - MergeFusionNodeOutputEdgeList(ge::NodePtr fusNode, - std::vector &fusNodelist, - std::vector &fusOutputEdgeList); + MergeFusionNodeOutputEdgeList(ge::NodePtr fus_node, + std::vector &fus_nodelist, + std::vector &fus_output_edge_list); - string engineName_; + string engine_name_; std::vector exist_fusion_src_list_; std::vector exist_fusion_dst_list_; @@ -126,7 +117,7 @@ private: // std::vector> ge::kFusionDataFlowVec_t fusion_output_dataflow_list_; - GraphCommImplPtr graphCommImplPtr_; + GraphCommImplPtr graph_comm_impl_ptr_; }; } // namespace fe #endif diff --git a/inc/common/util/ai_core/common/json_util.h b/inc/common/util/ai_core/common/json_util.h new file mode 100644 index 000000000..cba3e9906 --- /dev/null +++ b/inc/common/util/ai_core/common/json_util.h @@ -0,0 +1,49 @@ +/** + * @file json_util.h + * + * Copyright (c) Huawei Technologies Co., Ltd. 2019-2019. All rights reserved. + * + * @brief l1 fusion: + * + * @version 1.0 + * + */ + +#ifndef PROJECT_JSON_UTIL_H +#define PROJECT_JSON_UTIL_H + +#include "graph/compute_graph.h" + +#include "common/aicore_util_types.h" +#include "fusion_engine/graph_tuner/graph_tuner_errorcode.h" + +const std::string L1_FUSION_EXTEND_CONTENT = "_l1_fusion_extend_content"; +const std::string L2_FUSION_EXTEND_CONTENT = "l2_fusion_extend_content"; +const std::string TASK_L2_FUSION_INFO_EXTEND_CONTENT = "task_l2_fusion_info_extend_content"; +const std::string L1_FUSION_TO_OP_STRUCT = "_l1fusion_ToOpStruct"; +const std::string L2_FUSION_TO_OP_STRUCT = "_l2fusion_ToOpStruct"; +const std::string TASK_L2_FUSION_INFO = "_task_L2FusionInfo"; + +namespace tune { +using ToOpStructPtr = std::shared_ptr; +using L2FusionInfoPtr = std::shared_ptr; + +Status GetL1InfoFromJson(ge::OpDescPtr opDescPtr); + +Status GetL2InfoFromJson(ge::OpDescPtr opDescPtr); + +Status GetTaskL2FusionInfoFromJson(ge::OpDescPtr opDescPtr); + +Status ReadGraphInfoFromJson(ge::ComputeGraph &graph); + +Status WriteGraphInfoToJson(ge::ComputeGraph &graph); + +void GetL2ToOpStructFromJson(ge::OpDescPtr &opDescPtr, ToOpStructPtr &l2InfoPtr); + +void GetL1ToOpStructFromJson(ge::OpDescPtr &opDescPtr, ToOpStructPtr &l1InfoPtr); + +L2FusionInfoPtr GetL2FusionInfoFromJson(ge::OpDescPtr &opDescPtr); + +void SetL2FusionInfoToNode(ge::OpDescPtr &opDescPtr, L2FusionInfoPtr &l2FusionInfoPtr); +} // namespace tune +#endif //PROJECT_JSON_UTIL_H diff --git a/inc/common/util/ai_core/common/scope_allocator.h b/inc/common/util/ai_core/common/scope_allocator.h index 4848fbe7d..1d693907a 100644 --- a/inc/common/util/ai_core/common/scope_allocator.h +++ b/inc/common/util/ai_core/common/scope_allocator.h @@ -1,17 +1,12 @@ /** - * Copyright 2019 Huawei Technologies Co., Ltd + * @file scope_allocator.h * - * 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 + * Copyright (c) Huawei Technologies Co., Ltd. 2019-2019. All rights reserved. * - * http://www.apache.org/licenses/LICENSE-2.0 + * @brief tbe fusion scope id allocator + * + * @version 1.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 INC_COMMON_UTILS_AI_CORE_COMMON_SCOPE_ALLOCATOR_H_ @@ -32,10 +27,11 @@ class ScopeAllocator { int64_t GetCurrentScopeId(); int64_t AllocateScopeId(void); bool HasScopeAttr(ge::ConstOpDescPtr opdef); - bool GetScopeAttr(ge::ConstOpDescPtr opdef, int64_t &scopeId); - bool SetScopeAttr(ge::OpDescPtr opdef, int64_t scopeId); + bool GetScopeAttr(ge::ConstOpDescPtr opdef, int64_t &scope_id); + bool SetScopeAttr(ge::OpDescPtr opdef, int64_t scope_id); + bool ResetScopeId(int64_t scope_id); private: - int64_t scopeId; + int64_t scope_id; }; } // namespace fe #endif diff --git a/inc/common/util/ai_core/param_calculate/aicore_param_calculator.h b/inc/common/util/ai_core/param_calculate/aicore_param_calculator.h index 22064ccd0..0957c6625 100644 --- a/inc/common/util/ai_core/param_calculate/aicore_param_calculator.h +++ b/inc/common/util/ai_core/param_calculate/aicore_param_calculator.h @@ -1,17 +1,12 @@ /** - * Copyright 2019-2020 Huawei Technologies Co., Ltd + * @file aicore_param_calculator.h * - * 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 + * Copyright (c) Huawei Technologies Co., Ltd. 2019-2020. All rights reserved. * - * http://www.apache.org/licenses/LICENSE-2.0 + * @brief aicore param calculator + * + * @version 1.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 AICORE_PARAM_CALCULATOR diff --git a/inc/common/util/ai_core/param_calculate/tensorsize_calculator.h b/inc/common/util/ai_core/param_calculate/tensorsize_calculator.h index 2fdec1392..c006215f0 100644 --- a/inc/common/util/ai_core/param_calculate/tensorsize_calculator.h +++ b/inc/common/util/ai_core/param_calculate/tensorsize_calculator.h @@ -1,19 +1,14 @@ /** - * Copyright 2019 Huawei Technologies Co., Ltd + * @file tensorsize_calculator.h * - * 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 + * Copyright (c) Huawei Technologies Co., Ltd. 2019-2019. All rights reserved. * - * http://www.apache.org/licenses/LICENSE-2.0 + * @brief provide the capability of calculating + * workspace and input/output size + * + * @version 1.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 TENSORSIZE_CALCULATOR_H #define TENSORSIZE_CALCULATOR_H @@ -29,18 +24,18 @@ class TensorSizeCalculator { public: /** * Calculate the tensor size of input and output of each opdesc - * @param opDesc opdesc object - * @param opImplType op impl type + * @param op_desc opdesc object + * @param op_impl_type op impl type * @return status SUCCESS or FAILED */ - static Status CalculateOpTensorSize(ge::OpDesc &opDesc); + static Status CalculateOpTensorSize(ge::OpDesc &op_desc); private: - static Status CalcInputOpTensorSize(ge::OpDesc &opDesc, - int32_t &outputRealCalcFlag); + static Status CalcInputOpTensorSize(ge::OpDesc &op_desc, + int32_t &output_real_calc_flag); - static Status CalcOutputOpTensorSize(ge::OpDesc &opDesc, - int32_t &outputRealCalcFlag); + static Status CalcOutputOpTensorSize(ge::OpDesc &op_desc, + int32_t &output_real_calc_flag); }; } // namespace fe diff --git a/inc/common/util/compress/compress.h b/inc/common/util/compress/compress.h index b702324eb..7f0c135fb 100644 --- a/inc/common/util/compress/compress.h +++ b/inc/common/util/compress/compress.h @@ -1,19 +1,21 @@ -/** - * Copyright 2019-2020 Huawei Technologies Co., Ltd +/* + * Copyright (c) Huawei Technologies Co., Ltd. 2019-2020. 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 + * This program is free software; you can redistribute it and/or modify + * it under the terms of the Apache License Version 2.0.You may not use this file except in compliance with the License. * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * Apache License for more details 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. + * @brief compress header file + * + * @file compress.h + * + * @version 1.0 */ - #ifndef COMPRESS_H #define COMPRESS_H diff --git a/inc/common/util/compress/compress_weight.h b/inc/common/util/compress/compress_weight.h index aa48d4a07..38c252306 100644 --- a/inc/common/util/compress/compress_weight.h +++ b/inc/common/util/compress/compress_weight.h @@ -1,19 +1,12 @@ -/** - * Copyright 2020 Huawei Technologies Co., Ltd +/* + * Copyright (c) Huawei Technologies Co., Ltd. 2020-2020. 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 + * @brief header file of compress weight * - * http://www.apache.org/licenses/LICENSE-2.0 + * @file compress_weight.h * - * 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. + * @version 1.0 */ - #ifndef COMPRESS_WEIGHT_H #define COMPRESS_WEIGHT_H diff --git a/inc/common/util/error_manager/error_manager.h b/inc/common/util/error_manager/error_manager.h index 438e68a74..185f84cc9 100644 --- a/inc/common/util/error_manager/error_manager.h +++ b/inc/common/util/error_manager/error_manager.h @@ -20,6 +20,7 @@ #include #include #include +#include class ErrorManager { public: @@ -86,6 +87,7 @@ class ErrorManager { int ReadJsonFile(const std::string &file_path, void *handle); bool is_init_ = false; + std::mutex mutex_; std::map error_map_; std::vector error_messages_; std::vector warning_messages_; diff --git a/inc/common/util/platform_info.h b/inc/common/util/platform_info.h index 55baadad2..ab80f8303 100644 --- a/inc/common/util/platform_info.h +++ b/inc/common/util/platform_info.h @@ -1,12 +1,12 @@ /** * Copyright 2019-2020 Huawei Technologies Co., Ltd - + * * 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. @@ -36,85 +36,66 @@ class PlatformInfoManager { uint32_t InitializePlatformInfo(); uint32_t Finalize(); - uint32_t GetPlatformInfo(const string SoCVersion, PlatformInfo &platformInfo, - OptionalInfo &optiCompilationInfo); + uint32_t GetPlatformInfo(const string SoCVersion, PlatformInfo &platform_info, OptionalInfo &opti_compilation_info); - uint32_t GetPlatformInfoWithOutSocVersion(PlatformInfo &platformInfo, - OptionalInfo &optiCompilationInfo); + uint32_t GetPlatformInfoWithOutSocVersion(PlatformInfo &platform_info, OptionalInfo &opti_compilation_info); - void SetOptionalCompilationInfo(OptionalInfo &optiCompilationInfo); + void SetOptionalCompilationInfo(OptionalInfo &opti_compilation_info); private: PlatformInfoManager(); ~PlatformInfoManager(); - uint32_t LoadIniFile(string iniFileRealPath); + uint32_t LoadIniFile(string ini_file_real_path); void Trim(string &str); - uint32_t LoadConfigFile(string realPath); + uint32_t LoadConfigFile(string real_path); string RealPath(const std::string &path); string GetSoFilePath(); - void ParseVersion(map &versionMap, string &socVersion, - PlatformInfo &platformInfoTemp); + void ParseVersion(map &version_map, string &soc_version, PlatformInfo &platform_info_temp); + + void ParseSocInfo(map &soc_info_map, PlatformInfo &platform_info_temp); - void ParseSocInfo(map &socInfoMap, - PlatformInfo &platformInfoTemp); + void ParseCubeOfAICoreSpec(map &ai_core_spec_map, PlatformInfo &platform_info_temp); - void ParseCubeOfAICoreSpec(map &aiCoreSpecMap, - PlatformInfo &platformInfoTemp); + void ParseBufferOfAICoreSpec(map &ai_core_spec_map, PlatformInfo &platform_info_temp); - void ParseBufferOfAICoreSpec(map &aiCoreSpecMap, - PlatformInfo &platformInfoTemp); + void ParseUBOfAICoreSpec(map &ai_core_spec_map, PlatformInfo &platform_info_temp); - void ParseUBOfAICoreSpec(map &aiCoreSpecMap, - PlatformInfo &platformInfoTemp); + void ParseUnzipOfAICoreSpec(map &ai_core_spec_map, PlatformInfo &platform_info_temp); - void ParseUnzipOfAICoreSpec(map &aiCoreSpecMap, - PlatformInfo &platformInfoTemp); + void ParseAICoreSpec(map &ai_core_spec_map, PlatformInfo &platform_info_temp); - void ParseAICoreSpec(map &aiCoreSpecMap, - PlatformInfo &platformInfoTemp); + void ParseBufferOfAICoreMemoryRates(map &ai_core_memory_rates_map, PlatformInfo &platform_info_temp); - void ParseBufferOfAICoreMemoryRates(map &aiCoreMemoryRatesMap, - PlatformInfo &platformInfoTemp); + void ParseAICoreMemoryRates(map &ai_core_memory_rates_map, PlatformInfo &platform_info_temp); - void ParseAICoreMemoryRates(map &aiCoreMemoryRatesMap, - PlatformInfo &platformInfoTemp); + void ParseUBOfAICoreMemoryRates(map &ai_core_memory_rates_map, PlatformInfo &platform_info_temp); - void ParseUBOfAICoreMemoryRates(map &aiCoreMemoryRatesMap, - PlatformInfo &platformInfoTemp); + void ParseAICoreintrinsicDtypeMap(map &ai_coreintrinsic_dtype_map, PlatformInfo &platform_info_temp); - void ParseAICoreintrinsicDtypeMap( - map &aiCoreintrinsicDtypeMap, - PlatformInfo &platformInfoTemp); + void ParseVectorCoreSpec(map &vector_core_spec_map, PlatformInfo &platform_info_temp); - void ParseVectorCoreSpec(map &vectorCoreSpecMap, - PlatformInfo &platformInfoTemp); + void ParseVectorCoreMemoryRates(map &vector_core_memory_rates_map, PlatformInfo &platform_info_temp); - void ParseVectorCoreMemoryRates(map &vectorCoreMemoryRatesMap, - PlatformInfo &platformInfoTemp); + void ParseCPUCache(map &CPUCacheMap, PlatformInfo &platform_info_temp); - void ParseCPUCache(map &CPUCacheMap, - PlatformInfo &platformInfoTemp); + void ParseVectorCoreintrinsicDtypeMap(map &vector_coreintrinsic_dtype_map, + PlatformInfo &platform_info_temp); - void ParseVectorCoreintrinsicDtypeMap( - map &vectorCoreintrinsicDtypeMap, - PlatformInfo &platformInfoTemp); + uint32_t ParsePlatformInfoFromStrToStruct(map> &content_info_map, string &soc_version, + PlatformInfo &platform_info_temp); - uint32_t ParsePlatformInfoFromStrToStruct( - map> &contentInfoMap, string &socVersion, - PlatformInfo &platformInfoTemp); + uint32_t AssemblePlatformInfoVector(map> &content_info_map); - uint32_t AssemblePlatformInfoVector( - map> &contentInfoMap); private: - bool initFlag_; - map platformInfoMap_; - OptionalInfo optiCompilationInfo_; + bool init_flag_; + map platform_info_map_; + OptionalInfo opti_compilation_info_; }; } // namespace fe #endif diff --git a/inc/common/util/platform_info_def.h b/inc/common/util/platform_info_def.h index 05e6caece..1d4894a82 100644 --- a/inc/common/util/platform_info_def.h +++ b/inc/common/util/platform_info_def.h @@ -1,12 +1,12 @@ /** * Copyright 2019-2020 Huawei Technologies Co., Ltd - + * * 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. @@ -25,125 +25,117 @@ using std::map; using std::vector; using std::string; -namespace fe -{ -enum MemoryType { - DDR = 0, - HBM -}; +namespace fe { +enum MemoryType { DDR = 0, HBM }; -enum L2Type { - Cache = 0, - Buff -}; +enum L2Type { Cache = 0, Buff }; -typedef struct tagStrInfo { - string aicVersion; - string ccecAICVersion; - string ccecAIVVersion; - string isSupportAIcpuCompiler; +typedef struct tag_str_info { + string aic_version; + string ccec_aic_version; + string ccec_aiv_version; + string is_support_ai_cpu_compiler; } StrInfo; -typedef struct tagSoCInfo { - uint32_t aiCoreCnt; - uint32_t vectorCoreCnt; - uint32_t aiCpuCnt; - MemoryType memoryType; - uint64_t memorySize; - L2Type l2Type; - uint64_t l2Size; +typedef struct tag_so_c_info { + uint32_t ai_core_cnt; + uint32_t vector_core_cnt; + uint32_t ai_cpu_cnt; + MemoryType memory_type; + uint64_t memory_size; + L2Type l2_type; + uint64_t l2_size; uint32_t l2PageNum; } SoCInfo; -typedef struct tagAiCoreSpec { - double cubeFreq; - uint64_t cubeMSize; - uint64_t cubeNSize; - uint64_t cubeKSize; - uint64_t vecCalcSize; - uint64_t l0ASize; - uint64_t l0BSize; - uint64_t l0CSize; - uint64_t l1Size; - uint64_t smaskBuffer; - uint64_t ubSize; - uint64_t ubblockSize; - uint64_t ubbankSize; - uint64_t ubbankNum; - uint64_t ubburstInOneBlock; - uint64_t ubbankGroupNum; - uint32_t unzipEngines; - uint32_t unzipMaxRatios; - uint32_t unzipChannels; - uint8_t unzipIsTight; +typedef struct tag_ai_core_spec { + double cube_freq; + uint64_t cube_m_size; + uint64_t cube_n_size; + uint64_t cube_k_size; + uint64_t vec_calc_size; + uint64_t l0_a_size; + uint64_t l0_b_size; + uint64_t l0_c_size; + uint64_t l1_size; + uint64_t smask_buffer; + uint64_t ub_size; + uint64_t ubblock_size; + uint64_t ubbank_size; + uint64_t ubbank_num; + uint64_t ubburst_in_one_block; + uint64_t ubbank_group_num; + uint32_t unzip_engines; + uint32_t unzip_max_ratios; + uint32_t unzip_channels; + uint8_t unzip_is_tight; } AiCoreSpec; -typedef struct tagAiCoreMemoryRates { - double ddrRate; - double ddrReadRate; - double ddrWriteRate; - double l2Rate; - double l2ReadRate; - double l2WriteRate; - double l1ToL0ARate; - double l1ToL0BRate; - double l1ToUBRate; - double l0CToUBRate; - double ubToL2Rate; - double ubToDdrRate; - double ubToL1Rate; +typedef struct tag_ai_core_memory_rates { + double ddr_rate; + double ddr_read_rate; + double ddr_write_rate; + double l2_rate; + double l2_read_rate; + double l2_write_rate; + double l1_to_l0_a_rate; + double l1_to_l0_b_rate; + double l1_to_ub_rate; + double l0_c_to_ub_rate; + double ub_to_l2_rate; + double ub_to_ddr_rate; + double ub_to_l1_rate; } AiCoreMemoryRates; -typedef struct tagVectorCoreSpec { - double vecFreq; - uint64_t vecCalcSize; - uint64_t smaskBuffer; - uint64_t ubSize; - uint64_t ubblockSize; - uint64_t ubbankSize; - uint64_t ubbankNum; - uint64_t ubburstInOneBlock; - uint64_t ubbankGroupNum; - uint64_t vectorRegSize; - uint64_t predicateRegSize; - uint64_t addressRegSize; +typedef struct tag_vector_core_spec { + double vec_freq; + uint64_t vec_calc_size; + uint64_t smask_buffer; + uint64_t ub_size; + uint64_t ubblock_size; + uint64_t ubbank_size; + uint64_t ubbank_num; + uint64_t ubburst_in_one_block; + uint64_t ubbank_group_num; + uint64_t vector_reg_size; + uint64_t predicate_reg_size; + uint64_t address_reg_size; + uint64_t alignment_reg_size; } VectorCoreSpec; -typedef struct tagVectorCoreMemoryRates { - double ddrRate; - double ddrReadRate; - double ddrWriteRate; - double l2Rate; - double l2ReadRate; - double l2WriteRate; - double ubToL2Rate; - double ubToDdrRate; +typedef struct tag_vector_core_memory_rates { + double ddr_rate; + double ddr_read_rate; + double ddr_write_rate; + double l2_rate; + double l2_read_rate; + double l2_write_rate; + double ub_to_l2_rate; + double ub_to_ddr_rate; } VectorCoreMemoryRates; -typedef struct tagCPUCache { +typedef struct tag_cpu_cache { uint32_t AICPUSyncBySW; uint32_t TSCPUSyncBySW; } CPUCache; -typedef struct tagPlatformInfo -{ - StrInfo strInfo; - SoCInfo socInfo; - AiCoreSpec aiCoreSpec; - AiCoreMemoryRates aiCoreMemoryRates; - map> aiCoreIntrinsicDtypeMap; - VectorCoreSpec vectorCoreSpec; - VectorCoreMemoryRates vectorCoreMemoryRates; +typedef struct tag_platform_info { + StrInfo str_info; + SoCInfo soc_info; + AiCoreSpec ai_core_spec; + AiCoreMemoryRates ai_core_memory_rates; + map> ai_core_intrinsic_dtype_map; + VectorCoreSpec vector_core_spec; + VectorCoreMemoryRates vector_core_memory_rates; CPUCache cpucache; - map> vectorCoreIntrinsicDtypeMap; + map> vector_core_intrinsic_dtype_map; } PlatformInfo; -typedef struct tagOptionalInfo -{ - string socVersion; - string coreType; - uint32_t aiCoreNum; - string l1FusionFlag; +typedef struct tag_optional_info { + string soc_version; + string core_type; + uint32_t ai_core_num; + string l1_fusion_flag; } OptionalInfo; } // namespace fe #endif diff --git a/inc/external/ge/ge_api.h b/inc/external/ge/ge_api.h deleted file mode 100644 index e711bf61a..000000000 --- a/inc/external/ge/ge_api.h +++ /dev/null @@ -1,121 +0,0 @@ -/** - * Copyright 2019-2020 Huawei Technologies Co., Ltd - * - * 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 INC_EXTERNAL_GE_GE_API_H_ -#define INC_EXTERNAL_GE_GE_API_H_ - -#include -#include -#include - -#include "ge/ge_api_error_codes.h" -#include "ge/ge_api_types.h" -#include "graph/graph.h" -#include "graph/tensor.h" - -namespace ge { -typedef uint32_t (*pCallBackFunc)(uint32_t graph_id, const std::map ¶ms_list); - -// Initialize GE -Status GEInitialize(const std::map &options); - -// Finalize GE, release all resources -Status GEFinalize(); - -class GE_FUNC_DEV_VISIBILITY GE_FUNC_HOST_VISIBILITY Session { - public: - explicit Session(const std::map &options); - - ~Session(); - - /// - /// @ingroup client - /// @brief add a graph with a specific graphId - /// @param [in] graphId graph id - /// @return Status result of function - /// - Status AddGraph(uint32_t graphId, const Graph &graph); - - /// - /// @ingroup client - /// @brief add a graph with a specific graphId and graphOptions - /// @param [in] graphId graph id - /// @param [in] graph the graph - /// @param [in] options graph options - /// @return Status result of function - /// - Status AddGraph(uint32_t graphId, const Graph& graph, const std::map& options); - - /// - /// @ingroup ge_graph - /// @brief remove a graph of the session with specific session id - /// @param [in] graphId graph id - /// @return Status result of function - /// - Status RemoveGraph(uint32_t graphId); - - /// - /// @ingroup ge_graph - /// @brief run a graph of the session with specific session id - /// @param [in] graphId graph id - /// @param [in] inputs input data - /// @param [out] outputs output data - /// @return Status result of function - /// - Status RunGraph(uint32_t graphId, const std::vector &inputs, std::vector &outputs); - - /// - /// @ingroup ge_graph - /// @brief build graph in the session with specific session id - /// @param [in] graphId: graph id - /// @param [in] inputs: input data - /// @return Status result of function - /// - Status BuildGraph(uint32_t graphId, const std::vector &inputs); - - /// - /// @ingroup ge_graph - /// @brief run graph in the session with specific session id asynchronously - /// @param [in] graphId: graph id - /// @param [in] inputs: input data - /// @param [out] callback: callback while runing graph has been finished. - /// The callback function will not be checked. - /// Please ensure that the implementation of the function is trusted. - /// @return Status result of function - /// - Status RunGraphAsync(uint32_t graphId, const std::vector &inputs, RunAsyncCallback callback); - - /// - /// @ingroup ge_graph - /// @brief register callback func with specific summary or checkpoint by users - /// @param [in] key: func key - /// @param [in] callback: callback specific summary or checkpoint. - /// The callback function will not be checked. - /// Please ensure that the implementation of the function is trusted. - /// @return Status result of function - /// - Status RegisterCallBackFunc(const std::string &key, const pCallBackFunc &callback); - - bool IsGraphNeedRebuild(uint32_t graphId); - - std::map GetAllVariable(); - - private: - uint64_t sessionId_; -}; -} // namespace ge - -#endif // INC_EXTERNAL_GE_GE_API_H_ diff --git a/inc/external/ge/ge_api_error_codes.h b/inc/external/ge/ge_api_error_codes.h deleted file mode 100644 index 7b045d548..000000000 --- a/inc/external/ge/ge_api_error_codes.h +++ /dev/null @@ -1,76 +0,0 @@ -/** - * Copyright 2019-2020 Huawei Technologies Co., Ltd - * - * 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 INC_EXTERNAL_GE_GE_API_ERROR_CODES_H_ -#define INC_EXTERNAL_GE_GE_API_ERROR_CODES_H_ - -#include -#include - -namespace ge { -class StatusFactory { - public: - static StatusFactory *Instance() { - static StatusFactory instance; - return &instance; - } - - void RegisterErrorNo(uint32_t err, const std::string &desc) { - // Avoid repeated addition - if (err_desc_.find(err) != err_desc_.end()) { - return; - } - err_desc_[err] = desc; - } - - std::string GetErrDesc(uint32_t err) { - auto iter_find = err_desc_.find(err); - if (iter_find == err_desc_.end()) { - return ""; - } - return iter_find->second; - } - - protected: - StatusFactory() {} - ~StatusFactory() {} - - private: - std::map err_desc_; -}; - -class ErrorNoRegisterar { - public: - ErrorNoRegisterar(uint32_t err, const std::string &desc) { StatusFactory::Instance()->RegisterErrorNo(err, desc); } - ~ErrorNoRegisterar() {} -}; - -// Code compose(4 byte), runtime: 2 bit, type: 2 bit, level: 3 bit, sysid: 8 bit, modid: 5 bit, value: 12 bit -#define GE_ERRORNO(runtime, type, level, sysid, modid, name, value, desc) \ - constexpr ge::Status name = \ - ((0xFF & (static_cast(runtime))) << 30) | ((0xFF & (static_cast(type))) << 28) | \ - ((0xFF & (static_cast(level))) << 25) | ((0xFF & (static_cast(sysid))) << 17) | \ - ((0xFF & (static_cast(modid))) << 12) | (0x0FFF & (static_cast(value))); \ - const ErrorNoRegisterar g_##name##_errorno(name, desc); - -using Status = uint32_t; - -// General error code -GE_ERRORNO(0, 0, 0, 0, 0, SUCCESS, 0, "success"); -GE_ERRORNO(0b11, 0b11, 0b111, 0xFF, 0b11111, FAILED, 0xFFF, "failed"); /*lint !e401*/ -} // namespace ge - -#endif // INC_EXTERNAL_GE_GE_API_ERROR_CODES_H_ diff --git a/inc/external/ge/ge_api_types.h b/inc/external/ge/ge_api_types.h deleted file mode 100644 index e20418475..000000000 --- a/inc/external/ge/ge_api_types.h +++ /dev/null @@ -1,335 +0,0 @@ -/** - * Copyright 2019-2020 Huawei Technologies Co., Ltd - * - * 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 INC_EXTERNAL_GE_GE_API_TYPES_H_ -#define INC_EXTERNAL_GE_GE_API_TYPES_H_ - -#include -#include -#include -#include -#include -#include - -namespace ge { -// Option key: graph run mode -const char *const OPTION_GRAPH_RUN_MODE = "ge.graphRunMode"; - -// Option key: ome init -const char *const OPTION_EXEC_SESSION_ID = "ge.exec.sessionId"; -const char *const OPTION_EXEC_DEVICE_ID = "ge.exec.deviceId"; -const char *const OPTION_EXEC_JOB_ID = "ge.exec.jobId"; -const char *const OPTION_EXEC_IS_USEHCOM = "ge.exec.isUseHcom"; -const char *const OPTION_EXEC_IS_USEHVD = "ge.exec.isUseHvd"; -const char *const OPTION_EXEC_RANK_ID = "ge.exec.rankId"; -const char *const OPTION_EXEC_POD_NAME = "ge.exec.podName"; -const char *const OPTION_EXEC_DEPLOY_MODE = "ge.exec.deployMode"; -const char *const OPTION_EXEC_RANK_TABLE_FILE = "ge.exec.rankTableFile"; -const char *const GE_AICPU_FLAG = "ge.aicpuFlag"; -const char *const OPTION_EXEC_EXTERN_PLUGIN_PATH = "ge.soLoadPath"; -const char *const OPTION_EXEC_ENABLE_DUMP = "ge.exec.enableDump"; -const char *const OPTION_EXEC_DUMP_PATH = "ge.exec.dumpPath"; -const char *const OPTION_EXEC_DUMP_STEP = "ge.exec.dumpStep"; -const char *const OPTION_EXEC_DUMP_MODE = "ge.exec.dumpMode"; -const char *const OPTION_EXEC_ENABLE_DUMP_DEBUG = "ge.exec.enableDumpDebug"; -const char *const OPTION_EXEC_DUMP_DEBUG_MODE = "ge.exec.dumpDebugMode"; -const char *const OPTION_EXEC_ENABLE_INCRE_BUILD = "ge.exec.enableIncreBuild"; -const char *const OPTION_EXEC_INCRE_BUILD_CACHE_PATH = "ge.exec.increBuildCachePath"; -const char *const OPTION_EXEC_ENABLE_SCOPE_FUSION_PASSES = "ge.exec.enableScopeFusionPasses"; -// profiling flag -const char *const OPTION_EXEC_PROFILING_MODE = "ge.exec.profilingMode"; -const char *const OPTION_EXEC_PROFILING_OPTIONS = "ge.exec.profilingOptions"; -// Hccl flag, if ge.exec.hcclFlag =1, it means load plugin for opskernel, else:ge.exec.hcclFlag =0 -const char *const OPTION_EXEC_HCCL_FLAG = "ge.exec.hcclFlag"; -const char *const OPTION_EXEC_ATOMIC_FLAG = "ge.exec.enable_atomic"; -const char *const OPTION_EXEC_DISABLE_REUSED_MEMORY = "ge.exec.disableReuseMemory"; -const char *const OPTION_EXEC_ENABLE_TAILING_OPTIMIZATION = "ge.exec.isTailingOptimization"; - -// Option key: memory init -const char *const GRAPH_MEMORY_MAX_SIZE = "ge.graphMemoryMaxSize"; -const char *const VARIABLE_MEMORY_MAX_SIZE = "ge.variableMemoryMaxSize"; - -// Configure stream num by Session constructor options param, -// its value should be int32_t type, default value is "1" -const std::string STREAM_NUM = "ge.streamNum"; - -// Configure add head stream to model. -// its value should be "0" or "1", default value is "0" -const std::string HEAD_STREAM = "ge.headStream"; - -// Configure perf level by Session constructor options param, -// its value please see enum PerfLevel, default value is "4" -const std::string PERF_LEVEL = "ge.perfLevel"; - -// Configure encrypt mode by Session constructor options param, -// its value should be int32_t type, default value is "-1" -const std::string ENCRYPT_MODE = "ge.encryptMode"; - -// configure ek file by Session constructor options param, -// its value should be file path, default value is "" -const std::string EK_FILE = "ge.ekFile"; - -// Configure cert file by Session constructor options param, -// its value should be file path, default value is "" -const std::string CERT_FILE = "ge.certFile"; - -// Configure hw key file by Session constructor options param, -// its value should be file path, default value is "" -const std::string HW_KEY_FILE = "ge.hwKeyFile"; - -// Configure private file by Session constructor options param, -// its value should be file path, default value is "" -const std::string PRIVATE_KEY_FILE = "ge.privateKeyFile"; - -// Configure framework type by Session constructor options param, -// its value please see enum FrameworkType, default value is "3" -const std::string FRAMEWORK_TYPE = "ge.frameworkType"; - -// Configure calibration info file by Session constructor options param, -// its value should be file path, default value is "" -const std::string CALIBRATION_CONF_FILE = "ge.calibrationConfFile"; - -// Configure insert op info file by Session constructor options param, -// its value should be file path, default value is "" -const std::string INSERT_OP_FILE = "ge.insertOpFile"; - -// Configure output node name by Session constructor options param, -// its value should be std::string type, default value is "" -const std::string OUTPUT_NODE_NAME = "ge.outputNodeName"; - -// Configure weight compress flag by Session constructor options param, -// its value should be "0" or "1", default value is "0" -const std::string COMPRESS_FLAG = "ge.compressFlag"; - -const std::string PRECISION_MODE = "ge.exec.precision_mode"; - -// Configure single op flag for FE -// its value should be "0" or "1", default value is "0" -const std::string SINGLE_OP_FLAG = "ge.exec.single_op"; - -// Configure train flag by Session constructor options param, -// its value should be "0" or "1", default value is "0" -const std::string TRAIN_FLAG = "ge.trainFlag"; - -// Configure run flag by Session constructor options param, -// its value should be "0" or "1", default value is "0" -const std::string RUN_FLAG = "ge.runFlag"; - -// Configure run flag by Session constructor options param, -// its value should be "0" or "1", default value is "0" -// this option is to enable local framework op feature -const std::string LOCAL_FMKOP_FLAG = "ge.enabledLocalFmkop"; - -// Configure run flag by Session constructor options param, -// its value should be a path -// this option is to obtain the TBE op plugin path -const std::string TBE_PLUGIN_PATH_FLAG = "ge.TBE_plugin_path"; - -// Configure run flag by Session constructor options param, -// its value should be a path -// this option is to obtain the DDK Version info -const std::string DDK_VERSION_FLAG = "ge.DDK_version"; - -// Configure run flag by Session constructor options param, -// its value should be a path -// this option is to obtain fe flag -const std::string GE_FE_FLAG = "ge.feFlag"; - -// Configure stream max parallel num only by Session constructor options param, -// its value should be stream:int, such as "DNN_V100:2,DNN_HCCL:3", -// default value is "1", such as "DNN_V100:1,DNN_HCCL:1" -// this option is to obtain stream max parallel num -const std::string STREAM_MAX_PARALLEL_NUM = "ge.streamMaxParallelNum"; - -// congigure outputDatatype to setting net output type -const std::string OUTPUT_DATATYPE = "ge.outputDatatype"; - -// congigure opSelectImplmode to setting op select implmode -const std::string OP_SELECT_IMPL_MODE = "ge.opSelectImplmode"; - -// congigure optypelist_for_implmode to setting which op use implmode -const std::string OPTYPELIST_FOR_IMPLMODE = "ge.optypelistForImplmode"; - -// configure whether to enable hcom parallel by session constructor options param, -// its value should be "0" or "1", default value is "0" -const std::string HCOM_PARALLEL = "ge.hcomParallel"; - -// configure whether to use dynamic batch size -const char *const kDynamicBatchSize = "ge.dynamicBatchSize"; - -// configure whether to use dynamic image size -const char *const kDynamicImageSize = "ge.dynamicImageSize"; - -// Configure whether to use dynamic dims -const char *const kDynamicDims = "ge.dynamicDims"; - -// Configure auto tune mode, this option only take effect while AUTO_TUNE_FLAG is Y, -// example: GA|RL, support configure multiple, split by | -const std::string AUTO_TUNE_MODE = "ge.autoTuneMode"; - -// Configure soc version , example: "Ascend310" -const std::string SOC_VERSION = "ge.socVersion"; - -// Configure core type "VectorEngine", default value is "AIcoreEngine" -const std::string CORE_TYPE = "ge.engineType"; - -// Configure AICORE NUM -const std::string AICORE_NUM = "ge.aicoreNum"; - -// Configure L1FUSION -const std::string L1_FUSION = "ge.l1Fusion"; - -// Configure l1,l2,and others optimize option -const std::string BUFFER_OPTIMIZE = "ge.bufferOptimize"; - -// Configure Small Channel flag -const std::string ENABLE_SMALL_CHANNEL = "ge.enableSmallChannel"; - -// Configure Compress Weight flag -const std::string ENABLE_COMPRESS_WEIGHT = "ge.enableCompressWeight"; - -// Configure fusion switch file path -const std::string FUSION_SWITCH_FILE = "ge.fusionSwitchFile"; - -// Save original model -const std::string SAVE_ORIGINAL_MODEL = "ge.saveOriginalModel"; - -// Save original model file name -const std::string ORIGINAL_MODEL_FILE = "ge.originalModelFile"; - -const char *const OPTION_GE_MAX_DUMP_FILE_NUM = "ge.maxDumpFileNum"; -const char *const OPTION_GE_MAX_DUMP_FILE_SIZE = "ge.maxDumpFileSize"; -const char *const OPTION_GE_MAX_DUMP_OP_NUM = "ge.maxDumpOpNum"; - -// Configure for print op pass -// Its value should be "0" or "1", default value is "1" -const char *const ENABLE_PRINT_OP_PASS = "ge.enablePrintOpPass"; - -// Configure whether to use single stream. -// Its value should be "true" or "false", default value is "false" -const char *const ENABLE_SINGLE_STREAM = "ge.enableSingleStream"; - -// Configure input fp16 nodes -const std::string INPUT_FP16_NODES = "ge.INPUT_NODES_SET_FP16"; - -// Configure debug level, its value should be 0(default), 1 or 2. -// 0: close debug; 1: open TBE compiler; 2: open ccec compiler -const std::string OP_DEBUG_LEVEL = "ge.opDebugLevel"; - -// Graph run mode -enum GraphRunMode { PREDICTION = 0, TRAIN }; - -// Input/Output tensor info -struct InputTensorInfo { - uint32_t data_type; // data type - std::vector dims; // shape description - void *data; // tensor data - int64_t length; // tensor length -}; - -struct OutputTensorInfo { - uint32_t data_type; // data type - std::vector dims; // shape description - std::unique_ptr data; // tensor data - int64_t length; // tensor length - OutputTensorInfo() : data_type(0), dims({}), data(nullptr), length(0) {} - OutputTensorInfo(OutputTensorInfo &&out) : - data_type(out.data_type), - dims(out.dims), - data(std::move(out.data)), - length(out.length) {} - - OutputTensorInfo &operator=(OutputTensorInfo &&out) { - if (this != &out) { - data_type = out.data_type; - dims = out.dims; - data = std::move(out.data); - length = out.length; - } - return *this; - } - OutputTensorInfo(const OutputTensorInfo &) = delete; - OutputTensorInfo &operator=(const OutputTensorInfo &) = delete; -}; - -using Status = uint32_t; -using RunAsyncCallback = std::function &)>; -// for ir build -namespace ir_option { - static const char *const INPUT_FORMAT = "input_format"; - static const char *const INPUT_SHAPE = "input_shape"; - static const char *const OP_NAME_MAP = "op_name_map"; - static const char *const DYNAMIC_BATCH_SIZE = kDynamicBatchSize; - static const char *const DYNAMIC_IMAGE_SIZE = kDynamicImageSize; - static const char *const DYNAMIC_DIMS = kDynamicDims; - static const char *const INSERT_OP_FILE = ge::INSERT_OP_FILE.c_str(); - static const char *const PRECISION_MODE = ge::PRECISION_MODE.c_str(); - static const char *const EXEC_DISABLE_REUSED_MEMORY = ge::OPTION_EXEC_DISABLE_REUSED_MEMORY; - static const char *const AUTO_TUNE_MODE = ge::AUTO_TUNE_MODE.c_str(); - static const char *const CORE_TYPE = ge::CORE_TYPE.c_str(); - static const char *const SOC_VERSION = ge::SOC_VERSION.c_str(); - static const char *const ENABLE_SINGLE_STREAM = ge::ENABLE_SINGLE_STREAM; - static const char *const AICORE_NUM = ge::AICORE_NUM.c_str(); - static const char *const FUSION_SWITCH_FILE = ge::FUSION_SWITCH_FILE.c_str(); - static const char *const ENABLE_SMALL_CHANNEL = ge::ENABLE_SMALL_CHANNEL.c_str(); - static const char *const OP_SELECT_IMPL_MODE = ge::OP_SELECT_IMPL_MODE.c_str(); - static const char *const OUTPUT_TYPE = ge::OUTPUT_DATATYPE.c_str(); - static const char *const BUFFER_OPTIMIZE = ge::BUFFER_OPTIMIZE.c_str(); - static const char *const ENABLE_COMPRESS_WEIGHT = ge::ENABLE_COMPRESS_WEIGHT.c_str(); - static const char *const COMPRESS_WEIGHT_CONF = "compress_weight_conf"; - static const char *const OUT_NODES = ge::OUTPUT_NODE_NAME.c_str(); - static const char *const INPUT_FP16_NODES = ge::INPUT_FP16_NODES.c_str(); - static const char *const LOG_LEVEL = "log"; - static const char *const OPTYPELIST_FOR_IMPLMODE = ge::OPTYPELIST_FOR_IMPLMODE.c_str(); - - // for interface: aclgrphBuildModel - const std::set ir_builder_suppported_options = { - INPUT_FORMAT, - INPUT_SHAPE, - OP_NAME_MAP, - DYNAMIC_BATCH_SIZE, - DYNAMIC_IMAGE_SIZE, - DYNAMIC_DIMS, - INSERT_OP_FILE, - PRECISION_MODE, - EXEC_DISABLE_REUSED_MEMORY, - AUTO_TUNE_MODE, - OUTPUT_TYPE, - OUT_NODES, - INPUT_FP16_NODES, - LOG_LEVEL - }; - // for interface: aclgrphBuildInitialize - const std::set global_options = { - CORE_TYPE, - SOC_VERSION, - BUFFER_OPTIMIZE, - ENABLE_COMPRESS_WEIGHT, - COMPRESS_WEIGHT_CONF, - PRECISION_MODE, - EXEC_DISABLE_REUSED_MEMORY, - AUTO_TUNE_MODE, - ENABLE_SINGLE_STREAM, - AICORE_NUM, - FUSION_SWITCH_FILE, - ENABLE_SMALL_CHANNEL, - OP_SELECT_IMPL_MODE, - OPTYPELIST_FOR_IMPLMODE - }; -} -} // namespace ge - -#endif // INC_EXTERNAL_GE_GE_API_TYPES_H_ diff --git a/inc/external/ge/ge_ir_build.h b/inc/external/ge/ge_ir_build.h deleted file mode 100644 index dd48687f6..000000000 --- a/inc/external/ge/ge_ir_build.h +++ /dev/null @@ -1,93 +0,0 @@ -/** -* Copyright 2020 Huawei Technologies Co., Ltd - -* 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 INC_EXTERNAL_GE_IR_BUILD_H_ -#define INC_EXTERNAL_GE_IR_BUILD_H_ - -#include -#include -#include -#include "graph/graph.h" -#include "graph/ge_error_codes.h" - -namespace { -#define IR_MAJOR_VERSION (int(1)) -#define IR_MINOR_VERSION (int(0)) -#define IR_PATCH_VERSION (int(0)) -} - -namespace ge{ - -struct ModelBufferData -{ - std::shared_ptr data = nullptr; - uint64_t length; -}; - -/** - * @ingroup AscendCL - * @brief build model.Notice the model is stored in buffer - * - * @param global_options[IN] global init params for build - * @retval GRAPH_SUCCESS The function is successfully executed. - * @retval OtherValues Failure - */ -graphStatus aclgrphBuildInitialize(std::map global_options); - -/** - * @ingroup AscendCL - * @brief build model.Notice the model is stored in buffer - * - */ -void aclgrphBuildFinalize(); - -/** - * @ingroup AscendCL - * @brief build model.Notice the model is stored in buffer - * - * @param graph[IN] the graph ready to build - * @param options[IN] options used for build - * @param model[OUT] builded model - * @retval GRAPH_SUCCESS The function is successfully executed. - * @retval OtherValues Failure - */ -graphStatus aclgrphBuildModel(const ge::Graph &graph, const std::map &build_options, ModelBufferData& model); - -/** - * @ingroup AscendCL - * @brief save model buffer to file - * - * @param output_file[IN] the file path to be saved - * @param model[IN] model buffer data - * @retval GRAPH_SUCCESS The function is successfully executed. - * @retval OtherValues Failure - */ -graphStatus aclgrphSaveModel(const string &output_file, const ModelBufferData& model); - -/** - * @ingroup AscendCL - * @brief query IR interface version - * - * @param major_version[OUT] IR interface major version - * @param minor_version[OUT] IR interface minor version - * @param patch_version[OUT] IR interface patch version - * @retval GRAPH_SUCCESS The function is successfully executed. - * @retval OtherValues Failure - */ -graphStatus aclgrphGetIRVersion(int *major_version, int *minor_version, int *patch_version); - -}; // INC_EXTERNAL_GE_IR_BUILD_H_ -#endif diff --git a/inc/toolchain/stackcore/stackcore.h b/inc/external/graph/ascend_string.h similarity index 59% rename from inc/toolchain/stackcore/stackcore.h rename to inc/external/graph/ascend_string.h index d4b74cc76..04bf31ac9 100644 --- a/inc/toolchain/stackcore/stackcore.h +++ b/inc/external/graph/ascend_string.h @@ -14,19 +14,25 @@ * limitations under the License. */ -/** @defgroup stackcore StackCore */ -#ifndef LIB_STACKCORE_H -#define LIB_STACKCORE_H +#ifndef INC_EXTERNAL_GRAPH_ASCEND_STRING_H_ +#define INC_EXTERNAL_GRAPH_ASCEND_STRING_H_ -/** - * @ingroup stackcore - * @brief init stackcore, which register signal hander for exception core - */ -#ifdef __cplusplus -extern "C"{ -#endif -int StackInit(); -#ifdef __cplusplus -} -#endif -#endif +#include +#include + +namespace ge { +class AscendString { + public: + AscendString() = default; + + ~AscendString() = default; + + explicit AscendString(const char* name); + + const char* GetString() const; + + private: + std::shared_ptr name_; +}; +} // namespace ge +#endif // INC_EXTERNAL_GRAPH_ASCEND_STRING_H_ diff --git a/inc/external/graph/ge_error_codes.h b/inc/external/graph/ge_error_codes.h index d815a22dc..26e0d70ba 100644 --- a/inc/external/graph/ge_error_codes.h +++ b/inc/external/graph/ge_error_codes.h @@ -33,6 +33,7 @@ using graphStatus = uint32_t; const graphStatus GRAPH_FAILED = 0xFFFFFFFF; const graphStatus GRAPH_SUCCESS = 0; const graphStatus GRAPH_PARAM_INVALID = 50331649; +const graphStatus GRAPH_NODE_WITHOUT_CONST_INPUT = 50331648; } // namespace ge #endif // INC_EXTERNAL_GRAPH_GE_ERROR_CODES_H_ diff --git a/inc/external/graph/gnode.h b/inc/external/graph/gnode.h new file mode 100644 index 000000000..5465293f8 --- /dev/null +++ b/inc/external/graph/gnode.h @@ -0,0 +1,130 @@ +/** + * Copyright 2019-2020 Huawei Technologies Co., Ltd + * + * 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 INC_EXTERNAL_GRAPH_NODE_H_ +#define INC_EXTERNAL_GRAPH_NODE_H_ + +#include +#include + +#include "./ge_error_codes.h" +#include "./types.h" +#include "./tensor.h" +#include "./ascend_string.h" + +namespace ge { +class AttrValue; +class GNode; +class OpDesc; +class Graph; +class ComputeGraph; +using GNodePtr = std::shared_ptr; +using GraphPtr = std::shared_ptr; +using OpBytes = std::vector; +using OpDescPtr = std::shared_ptr; +using ComputeGraphPtr = std::shared_ptr; + +class NodeImpl; +class GE_FUNC_DEV_VISIBILITY GE_FUNC_HOST_VISIBILITY GNode { + public: + GNode(); + + ~GNode() = default; + + graphStatus GetType(ge::AscendString &type) const; + + graphStatus GetName(ge::AscendString &name) const; + + std::pair GetInDataNodesAndPortIndexs(const int32_t index) const; + + std::vector GetInControlNodes() const; + + std::vector> GetOutDataNodesAndPortIndexs(const int32_t index) const; + + std::vector GetOutControlNodes() const; + + graphStatus GetInputConstData(const int32_t index, Tensor &data) const; + + graphStatus GetInputIndexByName(const ge::AscendString &name, int32_t &index); + + graphStatus GetOutputIndexByName(const ge::AscendString &name, int32_t &index); + + size_t GetInputsSize() const; + + size_t GetOutputsSize() const; + + graphStatus GetInputDesc(const int32_t index, TensorDesc &tensor_desc) const; + + graphStatus UpdateInputDesc(const int32_t index, const TensorDesc &tensor_desc); + + graphStatus GetOutputDesc(const int32_t index, TensorDesc &tensor_desc) const; + + graphStatus UpdateOutputDesc(const int32_t index, const TensorDesc &tensor_desc); + + graphStatus GetAttr(const ge::AscendString &name, int64_t &attr_value) const; + graphStatus GetAttr(const ge::AscendString &name, int32_t &attr_value) const; + graphStatus GetAttr(const ge::AscendString &name, uint32_t &attr_value) const; + graphStatus GetAttr(const ge::AscendString &name, float &attr_value) const; + graphStatus GetAttr(const ge::AscendString &name, ge::AscendString &attr_value) const; + graphStatus GetAttr(const ge::AscendString &name, bool &attr_value) const; + graphStatus GetAttr(const ge::AscendString &name, Tensor &attr_value) const; + graphStatus GetAttr(const ge::AscendString &name, std::vector &attr_value) const; + graphStatus GetAttr(const ge::AscendString &name, std::vector &attr_value) const; + graphStatus GetAttr(const ge::AscendString &name, std::vector &attr_value) const; + graphStatus GetAttr(const ge::AscendString &name, std::vector &attr_value) const; + graphStatus GetAttr(const ge::AscendString &name, std::vector &attr_values) const; + graphStatus GetAttr(const ge::AscendString &name, std::vector &attr_value) const; + graphStatus GetAttr(const ge::AscendString &name, std::vector &attr_value) const; + graphStatus GetAttr(const ge::AscendString &name, OpBytes &attr_value) const; + graphStatus GetAttr(const ge::AscendString &name, std::vector> &attr_value) const; + graphStatus GetAttr(const ge::AscendString &name, std::vector &attr_value) const; + graphStatus GetAttr(const ge::AscendString &name, ge::DataType &attr_value) const; + graphStatus GetAttr(const ge::AscendString &name, AttrValue &attr_value) const; + + graphStatus SetAttr(const ge::AscendString &name, int64_t &attr_value) const; + graphStatus SetAttr(const ge::AscendString &name, int32_t &attr_value) const; + graphStatus SetAttr(const ge::AscendString &name, uint32_t &attr_value) const; + graphStatus SetAttr(const ge::AscendString &name, float &attr_value) const; + graphStatus SetAttr(const ge::AscendString &name, ge::AscendString &attr_value) const; + graphStatus SetAttr(const ge::AscendString &name, bool &attr_value) const; + graphStatus SetAttr(const ge::AscendString &name, Tensor &attr_value) const; + graphStatus SetAttr(const ge::AscendString &name, std::vector &attr_value) const; + graphStatus SetAttr(const ge::AscendString &name, std::vector &attr_value) const; + graphStatus SetAttr(const ge::AscendString &name, std::vector &attr_value) const; + graphStatus SetAttr(const ge::AscendString &name, std::vector &attr_value) const; + graphStatus SetAttr(const ge::AscendString &name, std::vector &attr_values) const; + graphStatus SetAttr(const ge::AscendString &name, std::vector &attr_value) const; + graphStatus SetAttr(const ge::AscendString &name, std::vector &attr_value) const; + graphStatus SetAttr(const ge::AscendString &name, OpBytes &attr_value) const; + graphStatus SetAttr(const ge::AscendString &name, std::vector> &attr_value) const; + graphStatus SetAttr(const ge::AscendString &name, std::vector &attr_value) const; + graphStatus SetAttr(const ge::AscendString &name, ge::DataType &attr_value) const; + graphStatus SetAttr(const ge::AscendString &name, AttrValue &attr_value) const; + + bool HasAttr(const ge::AscendString &name); + + graphStatus GetSubgraph(uint32_t index, GraphPtr graph) const; + + graphStatus GetALLSubgraphs(std::vector graph_list) const; + + private: + std::shared_ptr impl_; + friend class NodeAdapter; +}; +} // namespace ge +/*lint +e148*/ + +#endif // INC_EXTERNAL_GRAPH_NODE_H_ diff --git a/inc/external/graph/graph.h b/inc/external/graph/graph.h index 308867333..fabf6c594 100644 --- a/inc/external/graph/graph.h +++ b/inc/external/graph/graph.h @@ -23,11 +23,14 @@ #include #include "./operator.h" +#include "./gnode.h" namespace ge { +class Graph; class GraphImpl; using GraphImplPtr = std::shared_ptr; +using GraphPtr = std::shared_ptr; class GE_FUNC_DEV_VISIBILITY GE_FUNC_HOST_VISIBILITY Graph { friend class GraphUtils; @@ -53,15 +56,15 @@ class GE_FUNC_DEV_VISIBILITY GE_FUNC_HOST_VISIBILITY Graph { graphStatus AddOp(const ge::Operator &op); - graphStatus FindOpByName(const string &name, ge::Operator &op) const; + graphStatus FindOpByName(const std::string &name, ge::Operator &op) const; - graphStatus FindOpByType(const string &type, std::vector &ops) const; + graphStatus FindOpByType(const std::string &type, std::vector &ops) const; - graphStatus GetAllOpName(std::vector &op_name) const; + graphStatus GetAllOpName(std::vector &op_name) const; - graphStatus SaveToFile(const string &file_name) const; + graphStatus SaveToFile(const std::string &file_name) const; - graphStatus LoadFromFile(const string &file_name); + graphStatus LoadFromFile(const std::string &file_name); const std::string &GetName() const; @@ -73,7 +76,25 @@ class GE_FUNC_DEV_VISIBILITY GE_FUNC_HOST_VISIBILITY Graph { /// void SetNeedIteration(bool need_iteration); + std::vector GetAllNodes() const; + + std::vector GetDirectNode () const; + + graphStatus RemoveNode(GNode &node); + + graphStatus RemoveEdge(GNode &src_node, const int32_t src_port_index, GNode &dst_node, const int32_t dst_port_index); + + GNode AddNodeByOp(const Operator &op); + + graphStatus AddDataEdge(GNode &src_node, const int32_t src_port_index, + GNode &dst_node, const int32_t dst_port_index); + + graphStatus AddControlEdge(GNode &src_node, GNode &dst_node); + + static GraphPtr ConstructFromInputs(const std::vector &inputs, const ge::AscendString &name); + private: + GraphImplPtr impl_{nullptr}; }; } // namespace ge diff --git a/inc/external/graph/operator.h b/inc/external/graph/operator.h index b84ae1d48..a02b62075 100644 --- a/inc/external/graph/operator.h +++ b/inc/external/graph/operator.h @@ -45,9 +45,11 @@ namespace ge { class Operator; class OperatorImpl; +class NodeUtils; class NamedAttrs; class Graph; class AttrValue; +class Node; using SubgraphBuilder = std::function; using OperatorImplPtr = std::shared_ptr; @@ -65,8 +67,8 @@ using std::string; class GE_FUNC_DEV_VISIBILITY GE_FUNC_HOST_VISIBILITY Operator { public: friend class OperatorImpl; - friend class GraphBuilderImpl; + friend class NodeUtils; using OpInt = int64_t; using OpFloat = float; @@ -279,6 +281,8 @@ class GE_FUNC_DEV_VISIBILITY GE_FUNC_HOST_VISIBILITY Operator { OperatorImplPtr operator_impl_{nullptr}; graphStatus GetInputConstDataOut(const string &dst_name, Tensor &data) const; + + std::shared_ptr GetNode() const; }; /*lint +e148*/ } // namespace ge diff --git a/inc/external/graph/operator_reg.h b/inc/external/graph/operator_reg.h index 84210d9f2..478029516 100644 --- a/inc/external/graph/operator_reg.h +++ b/inc/external/graph/operator_reg.h @@ -225,6 +225,7 @@ class OpReg { \ private: \ void __dy_input_##x() { \ + Operator::DynamicInputRegister(#x, 0, true); \ (void)OpReg() #define DYNAMIC_OUTPUT(x, t) \ @@ -246,6 +247,7 @@ class OpReg { \ private: \ void __dy_output_##x() { \ + Operator::DynamicOutputRegister(#x, 0, true); \ (void)OpReg() #define GRAPH(x) \ diff --git a/inc/external/register/register.h b/inc/external/register/register.h index 3bbb03189..7f508313f 100644 --- a/inc/external/register/register.h +++ b/inc/external/register/register.h @@ -55,6 +55,33 @@ class Message; } namespace domi { +const int64_t kMaxNameLength = 1048576; // 1M + +enum DynamicType { + kInvalid = 0, + kInput = 1, + kOutput = 2 +}; +struct DynamicInputOutputInfo { + DynamicType type; // input/output + const char *port_name; + int64_t port_name_len; + const char *attr_name; + int64_t attr_name_len; + DynamicInputOutputInfo() : + type(kInvalid), port_name(nullptr), port_name_len(0), + attr_name(nullptr), attr_name_len(0) {} + DynamicInputOutputInfo(DynamicType type, const char *port_name, int64_t port_name_len, + const char *attr_name, int64_t attr_name_len) : + type(type), + port_name(port_name), + port_name_len(port_name_len), + attr_name(attr_name), + attr_name_len(attr_name_len) {} +}; +Status AutoMappingByOpFn(const ge::Operator &op_src, ge::Operator &op); +Status AutoMappingByOpFnDynamic(const ge::Operator &op_src, ge::Operator &op, + const vector &dynamic_name_attr_value); Status AutoMappingFn(const google::protobuf::Message *op_src, ge::Operator &op); Status AutoMappingFnDynamic(const google::protobuf::Message *op_src, ge::Operator &op, std::map> dynamic_name_attr_value, @@ -71,6 +98,7 @@ class OpRegistrationDataImpl; using ParseParamFunc = std::function; using ParseParamByOpFunc = std::function; using FusionParseParamFunc = std::function, ge::Operator &)>; +using FusionParseParamByOpFunc = std::function &, ge::Operator &)>; using ParseSubgraphFunc = std::function; class FMK_FUNC_HOST_VISIBILITY FMK_FUNC_DEV_VISIBILITY OpRegistrationData { @@ -91,6 +119,8 @@ class FMK_FUNC_HOST_VISIBILITY FMK_FUNC_DEV_VISIBILITY OpRegistrationData { OpRegistrationData &FusionParseParamsFn(const FusionParseParamFunc &fusionParseParamFn); + OpRegistrationData &FusionParseParamsFn(const FusionParseParamByOpFunc &fusion_parse_param_fn); + OpRegistrationData &ParseSubgraphPostFn(const ParseSubgraphFunc &subgraph_post_fn); OpRegistrationData &ImplyType(const domi::ImplyType &imply_type); @@ -108,6 +138,7 @@ class FMK_FUNC_HOST_VISIBILITY FMK_FUNC_DEV_VISIBILITY OpRegistrationData { ParseParamFunc GetParseParamFn() const; ParseParamByOpFunc GetParseParamByOperatorFn() const; FusionParseParamFunc GetFusionParseParamFn() const; + FusionParseParamByOpFunc GetFusionParseParamByOpFn() const; ParseSubgraphFunc GetParseSubgraphPostFn() const; private: diff --git a/inc/external/register/scope/scope_fusion_pass_register.h b/inc/external/register/scope/scope_fusion_pass_register.h index 05eaecbdf..9d6e59850 100644 --- a/inc/external/register/scope/scope_fusion_pass_register.h +++ b/inc/external/register/scope/scope_fusion_pass_register.h @@ -21,16 +21,31 @@ #include #include #include +#include #include "ge/ge_api_error_codes.h" #include "register/register_error_codes.h" #include "register/register_types.h" #include "graph/operator.h" +#define CHECK_INNER_NODE_CONDITION(cond, fusion_rlt) \ + do { \ + if (!(cond)) { \ + if ((fusion_rlt) != nullptr) { \ + (fusion_rlt)->SetType(ge::kScopeInvalidType); \ + } \ + return; \ + } \ + } while (0) + namespace domi { class TensorFlowModelParser; } // namespace domi namespace ge { const int32_t kFusionDisableIndex = 99999; +const char *const kScopeToMultiNodes = "ScopeToMultiNodes"; +const char *const kScopeInvalidType = "ScopeInvalidType"; +const char *const kInputFromFusionScope = "InputFromFusionScope"; +const char *const kOutputToFusionScope = "OutputToFusionScope"; class ScopePattern; using ScopeFusionPatterns = std::vector>; @@ -38,15 +53,16 @@ class ScopePassManager; class GE_FUNC_HOST_VISIBILITY GE_FUNC_DEV_VISIBILITY Scope { public: - explicit Scope(const std::string &name, const std::string &sub_type = "", Scope *father_scope = nullptr); + Scope(); + Status Init(const std::string &name, const std::string &sub_type = "", Scope *father_scope = nullptr); ~Scope(); - std::string Name() const; - std::string SubType() const; - std::map AllNodesMap() const; + const std::string &Name() const; + const std::string &SubType() const; + const std::unordered_map &AllNodesMap() const; Scope *GetSubScope(const std::string &scope_name) const; - std::string LastName() const; - std::vector GetAllSubScopes() const; + const std::string LastName() const; + const std::vector &GetAllSubScopes() const; const Scope *GetFatherScope() const; private: @@ -62,21 +78,57 @@ class GE_FUNC_HOST_VISIBILITY GE_FUNC_DEV_VISIBILITY Scope { class GE_FUNC_HOST_VISIBILITY GE_FUNC_DEV_VISIBILITY FusionScopesResult { public: FusionScopesResult(); + Status Init(); ~FusionScopesResult(); void SetName(const std::string &name); void SetType(const std::string &type); void SetDescription(const std::string &description); - std::string Name() const; - std::vector Nodes() const; + const std::string &Name() const; + const std::vector &Nodes() const; void InsertInputs(const std::string &inner_op_name, const std::vector &index_map); void InsertOutputs(const std::string &inner_op_name, const std::vector &index_map); + class InnerNodeInfo { + public: + explicit InnerNodeInfo(const std::string &fusion_node_name); + InnerNodeInfo(const std::string &fusion_node_name, const std::string &name, const std::string &type); + InnerNodeInfo(InnerNodeInfo &&other) noexcept; + InnerNodeInfo &operator=(InnerNodeInfo &&other) noexcept; + InnerNodeInfo(const InnerNodeInfo &) = delete; + InnerNodeInfo &operator=(const InnerNodeInfo &) = delete; + ~InnerNodeInfo(); + InnerNodeInfo &SetName(const std::string &name); + InnerNodeInfo &SetType(const std::string &type); + InnerNodeInfo &InsertInput(const std::string &input_node, int32_t peer_out_idx); + InnerNodeInfo &InsertOutput(const std::string &output_node, int32_t peer_in_idx); + ge::graphStatus BuildInnerNode(); + ge::graphStatus SetInputFormat(const std::string &input_name, const std::string &format); + ge::graphStatus SetOutputFormat(const std::string &output_name, const std::string &format); + ge::graphStatus SetDynamicInputFormat(const std::string &input_name, uint32_t index, const std::string &format); + ge::graphStatus SetDynamicOutputFormat(const std::string &output_name, uint32_t index, const std::string &format); + ge::Operator *MutableOperator(); + + std::string GetName() const; + std::string GetType() const; + std::vector> GetInputs() const; + std::vector> GetOutputs() const; + + private: + class InnerNodeInfoImpl; + std::unique_ptr impl_; + }; + + InnerNodeInfo *AddInnerNode(const std::string &name, const std::string &type); + InnerNodeInfo *MutableRecentInnerNode(); + InnerNodeInfo *MutableInnerNode(uint32_t index); + ge::graphStatus CheckInnerNodesInfo(); + private: class FusionScopesResultImpl; std::unique_ptr impl_; friend class ScopeGraph; friend class ScopeBasePass; - friend class domi::TensorFlowModelParser; + friend class TensorFlowModelParser; }; class GE_FUNC_HOST_VISIBILITY GE_FUNC_DEV_VISIBILITY ScopeTree { @@ -87,7 +139,7 @@ class GE_FUNC_HOST_VISIBILITY GE_FUNC_DEV_VISIBILITY ScopeTree { ScopeTree &operator=(const ScopeTree &scopetree) = delete; ~ScopeTree(); - std::vector GetAllScopes() const; + const std::vector &GetAllScopes() const; private: class ScopeTreeImpl; @@ -105,14 +157,14 @@ class GE_FUNC_HOST_VISIBILITY GE_FUNC_DEV_VISIBILITY ScopeGraph { ~ScopeGraph(); const ScopeTree *GetScopeTree() const; - std::map GetNodesMap() const; + const std::unordered_map &GetNodesMap() const; private: class ScopeGraphImpl; std::unique_ptr impl_; friend class ScopePassManager; friend class ScopeBasePass; - friend class domi::TensorFlowModelParser; + friend class TensorFlowModelParser; }; class GE_FUNC_HOST_VISIBILITY GE_FUNC_DEV_VISIBILITY ScopeAttrValue { @@ -154,7 +206,8 @@ class GE_FUNC_HOST_VISIBILITY GE_FUNC_DEV_VISIBILITY NodeOpTypeFeature : ScopeBa class GE_FUNC_HOST_VISIBILITY GE_FUNC_DEV_VISIBILITY NodeAttrFeature : ScopeBaseFeature { public: - NodeAttrFeature(std::string nodeType, std::string attr_name, ge::DataType datatype, ScopeAttrValue attr_value); + NodeAttrFeature(std::string nodeType, std::string attr_name, + ge::DataType datatype, ScopeAttrValue &attr_value); NodeAttrFeature(NodeAttrFeature const &feature); NodeAttrFeature &operator=(NodeAttrFeature const &feature); ~NodeAttrFeature(); @@ -251,7 +304,7 @@ class GE_FUNC_HOST_VISIBILITY GE_FUNC_DEV_VISIBILITY ScopeFusionPassRegistry { class ScopeFusionPassRegistryImpl; /*lint -e148*/ std::unique_ptr impl_; - friend class domi::TensorFlowModelParser; + friend class TensorFlowModelParser; }; class GE_FUNC_HOST_VISIBILITY GE_FUNC_DEV_VISIBILITY ScopeUtil { diff --git a/inc/framework/common/ge_inner_error_codes.h b/inc/framework/common/ge_inner_error_codes.h index cc044cb1c..79957687b 100644 --- a/inc/framework/common/ge_inner_error_codes.h +++ b/inc/framework/common/ge_inner_error_codes.h @@ -14,7 +14,6 @@ * limitations under the License. */ -/*lint -e* */ #ifndef INC_FRAMEWORK_COMMON_GE_INNER_ERROR_CODES_H_ #define INC_FRAMEWORK_COMMON_GE_INNER_ERROR_CODES_H_ @@ -97,6 +96,7 @@ GE_ERRORNO_COMMON(INTERNAL_ERROR, 4, "Internal errors"); // 1343225 GE_ERRORNO_COMMON(CSEC_ERROR, 5, "Failed to call libc_sec API!"); // 1343225861 GE_ERRORNO_COMMON(TEE_ERROR, 6, "Failed to call tee API!"); // 1343225862 GE_ERRORNO_COMMON(END_OF_SEQUENCE, 7, "End of sequence!"); // 1343225863 +GE_ERRORNO_COMMON(PATH_INVALID, 8, "Path is invalid!"); // 1343225864 // Error code for plugin manager GE_ERRORNO_COMMON(GE_PLGMGR_PATH_INVALID, 30, "Path is invalid!"); // 1343225886 @@ -127,6 +127,10 @@ GE_ERRORNO_CLIENT(GE_CLI_GE_NOT_INITIALIZED, 11, "GE is not yet initialized or i GE_ERRORNO_INIT(GE_MULTI_INIT, 0, "Multiple initializations are not supported."); // 1343234048 GE_ERRORNO_INIT(GE_FINALIZE_NOT_INIT, 1, "Finalize is not allowed before initialization."); // 1343234049 GE_ERRORNO_INIT(GE_MULTI_FINALIZE, 2, "Multiple finalizations are not supported."); // 1343234050 +GE_ERRORNO_INIT(GE_PROF_MULTI_INIT, 3, "Multiple profiling initializations are not supported."); // 1343234051 +GE_ERRORNO_INIT(GE_PROF_NOT_INIT, 4, "Profing initializations have not been done."); // 1343234052 +GE_ERRORNO_INIT(GE_PROF_MODE_CONFLICT, 5, + "Profiling command mode which is preferred is running, the api mode will not work."); // 1343234053 // Session module error code definition GE_ERRORNO_SESSION(GE_SESS_INIT_FAILED, 0, "Failed to initialize session."); // 1343238144 @@ -299,6 +303,7 @@ GE_ERRORNO_EXECUTOR(GE_EXEC_ALLOC_WEIGHT_MEM_FAILED, 16, "Failed to allocate wei GE_ERRORNO_EXECUTOR(GE_EXEC_ALLOC_VAR_MEM_FAILED, 17, "Failed to allocate variable memory."); GE_ERRORNO_EXECUTOR(GE_AIPP_NOT_EXIST, 18, "GE AIPP is not exist."); GE_ERRORNO_EXECUTOR(GE_DYNAMIC_AIPP_NOT_SUPPORT_QUERY, 19, "GE Dynamic AIPP is not support to query temporarily."); +GE_ERRORNO_EXECUTOR(GE_EXEC_ALLOC_P2P_MEM_FAILED, 20, "Failed to allocate P2P memory"); // Generator module error code definition GE_ERRORNO_GENERATOR(GE_GENERATOR_GRAPH_MANAGER_INIT_FAILED, 1, "Graph manager initialize failed."); diff --git a/inc/framework/common/ge_types.h b/inc/framework/common/ge_types.h index d1eb95b71..91815fc27 100644 --- a/inc/framework/common/ge_types.h +++ b/inc/framework/common/ge_types.h @@ -48,11 +48,18 @@ enum FrameworkType { }; enum OpEngineType { - ENGINE_SYS = 0, // default engine - ENGINE_AICORE = 1, - ENGINE_VECTOR = 2, - ENGINE_AICUBE = 3, // not support - ENGINE_AIVECTOR = 4 // not support + ENGINE_SYS = 0, // default engine + ENGINE_AICORE = 1, + ENGINE_VECTOR = 2, + ENGINE_AICUBE = 3, // not support + ENGINE_AIVECTOR = 4 // not support +}; + +enum InputAippType{ + DATA_WITHOUT_AIPP = 0, + DATA_WITH_STATIC_AIPP, + DATA_WITH_DYNAMIC_AIPP, + DYNAMIC_AIPP_NODE }; const char *const GE_ENGINE_ATTR_MEM_TYPE_HBM = "HBM"; @@ -100,6 +107,7 @@ struct OutputData { struct Command { std::string cmd_type; // Command type std::vector cmd_params; // Command params + uint64_t module_index; // prof module }; // The definition of I/O shape description @@ -136,6 +144,7 @@ struct OriginInputInfo { // The structure of AIPP info struct AippConfigInfo { + int8_t aipp_mode; int8_t input_format; int32_t src_image_size_w; int32_t src_image_size_h; @@ -183,6 +192,9 @@ struct AippConfigInfo { float var_reci_chn_1; float var_reci_chn_2; float var_reci_chn_3; + int8_t support_rotation; + uint32_t related_input_rank; + uint32_t max_src_image_size; }; // The structure of offline Modeldata @@ -261,16 +273,31 @@ struct ComputeGraphDescInfo { struct OpDescInfo { std::string op_name; + std::string op_type; uint32_t task_id; uint32_t stream_id; std::vector input_format; std::vector> input_shape; std::vector input_data_type; std::vector input_addrs; + std::vector input_size; std::vector output_format; std::vector> output_shape; std::vector output_data_type; std::vector output_addrs; + std::vector output_size; +}; +struct ModelDumpConfig { + std::string model_name; + std::vector layers; +}; + +struct DumpConfig { + std::string dump_path; + std::string dump_mode; + std::string dump_status; + std::string dump_op_switch; + std::vector dump_list; }; } // namespace ge #endif // INC_FRAMEWORK_COMMON_GE_TYPES_H_ diff --git a/inc/framework/common/helper/model_helper.h b/inc/framework/common/helper/model_helper.h index 27f1bc4d7..949d8b4c8 100644 --- a/inc/framework/common/helper/model_helper.h +++ b/inc/framework/common/helper/model_helper.h @@ -64,6 +64,7 @@ class ModelHelper { Status LoadWeights(OmFileLoadHelper& om_load_helper); Status LoadTask(OmFileLoadHelper& om_load_helper); Status LoadTBEKernelStore(OmFileLoadHelper& om_load_helper); + Status LoadCustAICPUKernelStore(OmFileLoadHelper& om_load_helper); Status ReleaseLocalModelData() noexcept; Status SaveModelPartition(std::shared_ptr& om_file_save_helper, ModelPartitionType type, const uint8_t* data, size_t size); diff --git a/inc/framework/common/op/attr_value_util.h b/inc/framework/common/op/attr_value_util.h index 6ef9b11de..e3803b781 100644 --- a/inc/framework/common/op/attr_value_util.h +++ b/inc/framework/common/op/attr_value_util.h @@ -21,7 +21,6 @@ #include #include -#include "common/types.h" #include "graph/debug/ge_attr_define.h" #include "proto/om.pb.h" diff --git a/inc/framework/common/op/ge_op_utils.h b/inc/framework/common/op/ge_op_utils.h index 87cf54d89..4718b180b 100644 --- a/inc/framework/common/op/ge_op_utils.h +++ b/inc/framework/common/op/ge_op_utils.h @@ -22,7 +22,8 @@ #include #include "common/op/attr_value_util.h" -#include "common/types.h" +#include "register/register_types.h" +#include "register/register_error_codes.h" #include "common/util.h" #include "graph/attr_value.h" #include "graph/ge_tensor.h" diff --git a/inc/framework/common/string_util.h b/inc/framework/common/string_util.h index 47e80e759..b74eddcf1 100644 --- a/inc/framework/common/string_util.h +++ b/inc/framework/common/string_util.h @@ -36,8 +36,8 @@ class StringUtils { #endif return s; } - // lint -esym(551,*) - static std::string &Rtrim(std::string &s) { /*lint !e618*/ + + static std::string &Rtrim(std::string &s) { #if __cplusplus >= 201103L (void)s.erase(s.begin(), std::find_if(s.begin(), s.end(), [](int c) { return !std::isspace(c); })); #else @@ -45,7 +45,7 @@ class StringUtils { #endif return s; } - // lint -esym(551,*) + /// /// @ingroup domi_common /// @brief delete spaces at the beginning and end of a string diff --git a/inc/framework/common/types.h b/inc/framework/common/types.h index 55e0870ca..91c684340 100644 --- a/inc/framework/common/types.h +++ b/inc/framework/common/types.h @@ -434,6 +434,7 @@ REGISTER_OPTYPE_DECLARE(HCOMREDUCESCATTER, "HcomReduceScatter"); REGISTER_OPTYPE_DECLARE(HCOMSEND, "HcomSend"); REGISTER_OPTYPE_DECLARE(HCOMRECEIVE, "HcomReceive"); REGISTER_OPTYPE_DECLARE(HCOMREMOTEREAD, "HcomRemoteRead"); +REGISTER_OPTYPE_DECLARE(HCOMREMOTEREFREAD, "HcomRemoteRefRead"); REGISTER_OPTYPE_DECLARE(HCOMREMOTEWRITE, "HcomRemoteWrite"); REGISTER_OPTYPE_DECLARE(VARASSIGN, "VarAssign"); @@ -851,9 +852,9 @@ static constexpr int32_t PARTITION_TYPE_WEIGHTS = 1; static constexpr int32_t PARTITION_TYPE_TASK_INFO = 2; // number of partitions in the current model -static constexpr uint32_t PARTITION_SIZE = 4; +static constexpr uint32_t PARTITION_SIZE = 5; -enum ModelPartitionType { MODEL_DEF = 0, WEIGHTS_DATA, TASK_INFO, TBE_KERNELS }; +enum ModelPartitionType { MODEL_DEF = 0, WEIGHTS_DATA, TASK_INFO, TBE_KERNELS, CUST_AICPU_KERNELS }; struct ModelPartitionMemInfo { ModelPartitionType type; diff --git a/inc/framework/common/util.h b/inc/framework/common/util.h index 8ba2333a6..42ab38683 100644 --- a/inc/framework/common/util.h +++ b/inc/framework/common/util.h @@ -345,7 +345,15 @@ std::string ToString(const google::protobuf::RepeatedField &rpd_field) { /// @return Timestamp, in microseconds (US) /// /// -uint64_t GetCurrentTimestap(); +uint64_t GetCurrentTimestamp(); + +/// +/// @ingroup domi_common +/// @brief Obtains the absolute time (timestamp) of the current system. +/// @return Timestamp, in seconds (US) +/// +/// +uint32_t GetCurrentSecondTimestap(); /// /// @ingroup domi_common @@ -390,6 +398,24 @@ bool CheckOutputPathValid(const std::string &file_path, const std::string &atc_p /// @param [out] result /// bool ValidateStr(const std::string &filePath, const std::string &mode); + +/// +/// @ingroup domi_common +/// @brief Check whether the file is normal file. +/// @param [in] file_path file path +/// @param [out] result +/// +bool IsValidFile(const char *file_path); + +/// +/// @ingroup domi_common +/// @brief Check path invalid +/// @param [in] path, path to be checked +/// @param [in] length, length of path +/// @return 0 success +/// @return -1 fail +/// +Status CheckPath(const char *path, size_t length); } // namespace ge #endif // INC_FRAMEWORK_COMMON_UTIL_H_ diff --git a/inc/framework/engine/dnnengine.h b/inc/framework/engine/dnnengine.h index 65897ac5d..1bcf5e07c 100644 --- a/inc/framework/engine/dnnengine.h +++ b/inc/framework/engine/dnnengine.h @@ -30,6 +30,7 @@ enum PriorityEnum { COST_0 = 0, COST_1, COST_2, + COST_3, COST_9 = 9, COST_10 = 10, }; diff --git a/inc/framework/executor/ge_executor.h b/inc/framework/executor/ge_executor.h index 613152e9e..ba90fd03f 100644 --- a/inc/framework/executor/ge_executor.h +++ b/inc/framework/executor/ge_executor.h @@ -108,11 +108,11 @@ class GE_FUNC_DEV_VISIBILITY GE_FUNC_HOST_VISIBILITY GeExecutor { /// @ingroup ge /// @brief Get current dynamic dims info by combined dims /// @param [in] model_id: model id allocate from manager - /// @param [in] combined_dims: array of combined dimensions + /// @param [in] dynamic_dims: cur gear dynamic dims value /// @param [out] cur_dynamic_dims: current dynamic dims /// @return execute result /// - ge::Status GetCurDynamicDims(uint32_t model_id, const std::vector &combined_dims, + ge::Status GetCurDynamicDims(uint32_t model_id, const std::vector &dynamic_dims, std::vector &cur_dynamic_dims); /// @@ -135,6 +135,15 @@ class GE_FUNC_DEV_VISIBILITY GE_FUNC_HOST_VISIBILITY GeExecutor { /// ge::Status GetCombinedDynamicDims(uint32_t model_id, std::vector> &batch_info); + /// + /// @ingroup ge + /// @brief Get user designeate shape order + /// @param [in] model_id + /// @param [out] user_designate_shape_order + /// @return execute result + /// + ge::Status GetUserDesignateShapeOrder(uint32_t model_id, std::vector &user_designate_shape_order); + ge::Status GetCurShape(const uint32_t model_id, std::vector &batch_info, int32_t &dynamic_type); /// @@ -154,6 +163,8 @@ class GE_FUNC_DEV_VISIBILITY GE_FUNC_HOST_VISIBILITY GeExecutor { ge::Status GetAIPPInfo(uint32_t model_id, uint32_t index, AippConfigInfo &aipp_info); ge::Status GetModelAttr(uint32_t model_id, std::vector &dynamic_output_shape_info); + ge::Status GetAippType(uint32_t model_id, uint32_t index, InputAippType &type, size_t &aipp_index); + ge::Status GetModelDescInfoForZeroCopy(uint32_t model_id, std::vector &input_desc, std::vector &output_desc); @@ -162,6 +173,8 @@ class GE_FUNC_DEV_VISIBILITY GE_FUNC_HOST_VISIBILITY GeExecutor { ge::Status CommandHandle(const ge::Command &command); + ge::Status SetDump(const DumpConfig &dump_config); + /// /// @ingroup ge /// @brief Query model memory consuming interface diff --git a/inc/framework/ge_runtime/davinci_model.h b/inc/framework/ge_runtime/davinci_model.h index 8b6ca978f..91e701591 100644 --- a/inc/framework/ge_runtime/davinci_model.h +++ b/inc/framework/ge_runtime/davinci_model.h @@ -27,10 +27,10 @@ namespace ge { namespace model_runner { class DavinciModel { public: - DavinciModel(const std::vector> &task_info_list, /*lint !e151*/ + DavinciModel(const std::vector> &task_info_list, const std::vector> &data_info_list, - const std::vector> &output_info_list, /*lint !e151*/ - const std::vector> &constant_info_list, /*lint !e1049*/ + const std::vector> &output_info_list, + const std::vector> &constant_info_list, const std::vector &variable_info_list, const std::vector &wait_active_stream_list, const std::vector &force_copy_stream_list, uint64_t mem_size = 0, uint64_t weight_size = 0, @@ -68,12 +68,12 @@ class DavinciModel { uint32_t GetBatchNum() const { return batch_num_; } uint32_t GetEventNum() const { return event_num_; } - const std::vector &GetWaitActiveStreams() const { return wait_active_stream_list_; } /*lint !e1413*/ - const std::vector &GetForceCopyStreams() const { return force_copy_stream_list_; } /*lint !e1413*/ + const std::vector &GetWaitActiveStreams() const { return wait_active_stream_list_; } + const std::vector &GetForceCopyStreams() const { return force_copy_stream_list_; } int32_t GetPriority() const { return priority_; } - const std::vector> &GetTaskInfoList() const { return task_info_list_; } /*lint !e151*/ + const std::vector> &GetTaskInfoList() const { return task_info_list_; } const std::vector> &GetDataInfoList() const { return data_info_list_; } const std::vector> &GetOutputInfoList() const { return output_info_list_; } const std::vector> &GetConstantInfoList() const { return output_info_list_; } @@ -81,7 +81,7 @@ class DavinciModel { private: std::vector> task_info_list_; - std::vector> data_info_list_; /*lint !e151*/ + std::vector> data_info_list_; std::vector> output_info_list_; std::vector> constant_info_list_; std::vector variable_info_list_; diff --git a/inc/framework/ge_runtime/model_runner.h b/inc/framework/ge_runtime/model_runner.h index a5256af76..e495dfdfd 100644 --- a/inc/framework/ge_runtime/model_runner.h +++ b/inc/framework/ge_runtime/model_runner.h @@ -52,11 +52,8 @@ class ModelRunner { bool RunModel(uint32_t model_id, const InputData &input_data, OutputData *output_data); - bool GetInputOutputDescInfo(uint32_t model_id, - bool zero_copy, - std::vector *input_desc, - std::vector *output_desc, - std::vector *input_format, + bool GetInputOutputDescInfo(uint32_t model_id, bool zero_copy, std::vector *input_desc, + std::vector *output_desc, std::vector *input_format, std::vector *output_format); private: diff --git a/inc/framework/ge_runtime/task_info.h b/inc/framework/ge_runtime/task_info.h index 861192198..e36c43334 100644 --- a/inc/framework/ge_runtime/task_info.h +++ b/inc/framework/ge_runtime/task_info.h @@ -161,12 +161,13 @@ class TbeTaskInfo : public TaskInfo { class AicpuTaskInfo : public TaskInfo { public: AicpuTaskInfo(const std::string &op_name, uint32_t stream_id, const string &so_name, const std::string &kernel_name, - const std::string &node_def, const std::vector &input_data_addrs, + const std::string &node_def, const std::string &ext_info, const std::vector &input_data_addrs, const std::vector &output_data_addrs, bool dump_flag) : TaskInfo(op_name, stream_id, TaskInfoType::AICPU, dump_flag), so_name_(so_name), kernel_name_(kernel_name), node_def_(node_def), + ext_info_(ext_info), input_data_addrs_(input_data_addrs), output_data_addrs_(output_data_addrs) {} ~AicpuTaskInfo() override {} @@ -176,11 +177,13 @@ class AicpuTaskInfo : public TaskInfo { const std::string &node_def() const { return node_def_; } const std::vector &input_data_addrs() const { return input_data_addrs_; } const std::vector &output_data_addrs() const { return output_data_addrs_; } + const std::string &ext_info() const { return ext_info_; } private: std::string so_name_; std::string kernel_name_; std::string node_def_; + std::string ext_info_; std::vector input_data_addrs_; std::vector output_data_addrs_; }; @@ -293,19 +296,19 @@ class HcclTaskInfo : public TaskInfo { hcom_distribute_task_(hcom_distribute_task) {} ~HcclTaskInfo() override {} - const std::string &hccl_type() const { return hccl_type_; } /*lint !e1413*/ + const std::string &hccl_type() const { return hccl_type_; } void *input_data_addr() const { return input_data_addr_; } void *output_data_addr() const { return output_data_addr_; } void *workspace_addr() const { return workspace_addr_; } int64_t workspace_size() const { return workspace_size_; } int64_t hccl_stream_num() const { return hccl_stream_num_; } - const std::vector &private_def() const { return private_def_; } /*lint !e1413*/ + const std::vector &private_def() const { return private_def_; } void *ops_kernel_store() const { return ops_kernel_store_; } int32_t count() const { return count_; } int64_t root_id() const { return root_id_; } int64_t op_type() const { return op_type_; } int64_t data_type() const { return data_type_; } - const std::string group() const { return group_; } + const std::string &group() const { return group_; } std::function hcom_bind_model() const { return hcom_bind_model_; } std::function hcom_unbind_model() const { return hcom_unbind_model_; } std::function, void *)> hcom_distribute_task() const { diff --git a/inc/framework/generator/ge_generator.h b/inc/framework/generator/ge_generator.h index 931dfccec..4902a0213 100644 --- a/inc/framework/generator/ge_generator.h +++ b/inc/framework/generator/ge_generator.h @@ -28,6 +28,7 @@ #include "graph/graph.h" #include "graph/op_desc.h" #include "graph/detail/attributes_holder.h" +#include "omg/omg_inner_types.h" namespace ge { class GeGenerator { @@ -45,6 +46,7 @@ class GeGenerator { GeGenerator &operator=(const GeGenerator &) = delete; Status Initialize(const std::map &options); + Status Initialize(const std::map &options, OmgContext &context); Status Finalize(); diff --git a/inc/framework/memory/memory_api.h b/inc/framework/memory/memory_api.h index 52ac682a1..7c87fe74a 100644 --- a/inc/framework/memory/memory_api.h +++ b/inc/framework/memory/memory_api.h @@ -1,5 +1,5 @@ /** - * Copyright 2020 Huawei Technologies Co., Ltd + * Copyright 2019-2020 Huawei Technologies Co., Ltd * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -21,10 +21,11 @@ #include #include "ge/ge_api_error_codes.h" +#include "graph//types.h" #include "runtime/mem.h" namespace ge { -enum MemStorageType{ +enum MemStorageType { HBM = 0, RDMA_HBM, HOST_DDR, @@ -35,6 +36,12 @@ struct HostVarInfo { uint64_t var_size; }; +struct TensorInfo { + std::string var_name; + std::vector dims; + DataType data_type; +}; + /// /// \param size [in] rdma pool memory size to be allocated. /// \param mem_type [in] memory type for rdma pool. @@ -47,6 +54,13 @@ Status InitRdmaPool(size_t size, rtMemType_t mem_type = RT_MEMORY_HBM); /// \return Status result of function Status RdmaRemoteRegister(const std::vector &var_info, rtMemType_t mem_type = RT_MEMORY_HBM); +/// +/// \param tensor_info [in] description for tensor stored shared memory. +/// \param dev_addr [out] malloced shared memory addr. +/// \param memory_size [out] malloced shared memory size. +/// \return Status result of function +Status MallocSharedMemory(const TensorInfo &tensor_info, uint64_t &dev_addr, uint64_t &memory_size); + /// /// \param var_name [in] var_name name of host variable. /// \param base_addr [out] base_addr vase addr of host variable. diff --git a/inc/framework/memory/memory_assigner.h b/inc/framework/memory/memory_assigner.h index bbec014ba..4552fa7c1 100644 --- a/inc/framework/memory/memory_assigner.h +++ b/inc/framework/memory/memory_assigner.h @@ -33,7 +33,7 @@ class MemoryAssigner { MemoryAssigner &operator=(const MemoryAssigner &) = delete; - Status AssignMemory(bool is_loop_graph, size_t &mem_offset, size_t &zero_copy_mem_size); + Status AssignMemory(bool is_loop_graph, map &mem_offset, size_t &zero_copy_mem_size); private: ge::ComputeGraphPtr compute_graph_; diff --git a/inc/framework/omg/omg.h b/inc/framework/omg/omg.h index 623f49af9..e7ca05f75 100644 --- a/inc/framework/omg/omg.h +++ b/inc/framework/omg/omg.h @@ -21,7 +21,6 @@ #include #include #include -#include "framework/common/types.h" #include "framework/omg/omg_inner_types.h" #include "framework/omg/parser/parser_inner_ctx.h" #include "proto/ge_ir.pb.h" @@ -92,8 +91,6 @@ void GetGroupName(ge::proto::ModelDef &model); void FindParserSo(const string &path, vector &fileList, string &caffe_parser_path); -Status CheckCustomAiCpuOpLib(); - Status DumpInfershapeJson(const ge::Graph &graph, const char *json_file); Status SetOutputNodeInfo(ge::Graph &graph, const std::string &output_type, const std::string &output_format); diff --git a/inc/framework/omg/omg_inner_types.h b/inc/framework/omg/omg_inner_types.h index 803612322..c48d16494 100644 --- a/inc/framework/omg/omg_inner_types.h +++ b/inc/framework/omg/omg_inner_types.h @@ -25,7 +25,6 @@ #include #include #include "framework/common/fmk_error_codes.h" -#include "framework/common/types.h" #include "register/register_fmk_types.h" using domi::DOMI_TENSOR_ND; @@ -92,30 +91,23 @@ struct OmgContext { std::map> out_nodes_map; // user-designate out nodes (this is used for determing the orders) std::vector> user_out_nodes; + // default out nodes (this is used for determing the orders) + std::vector> default_out_nodes; + // save the output node of the network, value = topName, + // topName indicates the output name of the operator. + std::vector user_out_nodes_top_vec; // net out nodes (where user_out_nodes or leaf nodes) std::vector net_out_nodes; // net out nodes top names(only caffe has top) std::vector out_top_names; - // path for the aicpu custom operator so_file - std::vector aicpu_op_run_paths; - // ddk version - std::string ddk_version; // preferential format used by the entire network domiTensorFormat_t net_format = DOMI_TENSOR_RESERVED; domi::FrameworkType type = domi::FRAMEWORK_RESERVED; RunMode run_mode = ONLY_PRE_CHECK; bool train_flag = false; - // whether to use FP16 high precision - int32_t fp16_high_precision = HIGH_PRECISION_DEFAULT; std::string output_type; - // Save the name of the entire network: Some special operators are used to determine a network. Some operators in the - // network require special processing based on the specific network. e.g:faster-rcnn, the FirstStageProcessor module - // is determined as the Faster-R-CNN network based on the scope fusion. Then, the conv+reshape operators in the - // FirstStageBoxPredictor/BoxEncodingPredictor scope are combined. The convolution kernel rearrangement reshape - // operator needs to be deleted for the convolution kernel. - std::string net_name; // Whether to use dynamic batch size or dynamic image size bool is_dynamic_input = false; std::string dynamic_batch_size; diff --git a/inc/framework/omg/parser/model_parser.h b/inc/framework/omg/parser/model_parser.h index 3a8aa6ced..20bfcef4e 100644 --- a/inc/framework/omg/parser/model_parser.h +++ b/inc/framework/omg/parser/model_parser.h @@ -18,7 +18,7 @@ #define INC_FRAMEWORK_OMG_PARSER_MODEL_PARSER_H_ #include -#include "framework/common/types.h" +#include "framework/omg/parser/parser_types.h" #include "framework/omg/omg_inner_types.h" #include "graph/attr_value.h" #include "graph/compute_graph.h" diff --git a/inc/framework/omg/parser/op_parser.h b/inc/framework/omg/parser/op_parser.h index 251c04479..087bad32e 100644 --- a/inc/framework/omg/parser/op_parser.h +++ b/inc/framework/omg/parser/op_parser.h @@ -18,7 +18,7 @@ #define INC_FRAMEWORK_OMG_PARSER_OP_PARSER_H_ #include -#include "common/types.h" +#include "framework/omg/parser/parser_types.h" #include "omg/omg_inner_types.h" #include "proto/om.pb.h" #include "graph/ge_tensor.h" diff --git a/inc/framework/omg/parser/parser_factory.h b/inc/framework/omg/parser/parser_factory.h index 90d441d71..4845606f7 100644 --- a/inc/framework/omg/parser/parser_factory.h +++ b/inc/framework/omg/parser/parser_factory.h @@ -21,8 +21,8 @@ #include #include #include -#include "framework/common/types.h" #include "framework/omg/omg_inner_types.h" +#include "framework/omg/parser/parser_types.h" using Status = domi::Status; diff --git a/inc/framework/omg/parser/parser_inner_ctx.h b/inc/framework/omg/parser/parser_inner_ctx.h index 53f798955..b57420eb1 100644 --- a/inc/framework/omg/parser/parser_inner_ctx.h +++ b/inc/framework/omg/parser/parser_inner_ctx.h @@ -29,8 +29,33 @@ namespace ge { struct ParserContext { + // format of the input specified by the command line + std::unordered_map input_nodes_format_map; + // user-designate input dims + std::vector>> user_input_dims; std::unordered_map> input_dims; + // resolve the mapping between operators with the same name and corresponding network. format e.g. + // Detectionoutput:SsdDetectiontOutput + std::map op_conf_map; + // user-designate out nodes (this is used for determing the orders) + std::vector> user_out_nodes; + // default out nodes (this is used for determing the orders) + std::vector> default_out_nodes; + // save the output node of the network. key = operator name, value = index, index indicates the output index of the + // operator + std::map> out_nodes_map; + // save the output node of the network, value = topName, + // topName indicates the output name of the operator. + std::vector user_out_nodes_top_vec; + // net out nodes (where user_out_nodes or leaf nodes) + std::vector net_out_nodes; + // net out nodes top names(only caffe has top) + std::vector out_top_names; + // Whether to use dynamic batch size or dynamic image size + bool is_dynamic_input = false; + bool train_flag = false; domi::domiTensorFormat_t format = domi::DOMI_TENSOR_ND; + domi::FrameworkType type = domi::FRAMEWORK_RESERVED; RunMode run_mode = ONLY_PRE_CHECK; std::string custom_proto_path; // save caffe custom proto path, used by caffe parse std::string caffe_proto_path; // save caffe proto path, used by caffe parse diff --git a/inc/framework/omg/parser/parser_types.h b/inc/framework/omg/parser/parser_types.h new file mode 100644 index 000000000..62c9c750b --- /dev/null +++ b/inc/framework/omg/parser/parser_types.h @@ -0,0 +1,508 @@ +/** + * Copyright 2019-2020 Huawei Technologies Co., Ltd + * + * 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 PARSER_COMMON_TYPES_H_ +#define PARSER_COMMON_TYPES_H_ + +#include +#include + +#include "register/register_types.h" + +#if !defined(__ANDROID__) && !defined(ANDROID) +#ifndef DOMI_DYNAMIC_CAST +#define DOMI_DYNAMIC_CAST static_cast +#endif +#ifndef DOMI_DYNAMIC_POINTER_CAST +#define DOMI_DYNAMIC_POINTER_CAST std::static_pointer_cast +#endif +#else +#ifndef DOMI_DYNAMIC_CAST +#define DOMI_DYNAMIC_CAST static_cast +#endif +#ifndef DOMI_DYNAMIC_POINTER_CAST +#define DOMI_DYNAMIC_POINTER_CAST std::static_pointer_cast +#endif +#endif + +namespace ge { +namespace parser { +FMK_FUNC_HOST_VISIBILITY FMK_FUNC_DEV_VISIBILITY extern const char *DATA; +FMK_FUNC_HOST_VISIBILITY FMK_FUNC_DEV_VISIBILITY extern const char *AIPPDATA; +FMK_FUNC_HOST_VISIBILITY FMK_FUNC_DEV_VISIBILITY extern const char *CONVOLUTION; +FMK_FUNC_HOST_VISIBILITY FMK_FUNC_DEV_VISIBILITY extern const char *CORRELATION; +FMK_FUNC_HOST_VISIBILITY FMK_FUNC_DEV_VISIBILITY extern const char *CORRELATIONV2; +FMK_FUNC_HOST_VISIBILITY FMK_FUNC_DEV_VISIBILITY extern const char *DECONVOLUTION; +FMK_FUNC_HOST_VISIBILITY FMK_FUNC_DEV_VISIBILITY extern const char *POOLING; +FMK_FUNC_HOST_VISIBILITY FMK_FUNC_DEV_VISIBILITY extern const char *ELTWISE; +FMK_FUNC_HOST_VISIBILITY FMK_FUNC_DEV_VISIBILITY extern const char *RELU; +FMK_FUNC_HOST_VISIBILITY FMK_FUNC_DEV_VISIBILITY extern const char *RELU6; +FMK_FUNC_HOST_VISIBILITY FMK_FUNC_DEV_VISIBILITY extern const char *SIGMOID; +FMK_FUNC_HOST_VISIBILITY FMK_FUNC_DEV_VISIBILITY extern const char *ABSVAL; +FMK_FUNC_HOST_VISIBILITY FMK_FUNC_DEV_VISIBILITY extern const char *TANH; +FMK_FUNC_HOST_VISIBILITY FMK_FUNC_DEV_VISIBILITY extern const char *PRELU; +FMK_FUNC_HOST_VISIBILITY FMK_FUNC_DEV_VISIBILITY extern const char *BATCHNORM; +FMK_FUNC_HOST_VISIBILITY FMK_FUNC_DEV_VISIBILITY extern const char *FUSIONBATCHNORM; +FMK_FUNC_HOST_VISIBILITY FMK_FUNC_DEV_VISIBILITY extern const char *SCALE; +FMK_FUNC_HOST_VISIBILITY FMK_FUNC_DEV_VISIBILITY extern const char *FULL_CONNECTION; +FMK_FUNC_HOST_VISIBILITY FMK_FUNC_DEV_VISIBILITY extern const char *SOFTMAX; +FMK_FUNC_HOST_VISIBILITY FMK_FUNC_DEV_VISIBILITY extern const char *PLUS; +FMK_FUNC_HOST_VISIBILITY FMK_FUNC_DEV_VISIBILITY extern const char *ACTIVATION; +FMK_FUNC_HOST_VISIBILITY FMK_FUNC_DEV_VISIBILITY extern const char *FLATTEN; +FMK_FUNC_HOST_VISIBILITY FMK_FUNC_DEV_VISIBILITY extern const char *ADD; +FMK_FUNC_HOST_VISIBILITY FMK_FUNC_DEV_VISIBILITY extern const char *SUB; +FMK_FUNC_HOST_VISIBILITY FMK_FUNC_DEV_VISIBILITY extern const char *MUL; +FMK_FUNC_HOST_VISIBILITY FMK_FUNC_DEV_VISIBILITY extern const char *MATMUL; +FMK_FUNC_HOST_VISIBILITY FMK_FUNC_DEV_VISIBILITY extern const char *RSQRT; +FMK_FUNC_HOST_VISIBILITY FMK_FUNC_DEV_VISIBILITY extern const char *BIASADD; +FMK_FUNC_HOST_VISIBILITY FMK_FUNC_DEV_VISIBILITY extern const char *RESHAPE; +FMK_FUNC_HOST_VISIBILITY FMK_FUNC_DEV_VISIBILITY extern const char *REFORMAT; +FMK_FUNC_HOST_VISIBILITY FMK_FUNC_DEV_VISIBILITY extern const char *DEPCONVOLUTION; +FMK_FUNC_HOST_VISIBILITY FMK_FUNC_DEV_VISIBILITY extern const char *DROPOUT; +FMK_FUNC_HOST_VISIBILITY FMK_FUNC_DEV_VISIBILITY extern const char *DROPOUTGENMASK; +FMK_FUNC_HOST_VISIBILITY FMK_FUNC_DEV_VISIBILITY extern const char *DROPOUTDOMASK; +FMK_FUNC_HOST_VISIBILITY FMK_FUNC_DEV_VISIBILITY extern const char *CONCAT; +FMK_FUNC_HOST_VISIBILITY FMK_FUNC_DEV_VISIBILITY extern const char *ROIPOOLING; +FMK_FUNC_HOST_VISIBILITY FMK_FUNC_DEV_VISIBILITY extern const char *PROPOSAL; +FMK_FUNC_HOST_VISIBILITY FMK_FUNC_DEV_VISIBILITY extern const char *FSRDETECTIONOUTPUT; +FMK_FUNC_HOST_VISIBILITY FMK_FUNC_DEV_VISIBILITY extern const char *DETECTIONPOSTPROCESS; +FMK_FUNC_HOST_VISIBILITY FMK_FUNC_DEV_VISIBILITY extern const char *LRN; +FMK_FUNC_HOST_VISIBILITY FMK_FUNC_DEV_VISIBILITY extern const char *TRANSDATA; +FMK_FUNC_HOST_VISIBILITY FMK_FUNC_DEV_VISIBILITY extern const char *PERMUTE; +FMK_FUNC_HOST_VISIBILITY FMK_FUNC_DEV_VISIBILITY extern const char *SSDNORMALIZE; +FMK_FUNC_HOST_VISIBILITY FMK_FUNC_DEV_VISIBILITY extern const char *SSDPRIORBOX; +FMK_FUNC_HOST_VISIBILITY FMK_FUNC_DEV_VISIBILITY extern const char *NETOUTPUT; +FMK_FUNC_HOST_VISIBILITY FMK_FUNC_DEV_VISIBILITY extern const char *SSDDETECTIONOUTPUT; +FMK_FUNC_HOST_VISIBILITY FMK_FUNC_DEV_VISIBILITY extern const char *REFINEDETDETECTIONOUTPUT; +FMK_FUNC_HOST_VISIBILITY FMK_FUNC_DEV_VISIBILITY extern const char *CHANNELAXPY; +FMK_FUNC_HOST_VISIBILITY FMK_FUNC_DEV_VISIBILITY extern const char *PSROIPOOLING; +FMK_FUNC_HOST_VISIBILITY FMK_FUNC_DEV_VISIBILITY extern const char *POWER; +FMK_FUNC_HOST_VISIBILITY FMK_FUNC_DEV_VISIBILITY extern const char *POW; +FMK_FUNC_HOST_VISIBILITY FMK_FUNC_DEV_VISIBILITY extern const char *ROIALIGN; +FMK_FUNC_HOST_VISIBILITY FMK_FUNC_DEV_VISIBILITY extern const char *PYTHON; +FMK_FUNC_HOST_VISIBILITY FMK_FUNC_DEV_VISIBILITY extern const char *FREESPACEEXTRACT; +FMK_FUNC_HOST_VISIBILITY FMK_FUNC_DEV_VISIBILITY extern const char *SPATIALTF; +FMK_FUNC_HOST_VISIBILITY FMK_FUNC_DEV_VISIBILITY extern const char *SHAPE; +FMK_FUNC_HOST_VISIBILITY FMK_FUNC_DEV_VISIBILITY extern const char *SHAPEN; +FMK_FUNC_HOST_VISIBILITY FMK_FUNC_DEV_VISIBILITY extern const char *ARGMAX; +FMK_FUNC_HOST_VISIBILITY FMK_FUNC_DEV_VISIBILITY extern const char *GATHERND; +FMK_FUNC_HOST_VISIBILITY FMK_FUNC_DEV_VISIBILITY extern const char *GATHER; +FMK_FUNC_HOST_VISIBILITY FMK_FUNC_DEV_VISIBILITY extern const char *REALDIV; +FMK_FUNC_HOST_VISIBILITY FMK_FUNC_DEV_VISIBILITY extern const char *PACK; +FMK_FUNC_HOST_VISIBILITY FMK_FUNC_DEV_VISIBILITY extern const char *SLICE; +FMK_FUNC_HOST_VISIBILITY FMK_FUNC_DEV_VISIBILITY extern const char *SLICED; +FMK_FUNC_HOST_VISIBILITY FMK_FUNC_DEV_VISIBILITY extern const char *FLOORDIV; +FMK_FUNC_HOST_VISIBILITY FMK_FUNC_DEV_VISIBILITY extern const char *SQUEEZE; +FMK_FUNC_HOST_VISIBILITY FMK_FUNC_DEV_VISIBILITY extern const char *UNSQUEEZE; +FMK_FUNC_HOST_VISIBILITY FMK_FUNC_DEV_VISIBILITY extern const char *STRIDEDSLICE; +FMK_FUNC_HOST_VISIBILITY FMK_FUNC_DEV_VISIBILITY extern const char *RANGE; +FMK_FUNC_HOST_VISIBILITY FMK_FUNC_DEV_VISIBILITY extern const char *RPNPROPOSALS; +FMK_FUNC_HOST_VISIBILITY FMK_FUNC_DEV_VISIBILITY extern const char *DECODEBBOX; +FMK_FUNC_HOST_VISIBILITY FMK_FUNC_DEV_VISIBILITY extern const char *PAD; +FMK_FUNC_HOST_VISIBILITY FMK_FUNC_DEV_VISIBILITY extern const char *PADV2; +FMK_FUNC_HOST_VISIBILITY FMK_FUNC_DEV_VISIBILITY extern const char *MIRRORPAD; +FMK_FUNC_HOST_VISIBILITY FMK_FUNC_DEV_VISIBILITY extern const char *TILE; +FMK_FUNC_HOST_VISIBILITY FMK_FUNC_DEV_VISIBILITY extern const char *SIZE; +FMK_FUNC_HOST_VISIBILITY FMK_FUNC_DEV_VISIBILITY extern const char *CLIPBOXES; +FMK_FUNC_HOST_VISIBILITY FMK_FUNC_DEV_VISIBILITY extern const char *FASTRCNNPREDICTIONS; +FMK_FUNC_HOST_VISIBILITY FMK_FUNC_DEV_VISIBILITY extern const char *SPLIT; +FMK_FUNC_HOST_VISIBILITY FMK_FUNC_DEV_VISIBILITY extern const char *SPLITV; +FMK_FUNC_HOST_VISIBILITY FMK_FUNC_DEV_VISIBILITY extern const char *EXPANDDIMS; +FMK_FUNC_HOST_VISIBILITY FMK_FUNC_DEV_VISIBILITY extern const char *EMPTY; +FMK_FUNC_HOST_VISIBILITY FMK_FUNC_DEV_VISIBILITY extern const char *MEAN; +FMK_FUNC_HOST_VISIBILITY FMK_FUNC_DEV_VISIBILITY extern const char *GREATER; +FMK_FUNC_HOST_VISIBILITY FMK_FUNC_DEV_VISIBILITY extern const char *SWITCH; +FMK_FUNC_HOST_VISIBILITY FMK_FUNC_DEV_VISIBILITY extern const char *SWITCHN; +FMK_FUNC_HOST_VISIBILITY FMK_FUNC_DEV_VISIBILITY extern const char *MERGE; +FMK_FUNC_HOST_VISIBILITY FMK_FUNC_DEV_VISIBILITY extern const char *SYMBOLICGRADIENT; +FMK_FUNC_HOST_VISIBILITY FMK_FUNC_DEV_VISIBILITY extern const char *REMOTECALL; +FMK_FUNC_HOST_VISIBILITY FMK_FUNC_DEV_VISIBILITY extern const char *_IF; +FMK_FUNC_HOST_VISIBILITY FMK_FUNC_DEV_VISIBILITY extern const char *STATELESSIF; +FMK_FUNC_HOST_VISIBILITY FMK_FUNC_DEV_VISIBILITY extern const char *IF; +FMK_FUNC_HOST_VISIBILITY FMK_FUNC_DEV_VISIBILITY extern const char *CASE; +FMK_FUNC_HOST_VISIBILITY FMK_FUNC_DEV_VISIBILITY extern const char *_WHILE; +FMK_FUNC_HOST_VISIBILITY FMK_FUNC_DEV_VISIBILITY extern const char *WHILE; +FMK_FUNC_HOST_VISIBILITY FMK_FUNC_DEV_VISIBILITY extern const char *STATELESSWHILE; +FMK_FUNC_HOST_VISIBILITY FMK_FUNC_DEV_VISIBILITY extern const char *FOR; +FMK_FUNC_HOST_VISIBILITY FMK_FUNC_DEV_VISIBILITY extern const char *PARTITIONEDCALL; +FMK_FUNC_HOST_VISIBILITY FMK_FUNC_DEV_VISIBILITY extern const char *STATEFULPARTITIONEDCALL; +FMK_FUNC_HOST_VISIBILITY FMK_FUNC_DEV_VISIBILITY extern const char *FAKEPARAM; +FMK_FUNC_HOST_VISIBILITY FMK_FUNC_DEV_VISIBILITY extern const char *TRANSPOSE; +FMK_FUNC_HOST_VISIBILITY FMK_FUNC_DEV_VISIBILITY extern const char *TRANSPOSED; +FMK_FUNC_HOST_VISIBILITY FMK_FUNC_DEV_VISIBILITY extern const char *CAST; +FMK_FUNC_HOST_VISIBILITY FMK_FUNC_DEV_VISIBILITY extern const char *REGION; +FMK_FUNC_HOST_VISIBILITY FMK_FUNC_DEV_VISIBILITY extern const char *YOLO; +FMK_FUNC_HOST_VISIBILITY FMK_FUNC_DEV_VISIBILITY extern const char *YOLODETECTIONOUTPUT; +FMK_FUNC_HOST_VISIBILITY FMK_FUNC_DEV_VISIBILITY extern const char *FILL; +FMK_FUNC_HOST_VISIBILITY FMK_FUNC_DEV_VISIBILITY extern const char *REVERSE; +FMK_FUNC_HOST_VISIBILITY FMK_FUNC_DEV_VISIBILITY extern const char *UNPACK; +FMK_FUNC_HOST_VISIBILITY FMK_FUNC_DEV_VISIBILITY extern const char *YOLO2REORG; +FMK_FUNC_HOST_VISIBILITY FMK_FUNC_DEV_VISIBILITY extern const char *REDUCESUM; +FMK_FUNC_HOST_VISIBILITY FMK_FUNC_DEV_VISIBILITY extern const char *SUM; +FMK_FUNC_HOST_VISIBILITY FMK_FUNC_DEV_VISIBILITY extern const char *CONSTANT; +FMK_FUNC_HOST_VISIBILITY FMK_FUNC_DEV_VISIBILITY extern const char *RESIZEBILINEAR; +FMK_FUNC_HOST_VISIBILITY FMK_FUNC_DEV_VISIBILITY extern const char *RESIZEBILINEARGRAD; +FMK_FUNC_HOST_VISIBILITY FMK_FUNC_DEV_VISIBILITY extern const char *MAXIMUM; +FMK_FUNC_HOST_VISIBILITY FMK_FUNC_DEV_VISIBILITY extern const char *FRAMEWORKOP; +FMK_FUNC_HOST_VISIBILITY FMK_FUNC_DEV_VISIBILITY extern const char *ARG; +FMK_FUNC_HOST_VISIBILITY FMK_FUNC_DEV_VISIBILITY extern const char *FUSEDBATCHNORMGRAD; +FMK_FUNC_HOST_VISIBILITY FMK_FUNC_DEV_VISIBILITY extern const char *LSTM; +FMK_FUNC_HOST_VISIBILITY FMK_FUNC_DEV_VISIBILITY extern const char *HIGHWAY; +FMK_FUNC_HOST_VISIBILITY FMK_FUNC_DEV_VISIBILITY extern const char *RNN; +FMK_FUNC_HOST_VISIBILITY FMK_FUNC_DEV_VISIBILITY extern const char *ATTENTIONDECODER; +FMK_FUNC_HOST_VISIBILITY FMK_FUNC_DEV_VISIBILITY extern const char *LOGICAL_NOT; +FMK_FUNC_HOST_VISIBILITY FMK_FUNC_DEV_VISIBILITY extern const char *LOGICAL_AND; +FMK_FUNC_HOST_VISIBILITY FMK_FUNC_DEV_VISIBILITY extern const char *LOGICAL_OR; +FMK_FUNC_HOST_VISIBILITY FMK_FUNC_DEV_VISIBILITY extern const char *EQUAL; +FMK_FUNC_HOST_VISIBILITY FMK_FUNC_DEV_VISIBILITY extern const char *NOTEQUAL; +FMK_FUNC_HOST_VISIBILITY FMK_FUNC_DEV_VISIBILITY extern const char *INTERP; +FMK_FUNC_HOST_VISIBILITY FMK_FUNC_DEV_VISIBILITY extern const char *SHUFFLECHANNEL; +FMK_FUNC_HOST_VISIBILITY FMK_FUNC_DEV_VISIBILITY extern const char *AIPP; +FMK_FUNC_HOST_VISIBILITY FMK_FUNC_DEV_VISIBILITY extern const char *MULTISHAPE; +FMK_FUNC_HOST_VISIBILITY FMK_FUNC_DEV_VISIBILITY extern const char *RECIPROCAL; +FMK_FUNC_HOST_VISIBILITY FMK_FUNC_DEV_VISIBILITY extern const char *SELU; +FMK_FUNC_HOST_VISIBILITY FMK_FUNC_DEV_VISIBILITY extern const char *ELU; +FMK_FUNC_HOST_VISIBILITY FMK_FUNC_DEV_VISIBILITY extern const char *ACOSH; +FMK_FUNC_HOST_VISIBILITY FMK_FUNC_DEV_VISIBILITY extern const char *ASINH; +FMK_FUNC_HOST_VISIBILITY FMK_FUNC_DEV_VISIBILITY extern const char *MINIMUM; +FMK_FUNC_HOST_VISIBILITY FMK_FUNC_DEV_VISIBILITY extern const char *CLIP; +FMK_FUNC_HOST_VISIBILITY FMK_FUNC_DEV_VISIBILITY extern const char *L2NORMALIZE; +FMK_FUNC_HOST_VISIBILITY FMK_FUNC_DEV_VISIBILITY extern const char *CROPANDRESIZE; +FMK_FUNC_HOST_VISIBILITY FMK_FUNC_DEV_VISIBILITY extern const char *UNUSEDCONST; +FMK_FUNC_HOST_VISIBILITY FMK_FUNC_DEV_VISIBILITY extern const char *SPARSETODENSE; +FMK_FUNC_HOST_VISIBILITY FMK_FUNC_DEV_VISIBILITY extern const char *NONMAXSUPPRESSION; +FMK_FUNC_HOST_VISIBILITY FMK_FUNC_DEV_VISIBILITY extern const char *TOPKV2; +FMK_FUNC_HOST_VISIBILITY FMK_FUNC_DEV_VISIBILITY extern const char *INVERTPERMUTATION; +FMK_FUNC_HOST_VISIBILITY FMK_FUNC_DEV_VISIBILITY extern const char *MULTINOMIAL; +FMK_FUNC_HOST_VISIBILITY FMK_FUNC_DEV_VISIBILITY extern const char *REVERSESEQUENCE; +FMK_FUNC_HOST_VISIBILITY FMK_FUNC_DEV_VISIBILITY extern const char *REDUCEPROD; +FMK_FUNC_HOST_VISIBILITY FMK_FUNC_DEV_VISIBILITY extern const char *REDUCEMAX; +FMK_FUNC_HOST_VISIBILITY FMK_FUNC_DEV_VISIBILITY extern const char *REDUCEMIN; +FMK_FUNC_HOST_VISIBILITY FMK_FUNC_DEV_VISIBILITY extern const char *EXTRACTIMAGEPATCHES; +FMK_FUNC_HOST_VISIBILITY FMK_FUNC_DEV_VISIBILITY extern const char *SQRT; +FMK_FUNC_HOST_VISIBILITY FMK_FUNC_DEV_VISIBILITY extern const char *REDUCEALL; +FMK_FUNC_HOST_VISIBILITY FMK_FUNC_DEV_VISIBILITY extern const char *RESIZENEARESTNEIGHBOR; +FMK_FUNC_HOST_VISIBILITY FMK_FUNC_DEV_VISIBILITY extern const char *SPACETOBATCHND; +FMK_FUNC_HOST_VISIBILITY FMK_FUNC_DEV_VISIBILITY extern const char *BATCHTOSPACEND; +FMK_FUNC_HOST_VISIBILITY FMK_FUNC_DEV_VISIBILITY extern const char *ASSERT; +FMK_FUNC_HOST_VISIBILITY FMK_FUNC_DEV_VISIBILITY extern const char *GREATEREQUAL; +FMK_FUNC_HOST_VISIBILITY FMK_FUNC_DEV_VISIBILITY extern const char *FLOOR; +FMK_FUNC_HOST_VISIBILITY FMK_FUNC_DEV_VISIBILITY extern const char *RANDOMUNIFORM; +FMK_FUNC_HOST_VISIBILITY FMK_FUNC_DEV_VISIBILITY extern const char *BATCHMATMUL; +FMK_FUNC_HOST_VISIBILITY FMK_FUNC_DEV_VISIBILITY extern const char *SPACETODEPTH; +FMK_FUNC_HOST_VISIBILITY FMK_FUNC_DEV_VISIBILITY extern const char *DEPTHTOSPACE; +FMK_FUNC_HOST_VISIBILITY FMK_FUNC_DEV_VISIBILITY extern const char *RINT; +FMK_FUNC_HOST_VISIBILITY FMK_FUNC_DEV_VISIBILITY extern const char *ATAN; +FMK_FUNC_HOST_VISIBILITY FMK_FUNC_DEV_VISIBILITY extern const char *ATAN2; +FMK_FUNC_HOST_VISIBILITY FMK_FUNC_DEV_VISIBILITY extern const char *ATANH; +FMK_FUNC_HOST_VISIBILITY FMK_FUNC_DEV_VISIBILITY extern const char *ACOS; +FMK_FUNC_HOST_VISIBILITY FMK_FUNC_DEV_VISIBILITY extern const char *ASIN; +FMK_FUNC_HOST_VISIBILITY FMK_FUNC_DEV_VISIBILITY extern const char *NEG; +FMK_FUNC_HOST_VISIBILITY FMK_FUNC_DEV_VISIBILITY extern const char *LOG; +FMK_FUNC_HOST_VISIBILITY FMK_FUNC_DEV_VISIBILITY extern const char *TAN; +FMK_FUNC_HOST_VISIBILITY FMK_FUNC_DEV_VISIBILITY extern const char *ROUND; +FMK_FUNC_HOST_VISIBILITY FMK_FUNC_DEV_VISIBILITY extern const char *UPSAMPLE; +FMK_FUNC_HOST_VISIBILITY FMK_FUNC_DEV_VISIBILITY extern const char *FLOORMOD; +FMK_FUNC_HOST_VISIBILITY FMK_FUNC_DEV_VISIBILITY extern const char *LESS; +FMK_FUNC_HOST_VISIBILITY FMK_FUNC_DEV_VISIBILITY extern const char *LESSEQUAL; +FMK_FUNC_HOST_VISIBILITY FMK_FUNC_DEV_VISIBILITY extern const char *ONEHOT; +FMK_FUNC_HOST_VISIBILITY FMK_FUNC_DEV_VISIBILITY extern const char *REFSWITCH; +FMK_FUNC_HOST_VISIBILITY FMK_FUNC_DEV_VISIBILITY extern const char *REFMERGE; +FMK_FUNC_HOST_VISIBILITY FMK_FUNC_DEV_VISIBILITY extern const char *ENTER; +FMK_FUNC_HOST_VISIBILITY FMK_FUNC_DEV_VISIBILITY extern const char *REFENTER; +FMK_FUNC_HOST_VISIBILITY FMK_FUNC_DEV_VISIBILITY extern const char *LOOPCOND; +FMK_FUNC_HOST_VISIBILITY FMK_FUNC_DEV_VISIBILITY extern const char *NEXTITERATION; +FMK_FUNC_HOST_VISIBILITY FMK_FUNC_DEV_VISIBILITY extern const char *REFNEXTITERATION; +FMK_FUNC_HOST_VISIBILITY FMK_FUNC_DEV_VISIBILITY extern const char *EXIT; +FMK_FUNC_HOST_VISIBILITY FMK_FUNC_DEV_VISIBILITY extern const char *REFEXIT; +FMK_FUNC_HOST_VISIBILITY FMK_FUNC_DEV_VISIBILITY extern const char *CONTROLTRIGGER; +FMK_FUNC_HOST_VISIBILITY FMK_FUNC_DEV_VISIBILITY extern const char *ZEROSLIKE; +FMK_FUNC_HOST_VISIBILITY FMK_FUNC_DEV_VISIBILITY extern const char *EXP; +FMK_FUNC_HOST_VISIBILITY FMK_FUNC_DEV_VISIBILITY extern const char *WHERE; +FMK_FUNC_HOST_VISIBILITY FMK_FUNC_DEV_VISIBILITY extern const char *FAKEQUANTWITHMINMAXVARS; +FMK_FUNC_HOST_VISIBILITY FMK_FUNC_DEV_VISIBILITY extern const char *SOFTPLUS; +FMK_FUNC_HOST_VISIBILITY FMK_FUNC_DEV_VISIBILITY extern const char *SOFTSIGN; +FMK_FUNC_HOST_VISIBILITY FMK_FUNC_DEV_VISIBILITY extern const char *COSH; +FMK_FUNC_HOST_VISIBILITY FMK_FUNC_DEV_VISIBILITY extern const char *SINH; +FMK_FUNC_HOST_VISIBILITY FMK_FUNC_DEV_VISIBILITY extern const char *SQUAREDDIFFERENCE; +FMK_FUNC_HOST_VISIBILITY FMK_FUNC_DEV_VISIBILITY extern const char + *REQUIREDSPACETOBATCHPADDINGS; // for retinanet scope fusion +FMK_FUNC_HOST_VISIBILITY FMK_FUNC_DEV_VISIBILITY extern const char *SSDPOSTPROCESSOR; +FMK_FUNC_HOST_VISIBILITY FMK_FUNC_DEV_VISIBILITY extern const char *RETINANETBOXES; +FMK_FUNC_HOST_VISIBILITY FMK_FUNC_DEV_VISIBILITY extern const char *RETINAMULTIANCHORS; +FMK_FUNC_HOST_VISIBILITY FMK_FUNC_DEV_VISIBILITY extern const char *RETINANETCLIPPEDBOXES; +FMK_FUNC_HOST_VISIBILITY FMK_FUNC_DEV_VISIBILITY extern const char *RETINANETFILTEREDDETECTIONS; +FMK_FUNC_HOST_VISIBILITY FMK_FUNC_DEV_VISIBILITY extern const char *RETINANETPOSTPROCESSOR; +FMK_FUNC_HOST_VISIBILITY FMK_FUNC_DEV_VISIBILITY extern const char *RETINANETANCHORS; +FMK_FUNC_HOST_VISIBILITY FMK_FUNC_DEV_VISIBILITY extern const char *FASTERRCNNMAP; +FMK_FUNC_HOST_VISIBILITY FMK_FUNC_DEV_VISIBILITY extern const char *FASTERRCNNMAP1; +FMK_FUNC_HOST_VISIBILITY FMK_FUNC_DEV_VISIBILITY extern const char *FASTERRCNNSECONDSTAGEPOSTPROCESSOR; +FMK_FUNC_HOST_VISIBILITY FMK_FUNC_DEV_VISIBILITY extern const char *FASTERRCNNROIINTERPOOLING; +FMK_FUNC_HOST_VISIBILITY FMK_FUNC_DEV_VISIBILITY extern const char *FASTERRCNNFIRSTSTAGEPOSTPROCESSOR; +FMK_FUNC_HOST_VISIBILITY FMK_FUNC_DEV_VISIBILITY extern const char *FASTERRCNNGRIDANCHORGENERATOR; +FMK_FUNC_HOST_VISIBILITY FMK_FUNC_DEV_VISIBILITY extern const char *ROIINTERPOOLING; +FMK_FUNC_HOST_VISIBILITY FMK_FUNC_DEV_VISIBILITY extern const char *FASTERRCNNCLIPTOWINDOW; +FMK_FUNC_HOST_VISIBILITY FMK_FUNC_DEV_VISIBILITY extern const char *EMBEDLOOKUP; +FMK_FUNC_HOST_VISIBILITY FMK_FUNC_DEV_VISIBILITY extern const char *HASHLOOKUP; +FMK_FUNC_HOST_VISIBILITY FMK_FUNC_DEV_VISIBILITY extern const char *LSH_PROJ; +FMK_FUNC_HOST_VISIBILITY FMK_FUNC_DEV_VISIBILITY extern const char *SVDF; +FMK_FUNC_HOST_VISIBILITY FMK_FUNC_DEV_VISIBILITY extern const char *SSDANCHORGENERATOR; +FMK_FUNC_HOST_VISIBILITY FMK_FUNC_DEV_VISIBILITY extern const char *IDENTITY; +FMK_FUNC_HOST_VISIBILITY FMK_FUNC_DEV_VISIBILITY extern const char *IDENTITYN; +FMK_FUNC_HOST_VISIBILITY FMK_FUNC_DEV_VISIBILITY extern const char *PLACEHOLDERWITHDEFAULT; +FMK_FUNC_HOST_VISIBILITY FMK_FUNC_DEV_VISIBILITY extern const char *SELECT; +FMK_FUNC_HOST_VISIBILITY FMK_FUNC_DEV_VISIBILITY extern const char *GETSPAN; +FMK_FUNC_HOST_VISIBILITY FMK_FUNC_DEV_VISIBILITY extern const char *STOPGRADIENT; +FMK_FUNC_HOST_VISIBILITY FMK_FUNC_DEV_VISIBILITY extern const char *PREVENTGRADIENT; +FMK_FUNC_HOST_VISIBILITY FMK_FUNC_DEV_VISIBILITY extern const char *GUARANTEECONST; +FMK_FUNC_HOST_VISIBILITY FMK_FUNC_DEV_VISIBILITY extern const char *BROADCASTGRADIENTARGS; +FMK_FUNC_HOST_VISIBILITY FMK_FUNC_DEV_VISIBILITY extern const char *BROADCASTARGS; +FMK_FUNC_HOST_VISIBILITY FMK_FUNC_DEV_VISIBILITY extern const char *CONFUSIONMATRIX; +FMK_FUNC_HOST_VISIBILITY FMK_FUNC_DEV_VISIBILITY extern const char *RANK; +FMK_FUNC_HOST_VISIBILITY FMK_FUNC_DEV_VISIBILITY extern const char *PLACEHOLDER; +FMK_FUNC_HOST_VISIBILITY FMK_FUNC_DEV_VISIBILITY extern const char *END; +FMK_FUNC_HOST_VISIBILITY FMK_FUNC_DEV_VISIBILITY extern const char *BASICLSTMCELL; +FMK_FUNC_HOST_VISIBILITY FMK_FUNC_DEV_VISIBILITY extern const char *GETNEXT; +FMK_FUNC_HOST_VISIBILITY FMK_FUNC_DEV_VISIBILITY extern const char *INITDATA; +FMK_FUNC_HOST_VISIBILITY FMK_FUNC_DEV_VISIBILITY extern const char *REFIDENTITY; +FMK_FUNC_HOST_VISIBILITY FMK_FUNC_DEV_VISIBILITY extern const char *BITCAST; + +/***************Ann special operator*************************/ +FMK_FUNC_HOST_VISIBILITY FMK_FUNC_DEV_VISIBILITY extern const char *ANN_MEAN; +FMK_FUNC_HOST_VISIBILITY FMK_FUNC_DEV_VISIBILITY extern const char *ANN_CONVOLUTION; +FMK_FUNC_HOST_VISIBILITY FMK_FUNC_DEV_VISIBILITY extern const char *ANN_DEPCONVOLUTION; +FMK_FUNC_HOST_VISIBILITY FMK_FUNC_DEV_VISIBILITY extern const char *ANN_FULLCONNECTION; +FMK_FUNC_HOST_VISIBILITY FMK_FUNC_DEV_VISIBILITY extern const char *ANN_NETOUTPUT; +FMK_FUNC_HOST_VISIBILITY FMK_FUNC_DEV_VISIBILITY extern const char *ANN_DATA; +FMK_FUNC_HOST_VISIBILITY FMK_FUNC_DEV_VISIBILITY extern const char *ANN_RESHAPE; +FMK_FUNC_HOST_VISIBILITY FMK_FUNC_DEV_VISIBILITY extern const char *ANN_ADD; +FMK_FUNC_HOST_VISIBILITY FMK_FUNC_DEV_VISIBILITY extern const char *ANN_MUL; +FMK_FUNC_HOST_VISIBILITY FMK_FUNC_DEV_VISIBILITY extern const char *ANN_SUB; +FMK_FUNC_HOST_VISIBILITY FMK_FUNC_DEV_VISIBILITY extern const char *ANN_DIV; +FMK_FUNC_HOST_VISIBILITY FMK_FUNC_DEV_VISIBILITY extern const char *ANN_DEQUANTIZE; +FMK_FUNC_HOST_VISIBILITY FMK_FUNC_DEV_VISIBILITY extern const char *ANN_QUANTIZE; +FMK_FUNC_HOST_VISIBILITY FMK_FUNC_DEV_VISIBILITY extern const char *ANN_PAD; +FMK_FUNC_HOST_VISIBILITY FMK_FUNC_DEV_VISIBILITY extern const char *ANN_RESIZE_BILINEAR; + +/***************************************************/ +/******************Training operator*************************/ +FMK_FUNC_HOST_VISIBILITY FMK_FUNC_DEV_VISIBILITY extern const char *GATHERV2; +FMK_FUNC_HOST_VISIBILITY FMK_FUNC_DEV_VISIBILITY extern const char *CONVGRADFILTER; +FMK_FUNC_HOST_VISIBILITY FMK_FUNC_DEV_VISIBILITY extern const char *CONV2D; +FMK_FUNC_HOST_VISIBILITY FMK_FUNC_DEV_VISIBILITY extern const char *CONV2DBACKPROPINPUT; +FMK_FUNC_HOST_VISIBILITY FMK_FUNC_DEV_VISIBILITY extern const char *FUSEDBATCHNORM; +FMK_FUNC_HOST_VISIBILITY FMK_FUNC_DEV_VISIBILITY extern const char *BIASADDGRAD; +FMK_FUNC_HOST_VISIBILITY FMK_FUNC_DEV_VISIBILITY extern const char *ACTIVATIONGRAD; +FMK_FUNC_HOST_VISIBILITY FMK_FUNC_DEV_VISIBILITY extern const char *MAXPOOLWITHARGMAX; +FMK_FUNC_HOST_VISIBILITY FMK_FUNC_DEV_VISIBILITY extern const char *MAXPOOLGRADWITHARGMAX; +FMK_FUNC_HOST_VISIBILITY FMK_FUNC_DEV_VISIBILITY extern const char *SPARSESOFTMAXCROSSENTROPYWITHLOGITS; +FMK_FUNC_HOST_VISIBILITY FMK_FUNC_DEV_VISIBILITY extern const char *SNAPSHOT; +FMK_FUNC_HOST_VISIBILITY FMK_FUNC_DEV_VISIBILITY extern const char *VAR; +FMK_FUNC_HOST_VISIBILITY FMK_FUNC_DEV_VISIBILITY extern const char *MEANGRAD; +FMK_FUNC_HOST_VISIBILITY FMK_FUNC_DEV_VISIBILITY extern const char *TRANSLATE; +FMK_FUNC_HOST_VISIBILITY FMK_FUNC_DEV_VISIBILITY extern const char *ADDN; +FMK_FUNC_HOST_VISIBILITY FMK_FUNC_DEV_VISIBILITY extern const char *L2LOSS; +FMK_FUNC_HOST_VISIBILITY FMK_FUNC_DEV_VISIBILITY extern const char *MULTIPLY; +FMK_FUNC_HOST_VISIBILITY FMK_FUNC_DEV_VISIBILITY extern const char *HUBERLOSSGRAD; +FMK_FUNC_HOST_VISIBILITY FMK_FUNC_DEV_VISIBILITY extern const char *HUBERLOSS; +FMK_FUNC_HOST_VISIBILITY FMK_FUNC_DEV_VISIBILITY extern const char *NEGATIVE; +FMK_FUNC_HOST_VISIBILITY FMK_FUNC_DEV_VISIBILITY extern const char *SSDCAST; +FMK_FUNC_HOST_VISIBILITY FMK_FUNC_DEV_VISIBILITY extern const char *SPARSESOFTMAXCROSSENTROPY; +FMK_FUNC_HOST_VISIBILITY FMK_FUNC_DEV_VISIBILITY extern const char *SPARSESOFTMAXCROSSENTROPYGRAD; +FMK_FUNC_HOST_VISIBILITY FMK_FUNC_DEV_VISIBILITY extern const char *SSDSQUEEZEFUSION; +FMK_FUNC_HOST_VISIBILITY FMK_FUNC_DEV_VISIBILITY extern const char *CONCATFOUR2FIVE; +FMK_FUNC_HOST_VISIBILITY FMK_FUNC_DEV_VISIBILITY extern const char *CONCATFIVE2FOUR; +FMK_FUNC_HOST_VISIBILITY FMK_FUNC_DEV_VISIBILITY extern const char *SSDREALDIVTILEMUL; +FMK_FUNC_HOST_VISIBILITY FMK_FUNC_DEV_VISIBILITY extern const char *SSDSUMMULREALDIVMEAN; + +FMK_FUNC_HOST_VISIBILITY FMK_FUNC_DEV_VISIBILITY extern const char *VARIABLEV2; +FMK_FUNC_HOST_VISIBILITY FMK_FUNC_DEV_VISIBILITY extern const char *VARHANDLEOP; +FMK_FUNC_HOST_VISIBILITY FMK_FUNC_DEV_VISIBILITY extern const char *TEMPORARYVARIABLE; +FMK_FUNC_HOST_VISIBILITY FMK_FUNC_DEV_VISIBILITY extern const char *DESTROYTEMPORARYVARIABLE; +FMK_FUNC_HOST_VISIBILITY FMK_FUNC_DEV_VISIBILITY extern const char *VARIABLE; +FMK_FUNC_HOST_VISIBILITY FMK_FUNC_DEV_VISIBILITY extern const char *ASSIGN; +FMK_FUNC_HOST_VISIBILITY FMK_FUNC_DEV_VISIBILITY extern const char *ASSIGNVARIABLEOP; +FMK_FUNC_HOST_VISIBILITY FMK_FUNC_DEV_VISIBILITY extern const char *ASSIGNADD; +FMK_FUNC_HOST_VISIBILITY FMK_FUNC_DEV_VISIBILITY extern const char *ASSIGNADDVARIABLEOP; +FMK_FUNC_HOST_VISIBILITY FMK_FUNC_DEV_VISIBILITY extern const char *ASSIGNSUB; +FMK_FUNC_HOST_VISIBILITY FMK_FUNC_DEV_VISIBILITY extern const char *ASSIGNSUBVARIABLEOP; +FMK_FUNC_HOST_VISIBILITY FMK_FUNC_DEV_VISIBILITY extern const char *APPLYMOMENTUM; +FMK_FUNC_HOST_VISIBILITY FMK_FUNC_DEV_VISIBILITY extern const char *RESOURCEAPPLYMOMENTUM; +FMK_FUNC_HOST_VISIBILITY FMK_FUNC_DEV_VISIBILITY extern const char *SGD; +FMK_FUNC_HOST_VISIBILITY FMK_FUNC_DEV_VISIBILITY extern const char *NOOP; +FMK_FUNC_HOST_VISIBILITY FMK_FUNC_DEV_VISIBILITY extern const char *READVARIABLEOP; +FMK_FUNC_HOST_VISIBILITY FMK_FUNC_DEV_VISIBILITY extern const char *PARALLELCONCATSTART; +FMK_FUNC_HOST_VISIBILITY FMK_FUNC_DEV_VISIBILITY extern const char *CONSTANTOP; +FMK_FUNC_HOST_VISIBILITY FMK_FUNC_DEV_VISIBILITY extern const char *DEPTHWISECONV2DBACKPROPFILTER; +FMK_FUNC_HOST_VISIBILITY FMK_FUNC_DEV_VISIBILITY extern const char *DEPTHWISECONV2DBACKPORPINPUT; +FMK_FUNC_HOST_VISIBILITY FMK_FUNC_DEV_VISIBILITY extern const char *DEPTHWISECONV2DFORWARDNATIVE; +FMK_FUNC_HOST_VISIBILITY FMK_FUNC_DEV_VISIBILITY extern const char *DROPOUTGRAD; +FMK_FUNC_HOST_VISIBILITY FMK_FUNC_DEV_VISIBILITY extern const char *APPLYRMSPROPMIXEDPRECISION; +FMK_FUNC_HOST_VISIBILITY FMK_FUNC_DEV_VISIBILITY extern const char *APPLYRMSPROP; +FMK_FUNC_HOST_VISIBILITY FMK_FUNC_DEV_VISIBILITY extern const char *RELU6GRAD; +FMK_FUNC_HOST_VISIBILITY FMK_FUNC_DEV_VISIBILITY extern const char *AVGPOOLGRAD; +FMK_FUNC_HOST_VISIBILITY FMK_FUNC_DEV_VISIBILITY extern const char *CONCATV2; +FMK_FUNC_HOST_VISIBILITY FMK_FUNC_DEV_VISIBILITY extern const char *CONCATOFFSET; +FMK_FUNC_HOST_VISIBILITY FMK_FUNC_DEV_VISIBILITY extern const char *LAYERNORMGRAD; +FMK_FUNC_HOST_VISIBILITY FMK_FUNC_DEV_VISIBILITY extern const char *LAYERNORM; +FMK_FUNC_HOST_VISIBILITY FMK_FUNC_DEV_VISIBILITY extern const char *LARS; +FMK_FUNC_HOST_VISIBILITY FMK_FUNC_DEV_VISIBILITY extern const char *DYNAMICSTITCH; + +/***************************************************/ +FMK_FUNC_HOST_VISIBILITY FMK_FUNC_DEV_VISIBILITY extern const char *SQUARE; +FMK_FUNC_HOST_VISIBILITY FMK_FUNC_DEV_VISIBILITY extern const char *HCOMBROADCAST; +FMK_FUNC_HOST_VISIBILITY FMK_FUNC_DEV_VISIBILITY extern const char *HCOMALLGATHER; +FMK_FUNC_HOST_VISIBILITY FMK_FUNC_DEV_VISIBILITY extern const char *HCOMALLREDUCE; +FMK_FUNC_HOST_VISIBILITY FMK_FUNC_DEV_VISIBILITY extern const char *HCOMREDUCESCATTER; +FMK_FUNC_HOST_VISIBILITY FMK_FUNC_DEV_VISIBILITY extern const char *HCOMSEND; +FMK_FUNC_HOST_VISIBILITY FMK_FUNC_DEV_VISIBILITY extern const char *HCOMRECEIVE; +FMK_FUNC_HOST_VISIBILITY FMK_FUNC_DEV_VISIBILITY extern const char *HCOMREMOTEREAD; +FMK_FUNC_HOST_VISIBILITY FMK_FUNC_DEV_VISIBILITY extern const char *HCOMREMOTEWRITE; + +FMK_FUNC_HOST_VISIBILITY FMK_FUNC_DEV_VISIBILITY extern const char *VARASSIGN; +FMK_FUNC_HOST_VISIBILITY FMK_FUNC_DEV_VISIBILITY extern const char *VARISINITIALIZEDOP; +FMK_FUNC_HOST_VISIBILITY FMK_FUNC_DEV_VISIBILITY extern const char *LogTimeStamp; +FMK_FUNC_HOST_VISIBILITY FMK_FUNC_DEV_VISIBILITY extern const char *ISVARIABLEINITIALIZED; +FMK_FUNC_HOST_VISIBILITY FMK_FUNC_DEV_VISIBILITY extern const char *STREAMSWITCH; +FMK_FUNC_HOST_VISIBILITY FMK_FUNC_DEV_VISIBILITY extern const char *STREAMSWITCHN; +FMK_FUNC_HOST_VISIBILITY FMK_FUNC_DEV_VISIBILITY extern const char *STREAMACTIVE; +FMK_FUNC_HOST_VISIBILITY FMK_FUNC_DEV_VISIBILITY extern const char *MEMCPYASYNC; +FMK_FUNC_HOST_VISIBILITY FMK_FUNC_DEV_VISIBILITY extern const char *MEMCPYADDRASYNC; +FMK_FUNC_HOST_VISIBILITY FMK_FUNC_DEV_VISIBILITY extern const char *STREAMMERGE; +FMK_FUNC_HOST_VISIBILITY FMK_FUNC_DEV_VISIBILITY extern const char *ENDGRAPH; +FMK_FUNC_HOST_VISIBILITY FMK_FUNC_DEV_VISIBILITY extern const char *SEND; +FMK_FUNC_HOST_VISIBILITY FMK_FUNC_DEV_VISIBILITY extern const char *RECV; +FMK_FUNC_HOST_VISIBILITY FMK_FUNC_DEV_VISIBILITY extern const char *ENDOFSEQUENCE; + +FMK_FUNC_HOST_VISIBILITY FMK_FUNC_DEV_VISIBILITY extern const char *LABELSET; +FMK_FUNC_HOST_VISIBILITY FMK_FUNC_DEV_VISIBILITY extern const char *LABELGOTO; +FMK_FUNC_HOST_VISIBILITY FMK_FUNC_DEV_VISIBILITY extern const char *LABELGOTOEX; +FMK_FUNC_HOST_VISIBILITY FMK_FUNC_DEV_VISIBILITY extern const char *LABELSWITCH; +FMK_FUNC_HOST_VISIBILITY FMK_FUNC_DEV_VISIBILITY extern const char *LABELSWITCHBYINDEX; + +FMK_FUNC_HOST_VISIBILITY FMK_FUNC_DEV_VISIBILITY extern const char *ATOMICADDRCLEAN; + +FMK_FUNC_HOST_VISIBILITY FMK_FUNC_DEV_VISIBILITY extern const char *ABS_GRAD; +FMK_FUNC_HOST_VISIBILITY FMK_FUNC_DEV_VISIBILITY extern const char *ACCUMULATE_N_V2; +FMK_FUNC_HOST_VISIBILITY FMK_FUNC_DEV_VISIBILITY extern const char *ACOS_GRAD; +FMK_FUNC_HOST_VISIBILITY FMK_FUNC_DEV_VISIBILITY extern const char *ACOSH_GRAD; +FMK_FUNC_HOST_VISIBILITY FMK_FUNC_DEV_VISIBILITY extern const char *ANY; +FMK_FUNC_HOST_VISIBILITY FMK_FUNC_DEV_VISIBILITY extern const char *APPROXIMATE_EQUAL; +FMK_FUNC_HOST_VISIBILITY FMK_FUNC_DEV_VISIBILITY extern const char *ASIN_GRAD; +FMK_FUNC_HOST_VISIBILITY FMK_FUNC_DEV_VISIBILITY extern const char *ASINH_GRAD; +FMK_FUNC_HOST_VISIBILITY FMK_FUNC_DEV_VISIBILITY extern const char *ATAN_GRAD; +FMK_FUNC_HOST_VISIBILITY FMK_FUNC_DEV_VISIBILITY extern const char *BROADCAST_TO; +FMK_FUNC_HOST_VISIBILITY FMK_FUNC_DEV_VISIBILITY extern const char *ELU_GRAD; +FMK_FUNC_HOST_VISIBILITY FMK_FUNC_DEV_VISIBILITY extern const char *ADD_V2; +FMK_FUNC_HOST_VISIBILITY FMK_FUNC_DEV_VISIBILITY extern const char *DATAFORMATDIMMAP; +FMK_FUNC_HOST_VISIBILITY FMK_FUNC_DEV_VISIBILITY extern const char *DATAFORMATVECPERMUTE; +FMK_FUNC_HOST_VISIBILITY FMK_FUNC_DEV_VISIBILITY extern const char *BESSELI0E; +FMK_FUNC_HOST_VISIBILITY FMK_FUNC_DEV_VISIBILITY extern const char *BESSELI1E; +FMK_FUNC_HOST_VISIBILITY FMK_FUNC_DEV_VISIBILITY extern const char *APPLYADADELTA; +FMK_FUNC_HOST_VISIBILITY FMK_FUNC_DEV_VISIBILITY extern const char *APPLYADAGRAD; +FMK_FUNC_HOST_VISIBILITY FMK_FUNC_DEV_VISIBILITY extern const char *APPLYADAGRADDA; +FMK_FUNC_HOST_VISIBILITY FMK_FUNC_DEV_VISIBILITY extern const char *APPLYADAM; +FMK_FUNC_HOST_VISIBILITY FMK_FUNC_DEV_VISIBILITY extern const char *APPLYADAMAX; +FMK_FUNC_HOST_VISIBILITY FMK_FUNC_DEV_VISIBILITY extern const char *APPLYADDSIGN; +FMK_FUNC_HOST_VISIBILITY FMK_FUNC_DEV_VISIBILITY extern const char *APPLYCENTEREDRMSPROP; +FMK_FUNC_HOST_VISIBILITY FMK_FUNC_DEV_VISIBILITY extern const char *APPLYFTRL; +FMK_FUNC_HOST_VISIBILITY FMK_FUNC_DEV_VISIBILITY extern const char *APPLYFTRLV2; +FMK_FUNC_HOST_VISIBILITY FMK_FUNC_DEV_VISIBILITY extern const char *APPLYGRADIENTDESCENT; +FMK_FUNC_HOST_VISIBILITY FMK_FUNC_DEV_VISIBILITY extern const char *APPLYPOWERSIGN; +FMK_FUNC_HOST_VISIBILITY FMK_FUNC_DEV_VISIBILITY extern const char *APPLYPROXIMALADAGRAD; +FMK_FUNC_HOST_VISIBILITY FMK_FUNC_DEV_VISIBILITY extern const char *APPLYPROXIMALGRADIENTDESCENT; +FMK_FUNC_HOST_VISIBILITY FMK_FUNC_DEV_VISIBILITY extern const char *DEQUANTIZE; + +FMK_FUNC_HOST_VISIBILITY FMK_FUNC_DEV_VISIBILITY extern const char *FOCAL_LOSS; +FMK_FUNC_HOST_VISIBILITY FMK_FUNC_DEV_VISIBILITY extern const char *FOCAL_LOSS_GRAD; +FMK_FUNC_HOST_VISIBILITY FMK_FUNC_DEV_VISIBILITY extern const char *SMOOTHL1_LOSS; +FMK_FUNC_HOST_VISIBILITY FMK_FUNC_DEV_VISIBILITY extern const char *SMOOTHL1_LOSS_grad; +FMK_FUNC_HOST_VISIBILITY FMK_FUNC_DEV_VISIBILITY extern const char *REDUCEMEAN; +FMK_FUNC_HOST_VISIBILITY FMK_FUNC_DEV_VISIBILITY extern const char *CONCAT_V2; +FMK_FUNC_HOST_VISIBILITY FMK_FUNC_DEV_VISIBILITY extern const char *ONEHOT_V2; +FMK_FUNC_HOST_VISIBILITY FMK_FUNC_DEV_VISIBILITY extern const char *SLICE_V2; +FMK_FUNC_HOST_VISIBILITY FMK_FUNC_DEV_VISIBILITY extern const char *TILE_V2; +FMK_FUNC_HOST_VISIBILITY FMK_FUNC_DEV_VISIBILITY extern const char *SUM_V2; +// Common type when the operator has the same name +FMK_FUNC_HOST_VISIBILITY FMK_FUNC_DEV_VISIBILITY extern const char *DETECTIONOUTPUT; +// Custom operator +FMK_FUNC_HOST_VISIBILITY FMK_FUNC_DEV_VISIBILITY extern const char *CUSTOMOP; +FMK_FUNC_HOST_VISIBILITY FMK_FUNC_DEV_VISIBILITY extern const char *CUSTOMOP_NCHW; +FMK_FUNC_HOST_VISIBILITY FMK_FUNC_DEV_VISIBILITY extern const char *CUSTOMOP_NHWC; +FMK_FUNC_HOST_VISIBILITY FMK_FUNC_DEV_VISIBILITY extern const char *CUSTOMOP_NC1HWC0; + +// Depthwise 4d_2_6d,6d_2_4d +FMK_FUNC_HOST_VISIBILITY FMK_FUNC_DEV_VISIBILITY extern const char *DEPTHWISEWEIGHT4D26D; +FMK_FUNC_HOST_VISIBILITY FMK_FUNC_DEV_VISIBILITY extern const char *DEPTHWISEWEIGHT6D24D; + +FMK_FUNC_HOST_VISIBILITY FMK_FUNC_DEV_VISIBILITY extern const char *SQRTGRAD; +FMK_FUNC_HOST_VISIBILITY FMK_FUNC_DEV_VISIBILITY extern const char *SIGMOIDGRAD; + +FMK_FUNC_HOST_VISIBILITY FMK_FUNC_DEV_VISIBILITY extern const char *TRANSSHAPE; + +// Horovod operator +FMK_FUNC_HOST_VISIBILITY FMK_FUNC_DEV_VISIBILITY extern const char *HVDCALLBACKALLREDUCE; +FMK_FUNC_HOST_VISIBILITY FMK_FUNC_DEV_VISIBILITY extern const char *HVDCALLBACKALLGATHER; +FMK_FUNC_HOST_VISIBILITY FMK_FUNC_DEV_VISIBILITY extern const char *HVDCALLBACKBROADCAST; +FMK_FUNC_HOST_VISIBILITY FMK_FUNC_DEV_VISIBILITY extern const char *HVDWAIT; + +/// +/// @brief Magic number of model file +/// +FMK_FUNC_HOST_VISIBILITY FMK_FUNC_DEV_VISIBILITY extern const uint32_t MODEL_FILE_MAGIC_NUM; // magic number + +/// +/// @brief Model head length +/// +FMK_FUNC_HOST_VISIBILITY FMK_FUNC_DEV_VISIBILITY extern const uint32_t MODEL_FILE_HEAD_LEN; + +FMK_FUNC_HOST_VISIBILITY FMK_FUNC_DEV_VISIBILITY extern const uint32_t MODEL_VERSION; ///< Model version 1.0/// + +// alpha default value +FMK_FUNC_HOST_VISIBILITY FMK_FUNC_DEV_VISIBILITY extern const float ALPHA_DEFAULT_VALUE; + +// beta default value +FMK_FUNC_HOST_VISIBILITY FMK_FUNC_DEV_VISIBILITY extern const float BETA_DEFAULT_VALUE; + +/// +/// @ingroup domi_omg +/// @brief INPUT node type +/// +FMK_FUNC_HOST_VISIBILITY FMK_FUNC_DEV_VISIBILITY extern const std::string INPUT_TYPE; +FMK_FUNC_HOST_VISIBILITY FMK_FUNC_DEV_VISIBILITY extern const std::string DUMMY_DATA; + +// dim default size value +FMK_FUNC_HOST_VISIBILITY FMK_FUNC_DEV_VISIBILITY static const int32_t DIM_DEFAULT_SIZE = 4; + +// for fusion op plugin +FMK_FUNC_HOST_VISIBILITY FMK_FUNC_DEV_VISIBILITY extern const std::string ATTR_NAME_FUSIONOP_ORIGINAL_TYPE; + +FMK_FUNC_HOST_VISIBILITY FMK_FUNC_DEV_VISIBILITY extern const std::string ATTR_NAME_INPUT_TENSOR_DESC; +FMK_FUNC_HOST_VISIBILITY FMK_FUNC_DEV_VISIBILITY extern const std::string ATTR_NAME_OUTPUT_TENSOR_DESC; + +// DATA node type +FMK_FUNC_HOST_VISIBILITY FMK_FUNC_DEV_VISIBILITY extern const std::string DATA_TYPE; + +// framework Operator Type +FMK_FUNC_HOST_VISIBILITY FMK_FUNC_DEV_VISIBILITY extern const std::string FRAMEWORK_OP_TYPE; + +FMK_FUNC_HOST_VISIBILITY FMK_FUNC_DEV_VISIBILITY extern const std::string NODE_NAME_NET_OUTPUT; + +#pragma pack() // Cancels single-byte alignment +} // namespace parser +} // namespace ge + +#endif // PARSER_COMMON_TYPES_H_ diff --git a/inc/graph/compute_graph.h b/inc/graph/compute_graph.h index 9ae8fcd3b..90a4c743a 100644 --- a/inc/graph/compute_graph.h +++ b/inc/graph/compute_graph.h @@ -93,6 +93,7 @@ class ComputeGraph : public std::enable_shared_from_this, public A NodePtr AddNodeFront(const OpDescPtr &op); NodePtr AddInputNode(NodePtr node); NodePtr AddOutputNode(NodePtr node); + NodePtr AddOutputNodeByIndex(NodePtr node, int32_t index); // insert node with specific pre_node NodePtr AddNodeAfter(OpDescPtr &op, const NodePtr &pre_node); NodePtr AddNodeAfter(NodePtr node, const NodePtr &pre_node); @@ -138,6 +139,7 @@ class ComputeGraph : public std::enable_shared_from_this, public A graphStatus TopologicalSorting(); bool IsValid() const; + void InValid() { is_valid_flag_ = false; } void Dump() const; void Swap(ComputeGraph &graph); @@ -268,6 +270,7 @@ class ComputeGraph : public std::enable_shared_from_this, public A friend class ModelSerializeImp; friend class GraphDebugImp; friend class OnnxUtils; + friend class TuningUtils; std::string name_; uint32_t graph_id_ = 0; diff --git a/inc/graph/debug/ge_attr_define.h b/inc/graph/debug/ge_attr_define.h index 7ec6e1a8e..334abd1dd 100644 --- a/inc/graph/debug/ge_attr_define.h +++ b/inc/graph/debug/ge_attr_define.h @@ -33,6 +33,8 @@ namespace ge { #define GE_FUNC_DEV_VISIBILITY #endif // Public attribute +GE_FUNC_DEV_VISIBILITY GE_FUNC_HOST_VISIBILITY extern const std::string ATTR_NAME_FORCE_UNKNOWN_SHAPE; + GE_FUNC_DEV_VISIBILITY GE_FUNC_HOST_VISIBILITY extern const std::string ATTR_NAME_IS_UNKNOWN_SHAPE; GE_FUNC_DEV_VISIBILITY GE_FUNC_HOST_VISIBILITY extern const std::string ATTR_NAME_DYNAMIC_SHAPE_PARTITIONED; @@ -141,6 +143,11 @@ GE_FUNC_DEV_VISIBILITY GE_FUNC_HOST_VISIBILITY extern const std::string ATTR_NAM GE_FUNC_DEV_VISIBILITY GE_FUNC_HOST_VISIBILITY extern const std::string ATTR_NAME_AIPP_OUTPUTS; GE_FUNC_DEV_VISIBILITY GE_FUNC_HOST_VISIBILITY extern const std::string ATTR_NAME_INPUT_DIMS; +GE_FUNC_DEV_VISIBILITY GE_FUNC_HOST_VISIBILITY extern const std::string ATTR_DYNAMIC_AIPP_INPUT_DIMS; +GE_FUNC_DEV_VISIBILITY GE_FUNC_HOST_VISIBILITY extern const std::string ATTR_DATA_RELATED_AIPP_MODE; +GE_FUNC_DEV_VISIBILITY GE_FUNC_HOST_VISIBILITY extern const std::string ATTR_DATA_AIPP_DATA_NAME_MAP; + +GE_FUNC_DEV_VISIBILITY GE_FUNC_HOST_VISIBILITY extern const std::string ATTR_NAME_GRAPH_HAS_BEEN_ADDED; GE_FUNC_DEV_VISIBILITY GE_FUNC_HOST_VISIBILITY extern const std::string ATTR_NAME_SESSION_GRAPH_ID; GE_FUNC_DEV_VISIBILITY GE_FUNC_HOST_VISIBILITY extern const std::string ATTR_NAME_PARENT_GRAPH_NAME; @@ -946,6 +953,7 @@ GE_FUNC_DEV_VISIBILITY GE_FUNC_HOST_VISIBILITY extern const std::string ATTR_NAM GE_FUNC_DEV_VISIBILITY GE_FUNC_HOST_VISIBILITY extern const std::string ATTR_NAME_BATCH_NUM; GE_FUNC_DEV_VISIBILITY GE_FUNC_HOST_VISIBILITY extern const std::string ATTR_NAME_BATCH_LABEL; GE_FUNC_DEV_VISIBILITY GE_FUNC_HOST_VISIBILITY extern const std::string ATTR_NAME_COMBINED_BATCH; +GE_FUNC_DEV_VISIBILITY GE_FUNC_HOST_VISIBILITY extern const std::string ATTR_USER_DESIGNEATE_SHAPE_ORDER; // Control flow GE_FUNC_DEV_VISIBILITY GE_FUNC_HOST_VISIBILITY extern const std::string ATTR_NAME_STREAM_SWITCH_COND; @@ -1021,8 +1029,6 @@ GE_FUNC_DEV_VISIBILITY GE_FUNC_HOST_VISIBILITY extern const std::string ATTR_NAM GE_FUNC_DEV_VISIBILITY GE_FUNC_HOST_VISIBILITY extern const std::string ATTR_NAME_FUSION_GROUP_KEY; GE_FUNC_DEV_VISIBILITY GE_FUNC_HOST_VISIBILITY extern const std::string ATTR_NAME_FUSION_VIRTUAL_OP; GE_FUNC_DEV_VISIBILITY GE_FUNC_HOST_VISIBILITY extern const std::string ATTR_NAME_FUSION_GROUP_TYPE; -GE_FUNC_DEV_VISIBILITY GE_FUNC_HOST_VISIBILITY extern const std::string ATTR_NAME_INPUT_MEM_TYPE_LIST; -GE_FUNC_DEV_VISIBILITY GE_FUNC_HOST_VISIBILITY extern const std::string ATTR_NAME_OUTPUT_MEM_TYPE_LIST; GE_FUNC_DEV_VISIBILITY GE_FUNC_HOST_VISIBILITY extern const std::string ATTR_NAME_L1_FUSION_EXTEND_PTR; GE_FUNC_DEV_VISIBILITY GE_FUNC_HOST_VISIBILITY extern const std::string ATTR_NAME_GET_TENSOR_ACTUAL_SIZE; GE_FUNC_DEV_VISIBILITY GE_FUNC_HOST_VISIBILITY extern const std::string ATTR_NAME_OUTPUT_OFFSET_FOR_L1_FUSION; @@ -1036,6 +1042,20 @@ GE_FUNC_DEV_VISIBILITY GE_FUNC_HOST_VISIBILITY extern const std::string ATTR_NAM GE_FUNC_DEV_VISIBILITY GE_FUNC_HOST_VISIBILITY extern const std::string ATTR_NAME_OP_INPUT_L1_FLAG; GE_FUNC_DEV_VISIBILITY GE_FUNC_HOST_VISIBILITY extern const std::string ATTR_NAME_OP_INPUT_L1_ADDR; GE_FUNC_DEV_VISIBILITY GE_FUNC_HOST_VISIBILITY extern const std::string ATTR_NAME_OP_INPUT_L1_VALID_SIZE; +GE_FUNC_DEV_VISIBILITY GE_FUNC_HOST_VISIBILITY extern const std::string ATTR_NAME_ENGINE_NAME_FOR_LX; +GE_FUNC_DEV_VISIBILITY GE_FUNC_HOST_VISIBILITY extern const std::string ATTR_NAME_KKERNEL_LIB_NAME_FOR_LX; +GE_FUNC_DEV_VISIBILITY GE_FUNC_HOST_VISIBILITY extern const std::string ATTR_NAME_NEED_LX_FUSION; +GE_FUNC_DEV_VISIBILITY GE_FUNC_HOST_VISIBILITY extern const std::string ATTR_NAME_OPTIMIZE_GROUP; +GE_FUNC_DEV_VISIBILITY GE_FUNC_HOST_VISIBILITY extern const std::string ATTR_NAME_OP_COMPILE_STRATEGY; +GE_FUNC_DEV_VISIBILITY GE_FUNC_HOST_VISIBILITY extern const std::string ATTR_NAME_TBE_KERNEL_NAME; +GE_FUNC_DEV_VISIBILITY GE_FUNC_HOST_VISIBILITY extern const std::string ATTR_NAME_TBE_KERNEL_BUFFER; + +// used for memory allocate +GE_FUNC_DEV_VISIBILITY GE_FUNC_HOST_VISIBILITY extern const std::string ATTR_NAME_INPUT_MEM_TYPE_LIST; +GE_FUNC_DEV_VISIBILITY GE_FUNC_HOST_VISIBILITY extern const std::string ATTR_NAME_OUTPUT_MEM_TYPE_LIST; +GE_FUNC_DEV_VISIBILITY GE_FUNC_HOST_VISIBILITY extern const std::string ATTR_NAME_WORKSPACE_TYPE_LIST; +GE_FUNC_DEV_VISIBILITY GE_FUNC_HOST_VISIBILITY extern const std::string ATTR_NAME_TENSOR_MEM_TYPE; +GE_FUNC_DEV_VISIBILITY GE_FUNC_HOST_VISIBILITY extern const std::string ATTR_MODEL_P2P_MEMORY_SIZE; // for unregistered op GE_FUNC_DEV_VISIBILITY GE_FUNC_HOST_VISIBILITY extern const std::string ATTR_NAME_UNREGST_OPPATH; @@ -1045,6 +1065,10 @@ GE_FUNC_DEV_VISIBILITY GE_FUNC_HOST_VISIBILITY extern const std::string ATTR_NAM GE_FUNC_DEV_VISIBILITY GE_FUNC_HOST_VISIBILITY extern const std::string ATTR_OP_DEBUG_FLAG; GE_FUNC_DEV_VISIBILITY GE_FUNC_HOST_VISIBILITY extern const std::string ATTR_OP_DEBUG_MODE; +// op dynamic input +GE_FUNC_DEV_VISIBILITY GE_FUNC_HOST_VISIBILITY extern const std::string ATTR_NAME_DYNAMIC_INPUT_START; +GE_FUNC_DEV_VISIBILITY GE_FUNC_HOST_VISIBILITY extern const std::string ATTR_NAME_DYNAMIC_INPUT_END; + // functional ops attr GE_FUNC_DEV_VISIBILITY GE_FUNC_HOST_VISIBILITY extern const std::string ATTR_NAME_IF_THEN_BRANCH; GE_FUNC_DEV_VISIBILITY GE_FUNC_HOST_VISIBILITY extern const std::string ATTR_NAME_IF_ELSE_BRANCH; @@ -1111,6 +1135,9 @@ GE_FUNC_DEV_VISIBILITY GE_FUNC_HOST_VISIBILITY extern const std::string ATTR_VAR GE_FUNC_DEV_VISIBILITY GE_FUNC_HOST_VISIBILITY extern const std::string ATTR_INPUT_MEMORY_TYPE; GE_FUNC_DEV_VISIBILITY GE_FUNC_HOST_VISIBILITY extern const std::string ATTR_OUTPUT_MEMORY_TYPE; +// stage +GE_FUNC_DEV_VISIBILITY GE_FUNC_HOST_VISIBILITY extern const std::string ATTR_STAGE_LEVEL; + // input_output_offset GE_FUNC_DEV_VISIBILITY GE_FUNC_HOST_VISIBILITY extern const std::string ATTR_ZERO_COPY_BASIC_OFFSET; GE_FUNC_DEV_VISIBILITY GE_FUNC_HOST_VISIBILITY extern const std::string ATTR_ZERO_COPY_RELATIVE_OFFSET; diff --git a/inc/graph/ge_context.h b/inc/graph/ge_context.h index ef05bd002..3f3d0a8e4 100644 --- a/inc/graph/ge_context.h +++ b/inc/graph/ge_context.h @@ -31,7 +31,7 @@ class GEContext { void SetSessionId(uint64_t session_id); void SetCtxDeviceId(uint32_t device_id); private: - uint64_t session_id_ = 0; + thread_local static uint64_t session_id_; uint32_t device_id_ = 0; uint64_t trace_id_ = 0; }; // class GEContext diff --git a/inc/graph/node.h b/inc/graph/node.h index 988ba5294..1b3355415 100644 --- a/inc/graph/node.h +++ b/inc/graph/node.h @@ -174,6 +174,9 @@ class Node : public std::enable_shared_from_this { fusion_output_dataflow_list_ = fusion_output_list; } + bool GetHostNode() const { return host_node_; } + void SetHostNode(bool is_host) { host_node_ = is_host; } + void SetOrigNode(const NodePtr &orignode) { orig_node_ = orignode; } NodePtr GetOrigNode() { return orig_node_; } @@ -192,6 +195,7 @@ class Node : public std::enable_shared_from_this { OutControlAnchorPtr out_control_anchor_; map attrs_; // lint !e1073 bool has_init_{false}; + bool host_node_{false}; bool anchor_status_updated_{false}; std::vector send_event_id_list_; std::vector recv_event_id_list_; @@ -202,6 +206,7 @@ class Node : public std::enable_shared_from_this { NodePtr orig_node_; friend class NodeUtils; friend class OnnxUtils; + friend class TuningUtils; }; } // namespace ge diff --git a/inc/graph/op_desc.h b/inc/graph/op_desc.h index e29d83940..42bf6c67a 100644 --- a/inc/graph/op_desc.h +++ b/inc/graph/op_desc.h @@ -18,6 +18,7 @@ #define INC_GRAPH_OP_DESC_H_ #include +#include #include #include #include @@ -91,6 +92,8 @@ class OpDesc : public std::enable_shared_from_this, public AttrHolder { graphStatus AddInputDescMiddle(const string &name, const unsigned int num, size_t index); + graphStatus AddOutputDescMiddle(const string &name, const unsigned int num, size_t index); + graphStatus AddOutputDescForward(const string &name, const unsigned int num); graphStatus AddOptionalInputDesc(const string &name, const GeTensorDesc &input_desc); @@ -157,9 +160,6 @@ class OpDesc : public std::enable_shared_from_this, public AttrHolder { graphStatus AddDynamicOutputDesc(const string &name, const unsigned int num, bool isPushBack = true); - void RemoveInputDesc(uint32_t index); - void RemoveOutputDesc(uint32_t index); - bool IsOptionalInput(const string &name) const; bool IsOptionalInput(uint32_t index) const; @@ -194,6 +194,14 @@ class OpDesc : public std::enable_shared_from_this, public AttrHolder { graphStatus CommonVerify() const; + graphStatus AddRegisterInputName(const string &name); + + graphStatus AddRegisterOutputName(const string &name); + + vector GetRegisterInputName() const; + + vector GetRegisterOutputName() const; + using AttrHolder::AddRequiredAttr; using AttrHolder::DelAttr; using AttrHolder::GetAllAttrNames; @@ -231,7 +239,8 @@ class OpDesc : public std::enable_shared_from_this, public AttrHolder { vector GetOpInferDepends() const; string GetInputNameByIndex(uint32_t index) const; - + string GetValidInputNameByIndex(uint32_t index) const; + int GetValidInputIndexByName(const string &name) const; int GetInputIndexByName(const string &name) const; string GetOutputNameByIndex(uint32_t index) const; @@ -304,9 +313,11 @@ class OpDesc : public std::enable_shared_from_this, public AttrHolder { vector inputs_desc_{}; map input_name_idx_{}; + vector register_input_name_{}; std::unordered_set optional_input_names_{}; vector outputs_desc_{}; map output_name_idx_{}; + vector register_output_name_{}; std::function infer_func_ = nullptr; std::function infer_format_func_ = nullptr; std::function verifier_func_ = nullptr; diff --git a/inc/graph/op_kernel_bin.h b/inc/graph/op_kernel_bin.h index df7bdc55b..61a527302 100644 --- a/inc/graph/op_kernel_bin.h +++ b/inc/graph/op_kernel_bin.h @@ -42,6 +42,7 @@ class OpKernelBin { using OpKernelBinPtr = std::shared_ptr; const char *const OP_EXTATTR_NAME_TBE_KERNEL = "tbeKernel"; +const char *const OP_EXTATTR_CUSTAICPU_KERNEL = "cust_aicpu_kernel"; } // namespace ge #endif // INC_GRAPH_OP_KERNEL_BIN_H_ diff --git a/inc/graph/opsproto_manager.h b/inc/graph/opsproto_manager.h index 1b0adce7e..f95a618bc 100644 --- a/inc/graph/opsproto_manager.h +++ b/inc/graph/opsproto_manager.h @@ -23,6 +23,7 @@ #include #include #include +#include namespace ge { class OpsProtoManager { @@ -30,14 +31,15 @@ class OpsProtoManager { static OpsProtoManager *Instance(); bool Initialize(const std::map &options); - void Finalize(); + private: void LoadOpsProtoPluginSo(std::string &path); - private: std::string pluginPath_; std::vector handles_; + bool is_init_ = false; + std::mutex mutex_; }; } // namespace ge diff --git a/inc/graph/runtime_inference_context.h b/inc/graph/runtime_inference_context.h index a59a53ca9..0e7b092e9 100644 --- a/inc/graph/runtime_inference_context.h +++ b/inc/graph/runtime_inference_context.h @@ -23,6 +23,7 @@ #include #include "external/graph/ge_error_codes.h" #include "external/graph/tensor.h" +#include "ge_attr_value.h" namespace ge { class GE_FUNC_DEV_VISIBILITY GE_FUNC_HOST_VISIBILITY RuntimeInferenceContext { @@ -32,10 +33,12 @@ class GE_FUNC_DEV_VISIBILITY GE_FUNC_HOST_VISIBILITY RuntimeInferenceContext { static void DestroyContext(const std::string &context_id); graphStatus SetTensor(int64_t node_id, int output_id, Tensor &&tensor); + graphStatus GetTensor(int64_t node_id, int output_id, GeTensorPtr &tensor); graphStatus GetTensor(int64_t node_id, int output_id, Tensor &tensor); private: std::map> tensors_; + std::map> ge_tensors_; std::mutex mu_; static std::map> contexts_; diff --git a/inc/graph/tuning_utils.h b/inc/graph/tuning_utils.h new file mode 100644 index 000000000..b00498151 --- /dev/null +++ b/inc/graph/tuning_utils.h @@ -0,0 +1,133 @@ +#ifndef MAIN_TUNING_UTILS_H +#define MAIN_TUNING_UTILS_H + +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include + +#include +#include +#include +#include +#include +#include +#include +#include + +#include "framework/common/debug/ge_log.h" +#include "utils/attr_utils.h" +#include "utils/node_utils.h" +#include "external/ge/ge_api_types.h" +#include "graph/debug/ge_attr_define.h" +#include "graph/utils/op_desc_utils.h" +#include "graph/utils/tensor_utils.h" +namespace ge { +// Configure build mode, default value is "normal" +const char *const BUILD_MODE = "ge.buildMode"; +const char *const BUILD_STEP = "ge.buildStep"; +// Configure tuning path +const char *const TUNING_PATH = "ge.tuningPath"; +// for interface: aclgrphBuildModel +const std::set ir_builder_supported_options_for_lx_fusion = { + BUILD_MODE, + BUILD_STEP, + TUNING_PATH +}; + +// Build model +const char *const BUILD_MODE_NORMAL = "normal"; +const char *const BUILD_MODE_TUNING = "tuning"; +const char *const BUILD_MODE_BASELINE = "baseline"; +const std::set build_mode_options = { + BUILD_MODE_NORMAL, + BUILD_MODE_TUNING, + BUILD_MODE_BASELINE +}; + +// Build step +const char *const BUILD_STEP_BEFORE_UB_MATCH = "before_ub_match"; +const char *const BUILD_STEP_AFTER_UB_MATCH = "after_ub_match"; +const char *const BUILD_STEP_AFTER_BUILDER = "after_builder"; +const char *const BUILD_STEP_AFTER_BUILDER_SUB = "after_builder_sub"; +const char *const BUILD_STEP_AFTER_MERGE = "after_merge"; +const std::set build_step_options = { + BUILD_STEP_BEFORE_UB_MATCH, + BUILD_STEP_AFTER_UB_MATCH, + BUILD_STEP_AFTER_BUILDER, + BUILD_STEP_AFTER_BUILDER_SUB, + BUILD_STEP_AFTER_MERGE +}; + +using SubgraphCreateOutNode = std::unordered_map; +using NodetoNodeMap = std::unordered_map; +using NodeSet = std::set; +using NodeNametoNodeNameMap = std::unordered_map; +using NodetoNodeNameMap = std::unordered_map; +class TuningUtils { + public: + TuningUtils() = default; + ~TuningUtils() = default; + // Dump all the subgraphs and modify + // the subgraphs in them to be executable subgraphs if exe_flag is true + // `tuning_path` means path to save the graphs + static graphStatus ConvertGraphToFile(std::vector tuning_subgraphs, + std::vector non_tuning_subgraphs = {}, + bool exe_flag = false, + const std::string &path = "", + const std::string &user_path = ""); + // Recovery `graph` from graph dump files configured in options + static graphStatus ConvertFileToGraph(const map &options, ge::Graph &graph); + + private: + // part 1 + struct HelpInfo { + int64_t index; + bool exe_flag; + bool is_tuning_graph; + const std::string &path; + const std::string &user_path; + }; + static graphStatus MakeExeGraph(ComputeGraphPtr &exe_graph, + const HelpInfo& help_info); + static graphStatus HandlePld(NodePtr &node); + static graphStatus HandleEnd(NodePtr &node); + static graphStatus ChangePld2Data(NodePtr &node, NodePtr &data_node); + static graphStatus ChangeEnd2NetOutput(NodePtr &node, NodePtr &out_node); + static graphStatus LinkEnd2NetOutput(NodePtr &node, NodePtr &out_node); + static graphStatus CreateDataNode(NodePtr &node, NodePtr &data_node); + static graphStatus CreateNetOutput(NodePtr &node, NodePtr &out_node); + static graphStatus AddAttrToDataNodeForMergeGraph(const NodePtr &pld, NodePtr &data_node); + static graphStatus AddAttrToNetOutputForMergeGraph(const NodePtr &end, NodePtr &out_node); + static void DumpGraphToPath(ComputeGraphPtr &exe_graph, int64_t index, + bool is_tuning_graph, std::string path); + + static SubgraphCreateOutNode create_output_; + // part 2 + static graphStatus MergeAllSubGraph(std::vector &graphs, + ComputeGraphPtr &graph); + static graphStatus MergeSubGraph(ComputeGraphPtr &graph); + // Deletes new data and output nodes added by call `MakeExeGraph()` func in part 1 + static graphStatus RemoveDataNetoutputEdge(ComputeGraphPtr &graph); + static graphStatus GetInAndOutAnchorPair(NodePtr &data_node, + NodePtr &out_node, + AnchorPtr &dest_in_anchor, + AnchorPtr &src_out_anchor); + static NodeNametoNodeNameMap data_2_netoutput_; + static NodetoNodeNameMap data_node_2_netoutput_; + static NodetoNodeMap data_node_2_netoutput_node_; + static NodeSet netoutput_nodes_; + static NodeSet merged_graph_nodes_; + static std::mutex mutex_; + // for debug + static std::string PrintCheckLog(); + static std::string GetNodeNameByAnchor(const Anchor *anchor); +}; +} +#endif //MAIN_TUNING_UTILS_H diff --git a/inc/graph/utils/graph_utils.h b/inc/graph/utils/graph_utils.h index 28cc2d212..0e7adfe05 100644 --- a/inc/graph/utils/graph_utils.h +++ b/inc/graph/utils/graph_utils.h @@ -19,25 +19,25 @@ #include #include +#include #include #include -#include -#include #include +#include #include "graph/anchor.h" -#include "graph/node.h" #include "graph/compute_graph.h" -#include "graph/utils/anchor_utils.h" #include "graph/graph.h" #include "graph/model.h" +#include "graph/node.h" +#include "graph/utils/anchor_utils.h" #define GE_DUMP(compute_graph, name) \ do { \ GraphUtils::DumpGEGraph(compute_graph, name); \ GraphUtils::DumpGEGraphToOnnx(*compute_graph, name); \ + uint64_t i = 0; \ for (const auto &sub_graph_func : compute_graph->GetAllSubgraphs()) { \ - static int8_t i = 0; \ auto sub_graph_func_name = std::string(name) + std::string("_sub_graph_") + std::to_string(i++); \ GraphUtils::DumpGEGraph(sub_graph_func, sub_graph_func_name); \ GraphUtils::DumpGEGraphToOnnx(*sub_graph_func, sub_graph_func_name); \ @@ -132,9 +132,7 @@ struct NodeIndexIO { IOType io_type_ = kOut; std::string value_; - const std::string &ToString() const { - return value_; - } + const std::string &ToString() const { return value_; } }; class GraphUtils { @@ -205,14 +203,26 @@ class GraphUtils { static bool MatchDumpStr(const std::string &suffix); - static void DumpGEGraph(const ge::ComputeGraphPtr &graph, const std::string &suffix, bool is_always_dump = false); + static void DumpGEGraph(const ge::ComputeGraphPtr &graph, + const std::string &suffix, + bool is_always_dump = false, + const std::string &user_graph_name = ""); + + static void DumpGEGrph(const ge::ComputeGraphPtr &graph, + const std::string &path, + const std::string &suffix); static bool LoadGEGraph(const char *file, ge::ComputeGraph &compute_graph); + static bool LoadGEGraph(const char *file, ge::ComputeGraphPtr &compute_graph); + static void BreakConnect(const std::map &all_nodes_infos); static void DumpGEGraphToOnnx(const ge::ComputeGraph &compute_graph, const std::string &suffix); + static void DumpGrphToOnnx(const ge::ComputeGraph &compute_graph, + const std::string &path, const std::string &suffix); + static bool LoadGEGraphFromOnnx(const char *file, ge::ComputeGraph &compute_graph); static bool ReadProtoFromTextFile(const char *file, google::protobuf::Message *message); @@ -479,7 +489,7 @@ class ComputeGraphBuilder { /// @param [in] op_desc /// @return ComputeGraphBuilder /// - virtual ComputeGraphBuilder& AddNode(const OpDescPtr &op_desc); + virtual ComputeGraphBuilder &AddNode(const OpDescPtr &op_desc); /// /// @brief Add data-link among nodes in graph @@ -489,7 +499,7 @@ class ComputeGraphBuilder { /// @param [in] in_anchor_ind /// @return ComputeGraphBuilder /// - virtual ComputeGraphBuilder& AddDataLink(const std::string &src_name, uint32_t out_anchor_ind, + virtual ComputeGraphBuilder &AddDataLink(const std::string &src_name, uint32_t out_anchor_ind, const std::string &dst_name, uint32_t in_anchor_ind); /// @@ -498,7 +508,7 @@ class ComputeGraphBuilder { /// @param [in] dst_name /// @return ComputeGraphBuilder /// - virtual ComputeGraphBuilder& AddControlLink(const std::string &src_name, const std::string &dst_name); + virtual ComputeGraphBuilder &AddControlLink(const std::string &src_name, const std::string &dst_name); /// /// @brief Build graph @@ -558,7 +568,8 @@ class ComputeGraphBuilder { class CompleteGraphBuilder : public ComputeGraphBuilder { public: - explicit CompleteGraphBuilder(std::string name) : name_(std::move(name)), parent_node_(nullptr) {} + explicit CompleteGraphBuilder(std::string name, bool retval_flag = true) + : name_(std::move(name)), parent_node_(nullptr), retval_flag_(retval_flag) {} CompleteGraphBuilder(const CompleteGraphBuilder &) = delete; CompleteGraphBuilder &operator=(const CompleteGraphBuilder &) = delete; CompleteGraphBuilder(const CompleteGraphBuilder &&) = delete; @@ -570,7 +581,7 @@ class CompleteGraphBuilder : public ComputeGraphBuilder { /// @param [in] op_desc /// @return CompleteGraphBuilder /// - CompleteGraphBuilder& AddNode(const OpDescPtr &op_desc) override; + CompleteGraphBuilder &AddNode(const OpDescPtr &op_desc) override; /// /// @brief Add data-link among nodes in graph @@ -580,7 +591,7 @@ class CompleteGraphBuilder : public ComputeGraphBuilder { /// @param [in] in_anchor_ind /// @return CompleteGraphBuilder /// - CompleteGraphBuilder& AddDataLink(const std::string &src_name, uint32_t out_anchor_ind, + CompleteGraphBuilder &AddDataLink(const std::string &src_name, uint32_t out_anchor_ind, const std::string &dst_name, uint32_t in_anchor_ind) override; /// @@ -589,7 +600,7 @@ class CompleteGraphBuilder : public ComputeGraphBuilder { /// @param [in] dst_name /// @return CompleteGraphBuilder /// - CompleteGraphBuilder& AddControlLink(const std::string &src_name, const std::string &dst_name) override; + CompleteGraphBuilder &AddControlLink(const std::string &src_name, const std::string &dst_name) override; /// /// @brief Set index_th input anchor for graph @@ -598,7 +609,7 @@ class CompleteGraphBuilder : public ComputeGraphBuilder { /// @param [in] anchor_inds /// @return CompleteGraphBuilder /// - CompleteGraphBuilder& SetInput(uint32_t index, const std::vector &node_names, + CompleteGraphBuilder &SetInput(uint32_t index, const std::vector &node_names, const std::vector &anchor_inds); /// @@ -606,7 +617,7 @@ class CompleteGraphBuilder : public ComputeGraphBuilder { /// @param [in] index /// @return CompleteGraphBuilder /// - CompleteGraphBuilder& SetUselessInput(uint32_t index); + CompleteGraphBuilder &SetUselessInput(uint32_t index); /// /// @brief Add output anchor for graph @@ -614,35 +625,35 @@ class CompleteGraphBuilder : public ComputeGraphBuilder { /// @param [in] anchor_ind /// @return CompleteGraphBuilder /// - CompleteGraphBuilder& AddOutput(const std::string &owner_node_name, uint32_t anchor_ind); + CompleteGraphBuilder &AddOutput(const std::string &owner_node_name, uint32_t anchor_ind); /// /// @brief Add target for graph /// @param [in] target_name /// @return CompleteGraphBuilder /// - CompleteGraphBuilder& AddTarget(const std::string &target_name); + CompleteGraphBuilder &AddTarget(const std::string &target_name); /// /// @brief Set parent-node of graph /// @param [in] parent_node /// @return CompleteGraphBuilder /// - CompleteGraphBuilder& SetParentNode(const NodePtr &parent_node); + CompleteGraphBuilder &SetParentNode(const NodePtr &parent_node); /// /// @brief Set mapping-relation of parent-node in_anchor_ind & Data-node /// @param [in] input_mapping: index_of_graph_input -> in_anchor_index_of_parent_node /// @return CompleteGraphBuilder /// - CompleteGraphBuilder& SetInputMapping(const std::map &input_mapping); + CompleteGraphBuilder &SetInputMapping(const std::map &input_mapping); /// /// @brief Set mapping-relation of parent-node out_anchor_ind & NetOutput-node out_anchor_ind /// @param [in] output_mapping: index_of_graph_output -> out_anchor_index_of_parent_node /// @return CompleteGraphBuilder /// - CompleteGraphBuilder& SetOutputMapping(const std::map &output_mapping); + CompleteGraphBuilder &SetOutputMapping(const std::map &output_mapping); /// /// @brief Build graph @@ -686,8 +697,37 @@ class CompleteGraphBuilder : public ComputeGraphBuilder { /// void BuildGraphTargets(graphStatus &error_code, std::string &error_msg); + /// + /// @brief Add NetOutput node + /// @param [out] error_code + /// @param [out] error_msg + /// @return void + /// + void AddNetOutputNode(graphStatus &error_code, std::string &error_msg); + + /// + /// @brief Build NetOutput nodes with data & ctrl edges + /// @param [in] net_output_desc + /// @param [in] peer_out_anchors + /// @param [out] error_code + /// @param [out] error_msg + /// @return void + /// + void BuildNetOutputNodeWithLink(const OpDescPtr &net_output_desc, + const std::vector &peer_out_anchors, + graphStatus &error_code, std::string &error_msg); + + /// + /// @brief process after build + /// @param [out] error_code + /// @param [out] error_msg + /// @return void + /// + void PostProcess(graphStatus &error_code, std::string &error_msg); + std::string name_; NodePtr parent_node_; + bool retval_flag_; std::map, std::vector>> graph_inputs_; std::vector> graph_outputs_; std::vector graph_targets_; @@ -698,7 +738,7 @@ class CompleteGraphBuilder : public ComputeGraphBuilder { std::map output_mapping_; }; -class PartialGraphBuilder : public ComputeGraphBuilder { +class PartialGraphBuilder : public ComputeGraphBuilder { public: PartialGraphBuilder() = default; PartialGraphBuilder(const PartialGraphBuilder &) = delete; @@ -712,7 +752,7 @@ class PartialGraphBuilder : public ComputeGraphBuilder { /// @param [in] op_desc /// @return PartialGraphBuilder /// - PartialGraphBuilder& AddNode(const OpDescPtr &op_desc) override; + PartialGraphBuilder &AddNode(const OpDescPtr &op_desc) override; /// /// @brief Add data-link among nodes in graph @@ -722,7 +762,7 @@ class PartialGraphBuilder : public ComputeGraphBuilder { /// @param [in] in_anchor_ind /// @return PartialGraphBuilder /// - PartialGraphBuilder& AddDataLink(const std::string &src_name, uint32_t out_anchor_ind, + PartialGraphBuilder &AddDataLink(const std::string &src_name, uint32_t out_anchor_ind, const std::string &dst_name, uint32_t in_anchor_ind) override; /// @@ -731,21 +771,21 @@ class PartialGraphBuilder : public ComputeGraphBuilder { /// @param [in] dst_name /// @return PartialGraphBuilder /// - PartialGraphBuilder& AddControlLink(const std::string &src_name, const std::string &dst_name) override; + PartialGraphBuilder &AddControlLink(const std::string &src_name, const std::string &dst_name) override; /// /// @brief Set owner graph /// @param [in] graph /// @return PartialGraphBuilder /// - PartialGraphBuilder& SetOwnerGraph(const ComputeGraphPtr &graph); + PartialGraphBuilder &SetOwnerGraph(const ComputeGraphPtr &graph); /// /// @brief Add exist node /// @param [in] node /// @return PartialGraphBuilder /// - PartialGraphBuilder& AddExistNode(const NodePtr &node); + PartialGraphBuilder &AddExistNode(const NodePtr &node); /// /// @brief Build multi nodes with links diff --git a/inc/hccl/hvd_adapter_pub.h b/inc/graph/utils/node_adapter.h similarity index 52% rename from inc/hccl/hvd_adapter_pub.h rename to inc/graph/utils/node_adapter.h index 9ded323b4..19d765438 100644 --- a/inc/hccl/hvd_adapter_pub.h +++ b/inc/graph/utils/node_adapter.h @@ -1,5 +1,5 @@ /** - * Copyright 2019-2020 Huawei Technologies Co., Ltd + * Copyright 2020 Huawei Technologies Co., Ltd * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -14,24 +14,19 @@ * limitations under the License. */ -/** - * @file hvd_adapter_pub.h - * @brief Horovod Adapter API - */ - -#ifndef HVD_ADAPTER_ -#define HVD_ADAPTER_ +#ifndef INC_GRAPH_UTILS_NODE_ADAPTER_H_ +#define INC_GRAPH_UTILS_NODE_ADAPTER_H_ -#include +#include "graph/gnode.h" +#include "graph/node.h" -namespace hccl { -using HvdCbDataProcessFunc = hcclResult_t (*)(void *fnData); - -/** - * @brief Add function to process fndata. - * @param fn A hvdCbDataProcessFunc type function. - * @return void - */ -extern void HvdCbDataProcessFuncAdd(HvdCbDataProcessFunc fn); // 注册处理回host侧数据的函数 -} -#endif // HVD_ADAPTER_ +namespace ge { +using NodePtr = std::shared_ptr; +class GE_FUNC_DEV_VISIBILITY GE_FUNC_HOST_VISIBILITY NodeAdapter { + public: + static GNode Node2GNode(const NodePtr &node); + static NodePtr GNode2Node(const GNode &node); + static GNodePtr Node2GNodePtr(const NodePtr &node); +}; +} // namespace ge +#endif // INC_GRAPH_UTILS_NODE_ADAPTER_H_ diff --git a/inc/graph/utils/node_utils.h b/inc/graph/utils/node_utils.h index ea6e1696b..77555629a 100644 --- a/inc/graph/utils/node_utils.h +++ b/inc/graph/utils/node_utils.h @@ -20,6 +20,7 @@ #include #include #include +#include "external/graph/operator.h" #include "graph/node.h" namespace ge { @@ -63,8 +64,11 @@ class NodeUtils { static void UnlinkAll(const Node &node); static graphStatus UpdatePeerNodeInputDesc(const NodePtr &node_ptr); - static graphStatus AppendInputAnchor(const NodePtr &node, uint32_t index); - static graphStatus RemoveInputAnchor(const NodePtr &node, uint32_t index); + static graphStatus AppendInputAnchor(const NodePtr &node, uint32_t num); + static graphStatus RemoveInputAnchor(const NodePtr &node, uint32_t num); + + static graphStatus AppendOutputAnchor(const NodePtr &node, uint32_t num); + static graphStatus RemoveOutputAnchor(const NodePtr &node, uint32_t num); static bool IsInNodesEmpty(const Node &node); static GeTensorDesc GetOutputDesc(const Node &node, uint32_t index); @@ -79,6 +83,7 @@ class NodeUtils { static std::string GetNodeType(const Node &node); static std::string GetNodeType(const NodePtr &node); + static std::vector GetAllSubgraphs(const Node &node); static ComputeGraphPtr GetSubgraph(const Node &node, uint32_t index); static graphStatus SetSubgraph(Node &node, uint32_t index, const ComputeGraphPtr &subgraph); @@ -104,6 +109,14 @@ class NodeUtils { static NodePtr GetParentInput(const Node &node); static NodePtr GetParentInput(const NodePtr &node); + /// + /// @brief Get is dynamic shape graph from node. + /// @param [in] node + /// @return bool + /// + static bool IsDynamicShape(const Node &node); + static bool IsDynamicShape(const NodePtr &node); + /// /// @brief Check is varying_input for while node /// @param [in] node: Data node for subgraph @@ -140,9 +153,22 @@ class NodeUtils { /// static vector GetSubgraphOutputNodes(const Node &node); - static NodePtr GetInDataNodeByIndex(const Node &node, int index); + static NodePtr GetInDataNodeByIndex(const Node &node, const int index); + + static vector> GetOutDataNodesWithAnchorByIndex(const Node &node, const int index); - static vector GetOutDataNodesByIndex(const Node &node, int index); + static ge::ConstNodePtr GetNodeFromOperator(const Operator &oprt); + + static graphStatus GetInputConstData(const ConstNodePtr& node_ptr, const string &dst_name, GeTensorPtr &ge_tensor); + + static graphStatus GetInputConstData(const Node &node, const string &dst_name, GeTensorPtr &ge_tensor); + + /// + /// @brief Get node type in cross subgragh. + /// @param [in] node + /// @return type + /// + static std::string GetInConstNodeTypeCrossSubgraph(const ge::NodePtr &node); private: static std::map> map_send_info_; diff --git a/inc/graph/utils/op_desc_utils.h b/inc/graph/utils/op_desc_utils.h index 22ba3ad79..4589180d7 100644 --- a/inc/graph/utils/op_desc_utils.h +++ b/inc/graph/utils/op_desc_utils.h @@ -52,7 +52,8 @@ class OpDescUtils { static vector MutableWeights(const ge::Node& node); static vector MutableWeights(const ge::NodePtr node); static graphStatus SetWeights(ge::Node& node, const vector& weights); - static graphStatus SetWeights(ge::NodePtr node, const vector& weights); + static graphStatus SetWeights(ge::NodePtr node, const vector &weights); + static graphStatus SetWeights(ge::Node &node, const map &weights_map); static graphStatus ClearWeights(ge::NodePtr node); static bool ClearInputDesc(ge::OpDescPtr op_desc, uint32_t index); diff --git a/inc/graph/utils/type_utils.h b/inc/graph/utils/type_utils.h index 92f39f4ae..4e7dfc70c 100644 --- a/inc/graph/utils/type_utils.h +++ b/inc/graph/utils/type_utils.h @@ -34,6 +34,7 @@ class TypeUtils { static bool IsFormatValid(Format format); static bool IsInternalFormat(Format format); + static std::string ImplyTypeToSerialString(domi::ImplyType imply_type); static std::string DataTypeToSerialString(DataType data_type); static DataType SerialStringToDataType(const std::string &str); static std::string FormatToSerialString(Format format); diff --git a/inc/hccl/base.h b/inc/hccl/base.h index 1d83d7bf9..94253bf4a 100644 --- a/inc/hccl/base.h +++ b/inc/hccl/base.h @@ -36,76 +36,18 @@ typedef unsigned short u16; typedef unsigned int u32; typedef unsigned long long u64; -/** - * @brief HCOM functions return value definition - */ -typedef enum tagHcclResult { - HCCL_SUCCESS = 0, /**< success */ - HCCL_E_PARA = 1, /**< parameter error */ - HCCL_E_PTR = 2, /**< empty pointer */ - HCCL_E_MEMORY = 3, /**< memory error */ - HCCL_E_INTERNAL = 4, /**< internal error */ - HCCL_E_NOT_SUPPORT = 5, /**< not support feature */ - HCCL_E_NOT_FOUND = 6, /**< not found specific resource */ - HCCL_E_UNAVAIL = 7, /**< resource unavailable */ - HCCL_E_SYSCALL = 8, /**< call system interface error */ - HCCL_E_TIMEOUT = 9, /**< timeout */ - HCCL_E_OPEN_FILE_FAILURE = 10, /**< open file fail */ - HCCL_E_TCP_CONNECT = 11, /**< tcp connect fail */ - HCCL_E_ROCE_CONNECT = 12, /**< roce connect fail */ - HCCL_E_TCP_TRANSFER = 13, /**< tcp transfer fail */ - HCCL_E_ROCE_TRANSFER = 14, /**< roce transfer fail */ - HCCL_E_RUNTIME = 15, /**< call runtime api fail */ - HCCL_E_DRV = 16, /**< call driver api fail */ - HCCL_E_PROFILING = 17, /**< call profiling api fail */ - HCCL_E_CCE = 18, /**< call cce api fail */ - HCCL_E_NETWORK = 19, /**< call network api fail */ - HCCL_E_RESERVED /**< reserved */ -} hcclResult_t; - -/* handle to communicator */ -typedef void *hcclComm_t; - -/** - * @brief HCCL Reduction opperation - */ -typedef enum tagHcclRedOp { - HCCL_REP_OP_SUM = 0, /**< sum */ - HCCL_REP_OP_PROD = 1, /**< prod */ - HCCL_REP_OP_MAX = 2, /**< max */ - HCCL_REP_OP_MIN = 3, /**< min */ - HCCL_REP_OP_RESERVED /**< reserved */ -} hcclRedOp_t; - /** * @brief Horovod Reduction opperation */ -typedef enum tagHorovodRedOp { - HOROVOD_REP_OP_AVERAGE = 0, /**< average */ - HOROVOD_REP_OP_SUM = 1, /**< sum */ - HOROVOD_REP_OP_ADASUM = 2, /**< adasum */ - HOROVOD_REP_OP_MIN = 3, /**< min */ - HOROVOD_REP_OP_MAX = 4, /**< max */ - HOROVOD_REP_OP_PROD = 5, /**< proo */ - HOROVOD_REP_OP_RESERVED /**< reserved */ -} horovodRedOp_t; - -/** - * @brief HCCL data type - */ -typedef enum tagHcclDataType { - HCCL_DATA_TYPE_INT8 = 0, /**< int8 */ - HCCL_DATA_TYPE_INT = 1, /**< int32 */ - HCCL_DATA_TYPE_HALF = 2, /**< fp16 */ - HCCL_DATA_TYPE_FLOAT = 3, /**< fp32 */ - HCCL_DATA_TYPE_INT16 = 4, /**< int16 */ - HCCL_DATA_TYPE_RESERVED /**< reserved */ -} hcclDataType_t; - -constexpr u32 HCCL_UNIQUE_ID_BYTES = 2060; // 2060: unique id length -using hcclUniqueId = struct hcclUniqueIdDef { - char internal[HCCL_UNIQUE_ID_BYTES]; -}; +typedef enum { + HOROVOD_REDUCE_AVERAGE = 0, /**< average */ + HOROVOD_REDUCE_SUM = 1, /**< sum */ + HOROVOD_REDUCE_ADASUM = 2, /**< adasum */ + HOROVOD_REDUCE_MIN = 3, /**< min */ + HOROVOD_REDUCE_MAX = 4, /**< max */ + HOROVOD_REDUCE_PROD = 5, /**< proo */ + HOROVOD_REDUCE_RESERVED /**< reserved */ +} HorovodReduceOp; const u32 HCCL_MAX_SEGMENT_NUM = 8; // The max number of gradient segments. @@ -119,6 +61,16 @@ struct model_feature { float *gradient_time; /**< The BP compution time of each gradient */ }; +/** + * @brief Memory Register Address Struct for Remote Access + */ +struct MemRegisterAddr { + u64 addr; + u64 length; +}; + +const u32 HCCL_MAX_MEM_REGISTER_NUM = 8; // The max number of memory register address. + enum GradSplitForceMode { FORCE_NONE, /**< no force */ FORCE_SIZE, /**< force split gradient by size */ diff --git a/inc/hccl/hccl_op_base.h b/inc/hccl/hccl_op_base.h deleted file mode 100644 index 017e4f8a9..000000000 --- a/inc/hccl/hccl_op_base.h +++ /dev/null @@ -1,132 +0,0 @@ -/** - * Copyright 2019-2020 Huawei Technologies Co., Ltd - * - * 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. - */ - -/** - * @file hccl_op_base.h - * @brief HCCL OP_BASE API - */ - -#ifndef HCCL_OPBASE_H_ -#define HCCL_OPBASE_H_ - -#include - -#ifdef __cplusplus -extern "C" { -#endif // __cplusplus - -/** - * @brief Initialize HCCL in OP_BASE mode. - * - * @param rank_table A string identifying the rank table file path, include file name. - * @param identify A string identifying the identify for the rank. - * @param comm A pointer identifying the initialized communication resource. - * @return hcclResult_t - * @see hcclCommDestroy() - */ -extern hcclResult_t hcclCommInitClusterInfo(const char *rankTable, const char *identify, hcclComm_t *comm); - -/** - * @brief Get hccl unique id in OP_BASE mode. - * - * @param id A pointer identifying the hccl unique id. - * @return hcclResult_t - */ -extern hcclResult_t hcclGetUniqueId(hcclUniqueId* id); - -/** - * @brief Initialize HCCL with unique id in OP_BASE mode. - * - * @param comm A pointer identifying the initialized communication resource. - * @param nranks A integer identifying the rank size of the cluster. - * @param commId A struct identifying the hccl unique id. - * @param myrank A integer identifying the identify for the rank. - * @return hcclResult_t - * @see hcclCommDestroy() - */ -extern hcclResult_t hcclCommInitUniqueId(hcclComm_t* comm, u32 nranks, hcclUniqueId commId, u32 myrank); - -/** - * @brief AllReduce operator in OP_BASE mode. - * - * @param inputPtr A pointer identifying the input data address of the operator. - * @param outputPtr A pointer identifying the output data address of the operator. - * @param count An integer(u64) identifying the number of the output data. -* @param dataType The data type of the operator, must be one of the following types: int8, int32, float16, float32. - * @param op The reduction type of the operator, must be one of the following types: sum, min, max, prod. - * @param comm A pointer identifying the communication resource based on. - * @param stream A pointer identifying the stream information. - * @return hcclResult_t - */ -extern hcclResult_t hcclAllReduce(void *inputPtr, void *outputPtr, u64 count, hcclDataType_t dataType, - hcclRedOp_t op, hcclComm_t comm, rtStream_t stream); - -/** - * @brief Broadcast operator in OP_BASE mode. - * - * @param ptr A pointer identifying the data address of the operator. - * @param count An integer(u64) identifying the number of the data. - * @param dataType The data type of the operator, must be one of the following types: int8, int32, float16, float32. - * @param root An integer(u32) identifying the the root rank in the operator. - * @param comm A pointer identifying the communication resource based on - * @param stream A pointer identifying the stream information. - * @return hcclResult_t - */ -extern hcclResult_t hcclBroadcast(void *ptr, u64 count, hcclDataType_t dataType, u32 root, hcclComm_t comm, - rtStream_t stream); - -/** - * @brief ReduceScatter operator in OP_BASE mode. - * - * @param inputPtr A pointer identifying the input data address of the operator. - * @param outputPtr A pointer identifying the output data address of the operator. - * @param count An integer(u64) identifying the number of the output data. -* @param dataType The data type of the operator, must be one of the following types: int8, int32, float16, float32. - * @param op The reduction type of the operator, must be one of the following types: sum, min, max, prod. - * @param comm A pointer identifying the communication resource based on. - * @param stream A pointer identifying the stream information. - * @return hcclResult_t - */ -extern hcclResult_t hcclReduceScatter(void* inputPtr, void* outputPtr, u64 count, hcclDataType_t dataType, - hcclRedOp_t op, hcclComm_t comm, rtStream_t stream); - -/** - * @brief AllGather operator in OP_BASE mode. - * - * @param inputPtr A pointer identifying the input data address of the operator. - * @param outputPtr A pointer identifying the output data address of the operator. - * @param count An integer(u64) identifying the number of the input data. -* @param dataType The data type of the operator, must be one of the following types: int8, int32, float16, float32. - * @param comm A pointer identifying the communication resource based on. - * @param stream A pointer identifying the stream information. - * @return hcclResult_t - */ -extern hcclResult_t hcclAllGather(void* inputPtr, void* outputPtr, u64 count, hcclDataType_t dataType, - hcclComm_t comm, rtStream_t stream); - -/** - * @brief Destroy HCCL comm - * - * @param comm A pointer identifying the communication resource targetting - * @return hcclResult_t - * @see hcclCommInitClusterInfo() - */ -extern hcclResult_t hcclCommDestroy(hcclComm_t comm); - -#ifdef __cplusplus -} -#endif // __cplusplus -#endif // HCCL_OPBASE_H_ diff --git a/inc/hccl/hcom.h b/inc/hccl/hcom.h index 19bf4fb36..90b96ac77 100644 --- a/inc/hccl/hcom.h +++ b/inc/hccl/hcom.h @@ -23,6 +23,7 @@ #define HCOM_H_ #include +#include #ifdef __cplusplus extern "C" { @@ -33,37 +34,37 @@ extern "C" { * * @param rank_table A string identifying the rank table file path, include file name. * @param identify A string identifying the identify for the rank. - * @return hcclResult_t + * @return HcclResult * @see hcom_destroy() */ -extern hcclResult_t hcom_init(const char *rank_table, const char *identify); +extern HcclResult hcom_init(const char *rank_table, const char *identify); /** * @brief Destroy HCOM * - * @return hcclResult_t + * @return HcclResult * @see hcom_init() */ -extern hcclResult_t hcom_destroy(void); +extern HcclResult hcom_destroy(void); /** * @brief Bind the model. * * @param model A pointer identifying the model information. * @param stream A pointer identifying the stream information. - * @return hcclResult_t + * @return HcclResult * @see hcom_unbind_model() */ -extern hcclResult_t hcom_bind_model(rtModel_t model, rtStream_t stream); +extern HcclResult hcom_bind_model(rtModel_t model, rtStream_t stream); /** * @brief Unbind the model. * * @param model An pointer identifying the model information. - * @return hcclResult_t + * @return HcclResult * @see hcom_unbind_model() */ -extern hcclResult_t hcom_unbind_model(rtModel_t model); +extern HcclResult hcom_unbind_model(rtModel_t model); /** * @brief All-gather operator. @@ -75,10 +76,10 @@ extern hcclResult_t hcom_unbind_model(rtModel_t model); * @param dataType The data type of the operator, must be one of the following types: int8, int32, float16, float32. * @param group A string identifying the group name of ranks participating in the operator. * @param stream A pointer identifying the stream information. - * @return hcclResult_t + * @return HcclResult */ -extern hcclResult_t hcom_all_gather(const char *tag, void *inputPtr, void *outputPtr, u64 inputCount, - hcclDataType_t dataType, const char *group, rtStream_t stream); +extern HcclResult hcom_all_gather(const char *tag, void *inputPtr, void *outputPtr, u64 inputCount, + HcclDataType dataType, const char *group, rtStream_t stream); /** * @brief All-reduce operator. @@ -91,10 +92,10 @@ extern hcclResult_t hcom_all_gather(const char *tag, void *inputPtr, void *outpu * @param op The reduction type of the operator, must be one of the following types: sum, min, max, prod. * @param group A string identifying the group name of ranks participating in the operator. * @param stream A pointer identifying the stream information. - * @return hcclResult_t + * @return HcclResult */ -extern hcclResult_t hcom_all_reduce(const char *tag, void *inputPtr, void *outputPtr, u64 count, - hcclDataType_t dataType, hcclRedOp_t op, const char *group, rtStream_t stream); +extern HcclResult hcom_all_reduce(const char *tag, void *inputPtr, void *outputPtr, u64 count, + HcclDataType dataType, HcclReduceOp op, const char *group, rtStream_t stream); /** * @brief Broadcast operator. @@ -106,9 +107,9 @@ extern hcclResult_t hcom_all_reduce(const char *tag, void *inputPtr, void *outpu * @param root An integer(u32) identifying the the root rank in the operator. * @param group A string identifying the group name of ranks participating in the operator. * @param stream A pointer identifying the stream information. - * @return hcclResult_t + * @return HcclResult */ -extern hcclResult_t hcom_broadcast(const char *tag, void *ptr, u64 count, hcclDataType_t dataType, u32 root, +extern HcclResult hcom_broadcast(const char *tag, void *ptr, u64 count, HcclDataType dataType, u32 root, const char *group, rtStream_t stream); /** @@ -122,46 +123,46 @@ extern hcclResult_t hcom_broadcast(const char *tag, void *ptr, u64 count, hcclDa * @param op The reduction type of the operator, must be one of the following types: sum, min, max, prod. * @param group A string identifying the group name of ranks participating in the operator. * @param stream A pointer identifying the stream information. - * @return hcclResult_t + * @return HcclResult */ -extern hcclResult_t hcom_reduce_scatter(const char *tag, void *inputPtr, void *outputPtr, u64 count, - hcclDataType_t dataType, hcclRedOp_t op, const char *group, rtStream_t stream); +extern HcclResult hcom_reduce_scatter(const char *tag, void *inputPtr, void *outputPtr, u64 count, + HcclDataType dataType, HcclReduceOp op, const char *group, rtStream_t stream); /** * @brief Get the rank number in the group. * * @param group A string identifying the group name. * @param rankSize A pointer identifying the rank number. - * @return hcclResult_t + * @return HcclResult */ -hcclResult_t hcom_get_rank_size(const char *group, u32 *rankSize); +HcclResult hcom_get_rank_size(const char *group, u32 *rankSize); /** * @brief Get the rank number of this rank's server within the group. * * @param group A string identifying the group name. * @param localRankSize A pointer identifying the rank number. - * @return hcclResult_t + * @return HcclResult */ -hcclResult_t hcom_get_local_rank_size(const char *group, u32 *localRankSize); +HcclResult hcom_get_local_rank_size(const char *group, u32 *localRankSize); /** * @brief Get the rank id of this rank. * * @param group A string identifying the group name. * @param rankId A pointer identifying the rank id. - * @return hcclResult_t + * @return HcclResult */ -hcclResult_t hcom_get_rank_id(const char *group, u32 *rankId); +HcclResult hcom_get_rank_id(const char *group, u32 *rankId); /** * @brief Get the local rank id of this rank's server within the group. * * @param group A string identifying the group name. * @param localRankId A pointer identifying the local rank id. - * @return hcclResult_t + * @return HcclResult */ -hcclResult_t hcom_get_local_rank_id(const char *group, u32 *localRankId); +HcclResult hcom_get_local_rank_id(const char *group, u32 *localRankId); /** * @brief Get the world rank id according to the group rank id. @@ -169,9 +170,9 @@ hcclResult_t hcom_get_local_rank_id(const char *group, u32 *localRankId); * @param group A string identifying the group name. * @param groupRank An integer(u32) identifying the group rank id. * @param worldRank A pointer identifying the world rank id. - * @return hcclResult_t + * @return HcclResult */ -hcclResult_t hcom_get_world_rank_from_group_rank(const char *group, u32 groupRank, u32 *worldRank); +HcclResult hcom_get_world_rank_from_group_rank(const char *group, u32 groupRank, u32 *worldRank); /** * @brief Get the group rank id according to the world rank id. @@ -179,9 +180,9 @@ hcclResult_t hcom_get_world_rank_from_group_rank(const char *group, u32 groupRan * @param worldRank An integer(u32) identifying the world rank id. * @param group A string identifying the group name. * @param groupRank A pointer identifying the group rank id. - * @return hcclResult_t + * @return HcclResult */ -hcclResult_t hcom_get_group_rank_from_world_rank(u32 worldRank, const char *group, u32 *groupRank); +HcclResult hcom_get_group_rank_from_world_rank(u32 worldRank, const char *group, u32 *groupRank); /** * @brief Create group. @@ -189,17 +190,17 @@ hcclResult_t hcom_get_group_rank_from_world_rank(u32 worldRank, const char *grou * @param group A string identifying the group name. * @param rankNum An integer(u32) identifying the number of ranks in the group. * @param rankIds A list identifying the ranks in the group. - * @return hcclResult_t + * @return HcclResult */ -hcclResult_t hcom_create_group(const char *group, u32 rankNum, u32 *rankIds); +HcclResult hcom_create_group(const char *group, u32 rankNum, u32 *rankIds); /** * @brief Destroy group * * @param group A string identifying the group name. - * @return hcclResult_t + * @return HcclResult */ -hcclResult_t hcom_destroy_group(const char *group); +HcclResult hcom_destroy_group(const char *group); /** * @brief Send operator. @@ -213,9 +214,9 @@ hcclResult_t hcom_destroy_group(const char *group); * The message will be send by the receive operator with the same "sr_tag". * @param group A string identifying the group name of ranks participating in the operator. * @param stream A pointer identifying the stream information. - * @return hcclResult_t + * @return HcclResult */ -hcclResult_t hcom_send(const char *tag, void *inputPtr, u64 count, hcclDataType_t dataType, +HcclResult hcom_send(const char *tag, void *inputPtr, u64 count, HcclDataType dataType, u32 destRank, u32 srTag, const char *group, rtStream_t stream); /** @@ -230,9 +231,9 @@ hcclResult_t hcom_send(const char *tag, void *inputPtr, u64 count, hcclDataType_ * The message will be send by the send operator with the same "sr_tag". * @param group A string identifying the group name of ranks participating in the operator. * @param stream A pointer identifying the stream information. - * @return hcclResult_t + * @return HcclResult */ -hcclResult_t hcom_receive(const char *tag, void *outputPtr, u64 count, hcclDataType_t dataType, +HcclResult hcom_receive(const char *tag, void *outputPtr, u64 count, HcclDataType dataType, u32 srcRank, u32 srTag, const char *group, rtStream_t stream); /** @@ -243,9 +244,9 @@ hcclResult_t hcom_receive(const char *tag, void *outputPtr, u64 count, hcclDataT * @param maxSegmentNum An integer(u32) identifying the max segments of gradients. * @param segmentNum A pointer identifying the segments number of gradients. * @param segmentIdx A list identifying the index of end gradient in each segment. - * @return hcclResult_t + * @return HcclResult */ -hcclResult_t hcom_get_split_strategy(const char *group, const struct model_feature *feature, u32 maxSegmentNum, +HcclResult hcom_get_split_strategy(const char *group, const struct model_feature *feature, u32 maxSegmentNum, u32 *segmentNum, u32 *segmentIdx, GradSplitForceMode force = FORCE_NONE, OriginalGraphShapeType shapeType = KNOWN_SHAPE); @@ -255,9 +256,9 @@ hcclResult_t hcom_get_split_strategy(const char *group, const struct model_featu * @param group A string identifying the group name. * @param segmentNum An integer(u32) identifying the segments number of gradients. * @param IdxList A list identifying the index of end gradient in each segment. - * @return hcclResult_t + * @return HcclResult */ -extern hcclResult_t hcom_set_split_strategy_by_index(const char *group, u32 segmentNum, const u32 *IdxList); +extern HcclResult hcom_set_split_strategy_by_index(const char *group, u32 segmentNum, const u32 *IdxList); /** * @brief Set the gradient split strategy with in the group, according to gradient data size. @@ -265,9 +266,18 @@ extern hcclResult_t hcom_set_split_strategy_by_index(const char *group, u32 segm * @param group A string identifying the group name. * @param segmentNum An integer(u32) identifying the segments number of gradients. * @param sizeList A list identifying the percent of each segment. - * @return hcclResult_t + * @return HcclResult */ -extern hcclResult_t hcom_set_split_strategy_by_size(const char *group, u32 segmentNum, const float *sizeList); +extern HcclResult hcom_set_split_strategy_by_size(const char *group, u32 segmentNum, const float *sizeList); + +/** + * @brief Register memories and init resources for remote access. + * + * @param addrList memory addresses for remote access. + * @param count number of remote memory addresses. + * @return HcclResult + */ +extern HcclResult hcom_remote_access_mem_register(const MemRegisterAddr* addrList, u32 count); #ifdef __cplusplus } diff --git a/inc/mmpa/mmpa_api.h b/inc/mmpa/mmpa_api.h new file mode 100644 index 000000000..f5b80269c --- /dev/null +++ b/inc/mmpa/mmpa_api.h @@ -0,0 +1,129 @@ +/** + * Copyright 2019-2020 Huawei Technologies Co., Ltd + * + * 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 _MMPA_API_H_ +#define _MMPA_API_H_ + +#define LINUX 0 +#define WIN 1 + +#if(OS_TYPE == LINUX) //lint !e553 + +#ifndef _GNU_SOURCE +#define _GNU_SOURCE +#endif + +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include + +#include +#include +#include +#include + +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include + +#include "securec.h" + +#include "./sub_inc/mmpa_typedef_linux.h" +#include "./sub_inc/mmpa_linux.h" + +#endif + + +#if(OS_TYPE == WIN) //lint !e553 +#include +#include +#include "Windows.h" +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include "shlwapi.h" +#include +#include +#include +#include +#include +#include +#include +#include + +#include "securec.h" + +#include "sub_inc/mmpa_typedef_win.h" +#include "sub_inc/mmpa_win.h" + +#pragma comment(lib, "ws2_32.lib") +#pragma comment(lib, "mswsock.lib") +#pragma comment(lib, "Kernel32.lib") +#pragma comment(lib, "shlwapi.lib") +#pragma comment(lib, "wbemuuid.lib") +#pragma comment(lib, "Iphlpapi.lib") +#endif + +#endif // MMPA_API_H_ + diff --git a/inc/mmpa/sub_inc/mmpa_linux.h b/inc/mmpa/sub_inc/mmpa_linux.h new file mode 100644 index 000000000..aced4968f --- /dev/null +++ b/inc/mmpa/sub_inc/mmpa_linux.h @@ -0,0 +1,519 @@ +/** + * Copyright 2019-2020 Huawei Technologies Co., Ltd + * + * 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 MMPA_LINUX_MMPA_LINUX_H +#define MMPA_LINUX_MMPA_LINUX_H + +#ifdef __cplusplus +#if __cplusplus +extern "C" { +#endif // __cpluscplus +#endif // __cpluscplus + +#define MMPA_MACINFO_DEFAULT_SIZE 18 +#define MMPA_CPUDESC_DEFAULT_SIZE 64 + +typedef pthread_t mmThread; +typedef pthread_mutex_t mmMutex_t; +typedef pthread_cond_t mmCond; +typedef pthread_mutex_t mmMutexFC; +typedef pthread_rwlock_t mmRWLock_t; +typedef signed int mmProcess; +typedef int mmPollHandle; +typedef int mmPipeHandle; +typedef int mmFileHandle; +typedef int mmComPletionKey; +typedef int mmCompletionHandle; +typedef int mmErrorMsg; +typedef int mmFd_t; + +typedef VOID *mmExitCode; +typedef key_t mmKey_t; +typedef int mmMsgid; +typedef struct dirent mmDirent; +typedef struct shmid_ds mmshmId_ds; +typedef int (*mmFilter)(const mmDirent *entry); +typedef int (*mmSort)(const mmDirent **a, const mmDirent **b); +typedef size_t mmSize_t; +typedef off_t mmOfft_t; +typedef pid_t mmPid_t; + +typedef VOID *(*userProcFunc)(VOID *pulArg); + +typedef struct { + userProcFunc procFunc; // Callback function pointer + VOID *pulArg; // Callback function parameters +} mmUserBlock_t; + +typedef struct { + const char *dli_fname; + void *dli_fbase; + const char *dli_sname; + void *dli_saddr; + size_t dli_size; /* ELF only */ + int dli_bind; /* ELF only */ + int dli_type; +} mmDlInfo; + +typedef struct { + int wSecond; // Seconds. [0-60] (1 leap second) + int wMinute; // Minutes. [0-59] + int wHour; // Hours. [0-23] + int wDay; // Day. [1-31] + int wMonth; // Month. [1-12] + int wYear; // Year + int wDayOfWeek; // Day of week. [0-6] + int tm_yday; // Days in year.[0-365] + int tm_isdst; // DST. [-1/0/1] + long int wMilliseconds; // milliseconds +} mmSystemTime_t; + +typedef sem_t mmSem_t; +typedef struct sockaddr mmSockAddr; +typedef socklen_t mmSocklen_t; +typedef int mmSockHandle; +typedef timer_t mmTimer; +typedef pthread_key_t mmThreadKey; + +typedef int mmOverLap; + +typedef ssize_t mmSsize_t; +typedef size_t mmSize; // size + +typedef struct { + UINT32 createFlag; + INT32 oaFlag; +} mmCreateFlag; + +typedef struct { + VOID *sendBuf; + INT32 sendLen; +} mmIovSegment; +typedef struct in_addr mmInAddr; + +typedef struct { + VOID *inbuf; + INT32 inbufLen; + VOID *outbuf; + INT32 outbufLen; + mmOverLap *oa; +} mmIoctlBuf; + +typedef int mmAtomicType; + +typedef enum { + pollTypeRead = 1, // pipe read + pollTypeRecv, // socket recv + pollTypeIoctl, // ioctl +} mmPollType; + +typedef struct { + mmPollHandle handle; // The file descriptor or handle of poll is required + mmPollType pollType; // Operation type requiring poll + // read or recv or ioctl + INT32 ioctlCode; // IOCTL operation code, dedicated to IOCTL + mmComPletionKey completionKey; // The default value is blank, which is used in windows + // The data used to receive the difference between which handle is readable +} mmPollfd; + +typedef struct { + VOID *priv; // User defined private content + mmPollHandle bufHandle; // Value of handle corresponding to buf + mmPollType bufType; // Data types polled to + VOID *buf; // Data used in poll + UINT32 bufLen; // Data length used in poll + UINT32 bufRes; // Actual return length +} mmPollData, *pmmPollData; + +typedef VOID (*mmPollBack)(pmmPollData); + +typedef struct { + INT32 tz_minuteswest; // How many minutes is it different from Greenwich + INT32 tz_dsttime; // type of DST correction +} mmTimezone; + +typedef struct { + LONG tv_sec; + LONG tv_usec; +} mmTimeval; + +typedef struct { + LONG tv_sec; + LONG tv_nsec; +} mmTimespec; + +typedef struct { + ULONGLONG totalSize; + ULONGLONG freeSize; + ULONGLONG availSize; +} mmDiskSize; + +#define mmTLS __thread +typedef struct stat mmStat_t; +typedef struct stat64 mmStat64_t; +typedef mode_t mmMode_t; + +typedef struct option mmStructOption; + +typedef struct { + char addr[MMPA_MACINFO_DEFAULT_SIZE]; // ex:aa-bb-cc-dd-ee-ff\0 +} mmMacInfo; + +typedef struct { + char **argv; + INT32 argvCount; + char **envp; + INT32 envpCount; +} mmArgvEnv; + +typedef struct { + char arch[MMPA_CPUDESC_DEFAULT_SIZE]; + char manufacturer[MMPA_CPUDESC_DEFAULT_SIZE]; // vendor + char version[MMPA_CPUDESC_DEFAULT_SIZE]; // modelname + INT32 frequency; // cpu frequency + INT32 maxFrequency; // max speed + INT32 ncores; // cpu cores + INT32 nthreads; // cpu thread count + INT32 ncounts; // logical cpu nums +} mmCpuDesc; + +typedef mode_t MODE; + +typedef struct { + INT32 detachFlag; // Determine whether to set separation property 0, not to separate 1 + INT32 priorityFlag; // Determine whether to set priority 0 and not set 1 + INT32 priority; // Priority value range to be set 1-99 + INT32 policyFlag; // Set scheduling policy or not 0 do not set 1 setting + INT32 policy; // Scheduling policy value value + // MMPA_THREAD_SCHED_RR + // MMPA_THREAD_SCHED_OTHER + // MMPA_THREAD_SCHED_FIFO + INT32 stackFlag; // Set stack size or not: 0 does not set 1 setting + UINT32 stackSize; // The stack size unit bytes to be set cannot be less than MMPA_THREAD_STACK_MIN +} mmThreadAttr; + +#ifdef __ANDROID__ +#define S_IREAD S_IRUSR +#define S_IWRITE S_IWUSR +#endif + +#define M_FILE_RDONLY O_RDONLY +#define M_FILE_WRONLY O_WRONLY +#define M_FILE_RDWR O_RDWR +#define M_FILE_CREAT O_CREAT + +#define M_RDONLY O_RDONLY +#define M_WRONLY O_WRONLY +#define M_RDWR O_RDWR +#define M_CREAT O_CREAT +#define M_BINARY O_RDONLY +#define M_TRUNC O_TRUNC +#define M_IRWXU S_IRWXU + +#define M_IN_CREATE IN_CREATE +#define M_IN_CLOSE_WRITE IN_CLOSE_WRITE +#define M_IN_IGNORED IN_IGNORED + +#define M_OUT_CREATE IN_CREATE +#define M_OUT_CLOSE_WRITE IN_CLOSE_WRITE +#define M_OUT_IGNORED IN_IGNORED +#define M_OUT_ISDIR IN_ISDIR + +#define M_IREAD S_IREAD +#define M_IRUSR S_IRUSR +#define M_IWRITE S_IWRITE +#define M_IWUSR S_IWUSR +#define M_IXUSR S_IXUSR +#define FDSIZE 64 +#define M_MSG_CREAT IPC_CREAT +#define M_MSG_EXCL (IPC_CREAT | IPC_EXCL) +#define M_MSG_NOWAIT IPC_NOWAIT + +#define M_WAIT_NOHANG WNOHANG // Non blocking waiting +#define M_WAIT_UNTRACED \ + WUNTRACED // If the subprocess enters the suspended state, it will return immediately + // But the end state of the subprocess is ignored +#define M_UMASK_USRREAD S_IRUSR +#define M_UMASK_GRPREAD S_IRGRP +#define M_UMASK_OTHREAD S_IROTH + +#define M_UMASK_USRWRITE S_IWUSR +#define M_UMASK_GRPWRITE S_IWGRP +#define M_UMASK_OTHWRITE S_IWOTH + +#define M_UMASK_USREXEC S_IXUSR +#define M_UMASK_GRPEXEC S_IXGRP +#define M_UMASK_OTHEXEC S_IXOTH + +#define mmConstructor(x) __attribute__((constructor)) VOID x() +#define mmDestructor(x) __attribute__((destructor)) VOID x() + +#define MMPA_NO_ARGUMENT 0 +#define MMPA_REQUIRED_ARGUMENT 1 +#define MMPA_OPTIONAL_ARGUMENT 2 + +#define MMPA_MAX_PATH PATH_MAX +#define M_NAME_MAX MAX_FNAME + +#define M_F_OK F_OK +#define M_R_OK R_OK +#define M_W_OK W_OK + +#define MMPA_STDIN STDIN_FILENO +#define MMPA_STDOUT STDOUT_FILENO +#define MMPA_STDERR STDERR_FILENO + +#define MMPA_RTLD_NOW RTLD_NOW +#define MMPA_RTLD_GLOBAL RTLD_GLOBAL +#define MMPA_RTLD_LAZY RTLD_LAZY +#define MMPA_RTLD_NODELETE RTLD_NODELETE + +#define MMPA_DL_EXT_NAME ".so" + +extern INT32 mmCreateTask(mmThread *threadHandle, mmUserBlock_t *funcBlock); +extern INT32 mmJoinTask(mmThread *threadHandle); +extern INT32 mmMutexInit(mmMutex_t *mutex); +extern INT32 mmMutexLock(mmMutex_t *mutex); +extern INT32 mmMutexTryLock(mmMutex_t *mutex); +extern INT32 mmMutexUnLock(mmMutex_t *mutex); +extern INT32 mmMutexDestroy(mmMutex_t *mutex); +extern INT32 mmCondInit(mmCond *cond); +extern INT32 mmCondLockInit(mmMutexFC *mutex); +extern INT32 mmCondLock(mmMutexFC *mutex); +extern INT32 mmCondUnLock(mmMutexFC *mutex); +extern INT32 mmCondLockDestroy(mmMutexFC *mutex); +extern INT32 mmRWLockInit(mmRWLock_t *rwLock); +extern INT32 mmRWLockRDLock(mmRWLock_t *rwLock); +extern INT32 mmRWLockTryRDLock(mmRWLock_t *rwLock); +extern INT32 mmRWLockWRLock(mmRWLock_t *rwLock); +extern INT32 mmRWLockTryWRLock(mmRWLock_t *rwLock); +extern INT32 mmRDLockUnLock(mmRWLock_t *rwLock); +extern INT32 mmWRLockUnLock(mmRWLock_t *rwLock); +extern INT32 mmRWLockDestroy(mmRWLock_t *rwLock); +extern INT32 mmCondWait(mmCond *cond, mmMutexFC *mutex); +extern INT32 mmCondTimedWait(mmCond *cond, mmMutexFC *mutex, UINT32 milliSecond); +extern INT32 mmCondNotify(mmCond *cond); +extern INT32 mmCondNotifyAll(mmCond *cond); +extern INT32 mmCondDestroy(mmCond *cond); +extern INT32 mmGetPid(); +extern INT32 mmGetTid(); +extern INT32 mmGetPidHandle(mmProcess *processHandle); +extern INT32 mmGetLocalTime(mmSystemTime_t *sysTime); +extern INT32 mmGetSystemTime(mmSystemTime_t *sysTime); + +extern INT32 mmSemInit(mmSem_t *sem, UINT32 value); +extern INT32 mmSemWait(mmSem_t *sem); +extern INT32 mmSemPost(mmSem_t *sem); +extern INT32 mmSemDestroy(mmSem_t *sem); +extern INT32 mmOpen(const CHAR *pathName, INT32 flags); +extern INT32 mmOpen2(const CHAR *pathName, INT32 flags, MODE mode); +extern FILE *mmPopen(CHAR *command, CHAR *type); +extern INT32 mmClose(INT32 fd); +extern INT32 mmPclose(FILE *stream); +extern mmSsize_t mmWrite(INT32 fd, VOID *buf, UINT32 bufLen); +extern mmSsize_t mmRead(INT32 fd, VOID *buf, UINT32 bufLen); +extern mmSockHandle mmSocket(INT32 sockFamily, INT32 type, INT32 protocol); +extern INT32 mmBind(mmSockHandle sockFd, mmSockAddr *addr, mmSocklen_t addrLen); +extern INT32 mmListen(mmSockHandle sockFd, INT32 backLog); +extern mmSockHandle mmAccept(mmSockHandle sockFd, mmSockAddr *addr, mmSocklen_t *addrLen); +extern INT32 mmConnect(mmSockHandle sockFd, mmSockAddr *addr, mmSocklen_t addrLen); +extern INT32 mmCloseSocket(mmSockHandle sockFd); +extern mmSsize_t mmSocketSend(mmSockHandle sockFd, VOID *sendBuf, INT32 sendLen, INT32 sendFlag); +extern mmSsize_t mmSocketRecv(mmSockHandle sockFd, VOID *recvBuf, INT32 recvLen, INT32 recvFlag); +extern INT32 mmSocketSendTo(mmSockHandle sockFd, + VOID *sendMsg, + INT32 sendLen, + UINT32 sendFlag, + const mmSockAddr* addr, + INT32 tolen); +extern mmSsize_t mmSocketRecvFrom(mmSockHandle sockFd, + VOID *recvBuf, + mmSize recvLen, + UINT32 recvFlag, + mmSockAddr* addr, + mmSocklen_t *FromLen); +extern INT32 mmSAStartup(); +extern INT32 mmSACleanup(); +extern VOID *mmDlopen(const CHAR *fileName, INT32 mode); +extern INT32 mmDladdr(VOID *addr, mmDlInfo *info); +extern VOID *mmDlsym(VOID *handle, CHAR *funcName); +extern INT32 mmDlclose(VOID *handle); +extern CHAR *mmDlerror(); +extern INT32 mmCreateAndSetTimer(mmTimer *timerHandle, mmUserBlock_t *timerBlock, UINT milliSecond, UINT period); +extern INT32 mmDeleteTimer(mmTimer timerHandle); +extern INT32 mmStatGet(const CHAR *path, mmStat_t *buffer); +extern INT32 mmStat64Get(const CHAR *path, mmStat64_t *buffer); +extern INT32 mmFStatGet(INT32 fd, mmStat_t *buffer); +extern INT32 mmMkdir(const CHAR *pathName, mmMode_t mode); +extern INT32 mmSleep(UINT32 milliSecond); + +extern INT32 mmCreateTaskWithAttr(mmThread *threadHandle, mmUserBlock_t *funcBlock); +extern INT32 mmGetProcessPrio(mmProcess pid); +extern INT32 mmSetProcessPrio(mmProcess pid, INT32 processPrio); +extern INT32 mmGetThreadPrio(mmThread *threadHandle); +extern INT32 mmSetThreadPrio(mmThread *threadHandle, INT32 threadPrio); +extern INT32 mmAccess(const CHAR *pathName); +extern INT32 mmAccess2(const CHAR *pathName, INT32 mode); +extern INT32 mmRmdir(const CHAR *pathName); + +extern INT32 mmIoctl(mmProcess fd, INT32 ioctlCode, mmIoctlBuf *bufPtr); +extern INT32 mmSemTimedWait(mmSem_t *sem, INT32 timeout); +extern mmSsize_t mmWritev(mmProcess fd, mmIovSegment *iov, INT32 iovcnt); +extern VOID mmMb(); +extern INT32 mmInetAton(const CHAR *addrStr, mmInAddr *addr); + +extern mmProcess mmOpenFile(const CHAR *fileName, UINT32 access, mmCreateFlag fileFlag); +extern mmSsize_t mmReadFile(mmProcess fileId, VOID *buffer, INT32 len); +extern mmSsize_t mmWriteFile(mmProcess fileId, VOID *buffer, INT32 len); +extern INT32 mmCloseFile(mmProcess fileId); + +extern mmAtomicType mmSetData(mmAtomicType *ptr, mmAtomicType value); +extern mmAtomicType mmValueInc(mmAtomicType *ptr, mmAtomicType value); +extern mmAtomicType mmValueSub(mmAtomicType *ptr, mmAtomicType value); +extern INT32 mmCreateTaskWithDetach(mmThread *threadHandle, mmUserBlock_t *funcBlock); + +// The following 3 interfaces are to be deleted +extern INT32 mmCreateNamedPipe(mmPipeHandle pipe[], CHAR *pipeName[], INT32 waitMode); +extern INT32 mmOpenNamePipe(mmPipeHandle pipe[], CHAR *pipeName[], INT32 waitMode); +extern VOID mmCloseNamedPipe(mmPipeHandle namedPipe[]); + +extern INT32 mmCreatePipe(mmPipeHandle pipe[], CHAR *pipeName[], UINT32 pipeCount, INT32 waitMode); +extern INT32 mmOpenPipe(mmPipeHandle pipe[], CHAR *pipeName[], UINT32 pipeCount, INT32 waitMode); +extern VOID mmClosePipe(mmPipeHandle pipe[], UINT32 pipeCount); + +// Poll related interface +extern mmCompletionHandle mmCreateCompletionPort(); +extern VOID mmCloseCompletionPort(mmCompletionHandle handle); +extern INT32 mmPoll(mmPollfd *fds, INT32 fdCount, INT32 timeout, mmCompletionHandle handleIOCP, pmmPollData polledData, + mmPollBack pollBack); +extern INT32 mmGetErrorCode(); +extern CHAR *mmGetErrorFormatMessage(mmErrorMsg errnum, CHAR *buf, mmSize size); +extern INT32 mmGetTimeOfDay(mmTimeval *timeVal, mmTimezone *timeZone); +extern mmTimespec mmGetTickCount(); +extern INT32 mmGetRealPath(CHAR *path, CHAR *realPath); +extern INT32 mmRealPath(const CHAR *path, CHAR *realPath, INT32 realPathLen); + +extern INT32 mmDup2(INT32 oldFd, INT32 newFd); + +extern INT32 mmDup(INT32 fd); + +extern INT32 mmUnlink(const CHAR *filename); + +extern INT32 mmChmod(const CHAR *filename, INT32 mode); + +extern INT32 mmFileno(FILE *stream); + +extern INT32 mmScandir(const CHAR *path, mmDirent ***entryList, mmFilter filterFunc, mmSort sort); + +extern VOID mmScandirFree(mmDirent **entryList, INT32 count); + +extern mmMsgid mmMsgCreate(mmKey_t key, INT32 msgFlag); + +extern mmMsgid mmMsgOpen(mmKey_t key, INT32 msgFlag); + +extern INT32 mmMsgSnd(mmMsgid msqid, VOID *buf, INT32 bufLen, INT32 msgFlag); + +extern INT32 mmMsgRcv(mmMsgid msqid, VOID *buf, INT32 bufLen, INT32 msgFlag); + +extern INT32 mmMsgClose(mmMsgid msqid); + +extern INT32 mmLocalTimeR(const time_t *timep, struct tm *result); + +extern INT32 mmGetOpt(INT32 argc, char *const *argv, const char *opts); +extern INT32 mmGetOptLong(INT32 argc, char *const *argv, const char *opts, const mmStructOption *longOpts, + INT32 *longIndex); + +extern LONG mmLseek(INT32 fd, INT64 offset, INT32 seekFlag); +extern INT32 mmFtruncate(mmProcess fd, UINT32 length); + +extern INT32 mmTlsCreate(mmThreadKey *key, VOID (*destructor)(VOID *)); +extern INT32 mmTlsSet(mmThreadKey key, const VOID *value); +extern VOID *mmTlsGet(mmThreadKey key); +extern INT32 mmTlsDelete(mmThreadKey key); +extern INT32 mmGetOsType(); + +extern INT32 mmFsync(mmProcess fd); +extern INT32 mmFsync2(INT32 fd); +extern INT32 mmChdir(const CHAR *path); +extern INT32 mmUmask(INT32 pmode); +extern INT32 mmThreadKill(mmThread id); +extern INT32 mmWaitPid(mmProcess pid, INT32 *status, INT32 options); + +extern INT32 mmGetCwd(CHAR *buffer, INT32 maxLen); +extern INT32 mmGetEnv(const CHAR *name, CHAR *value, UINT32 len); +extern INT32 mmSetEnv(const CHAR *name, const CHAR *value, INT32 overwrite); +extern CHAR *mmStrTokR(CHAR *str, const CHAR *delim, CHAR **saveptr); +extern CHAR *mmDirName(CHAR *path); +extern CHAR *mmBaseName(CHAR *path); +extern INT32 mmGetDiskFreeSpace(const char *path, mmDiskSize *diskSize); + +/* + * Function: set the thread name created by mmcreatetask + * Input: pstThreadHandle: thread ID + * name: thread name, the actual length of name must be < MMPA_THREADNAME_SIZE + * The input parameter error returns EN_INVALID_PARAM, the execution success returns EN_OK, and the + * execution failure returns EN_ERROR + */ +extern INT32 mmSetThreadName(mmThread *threadHandle, const CHAR *name); + +/* + * Function: get thread name + * Input: pstThreadHandle: thread ID + * size: Cache length of thread name + * name:User allocated cache for thread name, Cache length must be >= MMPA_THREADNAME_SIZE + * The input parameter error returns EN_INVALID_PARAM, the execution success returns EN_OK, and the + * execution failure returns EN_ERROR + */ +extern INT32 mmGetThreadName(mmThread *threadHandle, CHAR *name, INT32 size); +/* + * Function:Set the thread name of the currently executing thread - call inside the thread body + * Input:name:Thread name to be set + * The input parameter error returns EN_INVALID_PARAM, the execution success returns EN_OK, and the + * execution failure returns EN_ERROR + */ +extern INT32 mmSetCurrentThreadName(const CHAR *name); +/* + * Function:Get the thread name of the currently executing thread - in body call + * Input:name:The name of the thread to get, and the cache is allocated by the user,size>=MMPA_THREADNAME_SIZE + * The input parameter error returns EN_INVALID_PARAM, the execution success returns EN_OK, and the + * execution failure returns EN_ERROR + */ +extern INT32 mmGetCurrentThreadName(CHAR *name, INT32 size); +extern INT32 mmGetFileSize(const CHAR *fileName, ULONGLONG *length); +extern INT32 mmIsDir(const CHAR *fileName); +extern INT32 mmGetOsName(CHAR *name, INT32 nameSize); +extern INT32 mmGetOsVersion(CHAR *versionInfo, INT32 versionLength); +extern INT32 mmGetMac(mmMacInfo **list, INT32 *count); +extern INT32 mmGetMacFree(mmMacInfo *list, INT32 count); +extern INT32 mmGetCpuInfo(mmCpuDesc **cpuInfo, INT32 *count); +extern INT32 mmCpuInfoFree(mmCpuDesc *cpuInfo, INT32 count); +extern INT32 mmCreateProcess(const CHAR *fileName, const mmArgvEnv *env, const char *stdoutRedirectFile, mmProcess *id); + +extern INT32 mmCreateTaskWithThreadAttr(mmThread *threadHandle, const mmUserBlock_t *funcBlock, + const mmThreadAttr *threadAttr); +extern mmFileHandle mmShmOpen(const CHAR *name, INT32 oflag, mmMode_t mode); +extern INT32 mmShmUnlink(const CHAR *name); +extern VOID *mmMmap(mmFd_t fd, mmSize_t size, mmOfft_t offset, mmFd_t *extra, INT32 prot, INT32 flags); +extern INT32 mmMunMap(VOID *data, mmSize_t size, mmFd_t *extra); +#define MMPA_DLL_API + +#ifdef __cplusplus +#if __cplusplus +} +#endif /* __cpluscplus */ +#endif // __cpluscplus + +#endif // MMPA_LINUX_MMPA_LINUX_H_ diff --git a/inc/mmpa/sub_inc/mmpa_typedef_linux.h b/inc/mmpa/sub_inc/mmpa_typedef_linux.h new file mode 100644 index 000000000..9df5b9cec --- /dev/null +++ b/inc/mmpa/sub_inc/mmpa_typedef_linux.h @@ -0,0 +1,98 @@ +/** + * Copyright 2019-2020 Huawei Technologies Co., Ltd + * + * 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 MMPA_TYPEDEF_LINUX_H +#define MMPA_TYPEDEF_LINUX_H + +#ifdef __cplusplus +#if __cplusplus +extern "C" { +#endif // __cpluscplus +#endif // __cpluscplus + +#ifndef FALSE +#define FALSE 0 +#endif + +#ifndef TRUE +#define TRUE 1 +#endif + +typedef unsigned char UINT8; +typedef signed char INT8; +typedef unsigned short UINT16; +typedef signed short INT16; +typedef unsigned int UINT32; +typedef signed int INT32; +typedef unsigned long long UINT64; +typedef signed long long INT64; +typedef float FLOAT; +typedef double DOUBLE; +typedef void VOID; +typedef unsigned char UCHAR; +typedef char CHAR; +typedef unsigned short USHORT; +typedef short SHORT; +typedef unsigned int UINT; +typedef int INT; +typedef unsigned long ULONG; +typedef unsigned long long ULONGLONG; + +typedef long LONG; + +#define HANDLE_INVALID_VALUE (-1) +#define MMPA_MEM_MAX_LEN (0x7fffffff) +#define MMPA_PROCESS_ERROR (0x7fffffff) +#define PATH_SIZE 256 +#define MAX_IOVEC_SIZE 32 +#define MMPA_MAX_SLEEP_MILLSECOND 4294967 +#define MAX_PIPE_COUNT 2 +#define MMPA_PIPE_COUNT 2 +#define MMPA_THREADNAME_SIZE 16 +#define MMPA_MIN_OS_NAME_SIZE 64 +#define MMPA_MIN_OS_VERSION_SIZE 128 + +#define MMPA_ONE_THOUSAND 1000 +#define MMPA_ONE_BILLION 1000000000 +#define MMPA_COMPUTER_BEGIN_YEAR 1900 +#define MMPA_ZERO 0 +#define MMPA_MAX_THREAD_PIO 99 +#define MMPA_MIN_THREAD_PIO 1 +#define MMPA_DEFAULT_PIPE_PERMISSION 0777 +#define MMPA_DEFAULT_MSG_TYPE 1 + +#define MMPA_THREAD_SCHED_RR SCHED_RR +#define MMPA_THREAD_SCHED_FIFO SCHED_FIFO +#define MMPA_THREAD_SCHED_OTHER SCHED_OTHER +#define MMPA_THREAD_MIN_STACK_SIZE PTHREAD_STACK_MIN + +#define MM_MUTEX_INITIALIZER PTHREAD_MUTEX_INITIALIZER + +#define MMPA_MAX_NI 19 +#define MMPA_MIN_NI (-20) + +#define EN_OK 0 +#define EN_ERR 1 +#define EN_ERROR (-1) +#define EN_INVALID_PARAM (-2) +#define EN_TIMEOUT (-3) + +#ifdef __cplusplus +#if __cplusplus +} +#endif // __cpluscplus +#endif // __cpluscplus +#endif // MMPA_TYPEDEF_LINUX_H_ diff --git a/inc/hccl/hcom_ops_stores.h b/inc/mmpa/sub_inc/mmpa_typedef_win.h similarity index 31% rename from inc/hccl/hcom_ops_stores.h rename to inc/mmpa/sub_inc/mmpa_typedef_win.h index 274af6fde..8200bea6a 100644 --- a/inc/hccl/hcom_ops_stores.h +++ b/inc/mmpa/sub_inc/mmpa_typedef_win.h @@ -1,4 +1,4 @@ -/** +/** * Copyright 2019-2020 Huawei Technologies Co., Ltd * * Licensed under the Apache License, Version 2.0 (the "License"); @@ -14,55 +14,70 @@ * limitations under the License. */ -/** - * @file hcom_ops_stores.h - * @brief HCOM operators plugin API - */ +#ifndef MMPA_TYPEDEF_WIN_H +#define MMPA_TYPEDEF_WIN_H -#ifndef HCOM_OPS_STORES_H_ -#define HCOM_OPS_STORES_H_ +#ifdef __cplusplus +#if __cplusplus +extern "C" { +#endif // __cpluscplus +#endif // __cpluscplus -#include "common/opskernel/ops_kernel_info_store.h" -#include "common/optimizer/graph_optimizer.h" -#include "framework/common/ge_inner_error_codes.h" +#ifndef FALSE +#define FALSE 0 +#endif -using OpsKernelInfoStorePtr = std::shared_ptr; -using GraphOptimizerPtr = std::shared_ptr; +#ifndef TRUE +#define TRUE 1 +#endif -#ifdef __cplusplus -extern "C" { -#endif // __cplusplus +#define EN_OK 0 +#define EN_ERR 1 +#define EN_ERROR (-1) +#define EN_INVALID_PARAM (-2) +#define EN_TIMEOUT (-3) -/** - * @brief Initialize HCOM operators plugin. - * - * @param options Input parameter. Options must contain rank table path, deploy mode, rank id, pod name. - * @return ge::SUCCESS success; others:fail. - */ -ge::Status Initialize(const std::map &options); +#define HANDLE_INVALID_VALUE (-1) +#define INVALID_SOCKET_HANDLE INVALID_SOCKET +#define MMPA_MEM_MAX_LEN (0x7fffffff) +#define MMPA_PROCESS_ERROR (0x7fffffff) -/** - * @brief Finalize HCOM operators plugin. - * - * @return ge::SUCCESS success; others: fail. - */ -ge::Status Finalize(); +#define MMPA_ONE_THOUSAND 1000 +#define MMPA_COMPUTER_BEGIN_YEAR 1900 +#define SUMMER_TIME_OR_NOT (-1) +#define MMPA_ZERO 0 +#define MMPA_VALUE_ONE 1 +#define MMPA_SOCKET_MAIN_EDITION 2 +#define MMPA_SOCKET_SECOND_EDITION 0 +#define MMPA_PIPE_BUF_SIZE 1024 +#define MMPA_MAX_SCANDIR_COUNT 1024 +#define MAX_IOVEC_SIZE 32 +#define MMPA_PIPE_COUNT 2 +#define MMPA_THREADNAME_SIZE 16 +#define MMPA_MIN_OS_NAME_SIZE (MAX_COMPUTERNAME_LENGTH + 1) +#define MMPA_MIN_OS_VERSION_SIZE 64 -/** - * @brief Get the information store of HCOM operators. - * - * @param opKernInfos A map identifying the information store of HCOM operators. - */ -void GetOpsKernelInfoStores(std::map &opKernInfos); +#define MMPA_MAX_NI 19 +#define MMPA_MIDDLE_NI 5 +#define MMPA_LOW_NI (-5) +#define MMPA_MIN_NI (-20) +#define MMPA_MAX_FILE 128 -/** - * @brief Get the graph optimizer of HCOM operators. - * - * @param graphOptimizers A map identifying the graph optimizer of HCOM operators. - */ -void GetGraphOptimizerObjs(std::map &graphOptimizers); +#define MMPA_MAX_THREAD_PIO 99 +#define MMPA_MIDDLE_THREAD_PIO 66 +#define MMPA_LOW_THREAD_PIO 33 +#define MMPA_MIN_THREAD_PIO 1 + +#define MMPA_THREAD_SCHED_RR 0 +#define MMPA_THREAD_SCHED_FIFO 0 +#define MMPA_THREAD_SCHED_OTHER 0 +#define MMPA_THREAD_MIN_STACK_SIZE 0 + +#define MM_MUTEX_INITIALIZER NULL #ifdef __cplusplus +#if __cplusplus } -#endif // __cplusplus -#endif // HCOM_OPS_STORES_H_ +#endif // __cpluscplus +#endif // __cpluscplus +#endif // _MMPA_TYPEDEF_WIN_H_ diff --git a/inc/mmpa/sub_inc/mmpa_win.h b/inc/mmpa/sub_inc/mmpa_win.h new file mode 100644 index 000000000..6adc14268 --- /dev/null +++ b/inc/mmpa/sub_inc/mmpa_win.h @@ -0,0 +1,541 @@ +/** + * Copyright 2019-2020 Huawei Technologies Co., Ltd + * + * 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 MMPA_WIN_MMPA_WIN_H +#define MMPA_WIN_MMPA_WIN_H +#ifdef __cplusplus +#if __cplusplus +extern "C" { +#endif // __cpluscplus +#endif // __cpluscplus +#ifdef MMPA_DLL +#define MMPA_DLL_API __declspec(dllexport) +#else +#define MMPA_DLL_API __declspec(dllimport) +#endif + +#define MMPA_MACINFO_DEFAULT_SIZE 18 +#define MMPA_CPUDESC_DEFAULT_SIZE 64 + +MMPA_DLL_API extern char *optarg; +MMPA_DLL_API extern int opterr; +MMPA_DLL_API extern int optind; +MMPA_DLL_API extern int optopt; + +#pragma section(".CRT$XCU", long, read) +#pragma section(".CRT$XPU", long, read) + +typedef HANDLE mmMutex_t; +typedef HANDLE mmThread; +typedef HANDLE mmProcess; +typedef HANDLE mmPollHandle; +typedef HANDLE mmPipeHandle; +typedef HANDLE mmFileHandle; +typedef HANDLE mmCompletionHandle; +typedef HANDLE mmFd_t; +typedef CRITICAL_SECTION mmMutexFC; +typedef CONDITION_VARIABLE mmCond; + +typedef VOID *(*userProcFunc)(VOID *pulArg); +typedef struct { + userProcFunc procFunc; + VOID *pulArg; +} mmUserBlock_t; + +typedef DWORD mmThreadKey; +typedef SYSTEMTIME mmSystemTime_t; + +typedef HANDLE mmSem_t; +typedef SOCKET mmSockHandle; +typedef SRWLOCK mmRWLock_t; +typedef struct sockaddr mmSockAddr; +typedef int mmSocklen_t; +typedef int mmSemTimeout_t; +typedef long mmAtomicType; +typedef DWORD mmExitCode; +typedef DWORD mmErrorMsg; +typedef int mmKey_t; +typedef HANDLE mmMsgid; +typedef long int mmOfft_t; +typedef int mmPid_t; + +typedef INT32 mmSsize_t; +typedef int mmSize; // size +typedef size_t mmSize_t; +typedef VOID mmshmId_ds; + +typedef enum { + DT_DIR = FILE_ATTRIBUTE_DIRECTORY, +} mmDtype; + +typedef struct { + unsigned char d_type; + char d_name[MAX_PATH]; // file name +} mmDirent; + +typedef int (*mmFilter)(const mmDirent *entry); +typedef int (*mmSort)(const mmDirent **a, const mmDirent **b); + +typedef struct { + VOID *sendBuf; + INT32 sendLen; +} mmIovSegment; +typedef PVOID mmInAddr; + +typedef enum { + pollTypeRead = 1, // pipeline reading + pollTypeRecv, // socket receive + pollTypeIoctl, // ioctl read +} mmPollType; + +typedef struct { + HANDLE completionHandle; + mmPollType overlapType; + OVERLAPPED oa; +} mmComPletionKey, *pmmComPletionKey; + +typedef struct { + VOID *priv; // User defined private content + mmPollHandle bufHandle; // Value of handle corresponding to buf + mmPollType bufType; // Data types polled to + VOID *buf; + UINT32 bufLen; + UINT32 bufRes; +} mmPollData, *pmmPollData; + +typedef VOID (*mmPollBack)(pmmPollData); +typedef struct { + mmPollHandle handle; // The file descriptor or handle of poll is required + mmPollType pollType; // Operation type requiring poll,read or recv or ioctl + INT32 ioctlCode; // IOCTL operation code, dedicated to IOCTL + mmComPletionKey completionKey; // The default value is blank, which will be used in windows to receive the data with + // different handle +} mmPollfd; + +typedef struct { + OVERLAPPED oa; + HANDLE completionHandle; + WSABUF DataBuf; +} PRE_IO_DATA, *PPRE_IO_DATA; + +typedef OVERLAPPED mmOverLap; + +typedef struct { + UINT32 createFlag; + INT32 oaFlag; // Overlap operation is supported if it is not 0 +} mmCreateFlag; + +typedef struct { + VOID *inbuf; + INT32 inbufLen; + VOID *outbuf; + INT32 outbufLen; + mmOverLap *oa; +} mmIoctlBuf; + +typedef struct { + HANDLE timerQueue; + HANDLE timerHandle; +} mmTimerHandle; + +typedef struct { + LONG tv_sec; + LONG tv_usec; +} mmTimeval; + +typedef struct { + INT32 tz_minuteswest; // How many minutes is it different from Greenwich + INT32 tz_dsttime; // DST correction type +} mmTimezone; + +typedef struct { + LONG tv_sec; + LONG tv_nsec; +} mmTimespec; + +typedef mmTimerHandle mmTimer; + +#define mmTLS __declspec(thread) + +typedef struct stat mmStat_t; +typedef struct _stat64 mmStat64_t; +typedef int mmMode_t; + +typedef int MODE; + +typedef struct { + const char *name; + int has_arg; + int *flag; + int val; +} mmStructOption; + +typedef struct { + ULONGLONG totalSize; + ULONGLONG freeSize; + ULONGLONG availSize; +} mmDiskSize; + +typedef struct { + const char *dli_fname; + void *dli_fbase; + const char *dli_sname; + void *dli_saddr; + size_t dli_size; /* ELF only */ + int dli_bind; /* ELF only */ + int dli_type; +} mmDlInfo; + +typedef struct { + char addr[MMPA_MACINFO_DEFAULT_SIZE]; // ex:aa-bb-cc-dd-ee-ff\0 +} mmMacInfo; + +typedef struct { + char arch[MMPA_CPUDESC_DEFAULT_SIZE]; + char manufacturer[MMPA_CPUDESC_DEFAULT_SIZE]; // vendor + char version[MMPA_CPUDESC_DEFAULT_SIZE]; // modelname + INT32 frequency; // cpu frequency + INT32 maxFrequency; // max speed + INT32 ncores; // cpu cores + INT32 nthreads; // cpu thread count + INT32 ncounts; // logical cpu nums +} mmCpuDesc; + +typedef struct { + char **argv; + INT32 argvCount; + char **envp; + INT32 envpCount; +} mmArgvEnv; + +// Windows currently does not support properties other than thread separation properties +typedef struct { + INT32 detachFlag; // Thread detach property: 0 do not detach 1 detach + INT32 priorityFlag; + INT32 priority; + INT32 policyFlag; + INT32 policy; + INT32 stackFlag; + UINT32 stackSize; +} mmThreadAttr; + +typedef VOID (*mmPf)(VOID); +#define M_FILE_RDONLY GENERIC_READ +#define M_FILE_WRONLY GENERIC_WRITE +#define M_FILE_RDWR (GENERIC_READ | GENERIC_WRITE) +#define M_FILE_CREAT OPEN_ALWAYS + +#define M_RDONLY _O_RDONLY +#define M_WRONLY _O_WRONLY +#define M_RDWR _O_RDWR +#define M_IRWXU _O_RDWR +#define M_CREAT _O_CREAT +#define M_BINARY _O_BINARY +#define M_TRUNC _O_TRUNC + +#define M_IREAD _S_IREAD +#define M_IRUSR _S_IREAD +#define M_IWRITE _S_IWRITE +#define M_IWUSR _S_IWRITE +#define M_IXUSR 0 + +#define M_IN_CREATE FILE_NOTIFY_CHANGE_FILE_NAME | FILE_NOTIFY_CHANGE_DIR_NAME +#define M_IN_CLOSE_WRITE FILE_NOTIFY_CHANGE_LAST_WRITE +#define M_IN_IGNORED FILE_NOTIFY_CHANGE_FILE_NAME | FILE_NOTIFY_CHANGE_DIR_NAME + +#define M_OUT_CREATE 0x00000100 +#define M_OUT_CLOSE_WRITE 0x00000008 +#define M_OUT_IGNORED 0x00008000 +#define M_OUT_ISDIR 0x40000000 + +#define M_MSG_CREAT 1 +#define M_MSG_EXCL 2 +#define M_MSG_NOWAIT 3 + +#define M_WAIT_NOHANG 1 +#define M_WAIT_UNTRACED 2 + +#define M_UMASK_USRREAD _S_IREAD +#define M_UMASK_GRPREAD _S_IREAD +#define M_UMASK_OTHREAD _S_IREAD + +#define M_UMASK_USRWRITE _S_IWRITE +#define M_UMASK_GRPWRITE _S_IWRITE +#define M_UMASK_OTHWRITE _S_IWRITE + +#define M_UMASK_USREXEC 0 +#define M_UMASK_GRPEXEC 0 +#define M_UMASK_OTHEXEC 0 + +#define DT_UNKNOWN 0 +#define DT_FIFO 1 +#define DT_CHR 2 +#define DT_DIR 4 +#define DT_BLK 6 +#define DT_REG 8 +#define DT_LNK 10 +#define DT_SOCK 12 +#define DT_WHT 14 + +#define mmConstructor(x) __declspec(allocate(".CRT$XCU")) mmPf con = x +#define mmDestructor(x) __declspec(allocate(".CRT$XPU")) mmPf de = x + +#define MMPA_PRINT_ERROR ((opterr) && (*options != ':')) +#define MMPA_FLAG_PERMUTE 0x01 // permute non-options to the end of argv +#define MMPA_FLAG_ALLARGS 0x02 // treat non-options as args to option "-1" +#define MMPA_FLAG_LONGONLY 0x04 // operate as getopt_long_only +// return values +#define MMPA_BADCH (INT32)'?' +#define MMPA_BADARG ((*options == ':') ? (INT32)':' : (INT32)'?') +#define MMPA_INORDER (INT32)1 + +#define MMPA_NO_ARGUMENT 0 +#define MMPA_REQUIRED_ARGUMENT 1 +#define MMPA_OPTIONAL_ARGUMENT 2 + +#define MMPA_EMSG "" +#define MMPA_MAX_PATH MAX_PATH +#define M_NAME_MAX _MAX_FNAME + +#define M_F_OK 0 +#define M_W_OK 2 +#define M_R_OK 4 + +#define MMPA_STDIN stdin +#define MMPA_STDOUT stdout +#define MMPA_STDERR stderr + +#define MMPA_RTLD_NOW 0 +#define MMPA_RTLD_GLOBAL 0 +#define MMPA_RTLD_LAZY 0 +#define MMPA_RTLD_NODELETE 0 + +#define MMPA_DL_EXT_NAME ".dll" + +#define __attribute__(v) + +_declspec(dllexport) INT32 mmCreateTask(mmThread *threadHandle, mmUserBlock_t *funcBlock); +_declspec(dllexport) INT32 mmJoinTask(mmThread *threadHandle); +_declspec(dllexport) INT32 mmMutexInit(mmMutex_t *mutex); +_declspec(dllexport) INT32 mmMutexLock(mmMutex_t *mutex); +_declspec(dllexport) INT32 mmMutexTryLock(mmMutex_t *mutex); +_declspec(dllexport) INT32 mmMutexUnLock(mmMutex_t *mutex); +_declspec(dllexport) INT32 mmMutexDestroy(mmMutex_t *mutex); +_declspec(dllexport) INT32 mmCondInit(mmCond *cond); +_declspec(dllexport) INT32 mmCondLockInit(mmMutexFC *mutex); +_declspec(dllexport) INT32 mmCondLock(mmMutexFC *mutex); +_declspec(dllexport) INT32 mmCondUnLock(mmMutexFC *mutex); +_declspec(dllexport) INT32 mmCondLockDestroy(mmMutexFC *mutex); +_declspec(dllexport) INT32 mmRWLockInit(mmRWLock_t *rwLock); +_declspec(dllexport) INT32 mmRWLockRDLock(mmRWLock_t *rwLock); +_declspec(dllexport) INT32 mmRWLockTryRDLock(mmRWLock_t *rwLock); +_declspec(dllexport) INT32 mmRWLockWRLock(mmRWLock_t *rwLock); +_declspec(dllexport) INT32 mmRWLockTryWRLock(mmRWLock_t *rwLock); +_declspec(dllexport) INT32 mmRDLockUnLock(mmRWLock_t *rwLock); +_declspec(dllexport) INT32 mmWRLockUnLock(mmRWLock_t *rwLock); +_declspec(dllexport) INT32 mmRWLockDestroy(mmRWLock_t *rwLock); +_declspec(dllexport) INT32 mmCondWait(mmCond *cond, mmMutexFC *mutex); +_declspec(dllexport) INT32 mmCondTimedWait(mmCond *cond, mmMutexFC *mutex, UINT32 milliSecond); + +_declspec(dllexport) INT32 mmCondNotify(mmCond *cond); +_declspec(dllexport) INT32 mmCondNotifyAll(mmCond *cond); +_declspec(dllexport) INT32 mmCondDestroy(mmCond *cond); +_declspec(dllexport) INT32 mmGetPid(VOID); +_declspec(dllexport) INT32 mmGetTid(VOID); +_declspec(dllexport) INT32 mmGetPidHandle(mmProcess *processHandle); +_declspec(dllexport) INT32 mmGetLocalTime(mmSystemTime_t *sysTime); +_declspec(dllexport) INT32 mmGetSystemTime(mmSystemTime_t *sysTime); +_declspec(dllexport) INT32 mmSemInit(mmSem_t *sem, UINT32 value); +_declspec(dllexport) INT32 mmSemWait(mmSem_t *sem); +_declspec(dllexport) INT32 mmSemPost(mmSem_t *sem); +_declspec(dllexport) INT32 mmSemDestroy(mmSem_t *sem); +_declspec(dllexport) INT32 mmOpen(const CHAR *pathName, INT32 flags); +_declspec(dllexport) INT32 mmOpen2(const CHAR *pathName, INT32 flags, MODE mode); +_declspec(dllexport) FILE *mmPopen(CHAR *command, CHAR *type); +_declspec(dllexport) INT32 mmClose(INT32 fd); +_declspec(dllexport) INT32 mmPclose(FILE *stream); +_declspec(dllexport) mmSsize_t mmWrite(INT32 fd, VOID *buf, UINT32 bufLen); +_declspec(dllexport) mmSsize_t mmRead(INT32 fd, VOID *buf, UINT32 bufLen); +_declspec(dllexport) mmSockHandle mmSocket(INT32 sockFamily, INT32 type, INT32 protocol); +_declspec(dllexport) INT32 mmBind(mmSockHandle sockFd, mmSockAddr *addr, mmSocklen_t addrLen); +_declspec(dllexport) INT32 mmListen(mmSockHandle sockFd, INT32 backLog); +_declspec(dllexport) mmSockHandle mmAccept(mmSockHandle sockFd, mmSockAddr *addr, mmSocklen_t *addrLen); +_declspec(dllexport) INT32 mmConnect(mmSockHandle sockFd, mmSockAddr *addr, mmSocklen_t addrLen); +_declspec(dllexport) INT32 mmCloseSocket(mmSockHandle sockFd); +_declspec(dllexport) mmSsize_t mmSocketRecv(mmSockHandle sockFd, VOID *recvBuf, INT32 recvLen, INT32 recvFlag); +_declspec(dllexport) mmSsize_t mmSocketSend(mmSockHandle sockFd, VOID *sendBuf, INT32 sendLen, INT32 sendFlag); +_declspec(dllexport) INT32 mmSocketSendTo(mmSockHandle sockFd, + VOID *sendMsg, + INT32 sendLen, + UINT32 sendFlag, + const mmSockAddr* addr, + INT32 tolen); +_declspec(dllexport) mmSsize_t mmSocketRecvFrom(mmSockHandle sockFd, + VOID *recvBuf, + mmSize recvLen, + UINT32 recvFlag, + mmSockAddr* addr, + mmSocklen_t *FromLen); +_declspec(dllexport) INT32 mmSAStartup(VOID); +_declspec(dllexport) INT32 mmSACleanup(VOID); +_declspec(dllexport) VOID *mmDlopen(const CHAR *fileName, INT mode); +_declspec(dllexport) INT32 mmDladdr(VOID *addr, mmDlInfo *info); +_declspec(dllexport) VOID *mmDlsym(VOID *handle, CHAR *fileName); +_declspec(dllexport) INT32 mmDlclose(VOID *handle); +_declspec(dllexport) CHAR *mmDlerror(VOID); +_declspec(dllexport) INT32 + mmCreateAndSetTimer(mmTimer *timerHandle, mmUserBlock_t *timerBlock, UINT milliSecond, UINT period); +_declspec(dllexport) INT32 mmDeleteTimer(mmTimer timerHandle); +_declspec(dllexport) INT32 mmStatGet(const CHAR *path, mmStat_t *buffer); +_declspec(dllexport) INT32 mmStat64Get(const CHAR *path, mmStat64_t *buffer); +_declspec(dllexport) INT32 mmFStatGet(INT32 fd, mmStat_t *buffer); +_declspec(dllexport) INT32 mmMkdir(const CHAR *pathName, mmMode_t mode); +_declspec(dllexport) INT32 mmSleep(UINT32 milliSecond); +_declspec(dllexport) INT32 mmCreateTaskWithAttr(mmThread *threadHandle, mmUserBlock_t *funcBlock); +_declspec(dllexport) INT32 mmGetProcessPrio(mmProcess pid); +_declspec(dllexport) INT32 mmSetProcessPrio(mmProcess pid, INT32 processPrio); +_declspec(dllexport) INT32 mmGetThreadPrio(mmThread *threadHandle); +_declspec(dllexport) INT32 mmSetThreadPrio(mmThread *threadHandle, INT32 threadPrio); +_declspec(dllexport) INT32 mmAccess(const CHAR *pathName); +_declspec(dllexport) INT32 mmAccess2(const CHAR *pathName, INT32 mode); +_declspec(dllexport) INT32 mmRmdir(const CHAR *pathName); + +_declspec(dllexport) INT32 mmIoctl(mmProcess fd, INT32 ioctlCode, mmIoctlBuf *bufPtr); +_declspec(dllexport) INT32 mmSemTimedWait(mmSem_t *sem, INT32 timeout); +_declspec(dllexport) mmSsize_t mmWritev(mmSockHandle fd, mmIovSegment *iov, INT32 iovcnt); +_declspec(dllexport) VOID mmMb(); +_declspec(dllexport) INT32 mmInetAton(const CHAR *addrStr, mmInAddr *addr); + +_declspec(dllexport) mmProcess mmOpenFile(const CHAR *fileName, UINT32 access, mmCreateFlag fileFlag); +_declspec(dllexport) mmSsize_t mmReadFile(mmProcess fileId, VOID *buffer, INT32 len); +_declspec(dllexport) mmSsize_t mmWriteFile(mmProcess fileId, VOID *buffer, INT32 len); +_declspec(dllexport) INT32 mmCloseFile(mmProcess fileId); + +_declspec(dllexport) mmAtomicType mmSetData(mmAtomicType *ptr, mmAtomicType value); +_declspec(dllexport) mmAtomicType mmValueInc(mmAtomicType *ptr, mmAtomicType value); +_declspec(dllexport) mmAtomicType mmValueSub(mmAtomicType *ptr, mmAtomicType value); +_declspec(dllexport) INT32 mmCreateTaskWithDetach(mmThread *threadHandle, mmUserBlock_t *funcBlock); + +_declspec(dllexport) INT32 mmCreateNamedPipe(mmPipeHandle pipe[], CHAR *pipeName[], INT32 waitMode); +_declspec(dllexport) INT32 mmOpenNamePipe(mmPipeHandle pipe[], CHAR *pipeName[], INT32 waitMode); +_declspec(dllexport) VOID mmCloseNamedPipe(mmPipeHandle namedPipe[]); + +_declspec(dllexport) INT32 mmCreatePipe(mmPipeHandle pipe[], CHAR *pipeName[], UINT32 pipeCount, INT32 waitMode); +_declspec(dllexport) INT32 mmOpenPipe(mmPipeHandle pipe[], CHAR *pipeName[], UINT32 pipeCount, INT32 waitMode); +_declspec(dllexport) VOID mmClosePipe(mmPipeHandle pipe[], UINT32 pipeCount); + +_declspec(dllexport) mmCompletionHandle mmCreateCompletionPort(); +_declspec(dllexport) VOID mmCloseCompletionPort(mmCompletionHandle handle); +_declspec(dllexport) INT32 mmPoll(mmPollfd *fds, INT32 fdCount, INT32 timeout, mmCompletionHandle handleIOCP, + pmmPollData polledData, mmPollBack pollBack); + +_declspec(dllexport) INT32 mmGetErrorCode(); +_declspec(dllexport) CHAR *mmGetErrorFormatMessage(mmErrorMsg errnum, CHAR *buf, mmSize size); +_declspec(dllexport) INT32 mmGetTimeOfDay(mmTimeval *timeVal, mmTimezone *timeZone); +_declspec(dllexport) mmTimespec mmGetTickCount(); +_declspec(dllexport) INT32 mmGetRealPath(CHAR *path, CHAR *realPath); + +_declspec(dllexport) INT32 mmRealPath(const CHAR *path, CHAR *realPath, INT32 realPathLen); + +_declspec(dllexport) INT32 mmDup2(INT32 oldFd, INT32 newFd); +_declspec(dllexport) INT32 mmDup(INT32 fd); +_declspec(dllexport) INT32 mmUnlink(const CHAR *filename); +_declspec(dllexport) INT32 mmChmod(const CHAR *filename, INT32 mode); +_declspec(dllexport) INT32 mmFileno(FILE *stream); +_declspec(dllexport) INT32 mmScandir(const CHAR *path, mmDirent ***entryList, mmFilter filterFunc, mmSort sort); +_declspec(dllexport) VOID mmScandirFree(mmDirent **entryList, INT32 count); + +_declspec(dllexport) mmMsgid mmMsgCreate(mmKey_t key, INT32 msgFlag); +_declspec(dllexport) mmMsgid mmMsgOpen(mmKey_t key, INT32 msgFlag); +_declspec(dllexport) INT32 mmMsgRcv(mmMsgid msqid, VOID *buf, INT32 bufLen, INT32 msgFlag); +_declspec(dllexport) INT32 mmMsgSnd(mmMsgid msqid, VOID *buf, INT32 bufLen, INT32 msgFlag); + +_declspec(dllexport) INT32 mmMsgClose(mmMsgid msqid); + +_declspec(dllexport) INT32 mmLocalTimeR(const time_t *timep, struct tm *result); +_declspec(dllexport) INT32 mmGetOpt(INT32 argc, char *const *argv, const char *opts); +_declspec(dllexport) INT32 + mmGetOptLong(INT32 argc, CHAR *const *argv, const CHAR *opts, const mmStructOption *longopts, INT32 *longindex); + +_declspec(dllexport) LONG mmLseek(INT32 fd, INT64 offset, INT32 seekFlag); +_declspec(dllexport) INT32 mmFtruncate(mmProcess fd, UINT32 length); + +_declspec(dllexport) INT32 mmTlsCreate(mmThreadKey *key, VOID (*destructor)(VOID *)); +_declspec(dllexport) INT32 mmTlsSet(mmThreadKey key, const VOID *value); +_declspec(dllexport) VOID *mmTlsGet(mmThreadKey key); +_declspec(dllexport) INT32 mmTlsDelete(mmThreadKey key); +_declspec(dllexport) INT32 mmGetOsType(); + +_declspec(dllexport) INT32 mmFsync(mmProcess fd); +_declspec(dllexport) INT32 mmFsync2(INT32 fd); +_declspec(dllexport) INT32 mmChdir(const CHAR *path); +_declspec(dllexport) INT32 mmUmask(INT32 pmode); +_declspec(dllexport) INT32 mmWaitPid(mmProcess pid, INT32 *status, INT32 options); + +_declspec(dllexport) INT32 mmGetCwd(CHAR *buffer, INT32 maxLen); +_declspec(dllexport) CHAR *mmStrTokR(CHAR *str, const CHAR *delim, CHAR **saveptr); + +_declspec(dllexport) INT32 mmGetEnv(const CHAR *name, CHAR *value, UINT32 len); +_declspec(dllexport) INT32 mmSetEnv(const CHAR *name, const CHAR *value, INT32 overwrite); +_declspec(dllexport) CHAR *mmDirName(CHAR *path); +_declspec(dllexport) CHAR *mmBaseName(CHAR *path); +_declspec(dllexport) INT32 mmGetDiskFreeSpace(const char *path, mmDiskSize *diskSize); + +_declspec(dllexport) INT32 mmSetThreadName(mmThread *threadHandle, const CHAR *name); +_declspec(dllexport) INT32 mmGetThreadName(mmThread *threadHandle, CHAR *name, INT32 size); + +/* + * Function: set the thread name of the currently executing thread - internal call of thread, which is not supported + * under Windows temporarily, and is null. + * Input: name: the thread name to be set + * The input parameter error returns EN_INVALID_PARAM, the execution success returns EN_OK, and the + * execution failure returns EN_ERROR + */ +_declspec(dllexport) INT32 mmSetCurrentThreadName(const CHAR *name); + +/* + * Function: Get the thread name of the currently executing thread - thread body call, not supported under windows, null + * implementation. + * Input:name:The name of the thread to get, and the cache is allocated by the user,size>=MMPA_THREADNAME_SIZE. + * The input parameter error returns EN_INVALID_PARAM, the execution success returns + * EN_OK, and the execution failure returns EN_ERROR + */ +_declspec(dllexport) INT32 mmGetCurrentThreadName(CHAR *name, INT32 size); + +_declspec(dllexport) INT32 mmGetFileSize(const CHAR *fileName, ULONGLONG *length); +_declspec(dllexport) INT32 mmIsDir(const CHAR *fileName); +_declspec(dllexport) INT32 mmGetOsName(CHAR *name, INT32 nameSize); +_declspec(dllexport) INT32 mmGetOsVersion(CHAR *versionInfo, INT32 versionLength); +_declspec(dllexport) INT32 mmGetMac(mmMacInfo **list, INT32 *count); +_declspec(dllexport) INT32 mmGetMacFree(mmMacInfo *list, INT32 count); +_declspec(dllexport) INT32 mmGetCpuInfo(mmCpuDesc **cpuInfo, INT32 *count); +_declspec(dllexport) INT32 mmCpuInfoFree(mmCpuDesc *cpuInfo, INT32 count); +_declspec(dllexport) INT32 + mmCreateProcess(const CHAR *fileName, const mmArgvEnv *env, const char *stdoutRedirectFile, mmProcess *id); + +_declspec(dllexport) INT32 + mmCreateTaskWithThreadAttr(mmThread *threadHandle, const mmUserBlock_t *funcBlock, const mmThreadAttr *threadAttr); +_declspec(dllexport) mmFileHandle mmShmOpen(const CHAR *name, INT32 oflag, mmMode_t mode); +_declspec(dllexport) INT32 mmShmUnlink(const CHAR *name); +_declspec(dllexport) VOID *mmMmap(mmFd_t fd, mmSize_t size, mmOfft_t offset, mmFd_t *extra, INT32 prot, INT32 flags); +_declspec(dllexport) INT32 mmMunMap(VOID *data, mmSize_t size, mmFd_t *extra); +#ifdef __cplusplus +#if __cplusplus +} +#endif /* __cpluscplus */ +#endif // __cpluscplus + +#endif // MMPA_WIN_MMPA_WIN_H_ diff --git a/inc/register/graph_optimizer/buffer_fusion/buffer_fusion_constant.h b/inc/register/graph_optimizer/buffer_fusion/buffer_fusion_constant.h deleted file mode 100644 index 8a661e429..000000000 --- a/inc/register/graph_optimizer/buffer_fusion/buffer_fusion_constant.h +++ /dev/null @@ -1,74 +0,0 @@ -/** - * @file buffer_fusion_constant.h - * - * Copyright(C), 2017 - 2017, Huawei Tech. Co., Ltd. ALL RIGHTS RESERVED. - * - * @brief define the pattern. - * - * @author Huawei - * - * @version 1.0 - * - */ -#ifndef INC_REGISTER_GRAPH_OPTIMIZER_BUFFER_FUSION_CONSTANT_H_ -#define INC_REGISTER_GRAPH_OPTIMIZER_BUFFER_FUSION_CONSTANT_H_ -#include -#include - -namespace fe { -// add the op pattern -static const std::string TBE_PATTERN_INPUT_NODE = "InputData"; -static const std::string TBE_PATTERN_OP_TYPE_ANY = "OpTypeAny"; -static const std::string TBE_PATTERN_OUTPUT_NODE = "OutputData"; -static const std::string OP_PATTERN_ELEMWISE = "ElemWise"; -static const std::string OP_PATTERN_COMMONREDUCE = "CommReduce"; -static const std::string OP_PATTERN_SEGMENT = "Segment"; -static const std::string OP_PATTERN_MAXPOOL = "MaxPool"; -static const std::string OP_PATTERN_CONV = "Convolution"; -static const std::string OP_PATTERN_MATMUL = "Matmul"; -static const std::string OP_PATTERN_BNUPDATE = "bn_update"; -static const std::string OP_PATTERN_BNREDUCE = "bn_reduce"; -static const std::string OP_PATTERN_CONV_BACKPROP_INPUT = - "Conv2d_backprop_input"; -static const std::string OP_PATTERN_DEPTHWISE_CONV = "DepthwiseConvolution"; -static const std::string OP_PATTERN_QUANT = "quant"; -static const std::string OP_PATTERN_DEQUANT = "dequant"; -static const std::string OP_PATTERN_REQUANT = "requant"; -static const std::string OP_PATTERN_POOL2D = "Pool2d"; -static const std::string OP_PATTERN_ANTIQUANT = "anti_quant"; -static const std::string OP_PATTERN_STRIDED_WRITE = "strided_write"; -static const std::string OP_PATTERN_STRIDED_READ = "strided_read"; -static const std::string OP_PATTERN_AIPP = "aipp"; -static const std::string OP_PATTERN_CONFUSION_TRANSPOSE = "confusiontranspose"; -static const std::string OP_PATTERN_DEQUANTS16 = "dequant_s16"; -static const std::string OP_PATTERN_REQUANTS16 = "requant_s16"; -static const std::string OP_PATTERN_READ_SELECT = "read_select"; -static const std::string OP_PATTERN_WRITE_SELECT = "write_select"; - -static const std::vector OP_PATTERN_VEC{ - OP_PATTERN_ELEMWISE, - OP_PATTERN_COMMONREDUCE, - OP_PATTERN_SEGMENT, - OP_PATTERN_MAXPOOL, - OP_PATTERN_CONV, - OP_PATTERN_MATMUL, - OP_PATTERN_BNUPDATE, - OP_PATTERN_BNREDUCE, - OP_PATTERN_CONV_BACKPROP_INPUT, - OP_PATTERN_DEPTHWISE_CONV, - OP_PATTERN_QUANT, - OP_PATTERN_DEQUANT, - OP_PATTERN_REQUANT, - OP_PATTERN_POOL2D, - OP_PATTERN_ANTIQUANT, - OP_PATTERN_STRIDED_WRITE, - OP_PATTERN_STRIDED_READ, - OP_PATTERN_AIPP, - OP_PATTERN_CONFUSION_TRANSPOSE, - OP_PATTERN_DEQUANTS16, - OP_PATTERN_REQUANTS16, - OP_PATTERN_READ_SELECT, - OP_PATTERN_WRITE_SELECT}; -} // namespace fe - -#endif // INC_REGISTER_GRAPH_OPTIMIZER_BUFFER_FUSION_CONSTANT_H_ diff --git a/inc/register/graph_optimizer/buffer_fusion/buffer_fusion_pass_base.h b/inc/register/graph_optimizer/buffer_fusion/buffer_fusion_pass_base.h deleted file mode 100644 index d5dc2a834..000000000 --- a/inc/register/graph_optimizer/buffer_fusion/buffer_fusion_pass_base.h +++ /dev/null @@ -1,36 +0,0 @@ -#ifndef INC_REGISTER_GRAPH_OPTIMIZER_BUFFER_FUSION_PASS_BASE_H_ -#define INC_REGISTER_GRAPH_OPTIMIZER_BUFFER_FUSION_PASS_BASE_H_ - -#include "register/graph_optimizer/buffer_fusion/buffer_fusion_constant.h" -#include "register/graph_optimizer/buffer_fusion/buffer_fusion_pattern.h" -#include "register/graph_optimizer/graph_optimize_register_error_codes.h" -#include -#include -#include -#include - -namespace fe { -enum BufferFusionPassType { - BUILT_IN_AI_CORE_BUFFER_FUSION_PASS, - BUILT_IN_VECTOR_CORE_BUFFER_FUSION_PASS, - CUSTOM_AI_CORE_BUFFER_FUSION_PASS, - CUSTOM_VECTOR_CORE_BUFFER_FUSION_PASS, - BUFFER_FUSION_PASS_TYPE_RESERVED -}; -class BufferFusionPassBase { -public: - explicit BufferFusionPassBase(); - virtual ~BufferFusionPassBase(); - virtual std::vector DefinePatterns() = 0; - virtual Status GetFusionNodes(const BufferFusionMapping &mapping, - vector &fusionNodes); - std::vector GetMatchedNodes(const BufferFusionMapping &mapping); - std::vector - GetMatchedNodesByDescName(const std::string &descName, - const BufferFusionMapping &mapping); - ge::NodePtr GetMatchedHeadNode(const std::vector &matchedNodes); -}; - -} // namespace fe - -#endif // INC_REGISTER_GRAPH_OPTIMIZER_BUFFER_FUSION_PASS_BASE_H_ diff --git a/inc/register/graph_optimizer/buffer_fusion/buffer_fusion_pass_registry.h b/inc/register/graph_optimizer/buffer_fusion/buffer_fusion_pass_registry.h deleted file mode 100644 index fb7f70eb5..000000000 --- a/inc/register/graph_optimizer/buffer_fusion/buffer_fusion_pass_registry.h +++ /dev/null @@ -1,66 +0,0 @@ -/** - * @file buffer_fusion_pass_registry.h - * - * Copyright(C), 2017 - 2017, Huawei Tech. Co., Ltd. ALL RIGHTS RESERVED. - * - * @brief provide interface: BufferFusionByPass - * - * @author Huawei - * - * @version 1.0 - * - */ -#ifndef INC_REGISTER_GRAPH_OPTIMIZER_BUFFER_FUSION_PASS_REGISTRY_H_ -#define INC_REGISTER_GRAPH_OPTIMIZER_BUFFER_FUSION_PASS_REGISTRY_H_ -#include "register/graph_optimizer/buffer_fusion/buffer_fusion_pass_base.h" -#include -#include -#include -#include - -namespace fe { -class BufferFusionPassRegistry { -public: - using CreateFn = BufferFusionPassBase *(*)(); - ~BufferFusionPassRegistry(); - - static BufferFusionPassRegistry &GetInstance(); - - void RegisterPass(const BufferFusionPassType &pass_type, - const std::string &pass_name, CreateFn create_fn); - - std::map - GetCreateFnByType(const BufferFusionPassType &pass_type); - -private: - BufferFusionPassRegistry(); - class BufferFusionPassRegistryImpl; - std::unique_ptr impl_; -}; - -class BufferFusionPassRegistrar { -public: - BufferFusionPassRegistrar(const BufferFusionPassType &pass_type, - const std::string &pass_name, - BufferFusionPassBase *(*create_fun)()); - ~BufferFusionPassRegistrar() {} -}; - -#define REGISTER_BUFFER_FUSION_PASS(pass_name, pass_type, pass_class) \ - REGISTER_BUFFER_FUSION_PASS_UNIQ_HELPER(__COUNTER__, pass_name, pass_type, \ - pass_class) - -#define REGISTER_BUFFER_FUSION_PASS_UNIQ_HELPER(ctr, pass_name, pass_type, \ - pass_class) \ - REGISTER_BUFFER_FUSION_PASS_UNIQ(ctr, pass_name, pass_type, pass_class) - -#define REGISTER_BUFFER_FUSION_PASS_UNIQ(ctr, pass_name, pass_type, \ - pass_class) \ - static ::fe::BufferFusionPassRegistrar register_buffer_fusion_pass##ctr \ - __attribute__((unused)) = ::fe::BufferFusionPassRegistrar( \ - pass_type, pass_name, []() -> ::fe::BufferFusionPassBase * { \ - return new (std::nothrow) pass_class(); \ - }) - -} // namespace fe -#endif // INC_REGISTER_GRAPH_OPTIMIZER_BUFFER_FUSION_PASS_REGISTRY_H_ diff --git a/inc/register/graph_optimizer/buffer_fusion/buffer_fusion_pattern.h b/inc/register/graph_optimizer/buffer_fusion/buffer_fusion_pattern.h deleted file mode 100644 index 575b55664..000000000 --- a/inc/register/graph_optimizer/buffer_fusion/buffer_fusion_pattern.h +++ /dev/null @@ -1,74 +0,0 @@ -#ifndef INC_REGISTER_GRAPH_OPTIMIZER_BUFFER_FUSION_PATTERN_H_ -#define INC_REGISTER_GRAPH_OPTIMIZER_BUFFER_FUSION_PATTERN_H_ -#include "graph/debug/ge_attr_define.h" -#include "graph/utils/attr_utils.h" -#include "graph/utils/graph_utils.h" -#include -#include -#include - -namespace fe { -static const int TBE_FUSION_OP_NUM_MAX = 5; -static const int TBE_PATTERN_NUM_MAX = 5; -static const int TBE_PATTERN_NUM_NONE = 0; -static const int TBE_PATTERN_NUM_DEFAULT = 1; -static const int TBE_OUTPUT_BRANCH_SINGLE = 1; -static const int TBE_OUTPUT_BRANCH_MULTI = 2; -static const int TBE_PATTERN_GROUPID_INVALID = -1; - -struct BufferFusionOpDesc { - std::string descName; // description name - std::vector types; // description type - std::vector inputs; // all input op - std::vector outputs; // all output op - int64_t outBranchType; // out desc type, 1:single, 2: multi - int64_t repeateMin; // opdesc min repeat num - int64_t repeateMax; // opdesc max repeat num - int64_t repeateCurr; // opdesc current repeat num - bool matchStatus; - int64_t groupId; // record desc groupid, need one desc matched at least in - // the same group -}; -using BufferFusionMapping = - std::map>; -using BufferFusionMappings = std::vector; - -class BufferFusionPattern { -public: - explicit BufferFusionPattern(std::string name = "", - int64_t opMaxCount = TBE_FUSION_OP_NUM_MAX); - - virtual ~BufferFusionPattern(); - - BufferFusionPattern &AddOpDesc(const std::string &descName, - const std::vector &patterns, - int64_t repeatMin = TBE_PATTERN_NUM_DEFAULT, - int64_t repeatMax = TBE_PATTERN_NUM_DEFAULT, - int64_t groupId = TBE_PATTERN_GROUPID_INVALID); - - BufferFusionPattern &SetOutputs(const std::string &descName, - const std::vector &patterns, - int64_t relation = TBE_OUTPUT_BRANCH_SINGLE); - - BufferFusionPattern &SetHead(const std::vector &opPatterns); - - std::string GetName(); - int64_t GetOpMaxCount(); - std::vector GetOpDescs(); - bool GetOutputs(BufferFusionOpDesc *opDesc, - std::vector &outputs); - std::vector GetHead(); - int64_t GetErrorCnt(); - void InitRepeatCurr(const BufferFusionPattern &pattern); - -private: - BufferFusionOpDesc *GetOpDesc(const std::string &descName); - std::string name_; - int64_t opMaxCount_; - std::vector ops_; - std::map opMap_; - std::vector head_; - int64_t errorCount_; -}; -} // namespace fe -#endif // INC_REGISTER_GRAPH_OPTIMIZER_BUFFER_FUSION_PATTERN_H_ \ No newline at end of file diff --git a/inc/register/graph_optimizer/fusion_common/graph_pass_util.h b/inc/register/graph_optimizer/fusion_common/graph_pass_util.h deleted file mode 100644 index c01000f8d..000000000 --- a/inc/register/graph_optimizer/fusion_common/graph_pass_util.h +++ /dev/null @@ -1,250 +0,0 @@ -/** - * @file graph_pass.h - * Copyright (c) Huawei Technologies Co., Ltd. 2019-2019. All rights reserved. - * - * @brief define graph pass, which provides two interface: 1. run pass; - * 2. record op names before fusion - * - * @author Huawei - * - * @version 1.0 - */ - -#ifndef INC_REGISTER_GRAPH_OPTIMIZER_GRAPH_PASS_UTIL_H_ -#define INC_REGISTER_GRAPH_OPTIMIZER_GRAPH_PASS_UTIL_H_ -#include "graph/compute_graph.h" -#include "graph/debug/ge_attr_define.h" -#include "graph/utils/attr_utils.h" -#include "graph/utils/node_utils.h" -#include "graph/utils/type_utils.h" -#include "register/graph_optimizer/graph_optimize_register_error_codes.h" - -#include -#include -#include -#include -#include - -namespace fe { -using NodeTypeMap = std::unordered_map>; -using NodeTypeMapPtr = std::shared_ptr; -struct NodeMapInfo { - int64_t runCount; - NodeTypeMapPtr nodeTypeMap; -}; -using NodeMapInfoPtr = std::shared_ptr; - -class GraphPassUtil { -public: - /** set outputdesc attr for data dump - * - * @param originIndex,usually is origin node output index - * - * @param fusionIndex,usually is fusion node output index - * - * @param originNode, usually is origin node - * - * @param fusionNode, usually is fusion node - */ - static void SetOutputDescAttr(uint32_t originIndex, uint32_t fusionIndex, - ge::NodePtr originNode, - ge::NodePtr fusionNode) { - if (fusionNode->GetOpDesc() == nullptr) { - return; - } - - auto fusionNodeOutputDesc = - fusionNode->GetOpDesc()->MutableOutputDesc(fusionIndex); - if (fusionNodeOutputDesc == nullptr) { - return; - } - if (originNode->GetOpDesc() == nullptr) { - return; - } - auto originNodeOutputDesc = - originNode->GetOpDesc()->MutableOutputDesc(originIndex); - if (originNodeOutputDesc == nullptr) { - return; - } - - std::vector originalNames; - if (ge::AttrUtils::GetListStr(originNode->GetOpDesc(), - ge::ATTR_NAME_DATA_DUMP_ORIGIN_OP_NAMES, - originalNames) && - originalNames.size() > 0) { - std::string originalName; - if (ge::AttrUtils::GetStr(originNodeOutputDesc, - ge::ATTR_NAME_DATA_DUMP_ORIGIN_NAME, - originalName)) { - (void)ge::AttrUtils::SetStr(fusionNodeOutputDesc, - ge::ATTR_NAME_DATA_DUMP_ORIGIN_NAME, - originalName); - - std::int64_t originOutputIndex = 0; - if (ge::AttrUtils::GetInt(originNodeOutputDesc, - ge::ATTR_NAME_DATA_DUMP_ORIGIN_OUTPUT_INDEX, - originOutputIndex)) { - (void)ge::AttrUtils::SetInt( - fusionNodeOutputDesc, ge::ATTR_NAME_DATA_DUMP_ORIGIN_OUTPUT_INDEX, - originOutputIndex); - } - - ge::DataType originDataType = - GetDataDumpOriginDataType(originNodeOutputDesc); - if (originDataType != ge::DT_UNDEFINED) { - SetDataDumpOriginDataType(originDataType, fusionNodeOutputDesc); - } - ge::Format originFormat = GetDataDumpOriginFormat(originNodeOutputDesc); - if (originFormat != ge::FORMAT_RESERVED) { - SetDataDumpOriginFormat(originFormat, fusionNodeOutputDesc); - } - } - } else { - (void)ge::AttrUtils::SetStr(fusionNodeOutputDesc, - ge::ATTR_NAME_DATA_DUMP_ORIGIN_NAME, - originNode->GetName()); - (void)ge::AttrUtils::SetInt(fusionNodeOutputDesc, - ge::ATTR_NAME_DATA_DUMP_ORIGIN_OUTPUT_INDEX, - originIndex); - SetDataDumpOriginDataType(originNodeOutputDesc->GetOriginDataType(), - fusionNodeOutputDesc); - SetDataDumpOriginFormat(originNodeOutputDesc->GetOriginFormat(), - fusionNodeOutputDesc); - } - } - - /** get origin format for data dump - * - * @param tensorDesc,usually is outputDesc - * - * @return format of this tensorDesc - */ - static ge::Format GetDataDumpOriginFormat(ge::GeTensorDescPtr tensorDesc) { - std::string originFormatStr; - if (!ge::AttrUtils::GetStr(tensorDesc, - ge::ATTR_NAME_DATA_DUMP_ORIGIN_FORMAT, - originFormatStr)) { - // Can not get the certificate and it's not set,return directly - return ge::FORMAT_RESERVED; - } - if (originFormatStr == "RESERVED") { - return ge::FORMAT_RESERVED; - } - return ge::TypeUtils::SerialStringToFormat(originFormatStr); - } - - /** set origin format for data dump - * - * @param origin format - * - * @param tensorDesc,usually is outputDesc - */ - static void SetDataDumpOriginFormat(ge::Format originFormat, - ge::GeTensorDescPtr tensorDesc) { - std::string originFormatStr = "RESERVED"; - if (originFormat != ge::FORMAT_RESERVED) { - originFormatStr = ge::TypeUtils::FormatToSerialString(originFormat); - } - (void)ge::AttrUtils::SetStr( - tensorDesc, ge::ATTR_NAME_DATA_DUMP_ORIGIN_FORMAT, originFormatStr); - } - - /** set origin datatype for data dump - * - * @param origin datatype - * - * @param tensorDesc,usually is outputDesc - */ - static void SetDataDumpOriginDataType(ge::DataType originDataType, - ge::GeTensorDescPtr tensorDesc) { - std::string originDataTypeStr = "RESERVED"; - if (originDataType != ge::DT_UNDEFINED) { - originDataTypeStr = ge::TypeUtils::DataTypeToSerialString(originDataType); - } - (void)ge::AttrUtils::SetStr(tensorDesc, - ge::ATTR_NAME_DATA_DUMP_ORIGIN_DATA_TYPE, - originDataTypeStr); - } - - /** get origin datatype for data dump - * - * @param tensorDesc,usually is outputDesc - * - * @return format of this tensorDesc - */ - static ge::DataType - GetDataDumpOriginDataType(ge::GeTensorDescPtr tensorDesc) { - std::string originDataTypeStr; - if (!ge::AttrUtils::GetStr(tensorDesc, - ge::ATTR_NAME_DATA_DUMP_ORIGIN_DATA_TYPE, - originDataTypeStr)) { - return ge::DT_UNDEFINED; - } - if (originDataTypeStr == "RESERVED") { - return ge::DT_UNDEFINED; - } - return ge::TypeUtils::SerialStringToDataType(originDataTypeStr); - } - - static void AddNodeFromOpTypeMap(NodeMapInfoPtr &nodeMapInfo, - ge::NodePtr &nodePtr) { - if (nodeMapInfo == nullptr || nodePtr == nullptr) { - return; - } - NodeTypeMapPtr nodeTypeMap = nodeMapInfo->nodeTypeMap; - string realOpType = ge::NodeUtils::GetNodeType(*nodePtr); - auto iter = nodeTypeMap->find(realOpType); - if (iter != nodeTypeMap->end()) { - iter->second.insert(nodePtr); - } else { - nodeTypeMap->emplace( - std::make_pair(realOpType, std::unordered_set{nodePtr})); - } - } - - static Status GetOpTypeMapToGraph(NodeMapInfoPtr &nodeMapInfo, - const ge::ComputeGraph &graph) { - nodeMapInfo = graph.TryGetExtAttr("NodeMapInfo", nodeMapInfo); - if (nodeMapInfo == nullptr) { - return FAILED; - } - return SUCCESS; - } - - static void RecordOriginalNames(std::vector originalNodes, - ge::NodePtr node) { - // 1. get the originalNames - std::vector originalNames; - for (ge::NodePtr originalNode : originalNodes) { - if (originalNode == nullptr || originalNode->GetOpDesc() == nullptr) { - return; - } - - ge::OpDescPtr originOpDescPtr = originalNode->GetOpDesc(); - std::vector names_tmp; - bool isHasAttr = ge::AttrUtils::GetListStr( - originOpDescPtr, ge::ATTR_NAME_DATA_DUMP_ORIGIN_OP_NAMES, names_tmp); - if (isHasAttr) { - for (const auto &node_name : names_tmp) { - if (!node_name.empty()) { - originalNames.push_back(node_name); - } - } - } else { - originalNames.push_back(originOpDescPtr->GetName()); - } - } - - // 2. set the dump attr - if (node == nullptr || node->GetOpDesc() == nullptr) { - return; - } - ge::OpDescPtr nodeOpDescPtr = node->GetOpDesc(); - (void)ge::AttrUtils::SetListStr( - nodeOpDescPtr, ge::ATTR_NAME_DATA_DUMP_ORIGIN_OP_NAMES, originalNames); - } -}; - -} // namespace fe - -#endif // INC_REGISTER_GRAPH_OPTIMIZER_GRAPH_PASS_UTIL_H_ diff --git a/inc/register/graph_optimizer/fusion_common/pattern_fusion_base_pass.h b/inc/register/graph_optimizer/fusion_common/pattern_fusion_base_pass.h deleted file mode 100644 index 9bfa73b40..000000000 --- a/inc/register/graph_optimizer/fusion_common/pattern_fusion_base_pass.h +++ /dev/null @@ -1,106 +0,0 @@ -/** - * @file pattern_fusion_base_pass.h - * - * Copyright (c) Huawei Technologies Co., Ltd. 2019-2019. All rights reserved. - * - * @brief define fusion pass based on pattern - * - * @author Huawei - * - * @version 1.0 - */ - -#ifndef INC_REGISTER_GRAPH_OPTIMIZER_PATTERN_FUSION_BASE_PASS_H_ -#define INC_REGISTER_GRAPH_OPTIMIZER_PATTERN_FUSION_BASE_PASS_H_ - -#include "common/opskernel/ops_kernel_info_store.h" -#include "register/graph_optimizer/graph_fusion/fusion_pattern.h" -#include "register/graph_optimizer/graph_fusion/graph_fusion_pass_base.h" -#include "register/graph_optimizer/graph_fusion/graph_pass.h" -#include "register/graph_optimizer/graph_optimize_register_error_codes.h" -#include -#include -#include -#include -#include - -using std::initializer_list; -using std::map; -using std::string; -using std::vector; - -using namespace std; - -namespace fe { -using OpsKernelInfoStorePtr = std::shared_ptr; -class PatternFusionBasePassImpl; -using PatternFusionBasePassImplPtr = std::shared_ptr; - -/** Pass based on pattern - * @ingroup FUSION_PASS_GROUP - * @note New virtual methods should be append at the end of this class - */ -class PatternFusionBasePass : public GraphPass { -public: - using OpDesc = FusionPattern::OpDesc; - using Mapping = map, vector>; - using Mappings = vector; - std::map originOpAnchorsMap_; - - PatternFusionBasePass(); - virtual ~PatternFusionBasePass(); - - /** execute pass - * - * @param [in] graph, the graph waiting for pass level optimization - * @return SUCCESS, successfully optimized the graph by the pass - * @return NOT_CHANGED, the graph did not change - * @return FAILED, fail to modify graph - */ - Status Run(ge::ComputeGraph &graph) override; - - /** execute pass - * - * @param [in] graph, the graph waiting for pass level optimization - * @param [opsKernelInfoStorePtr, OP info kernel instance - * @return SUCCESS, successfully optimized the graph by the pass - * @return NOT_CHANGED, the graph did not change - * @return FAILED, fail to modify graph - */ - virtual Status Run(ge::ComputeGraph &graph, - OpsKernelInfoStorePtr opsKernelInfoStorePtr); - -protected: - virtual vector DefinePatterns() = 0; - virtual Status Fusion(ge::ComputeGraph &graph, Mapping &mapping, - vector &newNodes) = 0; - - std::vector GetNodesFromMapping(const Mapping &mapping); - ge::NodePtr GetNodeFromMapping(const string &id, const Mapping &mapping); - - void RecordOutputAnchorMap(ge::NodePtr outputNode); - Status SetDataDumpAttr(vector &originalNodes, - vector &fusNodes); - - bool CheckOpSupported(const ge::OpDescPtr &opDescPtr); - -private: - /** match all nodes in graph according to pattern - * - * @param pattern fusion pattern defined - * @param mappings match result - * @return SUCCESS, successfully add edge - * @return FAILED, fail - */ - bool MatchAll(ge::ComputeGraph &graph, const FusionPattern &pattern, - Mappings &mappings); - - Status RunOnePattern(ge::ComputeGraph &graph, const FusionPattern &pattern, - bool &changed); // lint !e148 - - /** Internal implement class ptr */ - std::shared_ptr patternFusionBasePassImplPtr_; -}; -} // namespace fe - -#endif // INC_REGISTER_GRAPH_OPTIMIZER_PATTERN_FUSION_BASE_PASS_H_ diff --git a/inc/register/graph_optimizer/graph_fusion/fusion_pass_manager/fusion_pass_registry.h b/inc/register/graph_optimizer/graph_fusion/fusion_pass_manager/fusion_pass_registry.h deleted file mode 100644 index a954c053e..000000000 --- a/inc/register/graph_optimizer/graph_fusion/fusion_pass_manager/fusion_pass_registry.h +++ /dev/null @@ -1,63 +0,0 @@ -/** - * @file fusion_pass_registry.h - * - * Copyright(C), 2017 - 2017, Huawei Tech. Co., Ltd. ALL RIGHTS RESERVED. - * - * @brief provide interface: GraphFusionByPass - * - * @author Huawei - * - * @version 1.0 - * - */ -#ifndef INC_REGISTER_GRAPH_OPTIMIZER_FUSION_PASS_REGISTRY_H_ -#define INC_REGISTER_GRAPH_OPTIMIZER_FUSION_PASS_REGISTRY_H_ - -#include "register/graph_optimizer/graph_fusion/graph_fusion_pass_base.h" -#include -#include -#include -#include - -namespace fe { -class FusionPassRegistry { -public: - using CreateFn = GraphPass *(*)(); - ~FusionPassRegistry(); - - static FusionPassRegistry &GetInstance(); - - void RegisterPass(const GraphFusionPassType &pass_type, - const std::string &pass_name, CreateFn create_fn); - - std::map - GetCreateFnByType(const GraphFusionPassType &pass_type); - -private: - FusionPassRegistry(); - class FusionPassRegistryImpl; - std::unique_ptr impl_; -}; - -class FusionPassRegistrar { -public: - FusionPassRegistrar(const GraphFusionPassType &pass_type, - const std::string &pass_name, GraphPass *(*create_fun)()); - ~FusionPassRegistrar() {} -}; - -#define REGISTER_PASS(pass_name, pass_type, pass_class) \ - REGISTER_PASS_UNIQ_HELPER(__COUNTER__, pass_name, pass_type, pass_class) - -#define REGISTER_PASS_UNIQ_HELPER(ctr, pass_name, pass_type, pass_class) \ - REGISTER_PASS_UNIQ(ctr, pass_name, pass_type, pass_class) - -#define REGISTER_PASS_UNIQ(ctr, pass_name, pass_type, pass_class) \ - static ::fe::FusionPassRegistrar register_fusion_pass##ctr \ - __attribute__((unused)) = ::fe::FusionPassRegistrar( \ - pass_type, pass_name, []() -> ::fe::GraphPass * { \ - return new (std::nothrow) pass_class(); \ - }) - -} // namespace fe -#endif // INC_REGISTER_GRAPH_OPTIMIZER_FUSION_PASS_REGISTRY_H_ diff --git a/inc/register/graph_optimizer/graph_fusion/fusion_pattern.h b/inc/register/graph_optimizer/graph_fusion/fusion_pattern.h deleted file mode 100644 index 697f5f3e2..000000000 --- a/inc/register/graph_optimizer/graph_fusion/fusion_pattern.h +++ /dev/null @@ -1,172 +0,0 @@ -/** - * @file pattern_fusion_base_pass.h - * - * Copyright (c) Huawei Technologies Co., Ltd. 2019-2019. All rights reserved. - * - * @brief define fusion pass based on pattern - * - * @author Huawei - * - * @version 1.0 - */ - -#ifndef INC_REGISTER_GRAPH_OPTIMIZER_FUSION_PATTERN_H_ -#define INC_REGISTER_GRAPH_OPTIMIZER_FUSION_PATTERN_H_ -#include -#include -#include -#include -#include - -using std::initializer_list; -using std::map; -using std::string; -using std::vector; - -using namespace std; - -namespace fe { - -/** Fusion pattern - * @ingroup FUSION_PASS_GROUP - * Describe Pattern of Ops waiting for fusion(Op type, etc) - */ -class FusionPattern { -public: - struct OpDesc; - using OpDescPtr = std::shared_ptr; - /** - * @ingroup fe - * @brief description of Ops - */ - struct OpDesc { - string id; // Identifier - std::vector types; // the Op types of Ops - std::vector inputs; // all input Ops - bool repeatable; // flag to show if match multiple Ops or not - bool is_output; // flag to show if the op is output node - }; - -public: - explicit FusionPattern(string name = ""); - ~FusionPattern(); - - /** set pattern name - * - * @param name pattern name - * @return FusionPattern - */ - FusionPattern &SetName(const string &name); - - /** add Op description with unknown number of args - * - * @param id pattern id - * @param types op type list - * @return FusionPattern - */ - FusionPattern &AddOpDesc(const string &id, - const initializer_list &types = {}); - - /** add Op description with vector - * - * @param id pattern id - * @param types op type list - * - * @return FusionPattern - */ - FusionPattern &AddOpDesc(const string &id, const vector &types); - - /** set input Ops with unknown number of args - * - * @param id pattern id - * - * @param inputIds inputs to id op - * - * @return FusionPattern - */ - FusionPattern &SetInputs(const string &id, - const initializer_list &inputIds); - - /** set input Ops with unknown number of args - * - * @param id pattern id - * - * @param inputIds inputs to id op - * - * @return FusionPattern - */ - FusionPattern &SetInputs(const string &id, const vector &inputIds); - - /** set output Op - * - * @param id pattern id - * - * @return FusionPattern - */ - FusionPattern &SetOutput(const string &id); - - /** build pattern and check if error exists - * - * @return True or False - */ - bool Build(); - - /** get pattern name - * - * @param id pattern id - * - * @return fusion pattern name - */ - const string &GetName() const; - - /** get the OpDesc of input Ops (const) - * - * @param op_desc op_desc for getting inputs - * - * @return op_desc's iniput opdesc list - */ - static const vector> * - GetInputs(std::shared_ptr op_desc); - - /** get the OpDesc of output Op - * - * @return pattern's output opdesc list - */ - const std::shared_ptr GetOutput() const; - - /** print pattern - * - */ - void Dump() const; - - void GetOpDescList(vector> &op_desc_list); - - /** get OpDesc based on ID, return nullptr if failed - * - * @param id pattern id - * - * @return pattern's output opdesc list - */ - std::shared_ptr GetOpDesc(const string &id) const; - -private: - FusionPattern(const FusionPattern &) = default; - FusionPattern &operator=(const FusionPattern &) = default; - - void SetError(); - -private: - string name_; - - vector> ops_; - - map> op_map_; - - std::shared_ptr output_; - - bool has_error_; -}; - -} // namespace fe - -#endif // INC_REGISTER_GRAPH_OPTIMIZER_FUSION_PATTERN_H_ diff --git a/inc/register/graph_optimizer/graph_fusion/graph_fusion_pass_base.h b/inc/register/graph_optimizer/graph_fusion/graph_fusion_pass_base.h deleted file mode 100644 index 68e07605b..000000000 --- a/inc/register/graph_optimizer/graph_fusion/graph_fusion_pass_base.h +++ /dev/null @@ -1,113 +0,0 @@ -/** - * @file custom_pattern_fusion_base_pass.h - * - * Copyright (c) Huawei Technologies Co., Ltd. 2020-2020. All rights reserved. - * - * @brief custom_pattern_fusion_base_pass - * - * @author Huawei - * - * @version 1.0 - * - */ - -#ifndef INC_REGISTER_GRAPH_OPTIMIZER_GRAPH_FUSION_PASS_BASE_H_ -#define INC_REGISTER_GRAPH_OPTIMIZER_GRAPH_FUSION_PASS_BASE_H_ - -#include -#include -#include -#include -#include - -#include "register/graph_optimizer/graph_fusion/fusion_pattern.h" -#include "register/graph_optimizer/graph_fusion/graph_pass.h" - -using std::initializer_list; -using std::map; -using std::string; -using std::vector; - -using namespace std; - -namespace fe { -enum GraphFusionPassType { - BUILT_IN_GRAPH_PASS = 0, - BUILT_IN_VECTOR_CORE_GRAPH_PASS, - CUSTOM_AI_CORE_GRAPH_PASS, - CUSTOM_VECTOR_CORE_GRAPH_PASS, - SECOND_ROUND_BUILT_IN_GRAPH_PASS, - GRAPH_FUSION_PASS_TYPE_RESERVED, -}; -class PatternFusionBasePassImpl; -using PatternFusionBasePassImplPtr = std::shared_ptr; - -/** Pass based on pattern - * @ingroup FUSION_PASS_GROUP - * @note New virtual methods should be append at the end of this class - */ -class GraphFusionPassBase : public GraphPass { -public: - using OpDesc = FusionPattern::OpDesc; - using Mapping = map, vector>; - using Mappings = vector; - - GraphFusionPassBase(); - virtual ~GraphFusionPassBase(); - - /** execute pass - * - * @param [in] graph, the graph waiting for pass level optimization - * @return SUCCESS, successfully optimized the graph by the pass - * @return NOT_CHANGED, the graph did not change - * @return FAILED, fail to modify graph - */ - Status Run(ge::ComputeGraph &graph) override; - -protected: - /** define pattern - * - * @return NA - */ - virtual vector DefinePatterns() = 0; - - /** do fusion according to nodes matched - * - * @param graph the graph waiting for pass level optimization - * @param newNodes fusion result node(s) - * @return SUCCESS, successfully optimized the graph by the pass - * @return NOT_CHANGED, the graph did not change - * @return FAILED, fail to modify graph - */ - virtual Status Fusion(ge::ComputeGraph &graph, Mapping &mapping, - vector &newNodes) = 0; // lint !e148 - - /** get nodes from matched result - * - * @param mapping match result - * @return nodes result - */ - static ge::NodePtr GetNodeFromMapping(const string &id, - const Mapping &mapping); - -private: - /** match all nodes in graph according to pattern - * - * @param pattern fusion pattern defined - * @param mappings match result - * @return SUCCESS, successfully add edge - * @return FAILED, fail - */ - bool MatchAll(ge::ComputeGraph &graph, const FusionPattern &pattern, - Mappings &mappings); - - Status RunOnePattern(ge::ComputeGraph &graph, const FusionPattern &pattern, - bool &changed); // lint !e148 - - /** Internal implement class ptr */ - std::shared_ptr patternFusionBasePassImplPtr_; -}; - -} // namespace fe - -#endif // INC_REGISTER_GRAPH_OPTIMIZER_GRAPH_FUSION_PASS_BASE_H_ diff --git a/inc/register/graph_optimizer/graph_fusion/graph_pass.h b/inc/register/graph_optimizer/graph_fusion/graph_pass.h deleted file mode 100644 index 87e219101..000000000 --- a/inc/register/graph_optimizer/graph_fusion/graph_pass.h +++ /dev/null @@ -1,39 +0,0 @@ -/** - * @file graph_pass.h - * Copyright (c) Huawei Technologies Co., Ltd. 2019-2019. All rights reserved. - * - * @brief define graph pass, which provides two interface: 1. run pass; - * 2. record op names before fusion - * - * @author Huawei - * - * @version 1.0 - */ - -#ifndef INC_REGISTER_GRAPH_OPTIMIZER_GRAPH_PASS_H_ -#define INC_REGISTER_GRAPH_OPTIMIZER_GRAPH_PASS_H_ - -#include "register/graph_optimizer/graph_fusion/pass.h" -#include - -namespace fe { - -/** graph pass - * @ingroup GRAPH_PASS_GROUP - * graph level pass - */ -class GraphPass : public Pass { -public: - /** execute pass - * - * @param [in] graph, the graph waiting for pass level optimization - * @return SUCCESS, successfully optimized the graph by the pass - * @return NOT_CHANGED, the graph did not change - * @return FAILED, fail to modify graph - */ - virtual Status Run(ge::ComputeGraph &graph) = 0; -}; - -} // namespace fe - -#endif // INC_REGISTER_GRAPH_OPTIMIZER_GRAPH_PASS_H_ diff --git a/inc/register/graph_optimizer/graph_fusion/pass.h b/inc/register/graph_optimizer/graph_fusion/pass.h deleted file mode 100644 index eb31e1d1b..000000000 --- a/inc/register/graph_optimizer/graph_fusion/pass.h +++ /dev/null @@ -1,48 +0,0 @@ -/** - * @file pass.h - * Copyright (c) Huawei Technologies Co., Ltd. 2019-2019. All rights reserved. - * - * @brief define pass - * - * @author Huawei - * - * @version 1.0 - */ -/** @defgroup FUSION_PASS_GROUP Fusion Pass Interface */ - -#ifndef INC_REGISTER_GRAPH_OPTIMIZER_PASS_H_ -#define INC_REGISTER_GRAPH_OPTIMIZER_PASS_H_ - -#include "graph/compute_graph.h" -#include "register/graph_optimizer/graph_optimize_register_error_codes.h" - -namespace fe { - -/** fusion pass - * @ingroup GRAPH_PASS_GROUP - * network level pass - */ -template class Pass { -public: - virtual ~Pass() {} - - /** execute pass - * - * @param [in] graph, the graph waiting for pass level optimization - * @return SUCCESS, successfully optimized the graph by the pass - * @return NOT_CHANGED, the graph did not change - * @return FAILED, fail to modify graph - */ - virtual Status Run(ge::ComputeGraph &graph) = 0; - - void SetName(const string &name) { name_ = name; } - - string GetName() { return name_; } - -private: - string name_; -}; - -} // namespace fe - -#endif // INC_REGISTER_GRAPH_OPTIMIZER_PASS_H_ diff --git a/inc/register/graph_optimizer/graph_optimize_register_error_codes.h b/inc/register/graph_optimizer/graph_optimize_register_error_codes.h deleted file mode 100644 index d88f1275e..000000000 --- a/inc/register/graph_optimizer/graph_optimize_register_error_codes.h +++ /dev/null @@ -1,50 +0,0 @@ -/** - * @file graph_optimize_register_error_codes.h - * - * Copyright (c) Huawei Technologies Co., Ltd. 2020-2020. All rights reserved. - * - * @brief fe_error_codes - * - * @author Huawei - * - * @version 1.0 - * - */ - -#ifndef INC_REGISTER_GRAPH_OPTIMIZE_REGISTER_ERROR_CODES_H_ -#define INC_REGISTER_GRAPH_OPTIMIZE_REGISTER_ERROR_CODES_H_ - -#include -#include - -/** Assigned SYS ID */ -const uint8_t SYSID_FE = 3; - -/** Common module ID */ -const uint8_t FE_MODID_COMMON = 50; - -namespace fe { - -/** FE error code definiton Macro -* Build error code -*/ -#define FE_DEF_ERRORNO(sysid, modid, name, value, desc) \ - static constexpr fe::Status name = \ - (((((uint32_t)(0xFF & ((uint8_t)(sysid)))) << 24) | \ - (((uint32_t)(0xFF & ((uint8_t)(modid)))) << 16)) | \ - (0xFFFF & ((uint16_t)(value)))); - -using Status = uint32_t; - -#define FE_DEF_ERRORNO_COMMON(name, value, desc) \ - FE_DEF_ERRORNO(SYSID_FE, FE_MODID_COMMON, name, value, desc) - -using Status = uint32_t; - -FE_DEF_ERRORNO(0, 0, SUCCESS, 0, "success"); -FE_DEF_ERRORNO(0xFF, 0xFF, FAILED, 0xFFFF, "failed"); -FE_DEF_ERRORNO_COMMON(NOT_CHANGED, 201, "The nodes of the graph not changed."); -FE_DEF_ERRORNO_COMMON(PARAM_INVALID, 1, "Parameter's invalid!"); - -} // namespace fe -#endif // INC_REGISTER_GRAPH_OPTIMIZE_REGISTER_ERROR_CODES_H_ diff --git a/inc/register/op_registry.h b/inc/register/op_registry.h index 1dc14b8b6..3feea0dfd 100644 --- a/inc/register/op_registry.h +++ b/inc/register/op_registry.h @@ -65,6 +65,9 @@ class FMK_FUNC_HOST_VISIBILITY FMK_FUNC_DEV_VISIBILITY OpRegistry { domi::FusionParseParamFunc GetFusionParseParamFunc(const std::string &op_type, const std::string &ori_type); + domi::FusionParseParamByOpFunc GetFusionParseParamByOpFunc(const std::string &op_type, + const std::string &ori_type); + domi::ParseSubgraphFunc GetParseSubgraphPostFunc(const std::string &op_type); domi::ImplyType GetImplyTypeByOriOpType(const std::string &ori_optype); @@ -78,6 +81,7 @@ class FMK_FUNC_HOST_VISIBILITY FMK_FUNC_DEV_VISIBILITY OpRegistry { std::unordered_map op_parse_params_fn_map_; std::unordered_map parse_params_by_op_func_map_; std::unordered_map fusion_op_parse_params_fn_map_; + std::unordered_map fusion_parse_params_by_op_fn_map_; std::unordered_map op_types_to_parse_subgraph_post_func_; std::unordered_map> remove_input_configure_map_; std::unordered_map origin_type_to_om_type_; diff --git a/inc/register/op_tiling.h b/inc/register/op_tiling.h deleted file mode 100644 index e9d19f942..000000000 --- a/inc/register/op_tiling.h +++ /dev/null @@ -1,133 +0,0 @@ -/** - * Copyright 2019-2020 Huawei Technologies Co., Ltd - * - * 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 INC_OP_TILING_H_ -#define INC_OP_TILING_H_ - -#include "external/register/register_types.h" -#include "graph/debug/ge_attr_define.h" -#include "graph/node.h" - -#include -#include -#include -#include -#include -#include -#include -#include "graph/node.h" - -#define REGISTER_OP_TILING_FUNC(optype, opfunc) \ - REGISTER_OP_TILING_FUNC_UNIQ_HELPER(optype, opfunc, __COUNTER__) - -#define REGISTER_OP_TILING_FUNC_UNIQ_HELPER(optype, opfunc, counter) \ - REGISTER_OP_TILING_FUNC_UNIQ(optype, opfunc, counter) - -#define REGISTER_OP_TILING_FUNC_UNIQ(optype, opfunc, counter) \ - static OpTilingInterf g_##optype##TilingInterf##counter(#optype, opfunc) - -namespace optiling { - -enum TensorArgType { - TA_NONE, - TA_SINGLE, - TA_LIST, -}; - - -using ByteBuffer = std::stringstream; - -struct TeOpTensor { - std::vector shape; - std::vector ori_shape; - std::string format; - std::string ori_format; - std::string dtype; - std::map attrs; -}; - - -struct TeOpTensorArg { - TensorArgType arg_type; - std::vector tensor; -}; - -struct OpRunInfo { - uint32_t block_dim; - std::vector workspaces; - ByteBuffer tiling_data; -}; - - -using TeOpAttrArgs = std::vector; -using TeConstTensorData = std::tuple; - -struct TeOpParas { - std::vector inputs; - std::vector outputs; - std::map const_inputs; - TeOpAttrArgs attrs; -}; - - -using OpTilingFunc = std::function; - -using OpTilingFuncPtr = bool(*)(const std::string&, const TeOpParas&, const nlohmann::json& , OpRunInfo&); - -class FMK_FUNC_HOST_VISIBILITY OpTilingInterf -{ -public: - OpTilingInterf(std::string op_type, OpTilingFunc func); - ~OpTilingInterf() = default; - static std::map &RegisteredOpInterf(); -}; - - -template -ByteBuffer& ByteBufferPut(ByteBuffer &buf, const T &value) -{ - buf.write(reinterpret_cast(&value), sizeof(value)); - buf.flush(); - return buf; -} - -template -ByteBuffer& ByteBufferGet(ByteBuffer &buf, T &value) -{ - buf.read(reinterpret_cast(&value), sizeof(value)); - return buf; -} - -inline size_t ByteBufferGetAll(ByteBuffer &buf, char *dest, size_t dest_len) -{ - size_t nread = 0; - size_t rn = 0; - do { - rn = buf.readsome(dest + nread, dest_len - nread); - nread += rn; - } while (rn > 0 && dest_len > nread); - - return nread; -} - - -extern "C" ge::graphStatus OpParaCalculate(const ge::Node &node, OpRunInfo &run_info); -extern "C" ge::graphStatus OpAtomicCalculate(const ge::Node &node, OpRunInfo &run_info); - -} - -#endif // INC_OP_TILING_H_ diff --git a/inc/register/proto/caffe/caffe.proto b/inc/register/proto/caffe/caffe.proto deleted file mode 100644 index f2d1acc64..000000000 --- a/inc/register/proto/caffe/caffe.proto +++ /dev/null @@ -1,1802 +0,0 @@ -syntax = "proto2"; - -package domi.caffe; - -// Specifies the shape (dimensions) of a Blob. -message BlobShape { - repeated int64 dim = 1 [packed = true]; -} - -message BlobProto { - optional BlobShape shape = 7; - repeated float data = 5 [packed = true]; - repeated float diff = 6 [packed = true]; - repeated double double_data = 8 [packed = true]; - repeated double double_diff = 9 [packed = true]; - optional bytes int8_data = 10; - repeated int32 int32_data = 11 [packed = true]; - repeated uint64 uint64_data = 12 [packed = true]; - // 4D dimensions -- deprecated. Use "shape" instead. - optional int32 num = 1 [default = 0]; - optional int32 channels = 2 [default = 0]; - optional int32 height = 3 [default = 0]; - optional int32 width = 4 [default = 0]; -} - -// The BlobProtoVector is simply a way to pass multiple blobproto instances -// around. -message BlobProtoVector { - repeated BlobProto blobs = 1; -} - -message Datum { - optional int32 channels = 1; - optional int32 height = 2; - optional int32 width = 3; - // the actual image data, in bytes - optional bytes data = 4; - optional int32 label = 5; - // Optionally, the datum could also hold float data. - repeated float float_data = 6; - // If true data contains an encoded image that need to be decoded - optional bool encoded = 7 [default = false]; -} - -message FillerParameter { - // The filler type. - optional string type = 1 [default = 'constant']; - optional float value = 2 [default = 0]; // the value in constant filler - optional float min = 3 [default = 0]; // the min value in uniform filler - optional float max = 4 [default = 1]; // the max value in uniform filler - optional float mean = 5 [default = 0]; // the mean value in Gaussian filler - optional float std = 6 [default = 1]; // the std value in Gaussian filler - // The expected number of non-zero output weights for a given input in - // Gaussian filler -- the default -1 means don't perform sparsification. - optional int32 sparse = 7 [default = -1]; - // Normalize the filler variance by fan_in, fan_out, or their average. - // Applies to 'xavier' and 'msra' fillers. - enum VarianceNorm { - FAN_IN = 0; - FAN_OUT = 1; - AVERAGE = 2; - } - optional VarianceNorm variance_norm = 8 [default = FAN_IN]; -} - -message NetParameter { - optional string name = 1; // consider giving the network a name - // DEPRECATED. See InputParameter. The input blobs to the network. - repeated string input = 3; - // DEPRECATED. See InputParameter. The shape of the input blobs. - repeated BlobShape input_shape = 8; - - // 4D input dimensions -- deprecated. Use "input_shape" instead. - // If specified, for each input blob there should be four - // values specifying the num, channels, height and width of the input blob. - // Thus, there should be a total of (4 * #input) numbers. - repeated int32 input_dim = 4; - - // Whether the network will force every layer to carry out backward operation. - // If set False, then whether to carry out backward is determined - // automatically according to the net structure and learning rates. - optional bool force_backward = 5 [default = false]; - // The current "state" of the network, including the phase, level, and stage. - // Some layers may be included/excluded depending on this state and the states - // specified in the layers' include and exclude fields. - optional NetState state = 6; - - // Print debugging information about results while running Net::Forward, - // Net::Backward, and Net::Update. - optional bool debug_info = 7 [default = false]; - - // The layers that make up the net. Each of their configurations, including - // connectivity and behavior, is specified as a LayerParameter. - repeated LayerParameter layer = 100; // ID 100 so layers are printed last. - - // DEPRECATED: use 'layer' instead. - repeated V1LayerParameter layers = 2; -} - -// NOTE -// Update the next available ID when you add a new SolverParameter field. -// -// SolverParameter next available ID: 42 (last added: layer_wise_reduce) -message SolverParameter { - ////////////////////////////////////////////////////////////////////////////// - // Specifying the train and test networks - // - // Exactly one train net must be specified using one of the following fields: - // train_net_param, train_net, net_param, net - // One or more test nets may be specified using any of the following fields: - // test_net_param, test_net, net_param, net - // If more than one test net field is specified (e.g., both net and - // test_net are specified), they will be evaluated in the field order given - // above: (1) test_net_param, (2) test_net, (3) net_param/net. - // A test_iter must be specified for each test_net. - // A test_level and/or a test_stage may also be specified for each test_net. - ////////////////////////////////////////////////////////////////////////////// - - // Proto filename for the train net, possibly combined with one or more - // test nets. - optional string net = 24; - // Inline train net param, possibly combined with one or more test nets. - optional NetParameter net_param = 25; - - optional string train_net = 1; // Proto filename for the train net. - repeated string test_net = 2; // Proto filenames for the test nets. - optional NetParameter train_net_param = 21; // Inline train net params. - repeated NetParameter test_net_param = 22; // Inline test net params. - - // The states for the train/test nets. Must be unspecified or - // specified once per net. - // - // By default, all states will have solver = true; - // train_state will have phase = TRAIN, - // and all test_state's will have phase = TEST. - // Other defaults are set according to the NetState defaults. - optional NetState train_state = 26; - repeated NetState test_state = 27; - - // The number of iterations for each test net. - repeated int32 test_iter = 3; - - // The number of iterations between two testing phases. - optional int32 test_interval = 4 [default = 0]; - optional bool test_compute_loss = 19 [default = false]; - // If true, run an initial test pass before the first iteration, - // ensuring memory availability and printing the starting value of the loss. - optional bool test_initialization = 32 [default = true]; - optional float base_lr = 5; // The base learning rate - // the number of iterations between displaying info. If display = 0, no info - // will be displayed. - optional int32 display = 6; - // Display the loss averaged over the last average_loss iterations - optional int32 average_loss = 33 [default = 1]; - optional int32 max_iter = 7; // the maximum number of iterations - // accumulate gradients over `iter_size` x `batch_size` instances - optional int32 iter_size = 36 [default = 1]; - - // The learning rate decay policy. The currently implemented learning rate - // policies are as follows: - // - fixed: always return base_lr. - // - step: return base_lr * gamma ^ (floor(iter / step)) - // - exp: return base_lr * gamma ^ iter - // - inv: return base_lr * (1 + gamma * iter) ^ (- power) - // - multistep: similar to step but it allows non uniform steps defined by - // stepvalue - // - poly: the effective learning rate follows a polynomial decay, to be - // zero by the max_iter. return base_lr (1 - iter/max_iter) ^ (power) - // - sigmoid: the effective learning rate follows a sigmod decay - // return base_lr ( 1/(1 + exp(-gamma * (iter - stepsize)))) - // - // where base_lr, max_iter, gamma, step, stepvalue and power are defined - // in the solver parameter protocol buffer, and iter is the current iteration. - optional string lr_policy = 8; - optional float gamma = 9; // The parameter to compute the learning rate. - optional float power = 10; // The parameter to compute the learning rate. - optional float momentum = 11; // The momentum value. - optional float weight_decay = 12; // The weight decay. - // regularization types supported: L1 and L2 - // controlled by weight_decay - optional string regularization_type = 29 [default = "L2"]; - // the stepsize for learning rate policy "step" - optional int32 stepsize = 13; - // the stepsize for learning rate policy "multistep" - repeated int32 stepvalue = 34; - - // Set clip_gradients to >= 0 to clip parameter gradients to that L2 norm, - // whenever their actual L2 norm is larger. - optional float clip_gradients = 35 [default = -1]; - - optional int32 snapshot = 14 [default = 0]; // The snapshot interval - optional string snapshot_prefix = 15; // The prefix for the snapshot. - // whether to snapshot diff in the results or not. Snapshotting diff will help - // debugging but the final protocol buffer size will be much larger. - optional bool snapshot_diff = 16 [default = false]; - enum SnapshotFormat { - HDF5 = 0; - BINARYPROTO = 1; - } - optional SnapshotFormat snapshot_format = 37 [default = BINARYPROTO]; - // the mode solver will use: 0 for CPU and 1 for GPU. Use GPU in default. - enum SolverMode { - CPU = 0; - GPU = 1; - } - optional SolverMode solver_mode = 17 [default = GPU]; - // the device_id will that be used in GPU mode. Use device_id = 0 in default. - optional int32 device_id = 18 [default = 0]; - // If non-negative, the seed with which the Solver will initialize the Caffe - // random number generator -- useful for reproducible results. Otherwise, - // (and by default) initialize using a seed derived from the system clock. - optional int64 random_seed = 20 [default = -1]; - - // type of the solver - optional string type = 40 [default = "SGD"]; - - // numerical stability for RMSProp, AdaGrad and AdaDelta and Adam - optional float delta = 31 [default = 1e-8]; - // parameters for the Adam solver - optional float momentum2 = 39 [default = 0.999]; - - // RMSProp decay value - // MeanSquare(t) = rms_decay*MeanSquare(t-1) + (1-rms_decay)*SquareGradient(t) - optional float rms_decay = 38 [default = 0.99]; - - // If true, print information about the state of the net that may help with - // debugging learning problems. - optional bool debug_info = 23 [default = false]; - - // If false, don't save a snapshot after training finishes. - optional bool snapshot_after_train = 28 [default = true]; - - // DEPRECATED: old solver enum types, use string instead - enum SolverType { - SGD = 0; - NESTEROV = 1; - ADAGRAD = 2; - RMSPROP = 3; - ADADELTA = 4; - ADAM = 5; - } - // DEPRECATED: use type instead of solver_type - optional SolverType solver_type = 30 [default = SGD]; - - // Overlap compute and communication for data parallel training - optional bool layer_wise_reduce = 41 [default = true]; -} - -// A message that stores the solver snapshots -message SolverState { - optional int32 iter = 1; // The current iteration - optional string learned_net = 2; // The file that stores the learned net. - repeated BlobProto history = 3; // The history for sgd solvers - optional int32 current_step = 4 [default = 0]; // The current step for learning rate -} - -enum Phase { - TRAIN = 0; - TEST = 1; -} - -message NetState { - optional Phase phase = 1 [default = TEST]; - optional int32 level = 2 [default = 0]; - repeated string stage = 3; -} - -message NetStateRule { - // Set phase to require the NetState have a particular phase (TRAIN or TEST) - // to meet this rule. - optional Phase phase = 1; - - // Set the minimum and/or maximum levels in which the layer should be used. - // Leave undefined to meet the rule regardless of level. - optional int32 min_level = 2; - optional int32 max_level = 3; - - // Customizable sets of stages to include or exclude. - // The net must have ALL of the specified stages and NONE of the specified - // "not_stage"s to meet the rule. - // (Use multiple NetStateRules to specify conjunctions of stages.) - repeated string stage = 4; - repeated string not_stage = 5; -} - -// Specifies training parameters (multipliers on global learning constants, -// and the name and other settings used for weight sharing). -message ParamSpec { - // The names of the parameter blobs -- useful for sharing parameters among - // layers, but never required otherwise. To share a parameter between two - // layers, give it a (non-empty) name. - optional string name = 1; - - // Whether to require shared weights to have the same shape, or just the same - // count -- defaults to STRICT if unspecified. - optional DimCheckMode share_mode = 2; - enum DimCheckMode { - // STRICT (default) requires that num, channels, height, width each match. - STRICT = 0; - // PERMISSIVE requires only the count (num*channels*height*width) to match. - PERMISSIVE = 1; - } - - // The multiplier on the global learning rate for this parameter. - optional float lr_mult = 3 [default = 1.0]; - - // The multiplier on the global weight decay for this parameter. - optional float decay_mult = 4 [default = 1.0]; -} - -// NOTE -// Update the next available ID when you add a new LayerParameter field. -// -// LayerParameter next available layer-specific ID: 151 (last added: smooth_l1_loss_param) -message LayerParameter { - optional string name = 1; // the layer name - optional string type = 2; // the layer type - repeated string bottom = 3; // the name of each bottom blob - repeated string top = 4; // the name of each top blob - - // The train / test phase for computation. - optional Phase phase = 10; - - // The amount of weight to assign each top blob in the objective. - // Each layer assigns a default value, usually of either 0 or 1, - // to each top blob. - repeated float loss_weight = 5; - - // Specifies training parameters (multipliers on global learning constants, - // and the name and other settings used for weight sharing). - repeated ParamSpec param = 6; - - // The blobs containing the numeric parameters of the layer. - repeated BlobProto blobs = 7; - - // Specifies whether to backpropagate to each bottom. If unspecified, - // Caffe will automatically infer whether each input needs backpropagation - // to compute parameter gradients. If set to true for some inputs, - // backpropagation to those inputs is forced; if set false for some inputs, - // backpropagation to those inputs is skipped. - // - // The size must be either 0 or equal to the number of bottoms. - repeated bool propagate_down = 11; - - // Rules controlling whether and when a layer is included in the network, - // based on the current NetState. You may specify a non-zero number of rules - // to include OR exclude, but not both. If no include or exclude rules are - // specified, the layer is always included. If the current NetState meets - // ANY (i.e., one or more) of the specified rules, the layer is - // included/excluded. - repeated NetStateRule include = 8; - repeated NetStateRule exclude = 9; - - // Parameters for data pre-processing. - optional TransformationParameter transform_param = 100; - - // Parameters shared by loss layers. - optional LossParameter loss_param = 101; - - // Layer type-specific parameters. - // - // Note: certain layers may have more than one computational engine - // for their implementation. These layers include an Engine type and - // engine parameter for selecting the implementation. - // The default for the engine is set by the ENGINE switch at compile-time. - optional AccuracyParameter accuracy_param = 102; - optional ArgMaxParameter argmax_param = 103; - optional BatchNormParameter batch_norm_param = 139; - optional BiasParameter bias_param = 141; - optional ConcatParameter concat_param = 104; - optional ContrastiveLossParameter contrastive_loss_param = 105; - optional ConvolutionParameter convolution_param = 106; - optional CropParameter crop_param = 144; - optional DataParameter data_param = 107; - optional DetectionOutputParameter detection_output_param = 150; - optional DropoutParameter dropout_param = 108; - optional DummyDataParameter dummy_data_param = 109; - optional EltwiseParameter eltwise_param = 110; - optional ELUParameter elu_param = 140; - optional EmbedParameter embed_param = 137; - optional ExpParameter exp_param = 111; - optional FlattenParameter flatten_param = 135; - optional HDF5DataParameter hdf5_data_param = 112; - optional HDF5OutputParameter hdf5_output_param = 113; - optional HingeLossParameter hinge_loss_param = 114; - optional ImageDataParameter image_data_param = 115; - optional InfogainLossParameter infogain_loss_param = 116; - optional InnerProductParameter inner_product_param = 117; - optional InputParameter input_param = 143; - optional LogParameter log_param = 134; - optional LRNParameter lrn_param = 118; - optional MemoryDataParameter memory_data_param = 119; - optional MVNParameter mvn_param = 120; - optional ParameterParameter parameter_param = 145; - optional PoolingParameter pooling_param = 121; - optional PowerParameter power_param = 122; - optional PReLUParameter prelu_param = 131; - optional PythonParameter python_param = 130; - optional RecurrentParameter recurrent_param = 146; - optional ReductionParameter reduction_param = 136; - optional ReLUParameter relu_param = 123; - optional ReshapeParameter reshape_param = 133; - optional ScaleParameter scale_param = 142; - optional SigmoidParameter sigmoid_param = 124; - optional SmoothL1LossParameter smooth_l1_loss_param = 148; - optional SoftmaxParameter softmax_param = 125; - optional SPPParameter spp_param = 132; - optional SliceParameter slice_param = 126; - optional TanHParameter tanh_param = 127; - optional ThresholdParameter threshold_param = 128; - optional TileParameter tile_param = 138; - optional WindowDataParameter window_data_param = 129; - optional PermuteParameter permute_param = 202; - optional PriorBoxParameter prior_box_param = 203; - optional NormalizeParameter norm_param = 206; - optional PSROIPoolingParameter psroi_pooling_param = 207; - optional FreespaceExtractParameter freespace_extract_param = 151; - optional PostprocessParameter postprocess_param = 152; - optional SpatialTransformParameter spatial_transform_param = 153; - optional ROIAlignParameter roi_align_param = 154; - optional ReorgParameter reorg_param = 155; - optional RegionParameter region_param = 156; - optional ReverseParameter reverse_param = 157; - optional InterpParameter interp_param = 158; - optional ShuffleChannelParameter shuffle_channel_param = 159; - optional UpsampleParameter upsample_param = 160; - optional ROIPoolingParameter roi_pooling_param = 161; - optional YoloParameter yolo_param = 199; - optional YoloV3DetectionOutputParameter yolov3_detection_output_param = 200; - optional ProposalParameter proposal_param = 201; - optional FSRDetectionOutputParameter fsrdetectionoutput_param = 222; - optional SSDDetectionOutputParameter ssddetectionoutput_param = 232; - optional YoloV2DetectionOutputParameter yolov2_detection_output_param = 204; - optional QuantParameter quant_param = 208; - optional CondTakeParameter condtake_param = 233; - optional MatrixInverseParameter matrix_inverse_param = 210; - optional WarpPerspectiveParameter warp_perspective_param = 234; - optional BatchMatMulParameter batch_matmul_param = 235; - optional SpatialTransformerParameter st_param = 5000; -} - -// Message that stores parameters used to apply transformation -// to the data layer's data -message TransformationParameter { - // For data pre-processing, we can do simple scaling and subtracting the - // data mean, if provided. Note that the mean subtraction is always carried - // out before scaling. - optional float scale = 1 [default = 1]; - // Specify if we want to randomly mirror data. - optional bool mirror = 2 [default = false]; - // Specify if we would like to randomly crop an image. - optional uint32 crop_size = 3 [default = 0]; - // mean_file and mean_value cannot be specified at the same time - optional string mean_file = 4; - // if specified can be repeated once (would substract it from all the channels) - // or can be repeated the same number of times as channels - // (would subtract them from the corresponding channel) - repeated float mean_value = 5; - // Force the decoded image to have 3 color channels. - optional bool force_color = 6 [default = false]; - // Force the decoded image to have 1 color channels. - optional bool force_gray = 7 [default = false]; -} - -// Message that stores parameters shared by loss layers -message LossParameter { - // If specified, ignore instances with the given label. - optional int32 ignore_label = 1; - // How to normalize the loss for loss layers that aggregate across batches, - // spatial dimensions, or other dimensions. Currently only implemented in - // SoftmaxWithLoss and SigmoidCrossEntropyLoss layers. - enum NormalizationMode { - // Divide by the number of examples in the batch times spatial dimensions. - // Outputs that receive the ignore label will NOT be ignored in computing - // the normalization factor. - FULL = 0; - // Divide by the total number of output locations that do not take the - // ignore_label. If ignore_label is not set, this behaves like FULL. - VALID = 1; - // Divide by the batch size. - BATCH_SIZE = 2; - // Do not normalize the loss. - NONE = 3; - } - // For historical reasons, the default normalization for - // SigmoidCrossEntropyLoss is BATCH_SIZE and *not* VALID. - optional NormalizationMode normalization = 3 [default = VALID]; - // Deprecated. Ignored if normalization is specified. If normalization - // is not specified, then setting this to false will be equivalent to - // normalization = BATCH_SIZE to be consistent with previous behavior. - optional bool normalize = 2; -} - -// Messages that store parameters used by individual layer types follow, in -// alphabetical order. - -message AccuracyParameter { - // When computing accuracy, count as correct by comparing the true label to - // the top k scoring classes. By default, only compare to the top scoring - // class (i.e. argmax). - optional uint32 top_k = 1 [default = 1]; - - // The "label" axis of the prediction blob, whose argmax corresponds to the - // predicted label -- may be negative to index from the end (e.g., -1 for the - // last axis). For example, if axis == 1 and the predictions are - // (N x C x H x W), the label blob is expected to contain N*H*W ground truth - // labels with integer values in {0, 1, ..., C-1}. - optional int32 axis = 2 [default = 1]; - - // If specified, ignore instances with the given label. - optional int32 ignore_label = 3; -} - -message ArgMaxParameter { - // If true produce pairs (argmax, maxval) - optional bool out_max_val = 1 [default = false]; - optional uint32 top_k = 2 [default = 1]; - // The axis along which to maximise -- may be negative to index from the - // end (e.g., -1 for the last axis). - // By default ArgMaxLayer maximizes over the flattened trailing dimensions - // for each index of the first / num dimension. - optional int32 axis = 3; -} - -message ConcatParameter { - // The axis along which to concatenate -- may be negative to index from the - // end (e.g., -1 for the last axis). Other axes must have the - // same dimension for all the bottom blobs. - // By default, ConcatLayer concatenates blobs along the "channels" axis (1). - optional int32 axis = 2 [default = 1]; - - // DEPRECATED: alias for "axis" -- does not support negative indexing. - optional uint32 concat_dim = 1 [default = 1]; -} - -message BatchNormParameter { - // If false, normalization is performed over the current mini-batch - // and global statistics are accumulated (but not yet used) by a moving - // average. - // If true, those accumulated mean and variance values are used for the - // normalization. - // By default, it is set to false when the network is in the training - // phase and true when the network is in the testing phase. - optional bool use_global_stats = 1; - // What fraction of the moving average remains each iteration? - // Smaller values make the moving average decay faster, giving more - // weight to the recent values. - // Each iteration updates the moving average @f$S_{t-1}@f$ with the - // current mean @f$ Y_t @f$ by - // @f$ S_t = (1-\beta)Y_t + \beta \cdot S_{t-1} @f$, where @f$ \beta @f$ - // is the moving_average_fraction parameter. - optional float moving_average_fraction = 2 [default = .999]; - // Small value to add to the variance estimate so that we don't divide by - // zero. - optional float eps = 3 [default = 1e-5]; -} - -message BiasParameter { - // The first axis of bottom[0] (the first input Blob) along which to apply - // bottom[1] (the second input Blob). May be negative to index from the end - // (e.g., -1 for the last axis). - // - // For example, if bottom[0] is 4D with shape 100x3x40x60, the output - // top[0] will have the same shape, and bottom[1] may have any of the - // following shapes (for the given value of axis): - // (axis == 0 == -4) 100; 100x3; 100x3x40; 100x3x40x60 - // (axis == 1 == -3) 3; 3x40; 3x40x60 - // (axis == 2 == -2) 40; 40x60 - // (axis == 3 == -1) 60 - // Furthermore, bottom[1] may have the empty shape (regardless of the value of - // "axis") -- a scalar bias. - optional int32 axis = 1 [default = 1]; - - // (num_axes is ignored unless just one bottom is given and the bias is - // a learned parameter of the layer. Otherwise, num_axes is determined by the - // number of axes by the second bottom.) - // The number of axes of the input (bottom[0]) covered by the bias - // parameter, or -1 to cover all axes of bottom[0] starting from `axis`. - // Set num_axes := 0, to add a zero-axis Blob: a scalar. - optional int32 num_axes = 2 [default = 1]; - - // (filler is ignored unless just one bottom is given and the bias is - // a learned parameter of the layer.) - // The initialization for the learned bias parameter. - // Default is the zero (0) initialization, resulting in the BiasLayer - // initially performing the identity operation. - optional FillerParameter filler = 3; - optional bool bias_from_blob = 4 [default = true]; -} - -message ContrastiveLossParameter { - // margin for dissimilar pair - optional float margin = 1 [default = 1.0]; - // The first implementation of this cost did not exactly match the cost of - // Hadsell et al 2006 -- using (margin - d^2) instead of (margin - d)^2. - // legacy_version = false (the default) uses (margin - d)^2 as proposed in the - // Hadsell paper. New models should probably use this version. - // legacy_version = true uses (margin - d^2). This is kept to support / - // reproduce existing models and results - optional bool legacy_version = 2 [default = false]; -} - -message ConvolutionParameter { - optional uint32 num_output = 1; // The number of outputs for the layer - optional bool bias_term = 2 [default = true]; // whether to have bias terms - - // Pad, kernel size, and stride are all given as a single value for equal - // dimensions in all spatial dimensions, or once per spatial dimension. - repeated uint32 pad = 3; // The padding size; defaults to 0 - repeated uint32 kernel_size = 4; // The kernel size - repeated uint32 stride = 6; // The stride; defaults to 1 - // Factor used to dilate the kernel, (implicitly) zero-filling the resulting - // holes. (Kernel dilation is sometimes referred to by its use in the - // algorithme à trous from Holschneider et al. 1987.) - repeated uint32 dilation = 18; // The dilation; defaults to 1 - - // For 2D convolution only, the *_h and *_w versions may also be used to - // specify both spatial dimensions. - optional uint32 pad_h = 9 [default = 0]; // The padding height (2D only) - optional uint32 pad_w = 10 [default = 0]; // The padding width (2D only) - optional uint32 kernel_h = 11; // The kernel height (2D only) - optional uint32 kernel_w = 12; // The kernel width (2D only) - optional uint32 stride_h = 13; // The stride height (2D only) - optional uint32 stride_w = 14; // The stride width (2D only) - - optional uint32 group = 5 [default = 1]; // The group size for group conv - - optional FillerParameter weight_filler = 7; // The filler for the weight - optional FillerParameter bias_filler = 8; // The filler for the bias - enum Engine { - DEFAULT = 0; - CAFFE = 1; - CUDNN = 2; - } - optional Engine engine = 15 [default = DEFAULT]; - - // The axis to interpret as "channels" when performing convolution. - // Preceding dimensions are treated as independent inputs; - // succeeding dimensions are treated as "spatial". - // With (N, C, H, W) inputs, and axis == 1 (the default), we perform - // N independent 2D convolutions, sliding C-channel (or (C/g)-channels, for - // groups g>1) filters across the spatial axes (H, W) of the input. - // With (N, C, D, H, W) inputs, and axis == 1, we perform - // N independent 3D convolutions, sliding (C/g)-channels - // filters across the spatial axes (D, H, W) of the input. - optional int32 axis = 16 [default = 1]; - - // Whether to force use of the general ND convolution, even if a specific - // implementation for blobs of the appropriate number of spatial dimensions - // is available. (Currently, there is only a 2D-specific convolution - // implementation; for input blobs with num_axes != 2, this option is - // ignored and the ND implementation will be used.) - optional bool force_nd_im2col = 17 [default = false]; -} - -message CropParameter { - // To crop, elements of the first bottom are selected to fit the dimensions - // of the second, reference bottom. The crop is configured by - // - the crop `axis` to pick the dimensions for cropping - // - the crop `offset` to set the shift for all/each dimension - // to align the cropped bottom with the reference bottom. - // All dimensions up to but excluding `axis` are preserved, while - // the dimensions including and trailing `axis` are cropped. - // If only one `offset` is set, then all dimensions are offset by this amount. - // Otherwise, the number of offsets must equal the number of cropped axes to - // shift the crop in each dimension accordingly. - // Note: standard dimensions are N,C,H,W so the default is a spatial crop, - // and `axis` may be negative to index from the end (e.g., -1 for the last - // axis). - optional int32 axis = 1 [default = 2]; - repeated uint32 offset = 2; -} - -message DataParameter { - enum DB { - LEVELDB = 0; - LMDB = 1; - } - // Specify the data source. - optional string source = 1; - // Specify the batch size. - optional uint32 batch_size = 4; - // The rand_skip variable is for the data layer to skip a few data points - // to avoid all asynchronous sgd clients to start at the same point. The skip - // point would be set as rand_skip * rand(0,1). Note that rand_skip should not - // be larger than the number of keys in the database. - // DEPRECATED. Each solver accesses a different subset of the database. - optional uint32 rand_skip = 7 [default = 0]; - optional DB backend = 8 [default = LEVELDB]; - // DEPRECATED. See TransformationParameter. For data pre-processing, we can do - // simple scaling and subtracting the data mean, if provided. Note that the - // mean subtraction is always carried out before scaling. - optional float scale = 2 [default = 1]; - optional string mean_file = 3; - // DEPRECATED. See TransformationParameter. Specify if we would like to randomly - // crop an image. - optional uint32 crop_size = 5 [default = 0]; - // DEPRECATED. See TransformationParameter. Specify if we want to randomly mirror - // data. - optional bool mirror = 6 [default = false]; - // Force the encoded image to have 3 color channels - optional bool force_encoded_color = 9 [default = false]; - // Prefetch queue (Increase if data feeding bandwidth varies, within the - // limit of device memory for GPU training) - optional uint32 prefetch = 10 [default = 4]; -} - -message DropoutParameter { - optional float dropout_ratio = 1 [default = 0.5]; // dropout ratio - optional bool scale_train = 2 [default = true]; // scale train or test phase -} - -// DummyDataLayer fills any number of arbitrarily shaped blobs with random -// (or constant) data generated by "Fillers" (see "message FillerParameter"). -message DummyDataParameter { - // This layer produces N >= 1 top blobs. DummyDataParameter must specify 1 or N - // shape fields, and 0, 1 or N data_fillers. - // - // If 0 data_fillers are specified, ConstantFiller with a value of 0 is used. - // If 1 data_filler is specified, it is applied to all top blobs. If N are - // specified, the ith is applied to the ith top blob. - repeated FillerParameter data_filler = 1; - repeated BlobShape shape = 6; - - // 4D dimensions -- deprecated. Use "shape" instead. - repeated uint32 num = 2; - repeated uint32 channels = 3; - repeated uint32 height = 4; - repeated uint32 width = 5; -} - -message EltwiseParameter { - enum EltwiseOp { - PROD = 0; - SUM = 1; - MAX = 2; - } - optional EltwiseOp operation = 1 [default = SUM]; // element-wise operation - repeated float coeff = 2; // blob-wise coefficient for SUM operation - - // Whether to use an asymptotically slower (for >2 inputs) but stabler method - // of computing the gradient for the PROD operation. (No effect for SUM op.) - optional bool stable_prod_grad = 3 [default = true]; -} - -// Message that stores parameters used by ELULayer -message ELUParameter { - // Described in: - // Clevert, D.-A., Unterthiner, T., & Hochreiter, S. (2015). Fast and Accurate - // Deep Network Learning by Exponential Linear Units (ELUs). arXiv - optional float alpha = 1 [default = 1]; -} - -// Message that stores parameters used by EmbedLayer -message EmbedParameter { - optional uint32 num_output = 1; // The number of outputs for the layer - // The input is given as integers to be interpreted as one-hot - // vector indices with dimension num_input. Hence num_input should be - // 1 greater than the maximum possible input value. - optional uint32 input_dim = 2; - - optional bool bias_term = 3 [default = true]; // Whether to use a bias term - optional FillerParameter weight_filler = 4; // The filler for the weight - optional FillerParameter bias_filler = 5; // The filler for the bias - -} - -// Message that stores parameters used by ExpLayer -message ExpParameter { - // ExpLayer computes outputs y = base ^ (shift + scale * x), for base > 0. - // Or if base is set to the default (-1), base is set to e, - // so y = exp(shift + scale * x). - optional float base = 1 [default = -1.0]; - optional float scale = 2 [default = 1.0]; - optional float shift = 3 [default = 0.0]; -} - -/// Message that stores parameters used by FlattenLayer -message FlattenParameter { - // The first axis to flatten: all preceding axes are retained in the output. - // May be negative to index from the end (e.g., -1 for the last axis). - optional int32 axis = 1 [default = 1]; - - // The last axis to flatten: all following axes are retained in the output. - // May be negative to index from the end (e.g., the default -1 for the last - // axis). - optional int32 end_axis = 2 [default = -1]; -} - -// Message that stores parameters used by HDF5DataLayer -message HDF5DataParameter { - // Specify the data source. - optional string source = 1; - // Specify the batch size. - optional uint32 batch_size = 2; - - // Specify whether to shuffle the data. - // If shuffle == true, the ordering of the HDF5 files is shuffled, - // and the ordering of data within any given HDF5 file is shuffled, - // but data between different files are not interleaved; all of a file's - // data are output (in a random order) before moving onto another file. - optional bool shuffle = 3 [default = false]; -} - -message HDF5OutputParameter { - optional string file_name = 1; -} - -message HingeLossParameter { - enum Norm { - L1 = 1; - L2 = 2; - } - // Specify the Norm to use L1 or L2 - optional Norm norm = 1 [default = L1]; -} - -message ImageDataParameter { - // Specify the data source. - optional string source = 1; - // Specify the batch size. - optional uint32 batch_size = 4 [default = 1]; - // The rand_skip variable is for the data layer to skip a few data points - // to avoid all asynchronous sgd clients to start at the same point. The skip - // point would be set as rand_skip * rand(0,1). Note that rand_skip should not - // be larger than the number of keys in the database. - optional uint32 rand_skip = 7 [default = 0]; - // Whether or not ImageLayer should shuffle the list of files at every epoch. - optional bool shuffle = 8 [default = false]; - // It will also resize images if new_height or new_width are not zero. - optional uint32 new_height = 9 [default = 0]; - optional uint32 new_width = 10 [default = 0]; - // Specify if the images are color or gray - optional bool is_color = 11 [default = true]; - // DEPRECATED. See TransformationParameter. For data pre-processing, we can do - // simple scaling and subtracting the data mean, if provided. Note that the - // mean subtraction is always carried out before scaling. - optional float scale = 2 [default = 1]; - optional string mean_file = 3; - // DEPRECATED. See TransformationParameter. Specify if we would like to randomly - // crop an image. - optional uint32 crop_size = 5 [default = 0]; - // DEPRECATED. See TransformationParameter. Specify if we want to randomly mirror - // data. - optional bool mirror = 6 [default = false]; - optional string root_folder = 12 [default = ""]; -} - -message InfogainLossParameter { - // Specify the infogain matrix source. - optional string source = 1; - optional int32 axis = 2 [default = 1]; // axis of prob -} - -message InnerProductParameter { - optional uint32 num_output = 1; // The number of outputs for the layer - optional bool bias_term = 2 [default = true]; // whether to have bias terms - optional FillerParameter weight_filler = 3; // The filler for the weight - optional FillerParameter bias_filler = 4; // The filler for the bias - - // The first axis to be lumped into a single inner product computation; - // all preceding axes are retained in the output. - // May be negative to index from the end (e.g., -1 for the last axis). - optional int32 axis = 5 [default = 1]; - // Specify whether to transpose the weight matrix or not. - // If transpose == true, any operations will be performed on the transpose - // of the weight matrix. The weight matrix itself is not going to be transposed - // but rather the transfer flag of operations will be toggled accordingly. - optional bool transpose = 6 [default = false]; -} - -message InputParameter { - // This layer produces N >= 1 top blob(s) to be assigned manually. - // Define N shapes to set a shape for each top. - // Define 1 shape to set the same shape for every top. - // Define no shape to defer to reshaping manually. - repeated BlobShape shape = 1; -} - -// Message that stores parameters used by LogLayer -message LogParameter { - // LogLayer computes outputs y = log_base(shift + scale * x), for base > 0. - // Or if base is set to the default (-1), base is set to e, - // so y = ln(shift + scale * x) = log_e(shift + scale * x) - optional float base = 1 [default = -1.0]; - optional float scale = 2 [default = 1.0]; - optional float shift = 3 [default = 0.0]; -} - -// Message that stores parameters used by LRNLayer -message LRNParameter { - optional uint32 local_size = 1 [default = 5]; - optional float alpha = 2 [default = 1.]; - optional float beta = 3 [default = 0.75]; - enum NormRegion { - ACROSS_CHANNELS = 0; - WITHIN_CHANNEL = 1; - } - optional NormRegion norm_region = 4 [default = ACROSS_CHANNELS]; - optional float k = 5 [default = 1.]; - enum Engine { - DEFAULT = 0; - CAFFE = 1; - CUDNN = 2; - } - optional Engine engine = 6 [default = DEFAULT]; -} - -message MemoryDataParameter { - optional uint32 batch_size = 1; - optional uint32 channels = 2; - optional uint32 height = 3; - optional uint32 width = 4; -} - -message MVNParameter { - // This parameter can be set to false to normalize mean only - optional bool normalize_variance = 1 [default = true]; - - // This parameter can be set to true to perform DNN-like MVN - optional bool across_channels = 2 [default = false]; - - // Epsilon for not dividing by zero while normalizing variance - optional float eps = 3 [default = 1e-9]; -} - -message ParameterParameter { - optional BlobShape shape = 1; -} - -message PoolingParameter { - enum PoolMethod { - MAX = 0; - AVE = 1; - STOCHASTIC = 2; - } - optional PoolMethod pool = 1 [default = MAX]; // The pooling method - // Pad, kernel size, and stride are all given as a single value for equal - // dimensions in height and width or as Y, X pairs. - optional uint32 pad = 4 [default = 0]; // The padding size (equal in Y, X) - optional uint32 pad_h = 9 [default = 0]; // The padding height - optional uint32 pad_w = 10 [default = 0]; // The padding width - optional uint32 kernel_size = 2; // The kernel size (square) - optional uint32 kernel_h = 5; // The kernel height - optional uint32 kernel_w = 6; // The kernel width - optional uint32 stride = 3 [default = 1]; // The stride (equal in Y, X) - optional uint32 stride_h = 7; // The stride height - optional uint32 stride_w = 8; // The stride width - enum Engine { - DEFAULT = 0; - CAFFE = 1; - CUDNN = 2; - } - optional Engine engine = 11 [default = DEFAULT]; - // If global_pooling then it will pool over the size of the bottom by doing - // kernel_h = bottom->height and kernel_w = bottom->width - optional bool global_pooling = 12 [default = false]; - optional bool ceil_mode = 13 [default = true]; - // How to calculate the output size - using ceil (default) or floor rounding. - enum RoundMode { - CEIL = 0; - FLOOR = 1; - } - optional RoundMode round_mode = 14 [default = CEIL]; -} - -message PowerParameter { - // PowerLayer computes outputs y = (shift + scale * x) ^ power. - optional float power = 1 [default = 1.0]; - optional float scale = 2 [default = 1.0]; - optional float shift = 3 [default = 0.0]; -} - -message PythonParameter { - optional string module = 1; - optional string layer = 2; - // This value is set to the attribute `param_str` of the `PythonLayer` object - // in Python before calling the `setup()` method. This could be a number, - // string, dictionary in Python dict format, JSON, etc. You may parse this - // string in `setup` method and use it in `forward` and `backward`. - optional string param_str = 3 [default = '']; - // Whether this PythonLayer is shared among worker solvers during data parallelism. - // If true, each worker solver sequentially run forward from this layer. - // This value should be set true if you are using it as a data layer. - optional bool share_in_parallel = 4 [default = false]; -} - -// Message that stores parameters used by RecurrentLayer -message RecurrentParameter { - // The dimension of the output (and usually hidden state) representation -- - // must be explicitly set to non-zero. - optional uint32 num_output = 1 [default = 0]; - - optional FillerParameter weight_filler = 2; // The filler for the weight - optional FillerParameter bias_filler = 3; // The filler for the bias - - // Whether to enable displaying debug_info in the unrolled recurrent net. - optional bool debug_info = 4 [default = false]; - - // Whether to add as additional inputs (bottoms) the initial hidden state - // blobs, and add as additional outputs (tops) the final timestep hidden state - // blobs. The number of additional bottom/top blobs required depends on the - // recurrent architecture -- e.g., 1 for RNNs, 2 for LSTMs. - optional bool expose_hidden = 5 [default = false]; -} - -// Message that stores parameters used by ReductionLayer -message ReductionParameter { - enum ReductionOp { - SUM = 1; - ASUM = 2; - SUMSQ = 3; - MEAN = 4; - } - - optional ReductionOp operation = 1 [default = SUM]; // reduction operation - - // The first axis to reduce to a scalar -- may be negative to index from the - // end (e.g., -1 for the last axis). - // (Currently, only reduction along ALL "tail" axes is supported; reduction - // of axis M through N, where N < num_axes - 1, is unsupported.) - // Suppose we have an n-axis bottom Blob with shape: - // (d0, d1, d2, ..., d(m-1), dm, d(m+1), ..., d(n-1)). - // If axis == m, the output Blob will have shape - // (d0, d1, d2, ..., d(m-1)), - // and the ReductionOp operation is performed (d0 * d1 * d2 * ... * d(m-1)) - // times, each including (dm * d(m+1) * ... * d(n-1)) individual data. - // If axis == 0 (the default), the output Blob always has the empty shape - // (count 1), performing reduction across the entire input -- - // often useful for creating new loss functions. - optional int32 axis = 2 [default = 0]; - - optional float coeff = 3 [default = 1.0]; // coefficient for output -} - -// Message that stores parameters used by ReLULayer -message ReLUParameter { - // Allow non-zero slope for negative inputs to speed up optimization - // Described in: - // Maas, A. L., Hannun, A. Y., & Ng, A. Y. (2013). Rectifier nonlinearities - // improve neural network acoustic models. In ICML Workshop on Deep Learning - // for Audio, Speech, and Language Processing. - optional float negative_slope = 1 [default = 0]; - enum Engine { - DEFAULT = 0; - CAFFE = 1; - CUDNN = 2; - } - optional Engine engine = 2 [default = DEFAULT]; -} - -message ReshapeParameter { - // Specify the output dimensions. If some of the dimensions are set to 0, - // the corresponding dimension from the bottom layer is used (unchanged). - // Exactly one dimension may be set to -1, in which case its value is - // inferred from the count of the bottom blob and the remaining dimensions. - // For example, suppose we want to reshape a 2D blob "input" with shape 2 x 8: - // - // layer { - // type: "Reshape" bottom: "input" top: "output" - // reshape_param { ... } - // } - // - // If "input" is 2D with shape 2 x 8, then the following reshape_param - // specifications are all equivalent, producing a 3D blob "output" with shape - // 2 x 2 x 4: - // - // reshape_param { shape { dim: 2 dim: 2 dim: 4 } } - // reshape_param { shape { dim: 0 dim: 2 dim: 4 } } - // reshape_param { shape { dim: 0 dim: 2 dim: -1 } } - // reshape_param { shape { dim: 0 dim:-1 dim: 4 } } - // - optional BlobShape shape = 1; - - // axis and num_axes control the portion of the bottom blob's shape that are - // replaced by (included in) the reshape. By default (axis == 0 and - // num_axes == -1), the entire bottom blob shape is included in the reshape, - // and hence the shape field must specify the entire output shape. - // - // axis may be non-zero to retain some portion of the beginning of the input - // shape (and may be negative to index from the end; e.g., -1 to begin the - // reshape after the last axis, including nothing in the reshape, - // -2 to include only the last axis, etc.). - // - // For example, suppose "input" is a 2D blob with shape 2 x 8. - // Then the following ReshapeLayer specifications are all equivalent, - // producing a blob "output" with shape 2 x 2 x 4: - // - // reshape_param { shape { dim: 2 dim: 2 dim: 4 } } - // reshape_param { shape { dim: 2 dim: 4 } axis: 1 } - // reshape_param { shape { dim: 2 dim: 4 } axis: -3 } - // - // num_axes specifies the extent of the reshape. - // If num_axes >= 0 (and axis >= 0), the reshape will be performed only on - // input axes in the range [axis, axis+num_axes]. - // num_axes may also be -1, the default, to include all remaining axes - // (starting from axis). - // - // For example, suppose "input" is a 2D blob with shape 2 x 8. - // Then the following ReshapeLayer specifications are equivalent, - // producing a blob "output" with shape 1 x 2 x 8. - // - // reshape_param { shape { dim: 1 dim: 2 dim: 8 } } - // reshape_param { shape { dim: 1 dim: 2 } num_axes: 1 } - // reshape_param { shape { dim: 1 } num_axes: 0 } - // - // On the other hand, these would produce output blob shape 2 x 1 x 8: - // - // reshape_param { shape { dim: 2 dim: 1 dim: 8 } } - // reshape_param { shape { dim: 1 } axis: 1 num_axes: 0 } - // - optional int32 axis = 2 [default = 0]; - optional int32 num_axes = 3 [default = -1]; -} - - -message ScaleParameter { - // The first axis of bottom[0] (the first input Blob) along which to apply - // bottom[1] (the second input Blob). May be negative to index from the end - // (e.g., -1 for the last axis). - // - // For example, if bottom[0] is 4D with shape 100x3x40x60, the output - // top[0] will have the same shape, and bottom[1] may have any of the - // following shapes (for the given value of axis): - // (axis == 0 == -4) 100; 100x3; 100x3x40; 100x3x40x60 - // (axis == 1 == -3) 3; 3x40; 3x40x60 - // (axis == 2 == -2) 40; 40x60 - // (axis == 3 == -1) 60 - // Furthermore, bottom[1] may have the empty shape (regardless of the value of - // "axis") -- a scalar multiplier. - optional int32 axis = 1 [default = 1]; - - // (num_axes is ignored unless just one bottom is given and the scale is - // a learned parameter of the layer. Otherwise, num_axes is determined by the - // number of axes by the second bottom.) - // The number of axes of the input (bottom[0]) covered by the scale - // parameter, or -1 to cover all axes of bottom[0] starting from `axis`. - // Set num_axes := 0, to multiply with a zero-axis Blob: a scalar. - optional int32 num_axes = 2 [default = 1]; - - // (filler is ignored unless just one bottom is given and the scale is - // a learned parameter of the layer.) - // The initialization for the learned scale parameter. - // Default is the unit (1) initialization, resulting in the ScaleLayer - // initially performing the identity operation. - optional FillerParameter filler = 3; - - // Whether to also learn a bias (equivalent to a ScaleLayer+BiasLayer, but - // may be more efficient). Initialized with bias_filler (defaults to 0). - optional bool bias_term = 4 [default = false]; - optional FillerParameter bias_filler = 5; - optional bool scale_from_blob = 6 [default = true]; -} - -message SigmoidParameter { - enum Engine { - DEFAULT = 0; - CAFFE = 1; - CUDNN = 2; - } - optional Engine engine = 1 [default = DEFAULT]; -} - -message SliceParameter { - // The axis along which to slice -- may be negative to index from the end - // (e.g., -1 for the last axis). - // By default, SliceLayer concatenates blobs along the "channels" axis (1). - optional int32 axis = 3 [default = 1]; - repeated uint32 slice_point = 2; - - // DEPRECATED: alias for "axis" -- does not support negative indexing. - optional uint32 slice_dim = 1 [default = 1]; -} - -message SmoothL1LossParameter { - // SmoothL1Loss(x) = - // 0.5 * (sigma * x) ** 2 -- if x < 1.0 / sigma / sigma - // |x| - 0.5 / sigma / sigma -- otherwise - optional float sigma = 1 [default = 1]; -} - -// Message that stores parameters used by SoftmaxLayer, SoftmaxWithLossLayer -message SoftmaxParameter { - enum Engine { - DEFAULT = 0; - CAFFE = 1; - CUDNN = 2; - } - optional Engine engine = 1 [default = DEFAULT]; - - // The axis along which to perform the softmax -- may be negative to index - // from the end (e.g., -1 for the last axis). - // Any other axes will be evaluated as independent softmaxes. - optional int32 axis = 2 [default = 1]; -} - -message TanHParameter { - enum Engine { - DEFAULT = 0; - CAFFE = 1; - CUDNN = 2; - } - optional Engine engine = 1 [default = DEFAULT]; -} - -// Message that stores parameters used by TileLayer -message TileParameter { - // The index of the axis to tile. - optional int32 axis = 1 [default = 1]; - - // The number of copies (tiles) of the blob to output. - optional int32 tiles = 2; -} - -// Message that stores parameters used by ThresholdLayer -message ThresholdParameter { - optional float threshold = 1 [default = 0]; // Strictly positive values -} - -message WindowDataParameter { - // Specify the data source. - optional string source = 1; - // For data pre-processing, we can do simple scaling and subtracting the - // data mean, if provided. Note that the mean subtraction is always carried - // out before scaling. - optional float scale = 2 [default = 1]; - optional string mean_file = 3; - // Specify the batch size. - optional uint32 batch_size = 4; - // Specify if we would like to randomly crop an image. - optional uint32 crop_size = 5 [default = 0]; - // Specify if we want to randomly mirror data. - optional bool mirror = 6 [default = false]; - // Foreground (object) overlap threshold - optional float fg_threshold = 7 [default = 0.5]; - // Background (non-object) overlap threshold - optional float bg_threshold = 8 [default = 0.5]; - // Fraction of batch that should be foreground objects - optional float fg_fraction = 9 [default = 0.25]; - // Amount of contextual padding to add around a window - // (used only by the window_data_layer) - optional uint32 context_pad = 10 [default = 0]; - // Mode for cropping out a detection window - // warp: cropped window is warped to a fixed size and aspect ratio - // square: the tightest square around the window is cropped - optional string crop_mode = 11 [default = "warp"]; - // cache_images: will load all images in memory for faster access - optional bool cache_images = 12 [default = false]; - // append root_folder to locate images - optional string root_folder = 13 [default = ""]; -} - -message SPPParameter { - enum PoolMethod { - MAX = 0; - AVE = 1; - STOCHASTIC = 2; - } - optional uint32 pyramid_height = 1; - optional PoolMethod pool = 2 [default = MAX]; // The pooling method - enum Engine { - DEFAULT = 0; - CAFFE = 1; - CUDNN = 2; - } - optional Engine engine = 6 [default = DEFAULT]; -} - -// DEPRECATED: use LayerParameter. -message V1LayerParameter { - repeated string bottom = 2; - repeated string top = 3; - optional string name = 4; - repeated NetStateRule include = 32; - repeated NetStateRule exclude = 33; - enum LayerType { - NONE = 0; - ABSVAL = 35; - ACCURACY = 1; - ARGMAX = 30; - BNLL = 2; - CONCAT = 3; - CONTRASTIVE_LOSS = 37; - CONVOLUTION = 4; - DATA = 5; - DECONVOLUTION = 39; - DROPOUT = 6; - DUMMY_DATA = 32; - EUCLIDEAN_LOSS = 7; - ELTWISE = 25; - EXP = 38; - FLATTEN = 8; - HDF5_DATA = 9; - HDF5_OUTPUT = 10; - HINGE_LOSS = 28; - IM2COL = 11; - IMAGE_DATA = 12; - INFOGAIN_LOSS = 13; - INNER_PRODUCT = 14; - LRN = 15; - MEMORY_DATA = 29; - MULTINOMIAL_LOGISTIC_LOSS = 16; - MVN = 34; - POOLING = 17; - POWER = 26; - RELU = 18; - SIGMOID = 19; - SIGMOID_CROSS_ENTROPY_LOSS = 27; - SILENCE = 36; - SOFTMAX = 20; - SOFTMAX_LOSS = 21; - SPLIT = 22; - SLICE = 33; - TANH = 23; - WINDOW_DATA = 24; - THRESHOLD = 31; - QUANT = 208; - DEQUANT = 209; - } - optional LayerType type = 5; - repeated BlobProto blobs = 6; - repeated string param = 1001; - repeated DimCheckMode blob_share_mode = 1002; - enum DimCheckMode { - STRICT = 0; - PERMISSIVE = 1; - } - repeated float blobs_lr = 7; - repeated float weight_decay = 8; - repeated float loss_weight = 35; - optional AccuracyParameter accuracy_param = 27; - optional ArgMaxParameter argmax_param = 23; - optional ConcatParameter concat_param = 9; - optional ContrastiveLossParameter contrastive_loss_param = 40; - optional ConvolutionParameter convolution_param = 10; - optional DataParameter data_param = 11; - optional DropoutParameter dropout_param = 12; - optional DummyDataParameter dummy_data_param = 26; - optional EltwiseParameter eltwise_param = 24; - optional ExpParameter exp_param = 41; - optional HDF5DataParameter hdf5_data_param = 13; - optional HDF5OutputParameter hdf5_output_param = 14; - optional HingeLossParameter hinge_loss_param = 29; - optional ImageDataParameter image_data_param = 15; - optional InfogainLossParameter infogain_loss_param = 16; - optional InnerProductParameter inner_product_param = 17; - optional LRNParameter lrn_param = 18; - optional MemoryDataParameter memory_data_param = 22; - optional MVNParameter mvn_param = 34; - optional PoolingParameter pooling_param = 19; - optional PowerParameter power_param = 21; - optional ReLUParameter relu_param = 30; - optional SigmoidParameter sigmoid_param = 38; - optional SoftmaxParameter softmax_param = 39; - optional SliceParameter slice_param = 31; - optional TanHParameter tanh_param = 37; - optional ThresholdParameter threshold_param = 25; - optional WindowDataParameter window_data_param = 20; - optional TransformationParameter transform_param = 36; - optional LossParameter loss_param = 42; - optional V0LayerParameter layer = 1; -} - -// DEPRECATED: V0LayerParameter is the old way of specifying layer parameters -// in Caffe. We keep this message type around for legacy support. -message V0LayerParameter { - optional string name = 1; // the layer name - optional string type = 2; // the string to specify the layer type - - // Parameters to specify layers with inner products. - optional uint32 num_output = 3; // The number of outputs for the layer - optional bool biasterm = 4 [default = true]; // whether to have bias terms - optional FillerParameter weight_filler = 5; // The filler for the weight - optional FillerParameter bias_filler = 6; // The filler for the bias - - optional uint32 pad = 7 [default = 0]; // The padding size - optional uint32 kernelsize = 8; // The kernel size - optional uint32 group = 9 [default = 1]; // The group size for group conv - optional uint32 stride = 10 [default = 1]; // The stride - enum PoolMethod { - MAX = 0; - AVE = 1; - STOCHASTIC = 2; - } - optional PoolMethod pool = 11 [default = MAX]; // The pooling method - optional float dropout_ratio = 12 [default = 0.5]; // dropout ratio - - optional uint32 local_size = 13 [default = 5]; // for local response norm - optional float alpha = 14 [default = 1.]; // for local response norm - optional float beta = 15 [default = 0.75]; // for local response norm - optional float k = 22 [default = 1.]; - - // For data layers, specify the data source - optional string source = 16; - // For data pre-processing, we can do simple scaling and subtracting the - // data mean, if provided. Note that the mean subtraction is always carried - // out before scaling. - optional float scale = 17 [default = 1]; - optional string meanfile = 18; - // For data layers, specify the batch size. - optional uint32 batchsize = 19; - // For data layers, specify if we would like to randomly crop an image. - optional uint32 cropsize = 20 [default = 0]; - // For data layers, specify if we want to randomly mirror data. - optional bool mirror = 21 [default = false]; - - // The blobs containing the numeric parameters of the layer - repeated BlobProto blobs = 50; - // The ratio that is multiplied on the global learning rate. If you want to - // set the learning ratio for one blob, you need to set it for all blobs. - repeated float blobs_lr = 51; - // The weight decay that is multiplied on the global weight decay. - repeated float weight_decay = 52; - - // The rand_skip variable is for the data layer to skip a few data points - // to avoid all asynchronous sgd clients to start at the same point. The skip - // point would be set as rand_skip * rand(0,1). Note that rand_skip should not - // be larger than the number of keys in the database. - optional uint32 rand_skip = 53 [default = 0]; - - // Fields related to detection (det_*) - // foreground (object) overlap threshold - optional float det_fg_threshold = 54 [default = 0.5]; - // background (non-object) overlap threshold - optional float det_bg_threshold = 55 [default = 0.5]; - // Fraction of batch that should be foreground objects - optional float det_fg_fraction = 56 [default = 0.25]; - - // optional bool OBSOLETE_can_clobber = 57 [default = true]; - - // Amount of contextual padding to add around a window - // (used only by the window_data_layer) - optional uint32 det_context_pad = 58 [default = 0]; - - // Mode for cropping out a detection window - // warp: cropped window is warped to a fixed size and aspect ratio - // square: the tightest square around the window is cropped - optional string det_crop_mode = 59 [default = "warp"]; - - // For ReshapeLayer, one needs to specify the new dimensions. - optional int32 new_num = 60 [default = 0]; - optional int32 new_channels = 61 [default = 0]; - optional int32 new_height = 62 [default = 0]; - optional int32 new_width = 63 [default = 0]; - - // Whether or not ImageLayer should shuffle the list of files at every epoch. - // It will also resize images if new_height or new_width are not zero. - optional bool shuffle_images = 64 [default = false]; - - // For ConcatLayer, one needs to specify the dimension for concatenation, and - // the other dimensions must be the same for all the bottom blobs. - // By default it will concatenate blobs along the channels dimension. - optional uint32 concat_dim = 65 [default = 1]; - - optional HDF5OutputParameter hdf5_output_param = 1001; -} - -message PReLUParameter { - // Parametric ReLU described in K. He et al, Delving Deep into Rectifiers: - // Surpassing Human-Level Performance on ImageNet Classification, 2015. - - // Initial value of a_i. Default is a_i=0.25 for all i. - optional FillerParameter filler = 1; - // Whether or not slope parameters are shared across channels. - optional bool channel_shared = 2 [default = false]; -} - -// Message that stores parameters used by DetectionOutputLayer -//message DetectionOutputParameter { -// optional int32 num_classes = 1 [default = 21]; -// optional float nms_threshold = 2 [default = 0.3]; -// optional int32 top_k = 3; -// optional float confidence_threshold = 4 [default = 0.8]; -//} - -// Message that store parameters used by PriorBoxLayer -message PriorBoxParameter { - // Encode/decode type. - enum CodeType { - CORNER = 1; - CENTER_SIZE = 2; - CORNER_SIZE = 3; - } - // Minimum box size (in pixels). Required! - repeated float min_size = 1; - // Maximum box size (in pixels). Required! - repeated float max_size = 2; - // Various of aspect ratios. Duplicate ratios will be ignored. - // If none is provided, we use default ratio 1. - repeated float aspect_ratio = 3; - // If true, will flip each aspect ratio. - // For example, if there is aspect ratio "r", - // we will generate aspect ratio "1.0/r" as well. - optional bool flip = 4 [default = true]; - // If true, will clip the prior so that it is within [0, 1] - optional bool clip = 5 [default = false]; - // Variance for adjusting the prior bboxes. - repeated float variance = 6; - // By default, we calculate img_height, img_width, step_x, step_y based on - // bottom[0] (feat) and bottom[1] (img). Unless these values are explicitely - // provided. - // Explicitly provide the img_size. - optional uint32 img_size = 7; - // Either img_size or img_h/img_w should be specified; not both. - optional uint32 img_h = 8; - optional uint32 img_w = 9; - - // Explicitly provide the step size. - optional float step = 10; - // Either step or step_h/step_w should be specified; not both. - optional float step_h = 11; - optional float step_w = 12; - - // Offset to the top left corner of each cell. - optional float offset = 13 [default = 0.5]; -} - -// Message that stores parameters used by PermutetLayer -message PermuteParameter { - // The new orders of the axes of data. Notice it should be with - // in the same range as the input data, and it starts from 0. - // Do not provide repeated order. - repeated uint32 order = 1; -} - -message NormalizeParameter { - optional bool across_spatial = 1 [default = true]; - // Initial value of scale. Default is 1.0 for all - optional FillerParameter scale_filler = 2; - // Whether or not scale parameters are shared across channels. - optional bool channel_shared = 3 [default = true]; - // Epsilon for not dividing by zero while normalizing variance - optional float eps = 4 [default = 1e-10]; -} - -// needed by ssd -message SaveOutputParameter { - // Output directory. If not empty, we will save the results. - optional string output_directory = 1; - // Output name prefix. - optional string output_name_prefix = 2; - // Output format. - // VOC - PASCAL VOC output format. - // COCO - MS COCO output format. - optional string output_format = 3; - // If you want to output results, must also provide the following two files. - // Otherwise, we will ignore saving results. - // label map file. - optional string label_map_file = 4; - // A file which contains a list of names and sizes with same order - // of the input DB. The file is in the following format: - // name height width - // ... - optional string name_size_file = 5; - // Number of test images. It can be less than the lines specified in - // name_size_file. For example, when we only want to evaluate on part - // of the test images. - optional uint32 num_test_image = 6; - // The resize parameter used in saving the data. - // optional ResizeParameter resize_param = 7; -} - -message NonMaximumSuppressionParameter { - // Threshold to be used in nms. - optional float nms_threshold = 1 [default = 0.3]; - // Maximum number of results to be kept. - optional int32 top_k = 2; - // Parameter for adaptive nms. - optional float eta = 3 [default = 1.0]; -} - -message GeneralNmsParameter { - optional int32 post_top_k = 1 ; - optional float nms_threshold = 2 [default = 0]; - optional float iou_threshold_decay = 3 [default = 1.0]; - optional float coor_scale_factor = 4 [default = 1.0]; -} - -// Message that store parameters used by DetectionOutputLayer, ssd/fasterRcnn -message DetectionOutputParameter { - optional int32 num_classes = 1; - optional bool share_location = 2 [default = true]; - optional int32 background_label_id = 3 [default = 0]; - optional NonMaximumSuppressionParameter nms_param = 4; - optional SaveOutputParameter save_output_param = 5; - optional PriorBoxParameter.CodeType code_type = 6 [default = CENTER_SIZE]; - optional bool variance_encoded_in_target = 8 [default = true]; - optional int32 keep_top_k = 7; - optional float confidence_threshold = 9; - optional float nms_threshold = 13; - optional int32 top_k = 14; - optional int32 boxes = 15 [default = 1]; - optional bool relative = 17 [default = true]; - optional float objectness_threshold = 18 [default = 0.5]; - optional float class_threshold = 19 [default = 0.5]; - repeated float biases = 20; - optional GeneralNmsParameter general_nms_param = 21; - optional float objectness_score = 22; -} -message PSROIPoolingParameter { - required float spatial_scale = 1; - required int32 output_dim = 2; // output channel number - required int32 group_size = 3; // number of groups to encode position-sensitive score maps -} -// Message that stores parameters used by FreespaceExtractLayer -message FreespaceExtractParameter { - optional float org_height = 1; -} - -// Message that stores parameters used by DetectpostprocessLayer -message PostprocessParameter { - optional float nms_thresh = 1 [default = 0.3]; - optional float conf_thresh = 2 [default = 0.5]; - optional uint32 post_nms_topn = 3 [default = 100]; - optional uint32 cls_num = 4 [default = 12]; - repeated float bbox_reg_weights = 5; -} - -// Message that stores parameters used by SpatialTransformLayer -message SpatialTransformParameter { - optional uint32 output_h = 1 [default = 0]; - optional uint32 output_w = 2 [default = 0]; - optional float border_value = 3 [default = 0]; - repeated float affine_transform = 4; - enum Engine { - DEFAULT = 0; - CAFFE = 1; - CUDNN = 2; - } - optional Engine engine = 15 [default = DEFAULT]; -} -message ROIAlignParameter { - // Pad, kernel size, and stride are all given as a single value for equal - // dimensions in height and width or as Y, X pairs. - optional uint32 pooled_h = 1 [default = 0]; // The pooled output height - optional uint32 pooled_w = 2 [default = 0]; // The pooled output width - // Multiplicative spatial scale factor to translate ROI coords from their - // input scale to the scale used when pooling - optional float spatial_scale = 3 [default = 1]; - optional int32 sampling_ratio = 4 [default = -1]; - optional int32 roi_end_mode = 5 [default = 0]; -} - -message RegionParameter { - optional uint32 classes = 1 [default = 20]; // Category of classification - optional uint32 coords = 2 [default = 4]; // Coordinates of box - optional uint32 boxes = 3 [default = 1]; // Number of boxes predicted per grid - optional uint32 softmax = 4 [default = 0]; - optional string softmax_tree = 5 [default = ""]; - optional uint32 background = 6 [default = 0]; -} -message ReorgParameter{ - optional uint32 stride = 2 [default = 2]; - optional bool reverse = 1 [default = false]; -} -message ReverseParameter{ - repeated int32 axis = 1; -} -message InterpParameter{ - optional int32 height = 1 [default = 0];//Height of output - optional int32 width = 2 [default = 0];//Width of output - optional int32 zoom_factor = 3 [default = 1];//zoom factor - optional int32 shrink_factor = 4 [default = 1];//shrink factor - optional int32 pad_beg = 5 [default = 0];//padding at begin of input - optional int32 pad_end = 6 [default = 0];//padding at end of input -} -message ShuffleChannelParameter{ - optional uint32 group = 1[default = 1]; // The number of group -} -message UpsampleParameter{ - optional float scale = 1[default = 1]; - optional int32 stride = 2[default = 2]; - optional int32 stride_h = 3[default = 2]; - optional int32 stride_w = 4[default=2]; -} -message ROIPoolingParameter { - required int32 pooled_h = 1; - required int32 pooled_w = 2; - optional float spatial_scale = 3 [default=0.0625]; - optional float spatial_scale_h = 4; - optional float spatial_scale_w = 5; -} - -message YoloParameter { - optional int32 boxes = 1 [default = 3]; - optional int32 coords = 2 [default = 4]; - optional int32 classes = 3 [default = 80]; - optional string yolo_version = 4 [default = "V3"]; - optional bool softmax = 5 [default = false]; - optional bool background = 6 [default = false]; - optional bool softmaxtree = 7 [default = false]; -} - -message YoloV3DetectionOutputParameter { - optional int32 boxes = 1 [default = 3]; - optional int32 classes = 2 [default = 80]; - optional bool relative = 3 [default = true]; - optional float obj_threshold = 4 [default = 0.5]; - optional float score_threshold = 5 [default = 0.5]; - optional float iou_threshold = 6 [default = 0.45]; - optional int32 pre_nms_topn = 7 [default = 512]; - optional int32 post_nms_topn = 8 [default = 1024]; - repeated float biases_high = 9; - repeated float biases_mid = 10; - repeated float biases_low = 11; - optional int32 coords = 12 [default = 4]; - repeated float biases = 13; - optional bool resize_origin_img_to_net = 14 [default = false]; -} - -message ProposalParameter { - optional float feat_stride = 1 [default = 16]; - optional float base_size = 2 [default = 16]; - optional float min_size = 3 [default = 16]; - repeated float ratio = 4; - repeated float scale = 5; - optional int32 pre_nms_topn = 6 [default = 3000]; - optional int32 post_nms_topn = 7 [default = 304]; - optional float iou_threshold = 8 [default = 0.7]; - optional bool output_actual_rois_num = 9 [default = false]; -} - -message FSRDetectionOutputParameter { - required int32 num_classes = 1; - required float score_threshold = 2; - required float iou_threshold = 3; - optional int32 batch_rois = 4 [default = 1]; -} - -message SSDDetectionOutputParameter { - required int32 num_classes= 1 [default = 2]; - optional bool share_location = 2 [default = true]; - optional int32 background_label_id = 3 [default = 0]; - optional float iou_threshold = 4 [default = 0.3]; - optional int32 top_k = 5 [default = 200]; - optional float eta = 6 [default = 1.0]; - optional bool variance_encoded_in_target = 7 [default = false]; - optional int32 code_type = 8 [default = 1]; - optional int32 keep_top_k = 9 [default = -1]; - optional float confidence_threshold = 10 [default = 0.0]; -} -message YoloV2DetectionOutputParameter { - optional int32 boxes = 1 [default = 5]; - optional int32 classes = 2 [default = 80]; - optional bool relative = 3 [default = true]; - optional float obj_threshold = 4 [default = 0.5]; - optional float score_threshold = 5 [default = 0.5]; - optional float iou_threshold = 6 [default = 0.45]; - optional int32 pre_nms_topn = 7 [default = 512]; - optional int32 post_nms_topn = 8 [default = 1024]; - repeated float biases = 9; - optional int32 coords = 10 [default = 4]; - optional bool resize_origin_img_to_net = 11 [default = false]; -} - -message QuantParameter { - optional float scale = 2; - optional bytes offset = 3; -} - -message BatchMatMulParameter{ - optional bool adj_x1 = 1 [default = false]; - optional bool adj_x2 = 2 [default = false]; -} - -message CondTakeParameter { - required string mode = 1; - required float val = 2; - optional float eps = 3 [default = 1e-06]; -} - -message MatrixInverseParameter { - optional bool adjoint = 1 [default = false]; -} - -message WarpPerspectiveParameter { - required int32 out_height = 1; - required int32 out_width = 2; - optional float constant = 3; - optional string border_type = 4 [default = 'BORDER_CONSTANT']; -} - -message SpatialTransformerParameter { - // How to use the parameter passed by localisation network - optional string transform_type = 1 [default = "affine"]; - // What is the sampling technique - optional string sampler_type = 2 [default = "bilinear"]; - - // If not set,stay same with the input dimension H and W - optional int32 output_H = 3; - optional int32 output_W = 4; - // If false, only compute dTheta, DO NOT compute dU - optional bool to_compute_dU = 5 [default = true]; - - // The default value for some parameters - optional double theta_1_1 = 6; - optional double theta_1_2 = 7; - optional double theta_1_3 = 8; - optional double theta_2_1 = 9; - optional double theta_2_2 = 10; - optional double theta_2_3 = 11; -} diff --git a/inc/register/proto/tensorflow/attr_value.proto b/inc/register/proto/tensorflow/attr_value.proto deleted file mode 100644 index 1cc67d627..000000000 --- a/inc/register/proto/tensorflow/attr_value.proto +++ /dev/null @@ -1,62 +0,0 @@ -syntax = "proto3"; - -package domi.tensorflow; -option cc_enable_arenas = true; -option java_outer_classname = "AttrValueProtos"; -option java_multiple_files = true; -option java_package = "org.tensorflow.framework"; - -import "tensor.proto"; -import "tensor_shape.proto"; -import "types.proto"; - -// Protocol buffer representing the value for an attr used to configure an Op. -// Comment indicates the corresponding attr type. Only the field matching the -// attr type may be filled. -message AttrValue { - // LINT.IfChange - message ListValue { - repeated bytes s = 2; // "list(string)" - repeated int64 i = 3 [packed = true]; // "list(int)" - repeated float f = 4 [packed = true]; // "list(float)" - repeated bool b = 5 [packed = true]; // "list(bool)" - repeated DataType type = 6 [packed = true]; // "list(type)" - repeated TensorShapeProto shape = 7; // "list(shape)" - repeated TensorProto tensor = 8; // "list(tensor)" - repeated NameAttrList func = 9; // "list(attr)" - } - // LINT.ThenChange(https://www.tensorflow.org/code/tensorflow/c/c_api.cc) - - oneof value { - bytes s = 2; // "string" - int64 i = 3; // "int" - float f = 4; // "float" - bool b = 5; // "bool" - DataType type = 6; // "type" - TensorShapeProto shape = 7; // "shape" - TensorProto tensor = 8; // "tensor" - ListValue list = 1; // any "list(...)" - - // "func" represents a function. func.name is a function's name or - // a primitive op's name. func.attr.first is the name of an attr - // defined for that function. func.attr.second is the value for - // that attr in the instantiation. - NameAttrList func = 10; - - // This is a placeholder only used in nodes defined inside a - // function. It indicates the attr value will be supplied when - // the function is instantiated. For example, let us suppose a - // node "N" in function "FN". "N" has an attr "A" with value - // placeholder = "foo". When FN is instantiated with attr "foo" - // set to "bar", the instantiated node N's attr A will have been - // given the value "bar". - string placeholder = 9; - } -} - -// A list of attr names and their values. The whole list is attached -// with a string name. E.g., MatMul[T=float]. -message NameAttrList { - string name = 1; - map attr = 2; -} diff --git a/inc/register/proto/tensorflow/function.proto b/inc/register/proto/tensorflow/function.proto deleted file mode 100644 index 075897c68..000000000 --- a/inc/register/proto/tensorflow/function.proto +++ /dev/null @@ -1,100 +0,0 @@ -syntax = "proto3"; - -package domi.tensorflow; -option cc_enable_arenas = true; -option java_outer_classname = "FunctionProtos"; -option java_multiple_files = true; -option java_package = "org.tensorflow.framework"; - -import "attr_value.proto"; -import "node_def.proto"; -import "op_def.proto"; - -// A library is a set of named functions. -message FunctionDefLibrary { - repeated FunctionDef function = 1; - repeated GradientDef gradient = 2; -} - -// A function can be instantiated when the runtime can bind every attr -// with a value. When a GraphDef has a call to a function, it must -// have binding for every attr defined in the signature. -// * device spec, etc. -message FunctionDef { - // The definition of the function's name, arguments, return values, - // attrs etc. - OpDef signature = 1; - - // Attributes specific to this function definition. - map attr = 5; - - // NOTE: field id 2 deleted on Jan 11, 2017, GraphDef version 21. - reserved 2; - - // In both of the following fields, there is the need to specify an - // output that is used as either the input to another node (in - // `node_def`) or as a return value of the function (in `ret`). - // Unlike the NodeDefs in GraphDef, we need to be able to specify a - // list in some cases (instead of just single outputs). Also, we - // need to be able to deal with lists of unknown length (so the - // output index may not be known at function definition time). So - // we use the following format instead: - // * "fun_in" where "fun_in" is the name of a function input arg in - // the `signature` field above. This represents that input, whether - // it is a single tensor or a list. - // * "fun_in:0" gives the first element of a function input arg (a - // non-list input is considered a list of length 1 for these - // purposes). - // * "node:out" where "node" is the name of a node in `node_def` and - // "out" is the name one of its op's output arguments (the name - // comes from the OpDef of the node's op). This represents that - // node's output, whether it is a single tensor or a list. - // Note: We enforce that an op's output arguments are never - // renamed in the backwards-compatibility test. - // * "node:out:0" gives the first element of a node output arg (a - // non-list output is considered a list of length 1 for these - // purposes). - // - // NOT CURRENTLY SUPPORTED (but may be in the future): - // * "node:out:-1" gives last element in a node output list - // * "node:out:1:" gives a list with all but the first element in a - // node output list - // * "node:out::-1" gives a list with all but the last element in a - // node output list - - // The body of the function. Unlike the NodeDefs in a GraphDef, attrs - // may have values of type `placeholder` and the `input` field uses - // the "output" format above. - - // By convention, "op" in node_def is resolved by consulting with a - // user-defined library first. If not resolved, "func" is assumed to - // be a builtin op. - repeated NodeDef node_def = 3; - - // A mapping from the output arg names from `signature` to the - // outputs from `node_def` that should be returned by the function. - map ret = 4; -} - -// GradientDef defines the gradient function of a function defined in -// a function library. -// -// A gradient function g (specified by gradient_func) for a function f -// (specified by function_name) must follow the following: -// -// The function 'f' must be a numerical function which takes N inputs -// and produces M outputs. Its gradient function 'g', which is a -// function taking N + M inputs and produces N outputs. -// -// I.e. if we have -// (y1, y2, ..., y_M) = f(x1, x2, ..., x_N), -// then, g is -// (dL/dx1, dL/dx2, ..., dL/dx_N) = g(x1, x2, ..., x_N, -// dL/dy1, dL/dy2, ..., dL/dy_M), -// where L is a scalar-value function of (x1, x2, ..., xN) (e.g., the -// loss function). dL/dx_i is the partial derivative of L with respect -// to x_i. -message GradientDef { - string function_name = 1; // The function name. - string gradient_func = 2; // The gradient function's name. -} diff --git a/inc/register/proto/tensorflow/graph.proto b/inc/register/proto/tensorflow/graph.proto deleted file mode 100644 index d639a7d6c..000000000 --- a/inc/register/proto/tensorflow/graph.proto +++ /dev/null @@ -1,56 +0,0 @@ -syntax = "proto3"; - -package domi.tensorflow; -option cc_enable_arenas = true; -option java_outer_classname = "GraphProtos"; -option java_multiple_files = true; -option java_package = "org.tensorflow.framework"; - -import "node_def.proto"; -import "function.proto"; -import "versions.proto"; - -// Represents the graph of operations -message GraphDef { - repeated NodeDef node = 1; - - // Compatibility versions of the graph. See core/public/version.h for version - // history. The GraphDef version is distinct from the TensorFlow version, and - // each release of TensorFlow will support a range of GraphDef versions. - VersionDef versions = 4; - - // Deprecated single version field; use versions above instead. Since all - // GraphDef changes before "versions" was introduced were forward - // compatible, this field is entirely ignored. - int32 version = 3 [deprecated = true]; - - // EXPERIMENTAL. DO NOT USE OR DEPEND ON THIS YET. - // - // "library" provides user-defined functions. - // - // Naming: - // * library.function.name are in a flat namespace. - // NOTE: We may need to change it to be hierarchical to support - // different orgs. E.g., - // { "/google/nn", { ... }}, - // { "/google/vision", { ... }} - // { "/org_foo/module_bar", { ... }} - // map named_lib; - // * If node[i].op is the name of one function in "library", - // node[i] is deemed as a function call. Otherwise, node[i].op - // must be a primitive operation supported by the runtime. - // - // - // Function call semantics: - // - // * The callee may start execution as soon as some of its inputs - // are ready. The caller may want to use Tuple() mechanism to - // ensure all inputs are ready in the same time. - // - // * The consumer of return values may start executing as soon as - // the return values the consumer depends on are ready. The - // consumer may want to use Tuple() mechanism to ensure the - // consumer does not start until all return values of the callee - // function are ready. - FunctionDefLibrary library = 2; -}; diff --git a/inc/register/proto/tensorflow/node_def.proto b/inc/register/proto/tensorflow/node_def.proto deleted file mode 100644 index b9bc97ee6..000000000 --- a/inc/register/proto/tensorflow/node_def.proto +++ /dev/null @@ -1,63 +0,0 @@ -syntax = "proto3"; - -package domi.tensorflow; -option cc_enable_arenas = true; -option java_outer_classname = "NodeProto"; -option java_multiple_files = true; -option java_package = "org.tensorflow.framework"; - -import "attr_value.proto"; - -message NodeDef { - // The name given to this operator. Used for naming inputs, - // logging, visualization, etc. Unique within a single GraphDef. - // Must match the regexp "[A-Za-z0-9.][A-Za-z0-9_./]*". - string name = 1; - - // The operation name. There may be custom parameters in attrs. - // Op names starting with an underscore are reserved for internal use. - string op = 2; - - // Each input is "node:src_output" with "node" being a string name and - // "src_output" indicating which output tensor to use from "node". If - // "src_output" is 0 the ":0" suffix can be omitted. Regular inputs - // may optionally be followed by control inputs that have the format - // "^node". - repeated string input = 3; - - // A (possibly partial) specification for the device on which this - // node should be placed. - // The expected syntax for this string is as follows: - // - // DEVICE_SPEC ::= PARTIAL_SPEC - // - // PARTIAL_SPEC ::= ("/" CONSTRAINT) * - // CONSTRAINT ::= ("job:" JOB_NAME) - // | ("replica:" [1-9][0-9]*) - // | ("task:" [1-9][0-9]*) - // | ("device:" [A-Za-z]* ":" ([1-9][0-9]* | "*") ) - // - // Valid values for this string include: - // * "/job:worker/replica:0/task:1/device:GPU:3" (full specification) - // * "/job:worker/device:GPU:3" (partial specification) - // * "" (no specification) - // - // If the constraints do not resolve to a single device (or if this - // field is empty or not present), the runtime will attempt to - // choose a device automatically. - string device = 4; - - // Operation-specific graph-construction-time configuration. - // Note that this should include all attrs defined in the - // corresponding OpDef, including those with a value matching - // the default -- this allows the default to change and makes - // NodeDefs easier to interpret on their own. However, if - // an attr with a default is not specified in this list, the - // default will be used. - // The "names" (keys) must match the regexp "[a-z][a-z0-9_]+" (and - // one of the names from the corresponding OpDef's attr field). - // The values must have a type matching the corresponding OpDef - // attr's type field. - // Add some examples here showing best practices. - map attr = 5; -}; diff --git a/inc/register/proto/tensorflow/op_def.proto b/inc/register/proto/tensorflow/op_def.proto deleted file mode 100644 index 3485d0453..000000000 --- a/inc/register/proto/tensorflow/op_def.proto +++ /dev/null @@ -1,164 +0,0 @@ -syntax = "proto3"; - -package domi.tensorflow; -option cc_enable_arenas = true; -option java_outer_classname = "OpDefProtos"; -option java_multiple_files = true; -option java_package = "org.tensorflow.framework"; - -import "attr_value.proto"; -import "types.proto"; - -// Defines an operation. A NodeDef in a GraphDef specifies an Op by -// using the "op" field which should match the name of a OpDef. -// LINT.IfChange -message OpDef { - // Op names starting with an underscore are reserved for internal use. - // Names should be CamelCase and match the regexp "[A-Z][a-zA-Z0-9_]*". - string name = 1; - - // For describing inputs and outputs. - message ArgDef { - // Name for the input/output. Should match the regexp "[a-z][a-z0-9_]*". - string name = 1; - - // Human readable description. - string description = 2; - - // Describes the type of one or more tensors that are accepted/produced - // by this input/output arg. The only legal combinations are: - // * For a single tensor: either the "type" field is set or the - // "type_attr" field is set to the name of an attr with type "type". - // * For a sequence of tensors with the same type: the "number_attr" - // field will be set to the name of an attr with type "int", and - // either the "type" or "type_attr" field will be set as for - // single tensors. - // * For a sequence of tensors, the "type_list_attr" field will be set - // to the name of an attr with type "list(type)". - DataType type = 3; - string type_attr = 4; // if specified, attr must have type "type" - string number_attr = 5; // if specified, attr must have type "int" - // If specified, attr must have type "list(type)", and none of - // type, type_attr, and number_attr may be specified. - string type_list_attr = 6; - - // For inputs: if true, the inputs are required to be refs. - // By default, inputs can be either refs or non-refs. - // For outputs: if true, outputs are refs, otherwise they are not. - bool is_ref = 16; - }; - - // Description of the input(s). - repeated ArgDef input_arg = 2; - - // Description of the output(s). - repeated ArgDef output_arg = 3; - - // Description of the graph-construction-time configuration of this - // Op. That is to say, this describes the attr fields that will - // be specified in the NodeDef. - message AttrDef { - // A descriptive name for the argument. May be used, e.g. by the - // Python client, as a keyword argument name, and so should match - // the regexp "[a-z][a-z0-9_]+". - string name = 1; - - // One of the type names from attr_value.proto ("string", "list(string)", - // "int", etc.). - string type = 2; - - // A reasonable default for this attribute if the user does not supply - // a value. If not specified, the user must supply a value. - AttrValue default_value = 3; - - // Human-readable description. - string description = 4; - - - // --- Constraints --- - // These constraints are only in effect if specified. Default is no - // constraints. - - // For type == "int", this is a minimum value. For "list(___)" - // types, this is the minimum length. - bool has_minimum = 5; - int64 minimum = 6; - - // The set of allowed values. Has type that is the "list" version - // of the "type" field above (uses the "list" field of AttrValue). - // If type == "type" or "list(type)" above, then the "type" field - // of "allowed_values.list" has the set of allowed DataTypes. - // If type == "string" or "list(string)", then the "s" field of - // "allowed_values.list" has the set of allowed strings. - AttrValue allowed_values = 7; - } - repeated AttrDef attr = 4; - - // Optional deprecation based on GraphDef versions. - OpDeprecation deprecation = 8; - - // One-line human-readable description of what the Op does. - string summary = 5; - - // Additional, longer human-readable description of what the Op does. - string description = 6; - - // ------------------------------------------------------------------------- - // Which optimizations this operation can participate in. - - // True if the operation is commutative ("op(a,b) == op(b,a)" for all inputs) - bool is_commutative = 18; - - // If is_aggregate is true, then this operation accepts N >= 2 - // inputs and produces 1 output all of the same type. Should be - // associative and commutative, and produce output with the same - // shape as the input. The optimizer may replace an aggregate op - // taking input from multiple devices with a tree of aggregate ops - // that aggregate locally within each device (and possibly within - // groups of nearby devices) before communicating. - bool is_aggregate = 16; // for things like add - - // Other optimizations go here, like - // can_alias_input, rewrite_when_output_unused, partitioning_strategy, etc. - - // ------------------------------------------------------------------------- - // Optimization constraints. - - // Ops are marked as stateful if their behavior depends on some state beyond - // their input tensors (e.g. variable reading op) or if they have - // a side-effect (e.g. printing or asserting ops). Equivalently, stateless ops - // must always produce the same output for the same input and have - // no side-effects. - // - // By default Ops may be moved between devices. Stateful ops should - // either not be moved, or should only be moved if that state can also - // be moved (e.g. via some sort of save / restore). - // Stateful ops are guaranteed to never be optimized away by Common - // Subexpression Elimination (CSE). - bool is_stateful = 17; // for things like variables, queue - - // ------------------------------------------------------------------------- - // Non-standard options. - - // By default, all inputs to an Op must be initialized Tensors. Ops - // that may initialize tensors for the first time should set this - // field to true, to allow the Op to take an uninitialized Tensor as - // input. - bool allows_uninitialized_input = 19; // for Assign, etc. -}; -// LINT.ThenChange( -// https://www.tensorflow.org/code/tensorflow/core/framework/op_def_util.cc) - -// Information about version-dependent deprecation of an op -message OpDeprecation { - // First GraphDef version at which the op is disallowed. - int32 version = 1; - - // Explanation of why it was deprecated and what to use instead. - string explanation = 2; -}; - -// A collection of OpDefs -message OpList { - repeated OpDef op = 1; -}; diff --git a/inc/register/proto/tensorflow/resource_handle.proto b/inc/register/proto/tensorflow/resource_handle.proto deleted file mode 100644 index a34523512..000000000 --- a/inc/register/proto/tensorflow/resource_handle.proto +++ /dev/null @@ -1,29 +0,0 @@ -syntax = "proto3"; - -package domi.tensorflow; -option cc_enable_arenas = true; -option java_outer_classname = "ResourceHandle"; -option java_multiple_files = true; -option java_package = "org.tensorflow.framework"; - -// Protocol buffer representing a handle to a tensorflow resource. Handles are -// not valid across executions, but can be serialized back and forth from within -// a single run. -message ResourceHandleProto { - // Unique name for the device containing the resource. - string device = 1; - - // Container in which this resource is placed. - string container = 2; - - // Unique name of this resource. - string name = 3; - - // Hash code for the type of the resource. Is only valid in the same device - // and in the same execution. - uint64 hash_code = 4; - - // For debug-only, the name of the type pointed to by this handle, if - // available. - string maybe_type_name = 5; -}; diff --git a/inc/register/proto/tensorflow/tensor.proto b/inc/register/proto/tensorflow/tensor.proto deleted file mode 100644 index d0a4d024c..000000000 --- a/inc/register/proto/tensorflow/tensor.proto +++ /dev/null @@ -1,94 +0,0 @@ -syntax = "proto3"; - -package domi.tensorflow; -option cc_enable_arenas = true; -option java_outer_classname = "TensorProtos"; -option java_multiple_files = true; -option java_package = "org.tensorflow.framework"; - -import "resource_handle.proto"; -import "tensor_shape.proto"; -import "types.proto"; - -// Protocol buffer representing a tensor. -message TensorProto { - DataType dtype = 1; - - // Shape of the tensor. - TensorShapeProto tensor_shape = 2; - - // Only one of the representations below is set, one of "tensor_contents" and - // the "xxx_val" attributes. We are not using oneof because as oneofs cannot - // contain repeated fields it would require another extra set of messages. - - // Version number. - // - // In version 0, if the "repeated xxx" representations contain only one - // element, that element is repeated to fill the shape. This makes it easy - // to represent a constant Tensor with a single value. - int32 version_number = 3; - - // Serialized raw tensor content from either Tensor::AsProtoTensorContent or - // memcpy in tensorflow::grpc::EncodeTensorToByteBuffer. This representation - // can be used for all tensor types. The purpose of this representation is to - // reduce serialization overhead during RPC call by avoiding serialization of - // many repeated small items. - bytes tensor_content = 4; - - // Type specific representations that make it easy to create tensor protos in - // all languages. Only the representation corresponding to "dtype" can - // be set. The values hold the flattened representation of the tensor in - // row major order. - - // DT_HALF, DT_BFLOAT16. Note that since protobuf has no int16 type, we'll - // have some pointless zero padding for each value here. - repeated int32 half_val = 13 [packed = true]; - - // DT_FLOAT. - repeated float float_val = 5 [packed = true]; - - // DT_DOUBLE. - repeated double double_val = 6 [packed = true]; - - // DT_INT32, DT_INT16, DT_INT8, DT_UINT8. - repeated int32 int_val = 7 [packed = true]; - - // DT_STRING - repeated bytes string_val = 8; - - // DT_COMPLEX64. scomplex_val(2*i) and scomplex_val(2*i+1) are real - // and imaginary parts of i-th single precision complex. - repeated float scomplex_val = 9 [packed = true]; - - // DT_INT64 - repeated int64 int64_val = 10 [packed = true]; - - // DT_BOOL - repeated bool bool_val = 11 [packed = true]; - - // DT_COMPLEX128. dcomplex_val(2*i) and dcomplex_val(2*i+1) are real - // and imaginary parts of i-th double precision complex. - repeated double dcomplex_val = 12 [packed = true]; - - // DT_RESOURCE - repeated ResourceHandleProto resource_handle_val = 14; - - // DT_VARIANT - repeated VariantTensorDataProto variant_val = 15; - - // DT_UINT32 - repeated uint32 uint32_val = 16 [packed = true]; - - // DT_UINT64 - repeated uint64 uint64_val = 17 [packed = true]; -}; - -// Protocol buffer representing the serialization format of DT_VARIANT tensors. -message VariantTensorDataProto { - // Name of the type of objects being serialized. - string type_name = 1; - // Portions of the object that are not Tensors. - bytes metadata = 2; - // Tensors contained within objects being serialized. - repeated TensorProto tensors = 3; -} diff --git a/inc/register/proto/tensorflow/tensor_shape.proto b/inc/register/proto/tensorflow/tensor_shape.proto deleted file mode 100644 index 4225a2e37..000000000 --- a/inc/register/proto/tensorflow/tensor_shape.proto +++ /dev/null @@ -1,45 +0,0 @@ -// Protocol buffer representing the shape of tensors. - -syntax = "proto3"; -option cc_enable_arenas = true; -option java_outer_classname = "TensorShapeProtos"; -option java_multiple_files = true; -option java_package = "org.tensorflow.framework"; - -package domi.tensorflow; - -// Dimensions of a tensor. -message TensorShapeProto { - // One dimension of the tensor. - message Dim { - // Size of the tensor in that dimension. - // This value must be >= -1, but values of -1 are reserved for "unknown" - // shapes (values of -1 mean "unknown" dimension). Certain wrappers - // that work with TensorShapeProto may fail at runtime when deserializing - // a TensorShapeProto containing a dim value of -1. - int64 size = 1; - - // Optional name of the tensor dimension. - string name = 2; - }; - - // Dimensions of the tensor, such as {"input", 30}, {"output", 40} - // for a 30 x 40 2D tensor. If an entry has size -1, this - // corresponds to a dimension of unknown size. The names are - // optional. - // - // The order of entries in "dim" matters: It indicates the layout of the - // values in the tensor in-memory representation. - // - // The first entry in "dim" is the outermost dimension used to layout the - // values, the last entry is the innermost dimension. This matches the - // in-memory layout of RowMajor Eigen tensors. - // - // If "dim.size()" > 0, "unknown_rank" must be false. - repeated Dim dim = 2; - - // If true, the number of dimensions in the shape is unknown. - // - // If true, "dim.size()" must be 0. - bool unknown_rank = 3; -}; diff --git a/inc/register/proto/tensorflow/types.proto b/inc/register/proto/tensorflow/types.proto deleted file mode 100644 index ba7a72b30..000000000 --- a/inc/register/proto/tensorflow/types.proto +++ /dev/null @@ -1,74 +0,0 @@ -syntax = "proto3"; - -package domi.tensorflow; -option cc_enable_arenas = true; -option java_outer_classname = "TypesProtos"; -option java_multiple_files = true; -option java_package = "org.tensorflow.framework"; - -// LINT.IfChange -enum DataType { - // Not a legal value for DataType. Used to indicate a DataType field - // has not been set. - DT_INVALID = 0; - - // Data types that all computation devices are expected to be - // capable to support. - DT_FLOAT = 1; - DT_DOUBLE = 2; - DT_INT32 = 3; - DT_UINT8 = 4; - DT_INT16 = 5; - DT_INT8 = 6; - DT_STRING = 7; - DT_COMPLEX64 = 8; // Single-precision complex - DT_INT64 = 9; - DT_BOOL = 10; - DT_QINT8 = 11; // Quantized int8 - DT_QUINT8 = 12; // Quantized uint8 - DT_QINT32 = 13; // Quantized int32 - DT_BFLOAT16 = 14; // Float32 truncated to 16 bits. Only for cast ops. - DT_QINT16 = 15; // Quantized int16 - DT_QUINT16 = 16; // Quantized uint16 - DT_UINT16 = 17; - DT_COMPLEX128 = 18; // Double-precision complex - DT_HALF = 19; - DT_RESOURCE = 20; - DT_VARIANT = 21; // Arbitrary C++ data types - DT_UINT32 = 22; - DT_UINT64 = 23; - - // Do not use! These are only for parameters. Every enum above - // should have a corresponding value below (verified by types_test). - DT_FLOAT_REF = 101; - DT_DOUBLE_REF = 102; - DT_INT32_REF = 103; - DT_UINT8_REF = 104; - DT_INT16_REF = 105; - DT_INT8_REF = 106; - DT_STRING_REF = 107; - DT_COMPLEX64_REF = 108; - DT_INT64_REF = 109; - DT_BOOL_REF = 110; - DT_QINT8_REF = 111; - DT_QUINT8_REF = 112; - DT_QINT32_REF = 113; - DT_BFLOAT16_REF = 114; - DT_QINT16_REF = 115; - DT_QUINT16_REF = 116; - DT_UINT16_REF = 117; - DT_COMPLEX128_REF = 118; - DT_HALF_REF = 119; - DT_RESOURCE_REF = 120; - DT_VARIANT_REF = 121; - DT_UINT32_REF = 122; - DT_UINT64_REF = 123; -} -// LINT.ThenChange( -// https://www.tensorflow.org/code/tensorflow/c/c_api.h, -// https://www.tensorflow.org/code/tensorflow/go/tensor.go, -// https://www.tensorflow.org/code/tensorflow/core/framework/tensor.cc, -// https://www.tensorflow.org/code/tensorflow/core/framework/types.h, -// https://www.tensorflow.org/code/tensorflow/core/framework/types.cc, -// https://www.tensorflow.org/code/tensorflow/python/framework/dtypes.py, -// https://www.tensorflow.org/code/tensorflow/python/framework/function.py) diff --git a/inc/register/proto/tensorflow/versions.proto b/inc/register/proto/tensorflow/versions.proto deleted file mode 100644 index 48061218a..000000000 --- a/inc/register/proto/tensorflow/versions.proto +++ /dev/null @@ -1,31 +0,0 @@ -syntax = "proto3"; - -package domi.tensorflow; -option cc_enable_arenas = true; -option java_outer_classname = "VersionsProtos"; -option java_multiple_files = true; -option java_package = "org.tensorflow.framework"; - -// Version information for a piece of serialized data -// -// There are different types of versions for each type of data -// (GraphDef, etc.), but they all have the same common shape -// described here. -// -// Each consumer has "consumer" and "min_producer" versions (specified -// elsewhere). A consumer is allowed to consume this data if -// -// producer >= min_producer -// consumer >= min_consumer -// consumer not in bad_consumers -// -message VersionDef { - // The version of the code that produced this data. - int32 producer = 1; - - // Any consumer below this version is not allowed to consume this data. - int32 min_consumer = 2; - - // Specific consumer versions which are disallowed (e.g. due to bugs). - repeated int32 bad_consumers = 3; -}; diff --git a/inc/register/register.h b/inc/register/register.h deleted file mode 100644 index 32adaea06..000000000 --- a/inc/register/register.h +++ /dev/null @@ -1,53 +0,0 @@ -/** - * Copyright 2020 Huawei Technologies Co., Ltd - * - * 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 INC_REGISTER_REGISTRY_H_ -#define INC_REGISTER_REGISTRY_H_ - -#include "external/register/register.h" - -namespace ge { -class FMK_FUNC_HOST_VISIBILITY FMK_FUNC_DEV_VISIBILITY HostCpuOp { - public: - HostCpuOp() = default; - virtual ~HostCpuOp() = default; - - virtual graphStatus Compute(Operator &op, - const std::map &inputs, - std::map &outputs) = 0; -}; - -class FMK_FUNC_HOST_VISIBILITY FMK_FUNC_DEV_VISIBILITY HostCpuOpRegistrar { - public: - HostCpuOpRegistrar(const char *op_type, HostCpuOp *(*create_fn)()); - ~HostCpuOpRegistrar() = default; -}; - -#define REGISTER_HOST_CPU_OP_BUILDER(name, op) \ - REGISTER_HOST_CPU_OP_BUILDER_UNIQ_HELPER(__COUNTER__, name, op) - -#define REGISTER_HOST_CPU_OP_BUILDER_UNIQ_HELPER(ctr, name, op) \ - REGISTER_HOST_CPU_OP_BUILDER_UNIQ(ctr, name, op) - -#define REGISTER_HOST_CPU_OP_BUILDER_UNIQ(ctr, name, op) \ - static ::ge::HostCpuOpRegistrar register_host_cpu_op##ctr \ - __attribute__((unused)) = \ - ::ge::HostCpuOpRegistrar(name, []()->::ge::HostCpuOp* { \ - return new (std::nothrow) op(); \ - }) -} // namespace ge - -#endif //INC_REGISTER_REGISTRY_H_ diff --git a/inc/register/register_format_transfer.h b/inc/register/register_format_transfer.h deleted file mode 100644 index 5cbf4ab42..000000000 --- a/inc/register/register_format_transfer.h +++ /dev/null @@ -1,79 +0,0 @@ -/** - * Copyright 2020 Huawei Technologies Co., Ltd - * - * 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 INC_REGISTER_REGISTER_FORMAT_TRANSFER_H_ -#define INC_REGISTER_REGISTER_FORMAT_TRANSFER_H_ - -#include -#include -#include - -#include "external/graph/types.h" -#include "ge/ge_api_error_codes.h" - -namespace ge { -namespace formats { -struct TransArgs { - const uint8_t *data; - Format src_format; - Format dst_format; - // For scenes that need to supplement the shape, for example, 5D to 4D - // It is not possible to convert the format normally if you only get the src_shape, - // and must get the shape before you mend the shape. - // So the parameters here need to be passed in both src_shape and dst_shape - std::vector src_shape; - std::vector dst_shape; - DataType src_data_type; -}; - -struct TransResult { - std::shared_ptr data; - // data length in bytes - size_t length; -}; - -class FormatTransfer { - public: - virtual ~FormatTransfer() = default; - virtual Status TransFormat(const TransArgs &args, TransResult &result) = 0; - virtual Status TransShape(Format src_format, const std::vector &src_shape, DataType data_type, - Format dst_format, std::vector &dst_shape) = 0; -}; - -using FormatTransferBuilder = std::function()>; - -class FormatTransferRegister { - public: - FormatTransferRegister(FormatTransferBuilder builder, Format src, Format dst); - ~FormatTransferRegister() = default; -}; - -#define REGISTER_FORMAT_TRANSFER(TransferClass, format1, format2) \ - namespace { \ - FormatTransferRegister format_transfer_register_##TransferClass##format1##format2( \ - []() { return std::make_shared(); }, format1, format2); \ - } - -/// Build a formattransfer according to 'args' -/// @param args -/// @param result -/// @return -std::shared_ptr BuildFormatTransfer(const TransArgs &args); - -bool FormatTransferExists(const TransArgs &args); -} // namespace formats -} // namespace ge -#endif // INC_REGISTER_REGISTER_FORMAT_TRANSFER_H_ \ No newline at end of file diff --git a/inc/register/scope/scope_graph_impl.h b/inc/register/scope/scope_graph_impl.h deleted file mode 100644 index 7d022d20f..000000000 --- a/inc/register/scope/scope_graph_impl.h +++ /dev/null @@ -1,143 +0,0 @@ -/** - * Copyright 2020 Huawei Technologies Co., Ltd - * - * 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 REGISTER_SCOPE_SCOPE_GRAPH_IMPL_H_ -#define REGISTER_SCOPE_SCOPE_GRAPH_IMPL_H_ - -#include "external/register/scope/scope_fusion_pass_register.h" -#include "proto/tensorflow/node_def.pb.h" -#include "proto/tensorflow/graph.pb.h" - -namespace ge { -class Scope::ScopeImpl { - public: - explicit ScopeImpl(const std::string &name, const std::string &sub_type = "", Scope *father_scope = nullptr) - : name_(name), sub_type_(sub_type), father_scope_(father_scope) {} - ~ScopeImpl(); - - std::string Name() const { return name_; } - std::string SubType() const { return sub_type_; } - void SetSubType(const std::string &sub_type) { sub_type_ = sub_type; } - void ClearTypeAndSubType(); - void AddNode(ge::OperatorPtr node_def); - std::vector Nodes() const { return nodes_; } - std::vector AllNodes() const; - std::map AllNodesMap() const; - void AddSubScope(Scope *scope) { sub_scopes_[scope->Name()] = scope; } - Scope *GetSubScope(const std::string &scope_name) const; - std::map GetSubScopes() const { return sub_scopes_; } - std::vector GetAllSubScopes() const; - int32_t GetOpTypeNum(const std::string &op_type) const; - void OpsNumInc(const std::string &op_type); - std::string LastName() const; - const Scope *GetFatherScope() const { return father_scope_; } - // trim scope_index - static std::string TrimScopeIndex(const std::string &scope_name); - - private: - std::string name_; - std::string sub_type_; - Scope *father_scope_; - std::map op_nums_; - std::map sub_scopes_; - std::vector nodes_; -}; - -class FusionScopesResult::FusionScopesResultImpl { - public: - FusionScopesResultImpl() {} - ~FusionScopesResultImpl() {}; - void SetName(const std::string &name) { name_ = name; } - void SetType(const std::string &type) { type_ = type; } - void SetDescription(const std::string &description) { description_ = description; } - std::string Name() const { return name_; } - std::string Type() const { return type_; } - std::string Description() const { return description_; } - void AddNodes(std::vector nodes); - std::vector Nodes() const { return nodes_; } - void AddScopes(const std::vector &scopes) { scopes_.insert(scopes_.end(), scopes.begin(), scopes.end()); } - std::vector Scopes() const { return scopes_; } - std::map> GetInputs() const { return inputs_; } - std::map> GetOutputs() const { return outputs_; } - void InsertInputs(const std::string &inner_op_name, const std::vector &index_map); - void InsertOutputs(const std::string &inner_op_name, const std::vector &index_map); - bool FindNodes(const std::string &node_name) const; - bool FindScopes(const std::string &scope_name) const; - - private: - std::string name_; - std::string type_; - std::string description_; - std::vector scopes_; - std::vector nodes_; - std::map> inputs_; - std::map> outputs_; -}; - -class ScopeTree::ScopeTreeImpl { - public: - ScopeTreeImpl() : root_(nullptr) {} - ScopeTreeImpl(const ScopeTreeImpl &) = delete; - ScopeTreeImpl &operator=(const ScopeTreeImpl &) = delete; - Status Init(); - ~ScopeTreeImpl(); - - void AddNodeToScope(ge::OperatorPtr node_def); - std::vector GetAllScopes() const { return scopes_; } - const Scope *Root() const { return root_; } - - private: - std::vector SplitNodeName(const std::string &node_name, char delim) const; - Scope *root_; - std::vector scopes_; -}; - -struct ScopeFusionOpInfo { - std::string node_name; - std::string fusion_node_name; - std::string fusion_op_type; - std::string description; - bool scope_pass = true; -}; - -class ScopeGraph::ScopeGraphImpl { - public: - ScopeGraphImpl() : scope_tree_(nullptr) {} - ScopeGraphImpl(const ScopeGraphImpl &) = delete; - ScopeGraphImpl &operator=(const ScopeGraphImpl &) = delete; - Status Init(); - ~ScopeGraphImpl(); - - const ScopeTree *GetScopeTree() const { return scope_tree_; } - void BuildScopeGraph(domi::tensorflow::GraphDef *graph_def); - void AddFusionScopesResult(FusionScopesResult *result); - std::map FusionScopesResults() const { return fusion_results_; } - FusionScopesResult *GetFusionScopesResults(const domi::tensorflow::NodeDef *node_def) const; - std::map GetNodesMap() const { return nodes_map_; } - bool IsFusionOpChild(const std::string &node_name, std::vector &info_list); - bool FusionOpChildIgnore(const ScopeFusionOpInfo &info); - bool IsFusionOp(const domi::tensorflow::NodeDef *node_def); - Status GetInputOrOutputIndex(const ScopeFusionOpInfo &info, int32_t old_index, bool input, int32_t &new_index); - - private: - std::vector GetFusionResultInputOrOutput(const ScopeFusionOpInfo &info, bool input); // input:true,output:false - void CheckScopesResult(FusionScopesResult *fusion_node); - std::map fusion_results_; - std::map nodes_map_; - ScopeTree *scope_tree_; -}; -} // namespace ge -#endif // REGISTER_SCOPE_SCOPE_GRAPH_IMPL_H_ \ No newline at end of file diff --git a/inc/register/scope/scope_pass_impl.h b/inc/register/scope/scope_pass_impl.h deleted file mode 100644 index 52f132884..000000000 --- a/inc/register/scope/scope_pass_impl.h +++ /dev/null @@ -1,61 +0,0 @@ -/** - * Copyright 2020 Huawei Technologies Co., Ltd - * - * 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 REGISTER_SCOPE_SCOPE_PASS_IMPL_H_ -#define REGISTER_SCOPE_SCOPE_PASS_IMPL_H_ - -#include "external/register/scope/scope_fusion_pass_register.h" - -namespace ge { -class ScopesResult::ScopesResultImpl { - public: - void SetScopes(std::vector &scopes) { scopes_ = scopes; } - std::vector GetScopes() const { return scopes_; } - void SetNodes(std::vector nodes) { nodes_ = nodes; } - std::vector GetNodes() const { return nodes_; } - - private: - std::vector scopes_; // multiple scopes - std::vector nodes_; // op outside of scope -}; - -class ScopeBasePass::ScopeBasePassImpl { - public: - ScopeBasePassImpl(ScopeBasePass *parent) : parent_(parent) {} - virtual ~ScopeBasePassImpl(); - - Status Run(std::shared_ptr &scope_graph); - - private: - Status AddFusionScopesResultToScopeGraph(std::shared_ptr &scope_graph, - std::vector &scope_results); - // Match rules one by one, support multiple sets of matching rules, and finally output a single scope - // Note: This function does not have to be rewritten. - // In order to match the fusion rules designed by you better, - // you can implement your specific versions separately. - bool MatchAllBatches(const ScopeTree *scope_tree, std::vector &results); - - bool MatchOneBatch(const ScopeTree *scope_tree, const std::vector &patternlist, - std::vector &results); - bool MatchOneScope(const ScopePattern *pattern, Scope *scope, std::vector &results); - Status PrintFusionScopeInfo(std::shared_ptr &scope_graph); - - private: - std::vector patterns_; - ScopeBasePass *parent_; -}; -} // namespace ge -#endif // REGISTER_SCOPE_SCOPE_PASS_IMPL_H_ \ No newline at end of file diff --git a/inc/register/scope/scope_pattern_impl.h b/inc/register/scope/scope_pattern_impl.h deleted file mode 100644 index 1c5a7bce3..000000000 --- a/inc/register/scope/scope_pattern_impl.h +++ /dev/null @@ -1,105 +0,0 @@ -/** - * Copyright 2020 Huawei Technologies Co., Ltd - * - * 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 REGISTER_SCOPE_SCOPE_PATTERN_IMPL_H_ -#define REGISTER_SCOPE_SCOPE_PATTERN_IMPL_H_ - -#include "external/register/scope/scope_fusion_pass_register.h" - -namespace ge { -class ScopeAttrValue::ScopeAttrValueImpl { - public: - ScopeAttrValueImpl() : int_value_(0), float_value_(0.0), string_value_(""), bool_value_(false) {} - ~ScopeAttrValueImpl() {} - - void SetIntValue(int64_t value) { int_value_ = value; } - void SetFloatValue(float value) { float_value_ = value; } - void SetStringValue(std::string value) { string_value_ = value; } - void SetBoolValue(bool value) { bool_value_ = value; } - int64_t GetIntValue() { return int_value_; } - float GetFloatValue() { return float_value_; } - std::string GetStrValue() { return string_value_; } - bool GetBoolValue() { return bool_value_; } - - private: - int64_t int_value_; - float float_value_; - std::string string_value_; - bool bool_value_; -}; - -class NodeOpTypeFeature::NodeOpTypeFeatureImpl : ScopeBaseFeature { - public: - NodeOpTypeFeatureImpl(std::string nodeType, int num, int step = 0) : node_type_(nodeType), num_(num), step_(step) {} - ~NodeOpTypeFeatureImpl() {} - bool Match(const Scope *scope) override; - - public: - std::string node_type_; // Node type - int num_; // Node number - int step_; // step -}; - -class NodeAttrFeature::NodeAttrFeatureImpl : ScopeBaseFeature { - public: - NodeAttrFeatureImpl(std::string nodeType, std::string attr_name, ge::DataType datatype, ScopeAttrValue attr_value) - : node_type_(nodeType), attr_name_(attr_name), datatype_(datatype), attr_value_(attr_value) {} - ~NodeAttrFeatureImpl() {} - bool Match(const Scope *scope) override; - - public: - std::string node_type_; // Node type - std::string attr_name_; // attribute name - ge::DataType datatype_; // datatype - ScopeAttrValue attr_value_; // AttrValue -}; - -class ScopeFeature::ScopeFeatureImpl : ScopeBaseFeature { - public: - ScopeFeatureImpl(std::string sub_type, int32_t num, std::string suffix = "", - std::string sub_scope_mask = "", int step = 0) - : sub_type_(sub_type), num_(num), suffix_(suffix), sub_scope_mask_(sub_scope_mask), step_(step) {} - ~ScopeFeatureImpl() {} - bool Match(const Scope *scope) override; - bool SubScopesMatch(std::vector &scopes); - - public: - std::string sub_type_; - int32_t num_; - std::string suffix_; - std::string sub_scope_mask_; - int step_; -}; - -class ScopePattern::ScopePatternImpl { - public: - ScopePatternImpl() {} - ~ScopePatternImpl() {} - bool Match(const Scope *scope) const; - void SetSubType(const std::string &sub_type); - std::string SubType() const { return sub_type_; } - void AddNodeOpTypeFeature(NodeOpTypeFeature feature); - void AddNodeAttrFeature(NodeAttrFeature feature); - void AddScopeFeature(ScopeFeature feature); - - private: - std::string sub_type_; // get Scope sub type - std::vector node_optype_features_; - std::vector node_attr_features_; - std::vector scopes_features_; -}; -} // namespace ge -#endif // REGISTER_SCOPE_SCOPE_PATTERN_IMPL_H_ \ No newline at end of file diff --git a/inc/register/tensor_assign.h b/inc/register/tensor_assign.h deleted file mode 100644 index 57a37f6c2..000000000 --- a/inc/register/tensor_assign.h +++ /dev/null @@ -1,103 +0,0 @@ -/** - * Copyright 2020 Huawei Technologies Co., Ltd - * - * 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 TENSOR_ASSIGN_H_ -#define TENSOR_ASSIGN_H_ - -#include "graph/ge_tensor.h" -#include "proto/tensorflow/tensor.pb.h" - -namespace domi { -using GeTensorPtr = std::shared_ptr; -using Status = uint32_t; -using domi::tensorflow::TensorProto; -using google::protobuf::int32; -using google::protobuf::int64; - -class TensorAssign { - public: - static Status SetGeTensor(const TensorProto &tensor, GeTensorPtr &weight); - - static Status SetGeTensorDataType(int64_t dataType, GeTensorPtr &weight); - - static ge::DataType ConvertTensorflowDataType(uint32_t tf_data_type); - - private: - static bool CheckBoolVal(tensorflow::DataType data_type); - - static bool CheckHalfVal(tensorflow::DataType data_type); - - static bool CheckFloatVal(tensorflow::DataType data_type); - - static bool CheckDoubleVal(tensorflow::DataType data_type); - - static bool CheckComplex64Val(tensorflow::DataType data_type); - - static bool CheckComplex128Val(tensorflow::DataType data_type); - - static bool CheckStringVal(tensorflow::DataType data_type); - - static bool CheckByte(tensorflow::DataType data_type); - - static bool CheckDoubleByte(tensorflow::DataType data_type); - - static bool CheckSignedFourByte(tensorflow::DataType data_type); - - static bool CheckUnsignedFourByte(tensorflow::DataType data_type); - - static bool CheckSignedEightByte(tensorflow::DataType data_type); - - static bool CheckUnsignedEightByte(tensorflow::DataType data_type); - - static Status GetDoubleByteVal(int32_t val_size, const google::protobuf::RepeatedField &val_vector, int count, - GeTensorPtr &weight); - static Status GetByteVal(int32_t val_size, const google::protobuf::RepeatedField &val_vector, int count, - GeTensorPtr &weight); - - static Status GetStringVal(int32_t val_size, const google::protobuf::RepeatedPtrField &val_vector, - int count, GeTensorPtr &weight); - - static void SetGeTensorWeightData(const TensorProto &tensor, int32_t val_size, int count, GeTensorPtr &weight); - - static void SetWeightData(tensorflow::DataType data_type, int count, const std::string &tensor_content, - GeTensorPtr &weight); - - template - static Status GetVal(int32_t val_size, const google::protobuf::RepeatedField &val_vector, int count, - GeTensorPtr &weight) { - bool zerosLike = (count != val_size && val_size == 1); - T *addr = new (std::nothrow) T[count](); - GE_CHECK_NOTNULL(addr); - int minCount = (count > val_size) ? val_size : count; - if (!zerosLike) { - for (int32_t i = 0; i < minCount; i++) { - *(addr + i) = val_vector.Get(i); - } - for (int32_t i = minCount; i < count; i++) { - *(addr + i) = val_vector.Get(minCount - 1); - } - } else { - for (int32_t i = 0; i < count; i++) { - *(addr + i) = val_vector.Get(0); - } - } - (void)weight->SetData(reinterpret_cast(addr), count * sizeof(T)); - GE_DELETE_NEW_ARRAY(addr); - return SUCCESS; - } -}; -} // namespace domi -#endif // TENSOR_ASSIGN_H_ diff --git a/inc/runtime/base.h b/inc/runtime/base.h new file mode 100644 index 000000000..a8341e323 --- /dev/null +++ b/inc/runtime/base.h @@ -0,0 +1,601 @@ +/** + * Copyright 2020 Huawei Technologies Co., Ltd + + * 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 __CCE_RUNTIME_BASE_H__ +#define __CCE_RUNTIME_BASE_H__ + +#include + +#if defined(__cplusplus) && !defined(COMPILE_OMG_PACKAGE) +extern "C" { +#endif + +// If you need export the function of this library in Win32 dll, use __declspec(dllexport) +#ifndef RTS_API +#ifdef RTS_DLL_EXPORT +#define RTS_API __declspec(dllexport) +#else +#define RTS_API +#endif +#endif + +/** + * @ingroup dvrt_base + * @brief runtime error numbers. + */ +typedef enum tagRtError { + RT_ERROR_NONE = 0x0, // success + + RT_ERROR_DEVICE_BASE = 0x07010000, + RT_ERROR_DEVICE_NULL, + RT_ERROR_DEVICE_NEW, + RT_ERROR_DEVICE_ID, + RT_ERROR_DEVICE_CHIPTYPE, + RT_ERROR_DEVICE_DEPLOY, + RT_ERROR_DEVICE_RETAIN, + RT_ERROR_DEVICE_PLATFORM, + RT_ERROR_DEVICE_LOADER, + RT_ERROR_DEVICE_LIMIT, + RT_ERROR_DEVICE_PROC_HANG_OUT, + RT_ERROR_DEVICE_POWER_UP_FAIL, + RT_ERROR_DEVICE_POWER_DOWN_FAIL, + RT_ERROR_DEVICE_INVALID, + + RT_ERROR_DRV_BASE = 0x07020000, + RT_ERROR_DRV_NULL, + RT_ERROR_DRV_NEW, + RT_ERROR_DRV_MEMORY, + RT_ERROR_DRV_INPUT, + RT_ERROR_DRV_PTRNULL, + RT_ERROR_DRV_OPEN_AICPU, + RT_ERROR_DRV_CLOSE_AICPU, + RT_ERROR_DRV_SYM_AICPU, + RT_ERROR_DRV_OPEN_TSD, + RT_ERROR_DRV_CLOSE_TSD, + RT_ERROR_DRV_SYM_TSD, + RT_ERROR_DRV_SOURCE, + RT_ERROR_DRV_REPORT, + RT_ERROR_DRV_COMMAND, + RT_ERROR_DRV_OCCUPY, + RT_ERROR_DRV_ERR, + + RT_ERROR_STREAM_BASE = 0x07030000, + RT_ERROR_STREAM_NULL, + RT_ERROR_STREAM_NEW, + RT_ERROR_STREAM_CONTEXT, + RT_ERROR_STREAM_INVALID, + RT_ERROR_STREAM_MODEL, + RT_ERROR_STREAM_FUSION, + RT_ERROR_STREAM_FULL, + RT_ERROR_STREAM_EMPTY, + RT_ERROR_STREAM_NOT_COMPLETE, + RT_ERROR_STREAM_SYNC, + RT_ERROR_STREAM_NO_CB_REG, + RT_ERROR_STREAM_DUPLICATE, + RT_ERROR_STREAM_NOT_EXIST, + RT_ERROR_SQ_NO_EXIST_SQ_TO_REUSE, + RT_ERROR_SQID_FULL, + + RT_ERROR_MODEL_BASE = 0x07040000, + RT_ERROR_MODEL_NULL, + RT_ERROR_MODEL_NEW, + RT_ERROR_MODEL_CONTEXT, + RT_ERROR_MODEL_ENDGRAPH, + RT_ERROR_MODEL_STREAM, + RT_ERROR_MODEL_EXCUTOR, + RT_ERROR_MODEL_SETUP, + RT_ERROR_MODEL_ID, + RT_ERROR_MODEL_EXE_FAILED, + RT_ERROR_END_OF_SEQUENCE, // end of sequence + RT_ERROR_MODEL_EXIT, + RT_ERROR_MODEL_EXIT_STREAM_UNBIND, + RT_ERROR_MODEL_EXIT_ID, + + RT_ERROR_EVENT_BASE = 0x07050000, + RT_ERROR_EVENT_NULL, + RT_ERROR_EVENT_NEW, + RT_ERROR_EVENT_RECORDER_NULL, + RT_ERROR_EVENT_TIMESTAMP_INVALID, + RT_ERROR_EVENT_TIMESTAMP_REVERSAL, + RT_ERROR_EVENT_NOT_COMPLETE, + + RT_ERROR_NOTIFY_BASE = 0x07060000, + RT_ERROR_NOTIFY_NULL, + RT_ERROR_NOTIFY_NEW, + RT_ERROR_NOTIFY_TYPE, + RT_ERROR_NOTIFY_NOT_COMPLETE, + + RT_ERROR_CONTEXT_BASE = 0x07070000, + RT_ERROR_CONTEXT_NULL, + RT_ERROR_CONTEXT_NEW, + RT_ERROR_CONTEXT_DEL, + RT_ERROR_CONTEXT_DEFAULT_STREAM_NULL, + RT_ERROR_CONTEXT_ONLINE_STREAM_NULL, + + RT_ERROR_KERNEL_BASE = 0x07080000, + RT_ERROR_KERNEL_NULL, + RT_ERROR_KERNEL_NEW, + RT_ERROR_KERNEL_LOOKUP, + RT_ERROR_KERNEL_NAME, + RT_ERROR_KERNEL_TYPE, + RT_ERROR_KERNEL_OFFSET, + RT_ERROR_KERNEL_DUPLICATE, + RT_ERROR_KERNEL_UNREGISTERING, + + RT_ERROR_PROGRAM_BASE = 0x07090000, + RT_ERROR_PROGRAM_NULL, + RT_ERROR_PROGRAM_NEW, + RT_ERROR_PROGRAM_DATA, + RT_ERROR_PROGRAM_SIZE, + RT_ERROR_PROGRAM_MEM_TYPE, + RT_ERROR_PROGRAM_MACHINE_TYPE, + RT_ERROR_PROGRAM_USEOUT, + + RT_ERROR_MODULE_BASE = 0x070a0000, + RT_ERROR_MODULE_NULL, + RT_ERROR_MODULE_NEW, + + RT_ERROR_INSTANCE_BASE = 0x070b0000, + RT_ERROR_INSTANCE_NULL, + RT_ERROR_INSTANCE_NEW, + RT_ERROR_INSTANCE_VERSION, + + RT_ERROR_API_BASE = 0x070c0000, + RT_ERROR_API_NULL, + RT_ERROR_API_NEW, + + RT_ERROR_DATADUMP_BASE = 0x070d0000, + RT_ERROR_DATADUMP_NULL, + RT_ERROR_DATADUMP_NEW, + RT_ERROR_DATADUMP_TIME, + RT_ERROR_DATADUMP_FILE, + RT_ERROR_DATADUMP_ADDRESS, + RT_ERROR_DATADUMP_LOAD_FAILED, + RT_ERROR_DUMP_ADDR_SET_FAILED, + + RT_ERROR_PROF_BASE = 0x070e0000, + RT_ERROR_PROF_NULL, + RT_ERROR_PROF_NEW, + RT_ERROR_PROF_START, + RT_ERROR_PROF_DEVICE_MEM, + RT_ERROR_PROF_HOST_MEM, + RT_ERROR_PROF_SET_DIR, + RT_ERROR_PROF_OPER, + RT_ERROR_PROF_FULL, + RT_ERROR_PROF_NAME, + + RT_ERROR_PCTRACE_BASE = 0x070f0000, + RT_ERROR_PCTRACE_NULL, + RT_ERROR_PCTRACE_NEW, + RT_ERROR_PCTRACE_TIME, + RT_ERROR_PCTRACE_FILE, + + RT_ERROR_TASK_BASE = 0x07100000, + RT_ERROR_TASK_NULL, + RT_ERROR_TASK_NEW, + RT_ERROR_TASK_TYPE, + RT_ERROR_TASK_ALLOCATOR, + + RT_ERROR_COMMON_BASE = 0x07110000, + RT_ERROR_INVALID_VALUE, // RT_ERROR_INPUT_INVALID + RT_ERROR_MEMORY_ADDRESS_UNALIGNED, + RT_ERROR_SEC_HANDLE, + RT_ERROR_OS_HANDLE, + RT_ERROR_MUTEX_LOCK, + RT_ERROR_MUTEX_UNLOCK, + RT_ERROR_CALLOC, + RT_ERROR_POOL_RESOURCE, + RT_ERROR_TRANS_ARGS, + RT_ERROR_METADATA, + RT_ERROR_LOST_HEARTBEAT, + RT_ERROR_REPORT_TIMEOUT, + RT_ERROR_FEATURE_NOT_SUPPROT, + RT_ERROR_MEMORY_ALLOCATION, + RT_ERROR_MEMORY_FREE, + RT_ERROR_INVALID_MEMORY_TYPE, + + RT_ERROR_DEBUG_BASE = 0x07120000, + RT_ERROR_DEBUG_NULL, + RT_ERROR_DEBUG_NEW, + RT_ERROR_DEBUG_SIGNAL, + RT_ERROR_DEBUG_OPEN, + RT_ERROR_DEBUG_WRITE, + RT_ERROR_DEBUG_REGISTER_FAILED, + RT_ERROR_DEBUG_UNREGISTER_FAILED, + + RT_ERROR_ENGINE_BASE = 0x07130000, + RT_ERROR_ENGINE_NULL, + RT_ERROR_ENGINE_NEW, + RT_ERROR_ENGINE_THREAD, + + RT_ERROR_LABEL_BASE = 0x07140000, + RT_ERROR_LABEL_NULL, + RT_ERROR_LABEL_NEW, + RT_ERROR_LABEL_CONTEXT, + RT_ERROR_LABEL_STREAM, + RT_ERROR_LABEL_MODEL, + RT_ERROR_LABEL_ALLOCATOR, + RT_ERROR_LABEL_FREE, + RT_ERROR_LABEL_SET, + RT_ERROR_LABEL_ID, + + RT_ERROR_TSFW_BASE = 0x07150000, + RT_ERROR_TSFW_UNKNOWN, + RT_ERROR_TSFW_NULL_PTR, + RT_ERROR_TSFW_ILLEGAL_AI_CORE_ID, + RT_ERROR_TSFW_ILLEGAL_PARAM, + RT_ERROR_TSFW_TASK_CMD_QUEUE_FULL, + RT_ERROR_TSFW_TASK_CMD_QUEUE_EMPTY, + RT_ERROR_TSFW_TASK_REPORT_QUEUE_FULL, + RT_ERROR_TSFW_TASK_REPORT_QUEUE_EMPTY, + RT_ERROR_TSFW_TASK_NODE_BUFF_ALL_OCCUPYED, + RT_ERROR_TSFW_TASK_NODE_BUFF_ALL_FREED, + RT_ERROR_TSFW_L2_MEM_INSUFFICIENT_SPACE, + RT_ERROR_TSFW_L2_MALLOC_FAILED, + RT_ERROR_TSFW_DMA_CHANNEL_ALL_OCCUPYED, + RT_ERROR_TSFW_MEMCPY_OP_FAILED, + RT_ERROR_TSFW_BS_SLOT_ALL_OCCUPYED, + RT_ERROR_TSFW_TBS_SLOT_REPEAT_FREE, + RT_ERROR_TSFW_PRIORITY_TASK_LIST_FULL, + RT_ERROR_TSFW_PRIORITY_TASK_LIST_EMPTY, + RT_ERROR_TSFW_NO_STREAM_LIST_NEED_TO_BE_PROCESSED, + RT_ERROR_TSFW_REPEAT_MARK_STREAM_NEED_SERVICE, + RT_ERROR_TSFW_SYS_DMA_CHANNEL_ALL_OCCUPAPYED, + RT_ERROR_TSFW_NO_HBML2TASKNODE_FOUND, + RT_ERROR_TSFW_SQNODE_NODE_SLOT_ALL_OCCUPAPYED, + RT_ERROR_TSFW_CQNODE_NODE_SLOT_ALL_OCCUPAPYED, + RT_ERROR_TSFW_SQNODE_NOT_ENOUGH, + RT_ERROR_TSFW_SQNODE_SLOT_REPEAT_FREE, + RT_ERROR_TSFW_CQNODE_SLOT_REPEAT_FREE, + RT_ERROR_TSFW_CQ_REPORT_FAILED, + RT_ERROR_TSFW_SYS_DMA_RESET_SUCCESS, + RT_ERROR_TSFW_SYS_DMA_RESET_FAILED, + RT_ERROR_TSFW_SYS_DMA_TRNSFER_FAILED, + RT_ERROR_TSFW_SYS_DMA_MEMADDRALIGN_FAILED, + RT_ERROR_TSFW_SYS_DMA_ERROR_QUEUE_FULL, + RT_ERROR_TSFW_SYS_DMA_ERROR_QUEUE_EMPTY, + RT_ERROR_TSFW_TIMER_EVENT_FULL, + RT_ERROR_TSFW_TASK_L2_DESC_ENTRY_NOT_ENOUGH, + RT_ERROR_TSFW_AICORE_TIMEOUT, + RT_ERROR_TSFW_AICORE_EXCEPTION, + RT_ERROR_TSFW_AICORE_TRAP_EXCEPTION, + RT_ERROR_TSFW_AICPU_TIMEOUT, + RT_ERROR_TSFW_SDMA_L2_TO_DDR_MALLOC_FAIL, + RT_ERROR_TSFW_AICPU_EXCEPTION, + RT_ERROR_TSFW_AICPU_DATADUMP_RSP_ERR, + RT_ERROR_TSFW_AICPU_MODEL_RSP_ERR, + RT_ERROR_TSFW_REPEAT_ACTIVE_MODEL_STREAM, + RT_ERROR_TSFW_REPEAT_NOTIFY_WAIT, + RT_ERROR_TSFW_DEBUG_INVALID_SQCQ, + RT_ERROR_TSFW_DEBUG_WRONG_COMMAND_TYPE, + RT_ERROR_TSFW_DEBUG_CMD_PROCESS, + RT_ERROR_TSFW_DEBUG_INVALID_DEVICE_STATUS, + RT_ERROR_TSFW_DEBUG_NOT_IN_DEBUG_STATUS, + RT_ERROR_TSFW_DEBUG_INVALID_TASK_STATUS, + RT_ERROR_TSFW_DEBUG_TASK_EMPTY, + RT_ERROR_TSFW_DEBUG_TASK_FULL, + RT_ERROR_TSFW_DEBUG_TASK_NOT_EXIST, + RT_ERROR_TSFW_DEBUG_AI_CORE_FULL, + RT_ERROR_TSFW_DEBUG_AI_CORE_NOT_EXIST, + RT_ERROR_TSFW_DEBUG_AI_CORE_EXCEPTION, + RT_ERROR_TSFW_DEBUG_AI_CORE_TIMEOUT, + RT_ERROR_TSFW_DEBUG_BREAKPOINT_FULL, + RT_ERROR_TSFW_DEBUG_READ_ERROR, + RT_ERROR_TSFW_DEBUG_WRITE_FAIL, + RT_ERROR_TSFW_QUEUE_FULL, + RT_ERROR_TSFW_QUEUE_EMPTY, + RT_ERROR_TSFW_QUEUE_ALLOC_MEM_FAIL, + RT_ERROR_TSFW_QUEUE_DATA_SIZE_UNMATCH, + RT_ERROR_TSFW_PCIE_DMA_INVLD_CPY_TYPE, + RT_ERROR_TSFW_INVLD_CPY_DIR, + RT_ERROR_TSFW_PCIE_DMA_INVLD_CQ_DES, + RT_ERROR_TSFW_PCIE_DMA_CPY_ERR, + RT_ERROR_TSFW_PCIE_DMA_LNK_CHN_BUSY, + RT_ERROR_TSFW_PROFILE_BUFF_FULL, + RT_ERROR_TSFW_PROFILE_MODE_CONFLICT, + RT_ERROR_TSFW_PROFILE_OTHER_PID_ON, + RT_ERROR_TSFW_SCHD_AIC_TASK_PRELOAD_FAILED, + RT_ERROR_TSFW_TSCPU_CLOSE_FAILED, + RT_ERROR_TSFW_EXPECT_FAIL, + RT_ERROR_TSFW_REPEAT_MODEL_STREAM, + RT_ERROR_TSFW_STREAM_MODEL_UNBIND, + RT_ERROR_TSFW_MODEL_EXE_FAILED, + RT_ERROR_TSFW_IPC_SEND_FAILED, + RT_ERROR_TSFW_IPC_PROC_REG_FAILED, + RT_ERROR_TSFW_STREAM_FULL, + RT_ERROR_TSFW_END_OF_SEQUENCE, + RT_ERROR_TSFW_SWITCH_STREAM_LABEL, + RT_ERROR_TSFW_TRANS_SQE_FAIL, + RT_ERROR_TSFW_RESERVED, + + RT_ERROR_SUBSCRIBE_BASE = 0x07160000, + RT_ERROR_SUBSCRIBE_NULL, + RT_ERROR_SUBSCRIBE_NEW, + RT_ERROR_SUBSCRIBE_STREAM, + RT_ERROR_SUBSCRIBE_THREAD, + RT_ERROR_SUBSCRIBE_GROUP, + + RT_ERROR_GROUP_BASE = 0x07170000, + RT_ERROR_GROUP_NOT_SET, + RT_ERROR_GROUP_NOT_CREATE, + + RT_ERROR_RESERVED = 0x07ff0000, + }rtError_t; + +/** + * @ingroup dvrt_base + * @brief runtime exception numbers. + */ +typedef enum tagRtExceptionType { + RT_EXCEPTION_NONE = 0, + RT_EXCEPTION_TS_DOWN = 1, + RT_EXCEPTION_TASK_TIMEOUT = 2, + RT_EXCEPTION_TASK_FAILURE = 3, + RT_EXCEPTION_DEV_RUNNING_DOWN = 4, + RT_EXCEPTION_STREAM_ID_FREE_FAILED = 5 +} rtExceptionType; + +/** + * @ingroup dvrt_base + * @brief Switch type. + */ +typedef enum tagRtCondition { + RT_EQUAL = 0, + RT_NOT_EQUAL, + RT_GREATER, + RT_GREATER_OR_EQUAL, + RT_LESS, + RT_LESS_OR_EQUAL +} rtCondition_t; + +/** + * @ingroup dvrt_base + * @brief Data Type of Extensible Switch Task. + */ +typedef enum tagRtSwitchDataType { + RT_SWITCH_INT32 = 0, + RT_SWITCH_INT64 = 1, +} rtSwitchDataType_t; + +typedef enum tagRtStreamFlagType { + RT_HEAD_STREAM = 0, // first stream + RT_INVALID_FLAG = 0xFFFFFFFF, +} rtStreamFlagType_t; + +typedef enum tagRtLimitType { + RT_LIMIT_TYPE_LOW_POWER_TIMEOUT = 0, // timeout for power down , ms +} rtLimitType_t; + +typedef struct rtExceptionInfo { + uint32_t taskid; + uint32_t streamid; + uint32_t tid; + uint32_t deviceid; +} rtExceptionInfo; + +typedef void (*rtErrorCallback)(rtExceptionType); + +typedef void (*rtTaskFailCallback)(rtExceptionInfo *exceptionInfo); + +/** + * @ingroup dvrt_base + * @brief stream handle. + */ +typedef void *rtStream_t; + +/** + * @ingroup dvrt_base + * @brief runtime event handle. + */ +typedef void *rtEvent_t; + +/** + * @ingroup dvrt_base + * @brief label handle. + */ +typedef void *rtLabel_t; + +/** + * @ingroup profiling_base + * @brief runtime handle. + */ +RTS_API rtError_t rtSetProfDirEx(const char *profDir, const char *address, const char *jobCtx); + +/** + * @ingroup profiling_base + * @brief init profiler object. + */ +RTS_API rtError_t rtProfilerInit(const char *profdir, const char *address, const char *job_ctx); + +/** + * @ingroup profiling_base + * @brief config rts profiler. + */ +RTS_API rtError_t rtProfilerConfig(uint16_t type); + +/** + * @ingroup profiling_base + * @brief start rts profiler. + */ +RTS_API rtError_t rtProfilerStart(uint64_t profConfig, int32_t numsDev, uint32_t* deviceList); + +/** + * @ingroup profiling_base + * @brief stop rts profiler. + */ +RTS_API rtError_t rtProfilerStop(uint64_t profConfig, int32_t numsDev, uint32_t* deviceList); + +/** + * @ingroup profiling_base + * @brief ts send keypoint profiler log. + */ +RTS_API rtError_t rtProfilerTrace(uint64_t id, bool notify, uint32_t flags, rtStream_t stream); + +/** + * @ingroup dvrt_base + * @brief Returns the last error from a runtime call. + */ +RTS_API rtError_t rtGetLastError(); + +/** + * @ingroup dvrt_base + * @brief Returns the last error from a runtime call. + */ +RTS_API rtError_t rtPeekAtLastError(); + +/** + * @ingroup dvrt_base + * @brief register callback for error code + * @param [out] NA + * @return RT_ERROR_NONE for ok + */ +RTS_API rtError_t rtSetExceptCallback(rtErrorCallback callback); + +/** + * @ingroup dvrt_base + * @brief register callback for task fail + * @param [out] NA + * @return RT_ERROR_NONE for ok + */ +RTS_API rtError_t rtSetTaskFailCallback(rtTaskFailCallback callback); + +/** + * @ingroup dvrt_base + * @brief notify handle. + */ +typedef void *rtNotify_t; + +/** + * @ingroup dvrt_base + * @brief create label instance + * @param [out] label created label + * @return RT_ERROR_NONE for ok + * @return RT_ERROR_INVALID_VALUE for error input + */ +RTS_API rtError_t rtLabelCreate(rtLabel_t *label); + +/** + * @ingroup dvrt_base + * @brief set label and stream instance + * @param [in] label set label + * @param [in] stream set stream + * @return RT_ERROR_NONE for ok + * @return RT_ERROR_INVALID_VALUE for error input + */ +RTS_API rtError_t rtLabelSet(rtLabel_t label, rtStream_t stream); + +/** + * @ingroup dvrt_base + * @brief destroy label instance + * @param [in] label label to destroy + * @return RT_ERROR_NONE for ok + * @return RT_ERROR_INVALID_VALUE for error input + */ +RTS_API rtError_t rtLabelDestroy(rtLabel_t label); + +/** + * @ingroup dvrt_base + * @brief label switch instance + * @param [in] ptr address to get value compared + * @param [in] condition + * @param [in] value to compare + * @param [in] true_label goto label + * @param [in] stream to submit label_switch task + * @return RT_ERROR_NONE for ok + * @return RT_ERROR_INVALID_VALUE for error input + */ +RTS_API rtError_t rtLabelSwitch(void *ptr, rtCondition_t condition, uint32_t value, rtLabel_t trueLabel, + rtStream_t stream); + +/** + * @ingroup dvrt_base + * @brief goto label instance + * @param [in] label goto label + * @param [in] stream to submit label_goto task + * @return RT_ERROR_NONE for ok + * @return RT_ERROR_INVALID_VALUE for error input + */ +RTS_API rtError_t rtLabelGoto(rtLabel_t label, rtStream_t stream); + +/** + * @ingroup dvrt_base + * @brief name label instance + * @param [in] label instance + * @param [in] name label name + * @return RT_ERROR_NONE for ok + * @return RT_ERROR_INVALID_VALUE for error input + */ +RTS_API rtError_t rtNameLabel(rtLabel_t label, const char *name); + +/** + * @ingroup dvrt_base + * @brief label switch by index + * @param [in] ptr index value ptr + * @param [in] max index max value + * @param [in] labelInfoPtr label content info ptr + * @param [in] stream set stream + * @return RT_ERROR_NONE for ok + * @return RT_ERROR_INVALID_VALUE for error input + */ +RTS_API rtError_t rtLabelSwitchByIndex(void *ptr, uint32_t max, void *labelInfoPtr, rtStream_t stream); + +/** + * @ingroup dvrt_base + * @brief stream goto label + * @param [in] label goto label + * @param [in] stream stream to submit label_goto task + * @return RT_ERROR_NONE for ok + * @return RT_ERROR_INVALID_VALUE for error input + */ +RTS_API rtError_t rtLabelGotoEx(rtLabel_t label, rtStream_t stream); + +/** + * @ingroup dvrt_base + * @brief labels to dev info + * @param [in] label model label list + * @param [in] labelNumber label number + * @param [in] dst device ptr + * @param [in] dstMax dst size + * @return RT_ERROR_NONE for ok + * @return RT_ERROR_INVALID_VALUE for error input + */ +RTS_API rtError_t rtLabelListCpy(rtLabel_t *label, uint32_t labelNumber, void *dst, uint32_t dstMax); + +/** + * @ingroup dvrt_base + * @brief labels to dev info + * @param [out] label created label handle + * @param [in] stream label bind stream + * @return RT_ERROR_NONE for ok + * @return RT_ERROR_INVALID_VALUE for error input + */ +RTS_API rtError_t rtLabelCreateEx(rtLabel_t *label, rtStream_t stream); + +/** + * @ingroup dvrt_base + * @brief get current thread last stream id and task id + * @param [out] stream id and task id + * @param [in] null + * @return RT_ERROR_NONE for ok + * @return RT_ERROR_INVALID_VALUE for input null ptr + */ +RTS_API rtError_t rtGetTaskIdAndStreamID(uint32_t *taskid, uint32_t *streamid); + +#if defined(__cplusplus) && !defined(COMPILE_OMG_PACKAGE) +} +#endif + +#endif // __CCE_RUNTIME_BASE_H__ diff --git a/inc/runtime/config.h b/inc/runtime/config.h new file mode 100644 index 000000000..f1a70eaa9 --- /dev/null +++ b/inc/runtime/config.h @@ -0,0 +1,192 @@ +/** + * Copyright 2020 Huawei Technologies Co., Ltd + + * 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 __CCE_RUNTIME_CONFIG_H__ +#define __CCE_RUNTIME_CONFIG_H__ + +#include "base.h" + +#if defined(__cplusplus) && !defined(COMPILE_OMG_PACKAGE) +extern "C" { +#endif + +#define PLAT_COMBINE(arch, chip, ver) ((arch << 16) | (chip << 8) | (ver)) +#define PLAT_GET_ARCH(type) ((type >> 16) & 0xffff) +#define PLAT_GET_CHIP(type) ((type >> 8) & 0xff) +#define PLAT_GET_VER(type) (type & 0xff) + +typedef enum tagRtArchType { + ARCH_BEGIN = 0, + ARCH_V100 = ARCH_BEGIN, + ARCH_V200, + ARCH_END, +} rtArchType_t; + +typedef enum tagRtChipType { + CHIP_BEGIN = 0, + CHIP_MINI = CHIP_BEGIN, + CHIP_CLOUD, + CHIP_MDC, + CHIP_LHISI, + CHIP_DC, + CHIP_END, +} rtChipType_t; + +typedef enum tagRtVersion { + VER_BEGIN = 0, + VER_NA = VER_BEGIN, + VER_ES, + VER_CS, + VER_END, +} rtVersion_t; + +/* match rtChipType_t */ +typedef enum tagRtPlatformType { + PLATFORM_BEGIN = 0, + PLATFORM_MINI_V1 = PLATFORM_BEGIN, + PLATFORM_CLOUD_V1, + PLATFORM_MINI_V2, + PLATFORM_LHISI_ES, + PLATFORM_LHISI_CS, + PLATFORM_DC, + PLATFORM_END, +} rtPlatformType_t; + +typedef enum tagRtCubeFracMKNFp16 { + RT_CUBE_MKN_FP16_2_16_16 = 0, + RT_CUBE_MKN_FP16_4_16_16, + RT_CUBE_MKN_FP16_16_16_16, + RT_CUBE_MKN_FP16_Default, +} rtCubeFracMKNFp16_t; + +typedef enum tagRtCubeFracMKNInt8 { + RT_CUBE_MKN_INT8_2_32_16 = 0, + RT_CUBE_MKN_INT8_4_32_4, + RT_CUBE_MKN_INT8_4_32_16, + RT_CUBE_MKN_INT8_16_32_16, + RT_CUBE_MKN_INT8_Default, +} rtCubeFracMKNInt8_t; + +typedef enum tagRtVecFracVmulMKNFp16 { + RT_VEC_VMUL_MKN_FP16_1_16_16 = 0, + RT_VEC_VMUL_MKN_FP16_Default, +} rtVecFracVmulMKNFp16_t; + +typedef enum tagRtVecFracVmulMKNInt8 { + RT_VEC_VMUL_MKN_INT8_1_32_16 = 0, + RT_VEC_VMUL_MKN_INT8_Default, +} rtVecFracVmulMKNInt8_t; + +typedef struct tagRtAiCoreSpec { + uint32_t cubeFreq; + uint32_t cubeMSize; + uint32_t cubeKSize; + uint32_t cubeNSize; + rtCubeFracMKNFp16_t cubeFracMKNFp16; + rtCubeFracMKNInt8_t cubeFracMKNInt8; + rtVecFracVmulMKNFp16_t vecFracVmulMKNFp16; + rtVecFracVmulMKNInt8_t vecFracVmulMKNInt8; +} rtAiCoreSpec_t; + +typedef struct tagRtAiCoreRatesPara { + uint32_t ddrRate; + uint32_t l2Rate; + uint32_t l2ReadRate; + uint32_t l2WriteRate; + uint32_t l1ToL0ARate; + uint32_t l1ToL0BRate; + uint32_t l0CToUBRate; + uint32_t ubToL2; + uint32_t ubToDDR; + uint32_t ubToL1; +} rtAiCoreMemoryRates_t; + +typedef struct tagRtMemoryConfig { + uint32_t flowtableSize; + uint32_t compilerSize; +} rtMemoryConfig_t; + +typedef struct tagRtPlatformConfig { uint32_t platformConfig; } rtPlatformConfig_t; + +/** + * @ingroup + * @brief get platform + * @param [in] platForm + * @return platForm + */ +RTS_API rtError_t rtGetPlatformConfig(rtPlatformConfig_t *platForm); + +/** + * @ingroup + * @brief get AI core count + * @param [in] aiCoreCnt + * @return aiCoreCnt + */ +RTS_API rtError_t rtGetAiCoreCount(uint32_t *aiCoreCnt); + +/** + * @ingroup + * @brief get AI cpu count + * @param [in] aiCpuCnt + * @return aiCpuCnt + */ +RTS_API rtError_t rtGetAiCpuCount(uint32_t *aiCpuCnt); + +/** + * @ingroup + * @brief get AI core frequency + * @param [in] aiCoreSpec + * @return aiCoreSpec + */ +RTS_API rtError_t rtGetAiCoreSpec(rtAiCoreSpec_t *aiCoreSpec); + +/** + * @ingroup + * @brief AI get core band Info + * @param [in] aiCoreMemoryRates + * @return aiCoreMemoryRates + */ +RTS_API rtError_t rtGetAiCoreMemoryRates(rtAiCoreMemoryRates_t *aiCoreMemoryRates); + +/** + * @ingroup + * @brief AI get core buffer Info,FlowTable Size,Compiler Size + * @param [in] memoryConfig + * @return memoryConfig + */ +RTS_API rtError_t rtGetMemoryConfig(rtMemoryConfig_t *memoryConfig); + +/** + * @ingroup + * @brief set platform in gen ctx + * @param [in] platForm + * @return RT_ERROR_NONE for ok, errno for failed + */ +RTS_API rtError_t rtSetPlatformType(rtPlatformType_t platformType); + +/** + * @ingroup + * @brief get l2 buffer Info,virtual baseaddr,Size + * @param [in] stream + * @return RT_ERROR_NONE for ok, errno for failed + */ +RTS_API rtError_t rtMemGetL2Info(rtStream_t stream, void **ptr, uint32_t *size); + +#if defined(__cplusplus) && !defined(COMPILE_OMG_PACKAGE) +} +#endif + +#endif // __CCE_RUNTIME_STREAM_H__ diff --git a/inc/runtime/context.h b/inc/runtime/context.h new file mode 100644 index 000000000..ffcf7e4b9 --- /dev/null +++ b/inc/runtime/context.h @@ -0,0 +1,164 @@ +/** + * Copyright 2020 Huawei Technologies Co., Ltd + + * 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 __CCE_RUNTIME_CONTEXT_H__ +#define __CCE_RUNTIME_CONTEXT_H__ + +#include "base.h" + +#if defined(__cplusplus) && !defined(COMPILE_OMG_PACKAGE) +extern "C" { +#endif + +/** + * @ingroup rt_context + * @brief runtime context handle. + */ +typedef void *rtContext_t; + +typedef enum tagDryRunFlag { + RT_DRYRUN_FLAG_FALSE = 0, + RT_DRYRUN_FLAG_TRUE = 1, +} rtDryRunFlag_t; + +typedef enum tagCtxMode { + RT_CTX_NORMAL_MODE = 0, + RT_CTX_GEN_MODE = 1, +} rtCtxMode_t; + +typedef struct tagRtGroupInfo { + int32_t groupId; + uint32_t flag; + uint32_t aicoreNum; + uint32_t aicpuNum; + uint32_t aivectorNum; + uint32_t sdmaNum; + uint32_t activeStreamNum; + void* extrPtr; +} rtGroupInfo_t; + +/** + * @ingroup rt_context + * @brief create context and associates it with the calling thread + * @param [out] ctx created context + * @param [in] flags context creation flag. set to 0. + * @param [in] device device to create context on + * @return RT_ERROR_NONE for ok + */ +RTS_API rtError_t rtCtxCreate(rtContext_t *ctx, uint32_t flags, int32_t device); + +/** + * @ingroup rt_context + * @brief create context and associates it with the calling thread + * @param [out] ctx created context + * @param [in] flags context creation flag. set to 0. + * @param [in] device device to create context on + * @return RT_ERROR_NONE for ok + */ +RTS_API rtError_t rtCtxCreateEx(rtContext_t *ctx, uint32_t flags, int32_t device); + +/** + * @ingroup rt_context + * @brief destroy context instance + * @param [in] ctx context to destroy + * @return RT_ERROR_NONE for ok + */ +RTS_API rtError_t rtCtxDestroy(rtContext_t ctx); + +/** + * @ingroup rt_context + * @brief destroy context instance + * @param [in] ctx context to destroy + * @return RT_ERROR_NONE for ok + */ +RTS_API rtError_t rtCtxDestroyEx(rtContext_t ctx); + +/** + * @ingroup rt_context + * @brief binds context to the calling CPU thread. + * @param [in] ctx context to bind. if NULL, unbind current context. + * @return RT_ERROR_NONE for ok + */ +RTS_API rtError_t rtCtxSetCurrent(rtContext_t ctx); + +/** + * @ingroup rt_context + * @brief block for a context's tasks to complete + * @return RT_ERROR_NONE for ok + */ +RTS_API rtError_t rtCtxSynchronize(void); + +/** + * @ingroup rt_context + * @brief returns the context bound to the calling CPU thread. + * @param [out] ctx returned context + * @return RT_ERROR_NONE for ok + */ +RTS_API rtError_t rtCtxGetCurrent(rtContext_t *ctx); + +/** + * @ingroup rt_context + * @brief returns the primary context of device. + * @param [out] ctx returned context + * @return RT_ERROR_NONE for ok + */ +RTS_API rtError_t rtGetPriCtxByDeviceId(int32_t device, rtContext_t *ctx); + +/** + * @ingroup rt_context + * @brief returns the device ID for the current context + * @param [out] device returned device id + * @return RT_ERROR_NONE for ok + */ +RTS_API rtError_t rtCtxGetDevice(int32_t *device); + +/** + * @ingroup + * @brief set group id + * @param [in] groupid + * @return RT_ERROR_NONE for ok, errno for failed + */ +RTS_API rtError_t rtSetGroup(int32_t groupId); + +/** + * @ingroup + * @brief get group info + * @param [in] groupid count + * @return RT_ERROR_NONE for ok, errno for failed + */ +RTS_API rtError_t rtGetGroupInfo(int32_t groupId, rtGroupInfo_t* groupInfo, uint32_t count); + +/** + * @ingroup + * @brief get group count + * @param [in] groupid count + * @return RT_ERROR_NONE for ok, errno for failed + */ +RTS_API rtError_t rtGetGroupCount(uint32_t *count); + +/** + * @ingroup rt_context + * @brief set context INF mode + * @param [in] mode + * @return RT_ERROR_NONE for ok + */ +RTS_API rtError_t rtSetCtxINFMode(bool mode); +#if defined(__cplusplus) && !defined(COMPILE_OMG_PACKAGE) +} +#endif + + +#endif // __CCE_RUNTIME_CONTEXT_H__ diff --git a/inc/runtime/dev.h b/inc/runtime/dev.h new file mode 100644 index 000000000..f3f2937c7 --- /dev/null +++ b/inc/runtime/dev.h @@ -0,0 +1,363 @@ +/** + * Copyright 2020 Huawei Technologies Co., Ltd + + * 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 __CCE_RUNTIME_DEVICE_H__ +#define __CCE_RUNTIME_DEVICE_H__ + +#include "base.h" + +#if defined(__cplusplus) && !defined(COMPILE_OMG_PACKAGE) +extern "C" { +#endif + +#define RT_CAPABILITY_SUPPORT (0x1) +#define RT_CAPABILITY_NOT_SUPPORT (0x0) + +typedef struct tagRTDeviceInfo { + uint8_t env_type; // 0: FPGA 1: EMU 2: ESL + uint32_t ctrl_cpu_ip; + uint32_t ctrl_cpu_id; + uint32_t ctrl_cpu_core_num; + uint32_t ctrl_cpu_endian_little; + uint32_t ts_cpu_core_num; + uint32_t ai_cpu_core_num; + uint32_t ai_core_num; + uint32_t ai_core_freq; + uint32_t ai_cpu_core_id; + uint32_t ai_core_id; + uint32_t aicpu_occupy_bitmap; + uint32_t hardware_version; + uint32_t ts_num; +} rtDeviceInfo_t; + +typedef enum tagRtRunMode { + RT_RUN_MODE_OFFLINE = 0, + RT_RUN_MODE_ONLINE = 1, + RT_RUN_MODE_AICPU_SCHED = 2, + RT_RUN_MODE_RESERVED +} rtRunMode; + +typedef enum tagRtAicpuDeployType { + AICPU_DEPLOY_CROSS_OS = 0x0, + AICPU_DEPLOY_CROSS_PROCESS = 0x1, + AICPU_DEPLOY_CROSS_THREAD = 0x2, + AICPU_DEPLOY_RESERVED +} rtAicpuDeployType_t; + +typedef enum tagRtFeatureType { + FEATURE_TYPE_MEMCPY = 0, + FEATURE_TYPE_RSV +} rtFeatureType_t; + +typedef enum tagMemcpyInfo { + MEMCPY_INFO_SUPPORT_ZEROCOPY = 0, + MEMCPY_INFO_RSV +} rtMemcpyInfo_t; + +/** + * @ingroup dvrt_dev + * @brief get total device number. + * @param [in|out] count the device number + * @return RT_ERROR_NONE for ok + * @return RT_ERROR_INVALID_VALUE for error input + */ +RTS_API rtError_t rtGetDeviceCount(int32_t *count); +/** + * @ingroup dvrt_dev + * @brief get device ids + * @param [in|out] get details of device ids + * @return RT_ERROR_NONE for ok + * @return RT_ERROR_DRV_ERR for error + */ +RTS_API rtError_t rtGetDeviceIDs(uint32_t *devices, uint32_t len); + +/** + * @ingroup dvrt_dev + * @brief get device infomation. + * @param [in] device the device id + * @param [in] moduleType module type + typedef enum { + MODULE_TYPE_SYSTEM = 0, system info + MODULE_TYPE_AICPU, aicpu info + MODULE_TYPE_CCPU, ccpu_info + MODULE_TYPE_DCPU, dcpu info + MODULE_TYPE_AICORE, AI CORE info + MODULE_TYPE_TSCPU, tscpu info + MODULE_TYPE_PCIE, PCIE info + } DEV_MODULE_TYPE; + * @param [in] infoType info type + typedef enum { + INFO_TYPE_ENV = 0, + INFO_TYPE_VERSION, + INFO_TYPE_MASTERID, + INFO_TYPE_CORE_NUM, + INFO_TYPE_OS_SCHED, + INFO_TYPE_IN_USED, + INFO_TYPE_ERROR_MAP, + INFO_TYPE_OCCUPY, + INFO_TYPE_ID, + INFO_TYPE_IP, + INFO_TYPE_ENDIAN, + } DEV_INFO_TYPE; + * @param [out] value the device info + * @return RT_ERROR_NONE for ok + * @return RT_ERROR_DRV_ERR for error + */ +RTS_API rtError_t rtGetDeviceInfo(uint32_t deviceId, int32_t moduleType, int32_t infoType, int64_t *value); + +/** + * @ingroup dvrt_dev + * @brief set target device for current thread + * @param [int] device the device id + * @return RT_ERROR_NONE for ok + * @return RT_ERROR_INVALID_VALUE for error input + */ +RTS_API rtError_t rtSetDevice(int32_t device); + +/** + * @ingroup dvrt_dev + * @brief set target device for current thread + * @param [int] device the device id + * @return RT_ERROR_NONE for ok + * @return RT_ERROR_INVALID_VALUE for error input + */ +RTS_API rtError_t rtSetDeviceEx(int32_t device); + +/** + * @ingroup dvrt_dev + * @brief get Index by phyId. + * @param [in] phyId the physical device id + * @param [out] devIndex the logic device id + * @return RT_ERROR_NONE for ok + * @return RT_ERROR_INVALID_VALUE for error input + */ +RTS_API rtError_t rtGetDeviceIndexByPhyId(uint32_t phyId, uint32_t *devIndex); + +/** + * @ingroup dvrt_dev + * @brief get phyId by Index. + * @param [in] devIndex the logic device id + * @param [out] phyId the physical device id + * @return RT_ERROR_NONE for ok + * @return RT_ERROR_INVALID_VALUE for error input + */ +RTS_API rtError_t rtGetDevicePhyIdByIndex(uint32_t devIndex, uint32_t *phyId); + +/** + * @ingroup dvrt_dev + * @brief enable direction:devIdDes---->phyIdSrc. + * @param [in] devIdDes the logical device id + * @param [in] phyIdSrc the physical device id + * @return RT_ERROR_NONE for ok + * @return RT_ERROR_INVALID_VALUE for error input + */ +RTS_API rtError_t rtEnableP2P(uint32_t devIdDes, uint32_t phyIdSrc, uint32_t flag); + +/** + * @ingroup dvrt_dev + * @brief disable direction:devIdDes---->phyIdSrc. + * @param [in] devIdDes the logical device id + * @param [in] phyIdSrc the physical device id + * @return RT_ERROR_NONE for ok + * @return RT_ERROR_INVALID_VALUE for error input + */ +RTS_API rtError_t rtDisableP2P(uint32_t devIdDes, uint32_t phyIdSrc); + +/** + * @ingroup dvrt_dev + * @brief get cability of P2P omemry copy betwen device and peeredevic. + * @param [in] device the logical device id + * @param [in] peerDevice the physical device id + * @param [outv] *canAccessPeer 1:enable 0:disable + * @return RT_ERROR_NONE for ok + * @return RT_ERROR_INVALID_VALUE for error input + */ +RTS_API rtError_t rtDeviceCanAccessPeer(int32_t* canAccessPeer, uint32_t device, uint32_t peerDevice); + +/** + * @ingroup dvrt_dev + * @brief get status + * @param [in] devIdDes the logical device id + * @param [in] phyIdSrc the physical device id + * @param [in|out] status status value + * @return RT_ERROR_NONE for ok + * @return RT_ERROR_INVALID_VALUE for error input + */ +RTS_API rtError_t rtGetP2PStatus(uint32_t devIdDes, uint32_t phyIdSrc, uint32_t *status); + +/** + * @ingroup dvrt_dev + * @brief get value of current thread + * @param [in|out] pid value of pid + * @return RT_ERROR_NONE for ok + */ +RTS_API rtError_t rtDeviceGetBareTgid(uint32_t *pid); + +/** + * @ingroup dvrt_dev + * @brief get target device of current thread + * @param [in|out] device the device id + * @return RT_ERROR_NONE for ok + * @return RT_ERROR_INVALID_VALUE for error input + */ +RTS_API rtError_t rtGetDevice(int32_t *device); + +/** + * @ingroup dvrt_dev + * @brief reset all opened device + * @return RT_ERROR_NONE for ok + * @return RT_ERROR_INVALID_VALUE for error input + */ +RTS_API rtError_t rtDeviceReset(int32_t device); + +/** + * @ingroup dvrt_dev + * @brief reset opened device + * @return RT_ERROR_NONE for ok + * @return RT_ERROR_INVALID_VALUE for error input + */ +RTS_API rtError_t rtDeviceResetEx(int32_t device); + +/** + * @ingroup dvrt_dev + * @brief get total device infomation. + * @param [in] device the device id + * @param [in] type limit type RT_LIMIT_TYPE_LOW_POWER_TIMEOUT=0 + * @param [in] value limit value + * @param [out] info the device info + * @return RT_ERROR_NONE for ok + * @return RT_ERROR_INVALID_VALUE for error input + */ +RTS_API rtError_t rtDeviceSetLimit(int32_t device, rtLimitType_t type, uint32_t value); + +/** + * @ingroup dvrt_dev + * @brief Wait for compute device to finish + * @return RT_ERROR_NONE for ok + * @return RT_ERROR_INVALID_VALUE for error input + */ +RTS_API rtError_t rtDeviceSynchronize(void); + +/** + * @ingroup dvrt_dev + * @brief get priority range of current device + * @param [in|out] leastPriority least priority + * @param [in|out] greatestPriority greatest priority + * @return RT_ERROR_NONE for ok + * @return RT_ERROR_INVALID_VALUE for error input + */ +RTS_API rtError_t rtDeviceGetStreamPriorityRange(int32_t *leastPriority, int32_t *greatestPriority); + +/** + * @ingroup dvrt_dev + * @brief Set exception handling callback function + * @param [in] callback rtExceptiontype + * @return RT_ERROR_NONE for ok + * @return RT_ERROR_INVALID_VALUE for error input + */ +RTS_API rtError_t rtSetExceptCallback(rtErrorCallback callback); + +/** + * @ingroup dvrt_dev + * @brief Setting Scheduling Type of Graph + * @param [in] tsId the ts id + * @return RT_ERROR_NONE for ok + * @return RT_ERROR_INVALID_VALUE for error input + */ +RTS_API rtError_t rtSetTSDevice(uint32_t tsId); + +/** + * @ingroup dvrt_dev + * @brief init aicpu executor + * @param [out] runtime run mode + * @return RT_ERROR_NONE for ok + * @return RT_ERROR_DRV_ERR for can not get run mode + */ +RTS_API rtError_t rtGetRunMode(rtRunMode *mode); + +/** + * @ingroup dvrt_dev + * @brief get aicpu deploy + * @param [out] aicpu deploy + * @return RT_ERROR_NONE for ok + * @return RT_ERROR_DRV_ERR for can not get aicpu deploy + */ +RTS_API rtError_t rtGetAicpuDeploy(rtAicpuDeployType_t *deplyType); + +/** + * @ingroup dvrt_dev + * @brief set chipType + * @return RT_ERROR_NONE for ok + */ +RTS_API rtError_t rtSetSocVersion(const char *version); + +/** + * @ingroup dvrt_dev + * @brief get chipType + * @return RT_ERROR_NONE for ok + */ +rtError_t rtGetSocVersion(char *version, const uint32_t maxLen); + +/** + * @ingroup dvrt_dev + * @brief get status + * @param [in] devId the logical device id + * @param [in] otherDevId the other logical device id + * @param [in] infoType info type + * @param [in|out] value pair info + * @return RT_ERROR_NONE for ok + */ +RTS_API rtError_t rtGetPairDevicesInfo(uint32_t devId, uint32_t otherDevId, int32_t infoType, int64_t *value); + +/** + * @ingroup dvrt_dev + * @brief get capability infomation. + * @param [in] featureType feature type + typedef enum tagRtFeatureType { + FEATURE_TYPE_MEMCPY = 0, + FEATURE_TYPE_RSV, + } rtFeatureType_t; + * @param [in] infoType info type + typedef enum tagMemcpyInfo { + MEMCPY_INFO_SUPPORT_ZEROCOPY = 0, + MEMCPY_INFO _RSV, + } rtMemcpyInfo_t; + * @param [out] value the capability info + * @return RT_ERROR_NONE for ok + */ +RTS_API rtError_t rtGetRtCapability(rtFeatureType_t featureType, int32_t featureInfo, int64_t *value); + +/** + * @ingroup dvrt_dev + * @brief set target device for current thread + * @param [int] device the device id + * @return RT_ERROR_NONE for ok + * @return RT_ERROR_INVALID_VALUE for error input + */ +RTS_API rtError_t rtSetDeviceWithoutTsd(int32_t device); + +/** + * @ingroup dvrt_dev + * @brief reset all opened device + * @return RT_ERROR_NONE for ok + * @return RT_ERROR_INVALID_VALUE for error input + */ +RTS_API rtError_t rtDeviceResetWithoutTsd(int32_t device); +#if defined(__cplusplus) && !defined(COMPILE_OMG_PACKAGE) +} +#endif + +#endif // __CCE_RUNTIME_DEVICE_H__ diff --git a/inc/hccl/cltm.h b/inc/runtime/dvfsprofile.h similarity index 32% rename from inc/hccl/cltm.h rename to inc/runtime/dvfsprofile.h index b741f46b6..6e4516955 100644 --- a/inc/hccl/cltm.h +++ b/inc/runtime/dvfsprofile.h @@ -1,56 +1,63 @@ /** - * Copyright 2019-2020 Huawei Technologies Co., Ltd - * + * Copyright 2020 Huawei Technologies Co., Ltd + * 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. - */ +*/ -/** - * @file cltm.h - * @brief Cluster Logical Topology Management API - * - */ +#ifndef __CCE_RUNTIME_DVFSPROFILE_H__ +#define __CCE_RUNTIME_DVFSPROFILE_H__ -#ifndef CLTM_INC_H_ -#define CLTM_INC_H_ +#include "base.h" -#ifdef __cplusplus +#if defined(__cplusplus) && !defined(COMPILE_OMG_PACKAGE) extern "C" { -#endif // __cplusplus +#endif + +typedef enum dvfsProfileMode { + DVFS_PROFILE_PERFORMANCE_PRIORITY, + DVFS_PROFILE_BALANCE_PRIORITY, + DVFS_PROFILE_POWER_PRIORITY, + DVFS_PROFILE_PRIORITY_MAX +} DvfsProfileMode; + +/** + * @ingroup dvrt_dvfsprofile + * @brief Set the performance mode of the device + * @param [in] mode dvfsProfileMode + * @return RT_ERROR_NONE for ok + * @return RT_ERROR_INVALID_VALUE for error input + */ +RTS_API rtError_t rtSetDvfsProfile(DvfsProfileMode mode); /** - * @brief CLTM functions return value definition + * @ingroup dvrt_dvfsprofile + * @brief Set the performance mode of the device + * @return RT_ERROR_NONE for ok + * @return RT_ERROR_INVALID_VALUE for invalid value */ -typedef enum tagCltmResult { - CLTM_SUCCESS = 0, /**< success */ - CTLM_E_PTR, /**< empty pointer */ - CLTM_E_PARA, /**< parameter error */ - CLTM_E_NO_RESOURCE, /**< resource not enough error */ - CLTM_E_RESERVED /**< reserved */ -} cltmResult_t; +RTS_API rtError_t rtUnsetDvfsProfile(); /** - * @brief Generate rank table - * - * @param allocatedResource A string identifying the resource list allocate by the CSM. - * @param rankTableBuf A string identifying the buffer of . - * @param maxBufSize An integer(u32) identifying the size of rank table buffer. - * @param usedBufSize A pointer identifying the used size of rank table buffer. - * @return cltmResult_t + * @ingroup dvrt_dvfsprofile + * @brief Get the current performance mode of the device + * @param [in|out] pmode dvfsProfileMode type pointer + * @return RT_ERROR_NONE for ok + * @return RT_ERROR_INVALID_VALUE for error input */ -cltmResult_t cltm_generate_ranktable(const char *allocatedResource, char* rankTableBuf, - unsigned int maxBufSize, unsigned int *usedBufSize); +RTS_API rtError_t rtGetDvfsProfile(DvfsProfileMode *pmode); -#ifdef __cplusplus +#if defined(__cplusplus) && !defined(COMPILE_OMG_PACKAGE) } #endif -#endif // CLTM_INC_H_ + +#endif // __CCE_RUNTIME_PROFILE_H__ diff --git a/inc/runtime/event.h b/inc/runtime/event.h new file mode 100644 index 000000000..c8a227e80 --- /dev/null +++ b/inc/runtime/event.h @@ -0,0 +1,236 @@ +/** + * Copyright 2020 Huawei Technologies Co., Ltd + + * 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 __CCE_RUNTIME_EVENT_H__ +#define __CCE_RUNTIME_EVENT_H__ + +#include "base.h" + +#if defined(__cplusplus) && !defined(COMPILE_OMG_PACKAGE) +extern "C" { +#endif + +/** + * @ingroup event_flags + * @brief event op bit flags + */ +#define RT_EVENT_DEFAULT (0x00) +#define RT_EVENT_WITH_FLAG (0x01) + +/** + * @ingroup dvrt_event + * @brief create event instance + * @param [in|out] event created event + * @return RT_ERROR_NONE for ok + * @return RT_ERROR_INVALID_VALUE for error input + */ +RTS_API rtError_t rtEventCreate(rtEvent_t *event); + +/** + * @ingroup dvrt_event + * @brief create event instance with flag + * @param [in|out] event created event flag event op flag + * @return RT_ERROR_NONE for ok + * @return RT_ERROR_INVALID_VALUE for error input + */ +RTS_API rtError_t rtEventCreateWithFlag(rtEvent_t *event, uint32_t flag); + +/** + * @ingroup dvrt_event + * @brief destroy event instance + * @param [in] event event to destroy + * @return RT_ERROR_NONE for ok + * @return RT_ERROR_INVALID_VALUE for error input + */ +RTS_API rtError_t rtEventDestroy(rtEvent_t event); + +/** + * @ingroup dvrt_event + * @brief event record + * @param [int] event event to record + * @param [int] stream stream handle + * @return RT_ERROR_NONE for ok + * @return RT_ERROR_INVALID_VALUE for error input + */ +RTS_API rtError_t rtEventRecord(rtEvent_t event, rtStream_t stream); + +/** + * @ingroup dvrt_event + * @brief event reset + * @param [int] event event to reset + * @param [int] stream stream handle + * @return RT_ERROR_NONE for ok + */ +RTS_API rtError_t rtEventReset(rtEvent_t event, rtStream_t stream); + +/** + * @ingroup dvrt_event + * @brief wait event to be complete + * @param [in] event event to wait + * @return RT_ERROR_NONE for ok + * @return RT_ERROR_INVALID_VALUE for error input + */ +RTS_API rtError_t rtEventSynchronize(rtEvent_t event); + +/** + * @ingroup dvrt_event + * @brief Queries an event's status + * @param [in] event event to query + * @return RT_ERROR_NONE for complete + * @return RT_ERROR_EVENT_NOT_COMPLETE for not complete + */ +RTS_API rtError_t rtEventQuery(rtEvent_t event); + +/** + * @ingroup dvrt_event + * @brief computes the elapsed time between events. + * @param [in] time time between start and end in ms + * @param [in] start starting event + * @param [in] end ending event + * @return RT_ERROR_NONE for ok, errno for failed + */ +RTS_API rtError_t rtEventElapsedTime(float *time, rtEvent_t start, rtEvent_t end); + +/** + * @ingroup dvrt_event + * @brief get the elapsed time from a event after event recorded. + * @param [in] time time in ms + * @param [in] event event handle + * @return RT_ERROR_NONE for ok, errno for failed + */ +RTS_API rtError_t rtEventGetTimeStamp(uint64_t *time, rtEvent_t event); + +/** + * @ingroup dvrt_event + * @brief name an event + * @param [in] event_ event to be named + * @param [in] name identification name + * @return RT_ERROR_NONE for ok + * @return RT_ERROR_INVALID_VALUE for error input of event, name + * @return RT_ERROR_DRV_ERR for driver error + */ +RTS_API rtError_t rtNameEvent(rtEvent_t event_, const char *name); + +/** + * @ingroup dvrt_event + * @brief Create a notify + * @param [in] device_id device id + * @param [in|out] notify_ notify to be created + * @return RT_ERROR_NONE for ok + * @return RT_ERROR_INVALID_VALUE for error input + */ +RTS_API rtError_t rtNotifyCreate(int32_t device_id, rtNotify_t *notify_); + +/** + * @ingroup dvrt_event + * @brief Destroy a notify + * @param [in] notify_ notify to be destroyed + * @return RT_ERROR_NONE for ok + * @return RT_ERROR_INVALID_VALUE for error input + * @return RT_ERROR_DRV_ERR for driver error + */ +RTS_API rtError_t rtNotifyDestroy(rtNotify_t notify_); + +/** + * @ingroup dvrt_event + * @brief Record a notify + * @param [in] notify_ notify to be recorded + * @param [in] stream_ input stream + * @return RT_ERROR_NONE for ok + * @return RT_ERROR_INVALID_VALUE for error input + * @return RT_ERROR_STREAM_CONTEXT for stream is not in current ctx + */ +RTS_API rtError_t rtNotifyRecord(rtNotify_t notify_, rtStream_t stream_); + +/** + * @ingroup dvrt_event + * @brief Wait for a notify + * @param [in] notify_ notify to be wait + * @param [in] stream_ input stream + * @return RT_ERROR_NONE for ok + * @return RT_ERROR_INVALID_VALUE for error input + * @return RT_ERROR_STREAM_CONTEXT for stream is not in current ctx + */ +RTS_API rtError_t rtNotifyWait(rtNotify_t notify_, rtStream_t stream_); + +/** + * @ingroup dvrt_event + * @brief Name a notify + * @param [in] notify_ notify to be named + * @param [in|out] name identification name + * @return RT_ERROR_NONE for ok + * @return RT_ERROR_INVALID_VALUE for error input + */ +RTS_API rtError_t rtNameNotify(rtNotify_t notify_, const char *name); + +/** + * @ingroup dvrt_event + * @brief get notify id + * @param [in] notify_ notify to be get + * @param [in|out] notify_id notify id + * @return RT_ERROR_NONE for ok + * @return RT_ERROR_INVALID_VALUE for error input + */ +RTS_API rtError_t rtGetNotifyID(rtNotify_t notify_, uint32_t *notify_id); + +/** + * @ingroup dvrt_event + * @brief Set a notify to IPC notify + * @param [in] notify_ notify to be set to IPC notify + * @param [in] name identification name + * @return RT_ERROR_NONE for ok + * @return RT_ERROR_INVALID_VALUE for error input of + */ +RTS_API rtError_t rtIpcSetNotifyName(rtNotify_t notify, char *name, uint32_t len); + +/** + * @ingroup dvrt_event + * @brief Open IPC notify + * @param [in] notify notify to be opened + * @param [in] name identification name + * @return RT_ERROR_NONE for ok + * @return RT_ERROR_INVALID_VALUE for error input + */ +RTS_API rtError_t rtIpcOpenNotify(rtNotify_t *notify, const char *name); + +/** + * @ingroup dvrt_event + * @brief Get the physical address corresponding to notify + * @param [in] notify notify to be queried + * @param [in] devAddrOffset device physical address offset + * @return RT_ERROR_NONE for ok + * @return RT_ERROR_INVALID_VALUE for error input + * @return RT_ERROR_DRV_ERR for driver error + */ +RTS_API rtError_t rtNotifyGetAddrOffset(rtNotify_t notify, uint64_t *devAddrOffset); + +/** + * @ingroup dvrt_event + * @brief Ipc set notify pid + * @param [in] name name to be queried + * @param [in] pid process id + * @param [in] num length of pid[] + * @return RT_ERROR_NONE for ok + * @return RT_ERROR_INVALID_VALUE for error input + * @return RT_ERROR_DRV_ERR for driver error + */ +RTS_API rtError_t rtSetIpcNotifyPid(const char *name, int32_t pid[], int num); + +#if defined(__cplusplus) && !defined(COMPILE_OMG_PACKAGE) +} +#endif + +#endif // __CCE_RUNTIME_EVENT_H__ diff --git a/inc/runtime/kernel.h b/inc/runtime/kernel.h new file mode 100644 index 000000000..de806a9e6 --- /dev/null +++ b/inc/runtime/kernel.h @@ -0,0 +1,537 @@ +/** + * Copyright 2020 Huawei Technologies Co., Ltd + + * 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 __CCE_RUNTIME_KERNEL_H__ +#define __CCE_RUNTIME_KERNEL_H__ + +#include "base.h" +#include "stream.h" + +#if defined(__cplusplus) && !defined(COMPILE_OMG_PACKAGE) +extern "C" { +#endif + +/** + * @ingroup rt_kernel + * @brief shared memory data control + */ +typedef struct tagRtSmData { + uint64_t L2_mirror_addr; // preload or swap source address + uint32_t L2_data_section_size; // every data size + uint8_t L2_preload; // 1 - preload from mirrorAddr, 0 - no preload + uint8_t modified; // 1 - data will be modified by kernel, 0 - no modified + uint8_t priority; // data priority + int8_t prev_L2_page_offset_base; // remap source section offset + uint8_t L2_page_offset_base; // remap destination section offset + uint8_t L2_load_to_ddr; // 1 - need load out, 0 - no need + uint8_t reserved[2]; // reserved +} rtSmData_t; + +/** + * @ingroup rt_kernel + * @brief shared memory description + */ +typedef struct tagRtSmCtrl { + rtSmData_t data[8]; // data description + uint64_t size; // max page Num + uint8_t remap[64]; /* just using for static remap mode, default:0xFF + array index: virtual l2 page id, array value: physic l2 page id */ + uint8_t l2_in_main; // 0-DDR, 1-L2, default:0xFF + uint8_t reserved[3]; +} rtSmDesc_t; + +typedef rtSmDesc_t rtL2Ctrl_t; + +/** + * @ingroup rt_kernel + * @brief device binary type + */ +typedef struct tagRtDevBinary { + uint32_t magic; // magic number + uint32_t version; // version of binary + const void *data; // binary data + uint64_t length; // binary length +} rtDevBinary_t; + +/** + * @ingroup rt_kernel + * @brief function mode type + */ +#define ONLINE_PROF_MAX_PMU_NUM (8) + +typedef struct ProfilefDataInfo { + const void *stubFunc; + uint32_t blockDim; + const void *args; + uint32_t argsSize; + rtSmDesc_t *smDesc; + rtStream_t stream; + uint64_t totalcycle; + uint64_t ovcycle; + uint64_t pmu_cnt[ONLINE_PROF_MAX_PMU_NUM]; +} rtProfDataInfo_t; + +/** + * @ingroup rt_kernel + * @brief function mode type + */ +typedef enum { + FUNC_MODE_NORMAL = 0, + FUNC_MODE_PCTRACE_USERPROFILE_RECORDLOOP, + FUNC_MODE_PCTRACE_USERPROFILE_SKIPLOOP, + FUNC_MODE_PCTRACE_CYCLECNT_RECORDLOOP, + FUNC_MODE_PCTRACE_CYCLECNT_SKIPLOOP, + FUNC_MODE_BUTT +} rtFuncModeType_t; + +/** + * @ingroup rt_kernel + * @brief kernel info + */ +typedef struct rtKernelInfo { + uint64_t task_offset; // kernel offset in module + /* flowtable */ + void *arg; // launch kernel arg + uint32_t arg_size; + /* module */ + void *module_addr; // module::baseaddr_ + uint32_t module_size; +} * rtKernelInfo_t; + +/** + * @ingroup rt_KernelConfigDump + * @brief device dump type + */ +typedef enum tagRtDumpKind { + RT_DATA_DUMP_KIND_INVALID = -1, + RT_DATA_DUMP_KIND_DUMP = 0, + RT_DATA_DUMP_KIND_RESERVED +} rtDumpKind_t; + +/** + * @ingroup rt_kernel + * @brief report callback + */ +typedef rtError_t (*rtKernelReportCallback)(rtStream_t stream, rtKernelInfo_t kernelInfo); + +/** + * @ingroup rt_kernel + * @brief stream report callback + */ +typedef void (*rtCallback_t)(void *fnData); + +/** + * @ingroup rt_kernel + * @brief magic number of plain binary for aicore + */ +#define RT_DEV_BINARY_MAGIC_PLAIN 0xabceed50 + +/** + * @ingroup rt_kernel + * @brief magic number of plain binary for aicpu + */ +#define RT_DEV_BINARY_MAGIC_PLAIN_AICPU 0xabceed51 + +/** + * @ingroup rt_kernel + * @brief magic number of plain binary for aivector + */ +#define RT_DEV_BINARY_MAGIC_PLAIN_AIVEC 0xabceed52 + +/** + * @ingroup rt_kernel + * @brief magic number of elf binary for aicore + */ +#define RT_DEV_BINARY_MAGIC_ELF 0x43554245 + +/** + * @ingroup rt_kernel + * @brief magic number of elf binary for aicpu + */ +#define RT_DEV_BINARY_MAGIC_ELF_AICPU 0x41415243 + +/** + * @ingroup rt_kernel + * @brief magic number of elf binary for aivector + */ +#define RT_DEV_BINARY_MAGIC_ELF_AIVEC 0x41415246 + +/** + * @ingroup rt_kernel_flags + * @brief kernel op bit flags + */ +#define RT_KERNEL_DEFAULT (0x00) +#define RT_KERNEL_CONVERT (0x01) +#define RT_KERNEL_DUMPFLAG (0x02) +#define RT_FUSION_KERNEL_DUMPFLAG (0x04) +#define RT_KERNEL_CUSTOM_AICPU (0x08) + +/** + * @ingroup rt_kernel + * @brief kernel L1 Fusion Dump bit flags + */ +#define RT_DDR_ADDR (0x0) + +/** + * @ingroup rt_kernel + * @brief register device binary + * @param [in] bin device binary description + * @param [out] handle device binary handle + * @return RT_ERROR_NONE for ok + * @return RT_ERROR_INVALID_VALUE for error input + */ +RTS_API rtError_t rtDevBinaryRegister(const rtDevBinary_t *bin, void **handle); + +/** + * @ingroup rt_kernel + * @brief register fast memeory device binary + * @param [in] handle device binary handle + * @return RT_ERROR_NONE for ok + * @return RT_ERROR_INVALID_VALUE for error input + */ +RTS_API rtError_t rtBinaryRegisterToFastMemory(void *handle); + +/** + * @ingroup rt_kernel + * @brief unregister device binary + * @param [in] handle device binary handle + * @return RT_ERROR_NONE for ok + * @return RT_ERROR_INVALID_VALUE for error input + */ +RTS_API rtError_t rtDevBinaryUnRegister(void *handle); + +/** + * @ingroup rt_kernel + * @brief register device binary metadata + * @param [in] handle device binary description + * @param [in] metadata device binary metadata + * @return RT_ERROR_NONE for ok + * @return RT_ERROR_INVALID_VALUE for error input + */ +RTS_API rtError_t rtMetadataRegister(void *handle, const char *metadata); + +/** + * @ingroup rt_kernel + * @brief register device binary dependency + * @param [in] mHandle master device binary description + * @param [in] sHandle slave device binary description + * @return RT_ERROR_NONE for ok + * @return RT_ERROR_INVALID_VALUE for error input + */ +RTS_API rtError_t rtDependencyRegister(void *mHandle, void *sHandle); + +/** + * @ingroup rt_kernel + * @brief register device function + * @param [in] binHandle device binary handle + * @param [in] stubFunc stub function + * @param [in] stubName stub function name + * @param [in] devFunc device function description. symbol name or address + * offset, depending binary type. + * @return RT_ERROR_NONE for ok + * @return RT_ERROR_INVALID_VALUE for error input + */ +RTS_API rtError_t rtFunctionRegister(void *binHandle, const void *stubFunc, const char *stubName, const void *devFunc, + uint32_t funcMode); + +/** + * @ingroup rt_kernel + * @brief find stub function by name + * @param [in] stubName stub function name + * @param [out] stubFunc stub function + * @return RT_ERROR_NONE for ok + * @return RT_ERROR_INVALID_VALUE for error input + */ +RTS_API rtError_t rtGetFunctionByName(const char *stubName, void **stubFunc); + +/** + * @ingroup rt_kernel + * @brief find addr by stub func + * @param [in] stubFunc stub function + * @param [out] addr + * @return RT_ERROR_NONE for ok + * @return RT_ERROR_INVALID_VALUE for error input + */ +RTS_API rtError_t rtGetAddrByFun(const void *stubFunc, void **addr); +/** + * @ingroup rt_kernel + * @brief query registered or not by stubName + * @param [in] stubName stub function name + * @return RT_ERROR_NONE for ok + * @return RT_ERROR_INVALID_VALUE for error input + */ +RTS_API rtError_t rtQueryFunctionRegistered(const char *stubName); + +/** + * @ingroup rt_kernel + * @brief config data dump + * @param [in] dumpSizePerBlock dump size + * @param [in] blockDim block dimentions + * @param [in] dumpBaseAddr dump base address + * @return RT_ERROR_NONE for ok + * @return RT_ERROR_INVALID_VALUE for error input + */ +RTS_API rtError_t rtKernelConfigDump(uint32_t kind, uint32_t dumpSizePerBlock, uint32_t blockDim, void **dumpBaseAddr, + rtStream_t stream_); + +/** + * @ingroup rt_kernel + * @brief launch kernel to device + * @param [in] stubFunc stub function + * @param [in] blockDim block dimentions + * @param [in] args argments address for kernel function + * @param [in] argsSize argements size + * @param [in] smDesc shared memory description + * @param [in] stream associated stream + * @return RT_ERROR_NONE for ok + * @return RT_ERROR_INVALID_VALUE for error input + */ +RTS_API rtError_t rtKernelLaunch(const void *stubFunc, uint32_t blockDim, void *args, uint32_t argsSize, + rtSmDesc_t *smDesc, rtStream_t stream); + +/** + * @ingroup rt_kernel + * @brief launch kernel to device + * @param [in] stubFunc stub function + * @param [in] blockDim block dimentions + * @param [in] args argments address for kernel function + * @param [in] argsSize argements size + * @param [in] smDesc shared memory description + * @param [in] stream associated stream + * @param [in] flag dump flag + * @return RT_ERROR_NONE for ok + * @return RT_ERROR_INVALID_VALUE for error input + */ +RTS_API rtError_t rtKernelLaunchWithFlag(const void *stubFunc, uint32_t blockDim, void *args, uint32_t argsSize, + rtSmDesc_t *smDesc, rtStream_t stream, uint32_t flags); + +/** + * @ingroup rt_kernel + * @brief launch kernel to device + * @param [in] args argments address for kernel function + * @param [in] argsSize argements size + * @param [in] flags launch flags + * @param [in] stream associated stream + * @return RT_ERROR_NONE for ok + * @return RT_ERROR_INVALID_VALUE for error input + */ +RTS_API rtError_t rtKernelLaunchEx(void *args, uint32_t argsSize, uint32_t flags, rtStream_t stream); + +/** + * @ingroup rt_kernel + * @brief launch cpu kernel to device + * @param [in] soName so name + * @param [in] kernelName kernel name + * @param [in] blockDim block dimentions + * @param [in] args argments address for kernel function + * @param [in] argsSize argments size + * @param [in] smDesc shared memory description + * @param [in] stream associated stream + * @return RT_ERROR_NONE for ok + * @return RT_ERROR_INVALID_VALUE for error input + */ +RTS_API rtError_t rtCpuKernelLaunch(const void *soName, const void *kernelName, uint32_t blockDim, const void *args, + uint32_t argsSize, rtSmDesc_t *smDesc, rtStream_t stream); + +/** + * @ingroup rt_kernel + * @brief launch cpu kernel to device with dump identifier + * @param [in] soName so name + * @param [in] kernelName kernel name + * @param [in] blockDim block dimentions + * @param [in] args argments address for kernel function + * @param [in] argsSize argments size + * @param [in] smDesc shared memory description + * @param [in] stream associated stream + * @param [in] flag dump flag or others function flag + * @return RT_ERROR_NONE for ok + * @return RT_ERROR_INVALID_VALUE for error input + */ +RTS_API rtError_t rtCpuKernelLaunchWithFlag(const void *soName, const void *kernelName, uint32_t blockDim, + const void *args, uint32_t argsSize, rtSmDesc_t *smDesc, rtStream_t stream, + uint32_t flags); + +typedef void *rtModel_t; +/** + * @ingroup rt_kernel + * @brief L1 fusion dump addr transfered to device + * @param [in] model handle info + * @param [in] addr ddr address of L1 Fusion Dump + * @param [in] dumpSize memory size + * @param [in] flag memory flag + * @return RT_ERROR_NONE for ok + * @return RT_ERROR_INVALID_VALUE for error input + */ + RTS_API rtError_t rtDumpAddrSet(rtModel_t model, void *addr , uint32_t dumpSize, uint32_t flag); + +/** + * @ingroup rt_kernel + * @brief load dump info to aicpu + * @param [in] dumpInfo dump info + * @param [in] length length of dump info + * @return RT_ERROR_NONE for ok + * @return RT_ERROR_INVALID_VALUE for error input + */ +RTS_API rtError_t rtDatadumpInfoLoad(const void *dumpInfo, uint32_t length); + +#ifndef __CLANG_CCE_RUNTIME_H__ +#define __CLANG_CCE_RUNTIME_H__ +/** + * @ingroup rt_kernel + * @brief configure call argment for next rtLaunch in current thread + * @param [in] numBlocks block dimentions + * @param [in] smDesc shared memory description + * @param [in] stream associated stream + * @return RT_ERROR_NONE for ok + * @return RT_ERROR_INVALID_VALUE for error input + */ +#ifdef __cplusplus +RTS_API rtError_t rtConfigureCall(uint32_t numBlocks, rtSmDesc_t *smDesc = nullptr, rtStream_t stream = nullptr); +#else +RTS_API rtError_t rtConfigureCall(uint32_t numBlocks, rtSmDesc_t *smDesc, rtStream_t stream); +#endif +#endif // __CLANG_CCE_RUNTIME_H__ + +/** + * @ingroup rt_kernel + * @brief setup argment for next rtLaunch in current thread + * @param [in] arg argment address for kernel function + * @param [in] size argment size + * @param [in] offset argment table offset + * @return RT_ERROR_NONE for ok + * @return RT_ERROR_INVALID_VALUE for error input + */ +RTS_API rtError_t rtSetupArgument(const void *arg, uint32_t size, uint32_t offset); + +/** + * @ingroup rt_kernel + * @brief launch kernel to device with previous setting kernel argment + * and call argment + * @param [in] stubFunc stub function + * @return RT_ERROR_NONE for ok + * @return RT_ERROR_INVALID_VALUE for error input + */ +RTS_API rtError_t rtLaunch(const void *stubFunc); + +/** + * @ingroup rt_kernel + * @brief implicitly transfered data to device. + * lifecycle end after next kernel task finish + * @param [in] ptr host memory + * @param [in] size host memory size + * @param [in] flag reserved. set to 0 + * @param [out] arg returned arg. used for next kernel's arg. + * @return RT_ERROR_NONE for ok + * @return RT_ERROR_INVALID_VALUE for error input + */ +RTS_API rtError_t rtKernelConfigTransArg(const void *ptr, uint64_t size, uint32_t flag, void **arg); + +/** + * @ingroup rt_kernel + * @brief start fusion kernels. + * @param [in] stream stream for fusion kernels + * @return RT_ERROR_NONE for ok + * @return RT_ERROR_INVALID_VALUE for error input + */ +RTS_API rtError_t rtKernelFusionStart(rtStream_t stream); + +/** + * @ingroup rt_kernel + * @brief end fusion kernels. + * @param [in] stream stream for fusion kernels + * @return RT_ERROR_NONE for ok + * @return RT_ERROR_INVALID_VALUE for error input + */ +RTS_API rtError_t rtKernelFusionEnd(rtStream_t stream); + +/** + * @ingroup rt_kernel + * @brief set kernelinfo callback + * @param [in] callback + * @return RT_ERROR_NONE for ok + * @return RT_ERROR_INVALID_VALUE for error input + */ +RTS_API rtError_t rtSetKernelReportCallback(rtKernelReportCallback callBack); + +/** + * @ingroup rt_kernel + * @brief subscribe stream callback report. + * @param [in] threadId thread id for stream + * @param [in] stream stream for subscribe + * @return RT_ERROR_NONE for ok + * @return RT_ERROR_INVALID_VALUE for error input + */ +RTS_API rtError_t rtSubscribeReport(uint64_t threadId, rtStream_t stream); + +/** + * @ingroup rt_kernel + * @brief add callback launch task in stream. + * @param [in] callBackFunc app callback function + * @param [in] fnData user data + * @param [in] stream subscribed stream + * @return RT_ERROR_NONE for ok + * @return RT_ERROR_INVALID_VALUE for error input + */ +RTS_API rtError_t rtCallbackLaunch(rtCallback_t callBackFunc, void *fnData, rtStream_t stream, bool isBlock); + +/** + * @ingroup rt_kernel + * @brief process callback report. + * @param [in] timeout if timeout=-1, while(1); else timeout + * @return RT_ERROR_NONE for ok + * @return RT_ERROR_INVALID_VALUE for error input + */ +RTS_API rtError_t rtProcessReport(int32_t timeout); + +/** + * @ingroup rt_kernel + * @brief unsubscribe callback report. + * @param [in] threadId thread id for stream + * @param [in] stream stream for subscribe + * @return RT_ERROR_NONE for ok + * @return RT_ERROR_INVALID_VALUE for error input + */ +RTS_API rtError_t rtUnSubscribeReport(uint64_t threadId, rtStream_t stream); + +/** + * @ingroup profiling_base + * @brief start online prof. + * @return RT_ERROR_NONE for ok + * @return RT_ERROR_INVALID_VALUE for error input + */ +RTS_API rtError_t rtStartOnlineProf(rtStream_t stream, uint32_t sampleNum); + +/** + * @ingroup profiling_base + * @brief stop online prof. + * @return RT_ERROR_NONE for ok + * @return RT_ERROR_INVALID_VALUE for error input + */ +RTS_API rtError_t rtStopOnlineProf(rtStream_t stream); + +/** + * @ingroup profiling_base + * @brief get online prof. + * @return RT_ERROR_NONE for ok + * @return RT_ERROR_INVALID_VALUE for error input + */ +RTS_API rtError_t rtGetOnlineProfData(rtStream_t stream, rtProfDataInfo_t *pProfData, uint32_t profDataNum); +#if defined(__cplusplus) && !defined(COMPILE_OMG_PACKAGE) +} +#endif + +#endif // __CCE_RUNTIME_KERNEL_H__ + diff --git a/inc/runtime/mem.h b/inc/runtime/mem.h new file mode 100644 index 000000000..22a00ac62 --- /dev/null +++ b/inc/runtime/mem.h @@ -0,0 +1,542 @@ +/** + * Copyright 2020 Huawei Technologies Co., Ltd + + * 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 __CCE_RUNTIME_MEM_H__ +#define __CCE_RUNTIME_MEM_H__ + +/*lint -e7*/ +#include +/*lint +e7*/ +#include "base.h" +#include "config.h" +#include "stream.h" + +#if defined(__cplusplus) && !defined(COMPILE_OMG_PACKAGE) +extern "C" { +#endif + +/** + * @ingroup dvrt_mem + * @brief memory type + */ +#define RT_MEMORY_DEFAULT ((uint32_t)0x0) // default memory on device +#define RT_MEMORY_HBM ((uint32_t)0x2) // HBM memory on device +#define RT_MEMORY_DDR ((uint32_t)0x4) // DDR memory on device +#define RT_MEMORY_SPM ((uint32_t)0x8) // shared physical memory on device +#define RT_MEMORY_P2P_HBM ((uint32_t)0x10) // HBM memory on other 4P device +#define RT_MEMORY_P2P_DDR ((uint32_t)0x11) // DDR memory on other device +#define RT_MEMORY_DDR_NC ((uint32_t)0x20) // DDR memory of non-cache +#define RT_MEMORY_TS_4G ((uint32_t)0x40) +#define RT_MEMORY_TS ((uint32_t)0x80) +#define RT_MEMORY_RESERVED ((uint32_t)0x100) + +#define RT_MEMORY_L1 ((uint32_t)0x1<<16) +#define RT_MEMORY_L2 ((uint32_t)0x1<<17) + +/** + * @ingroup dvrt_mem + * @brief memory info type + */ +#define RT_MEM_INFO_TYPE_DDR_SIZE ((uint32_t)0x1) +#define RT_MEM_INFO_TYPE_HBM_SIZE ((uint32_t)0x2) +#define RT_MEM_INFO_TYPE_DDR_P2P_SIZE ((uint32_t)0x3) +#define RT_MEM_INFO_TYPE_HBM_P2P_SIZE ((uint32_t)0x4) + +/** + * @ingroup dvrt_mem + * @brief memory Policy + */ +#define RT_MEMORY_POLICY_NONE ((uint32_t)0x0) // Malloc mem prior hage page, then default page +#define RT_MEMORY_POLICY_HUGE_PAGE_FIRST ((uint32_t)0x1 << 10) // Malloc mem prior hage page, then default page +#define RT_MEMORY_POLICY_HUGE_PAGE_ONLY ((uint32_t)0x1 << 11) // Malloc mem only use hage page +#define RT_MEMORY_POLICY_DEFAULT_PAGE_ONLY ((uint32_t)0x1 << 12) // Malloc mem only use default page +#define RT_MEMORY_POLICY_HUGE_PAGE_FIRST_P2P ((uint32_t)0x1 << 13) // Malloc mem prior hage page, then default page, use for p2p +#define RT_MEMORY_POLICY_HUGE_PAGE_ONLY_P2P ((uint32_t)0x1 << 14) // Malloc mem only use hage page, use for p2p +#define RT_MEMORY_POLICY_DEFAULT_PAGE_ONLY_P2P ((uint32_t)0x1 << 15) // Malloc mem only use default page, use for p2p + +#define MEM_ALLOC_TYPE_BIT ((uint32_t)0x3FF) // mem type bit in <0, 9> + +/** + * @ingroup dvrt_mem + * @brief memory type | memory Policy + */ +typedef uint32_t rtMemType_t; + +/** + * @ingroup dvrt_mem + * @brief memory advise type + */ +#define RT_MEMORY_ADVISE_EXE (0x02) +#define RT_MEMORY_ADVISE_THP (0x04) +#define RT_MEMORY_ADVISE_PLE (0x08) +#define RT_MEMORY_ADVISE_PIN (0x16) + +/** + * @ingroup dvrt_mem + * @brief memory copy type + */ +typedef enum tagRtMemcpyKind { + RT_MEMCPY_HOST_TO_HOST = 0, // host to host + RT_MEMCPY_HOST_TO_DEVICE, // host to device + RT_MEMCPY_DEVICE_TO_HOST, // device to host + RT_MEMCPY_DEVICE_TO_DEVICE, // device to device, 1P && P2P + RT_MEMCPY_MANAGED, // managed memory + RT_MEMCPY_ADDR_DEVICE_TO_DEVICE, + RT_MEMCPY_HOST_TO_DEVICE_EX, // host to device ex (only used for 8 bytes) + RT_MEMCPY_DEVICE_TO_HOST_EX, // device to host ex + RT_MEMCPY_RESERVED, +} rtMemcpyKind_t; + +typedef enum tagRtMemInfoType { + RT_MEMORYINFO_DDR, + RT_MEMORYINFO_HBM, + RT_MEMORYINFO_DDR_HUGE, // Hugepage memory of DDR + RT_MEMORYINFO_DDR_NORMAL, // Normal memory of DDR + RT_MEMORYINFO_HBM_HUGE, // Hugepage memory of HBM + RT_MEMORYINFO_HBM_NORMAL, // Normal memory of HBM + RT_MEMORYINFO_DDR_P2P_HUGE, // Hugepage memory of DDR + RT_MEMORYINFO_DDR_P2P_NORMAL, // Normal memory of DDR + RT_MEMORYINFO_HBM_P2P_HUGE, // Hugepage memory of HBM + RT_MEMORYINFO_HBM_P2P_NORMAL, // Normal memory of HBM +} rtMemInfoType_t; + +typedef enum tagRtRecudeKind { + RT_MEMCPY_SDMA_AUTOMATIC_ADD = 10, // D2D, SDMA inline reduce, include 1P, and P2P + RT_RECUDE_KIND_END +} rtRecudeKind_t; + +typedef enum tagRtDataType { + RT_DATA_TYPE_FP32 = 0, // fp32 + RT_DATA_TYPE_FP16 = 1, // fp16 + RT_DATA_TYPE_INT16 = 2, // int16 + RT_DATA_TYPE_END +} rtDataType_t; + +/** + * @ingroup dvrt_mem + * @brief memory copy channel type + */ +typedef enum tagRtMemcpyChannelType { + RT_MEMCPY_CHANNEL_TYPE_INNER = 0, // 1P + RT_MEMCPY_CHANNEL_TYPE_PCIe, + RT_MEMCPY_CHANNEL_TYPE_HCCs, // not support now + RT_MEMCPY_CHANNEL_TYPE_RESERVED, +} rtMemcpyChannelType_t; + +/** + * @ingroup rt_kernel + * @brief ai core memory size + */ +typedef struct rtAiCoreMemorySize { + uint32_t l0ASize; + uint32_t l0BSize; + uint32_t l0CSize; + uint32_t l1Size; + uint32_t ubSize; + uint32_t l2Size; + uint32_t l2PageNum; + uint32_t blockSize; + uint64_t bankSize; + uint64_t bankNum; + uint64_t burstInOneBlock; + uint64_t bankGroupNum; +} rtAiCoreMemorySize_t; + +/** + * @ingroup dvrt_mem + * @brief memory type + */ +typedef enum tagRtMemoryType { + RT_MEMORY_TYPE_HOST = 1, + RT_MEMORY_TYPE_DEVICE = 2 , + RT_MEMORY_TYPE_SVM = 3, + RT_MEMORY_TYPE_DVPP = 4 +} rtMemoryType_t; + +/** + * @ingroup dvrt_mem + * @brief memory attribute + */ +typedef struct tagRtPointerAttributes { + rtMemoryType_t memoryType; // host memory or device memory + rtMemoryType_t locationType; + uint32_t deviceID; // device ID + uint32_t pageSize; +} rtPointerAttributes_t; + + +typedef struct rtMallocHostSharedMemoryIn { + const char* name; + const uint64_t size; + uint32_t flag; +} rtMallocHostSharedMemoryIn; + +typedef struct rtMallocHostSharedMemoryOut { + int fd; + void* ptr; + void* devPtr; +} rtMallocHostSharedMemoryOut; + +typedef struct rtFreeHostSharedMemoryIn { + const char* name; + const uint64_t size; + int fd; + void* ptr; + void* devPtr; +} rtFreeHostSharedMemoryIn; + + +/** + * @ingroup dvrt_mem + * @brief alloc device memory + * @param [in|out] devPtr memory pointer + * @param [in] size memory size + * @param [in] type memory type + * @return RT_ERROR_NONE for ok + * @return RT_ERROR_INVALID_VALUE for error input + */ +RTS_API rtError_t rtMalloc(void **devPtr, uint64_t size, rtMemType_t type); + +/** + * @ingroup dvrt_mem + * @brief free device memory + * @param [in|out] devPtr memory pointer + * @return RT_ERROR_NONE for ok + * @return RT_ERROR_INVALID_VALUE for error input + */ +RTS_API rtError_t rtFree(void *devPtr); + +/** + * @ingroup dvrt_mem + * @brief alloc device memory for dvpp + * @param [in|out] devPtr memory pointer + * @param [in] size memory size + * @return RT_ERROR_NONE for ok + * @return RT_ERROR_INVALID_VALUE for error input + */ +RTS_API rtError_t rtDvppMalloc(void **devPtr, uint64_t size); + +/** + * @ingroup dvrt_mem + * @brief free device memory for dvpp + * @param [in|out] devPtr memory pointer + * @return RT_ERROR_NONE for ok + * @return RT_ERROR_INVALID_VALUE for error input + */ +RTS_API rtError_t rtDvppFree(void *devPtr); + +/** + * @ingroup dvrt_mem + * @brief alloc host memory + * @param [in|out] hostPtr memory pointer + * @param [in] size memory size + * @return RT_ERROR_NONE for ok + * @return RT_ERROR_INVALID_VALUE for error input + */ +RTS_API rtError_t rtMallocHost(void **hostPtr, uint64_t size); + +/** + * @ingroup dvrt_mem + * @brief free host memory + * @param [in] hostPtr memory pointer + * @return RT_ERROR_NONE for ok + * @return RT_ERROR_INVALID_VALUE for error input + */ +RTS_API rtError_t rtFreeHost(void *hostPtr); + +/** + * @ingroup dvrt_mem + * @brief alloc host shared memory + * @param [in] in alloc host shared memory inputPara pointer + * @param [in] out alloc host shared memory outputInfo pointer + * @return RT_ERROR_NONE for ok + * @return RT_ERROR_INVALID_VALUE for error input + */ + +RTS_API rtError_t rtMallocHostSharedMemory(rtMallocHostSharedMemoryIn *in, + rtMallocHostSharedMemoryOut *out); + +/** + * @ingroup dvrt_mem + * @brief free host memory + * @param [in] in free host shared memory inputPara pointer + * @return RT_ERROR_NONE for ok + * @return RT_ERROR_INVALID_VALUE for error input + */ + +RTS_API rtError_t rtFreeHostSharedMemory(rtFreeHostSharedMemoryIn *in); + +/** + * @ingroup dvrt_mem + * @brief alloc managed memory + * @param [in|out] ptr memory pointer + * @param [in] size memory size + * @param [in] flag reserved, set to 0. + * @return RT_ERROR_NONE for ok + * @return RT_ERROR_INVALID_VALUE for error input + */ +RTS_API rtError_t rtMemAllocManaged(void **ptr, uint64_t size, uint32_t flag); + +/** + * @ingroup dvrt_mem + * @brief free managed memory + * @param [in] ptr memory pointer + * @return RT_ERROR_NONE for ok + * @return RT_ERROR_INVALID_VALUE for error input + */ +RTS_API rtError_t rtMemFreeManaged(void *ptr); +/** + * @ingroup dvrt_mem + * @brief alloc cached device memory + * @param [in| devPtr memory pointer + * @param [in] size memory size + * @param [in] type memory type + * @return RT_ERROR_NONE for ok + */ +RTS_API rtError_t rtMallocCached(void **devPtr, uint64_t size, rtMemType_t type); + +/** + * @ingroup dvrt_mem + * @brief flush device mempory + * @param [in] base virtal base address + * @param [in] len memory size + * @return RT_ERROR_NONE for ok, errno for failed + */ +RTS_API rtError_t rtFlushCache(void *base, size_t len); + +/** + * @ingroup dvrt_mem + * @brief invalid device mempory + * @param [in] base virtal base address + * @param [in] len memory size + * @return RT_ERROR_NONE for ok, errno for failed + */ +RTS_API rtError_t rtInvalidCache(void *base, size_t len); + +/** + * @ingroup dvrt_mem + * @brief synchronized memcpy + * @param [in] dst destination address pointer + * @param [in] Max length of destination address memory + * @param [in] src source address pointer + * @param [in] count the number of byte to copy + * @param [in] kind memcpy type + * @return RT_ERROR_NONE for ok + * @return RT_ERROR_INVALID_VALUE for error input + */ +RTS_API rtError_t rtMemcpy(void *dst, uint64_t destMax, const void *src, uint64_t count, rtMemcpyKind_t kind); + +/** + * @ingroup dvrt_mem + * @brief asynchronized memcpy + * @param [in] dst destination address pointer + * @param [in] Max length of destination address memory + * @param [in] src source address pointer + * @param [in] count the number of byte to copy + * @param [in] kind memcpy type + * @param [in] stream asynchronized task stream + * @return RT_ERROR_NONE for ok + * @return RT_ERROR_INVALID_VALUE for error input + */ +RTS_API rtError_t rtMemcpyAsync(void *dst, uint64_t destMax, const void *src, uint64_t count, rtMemcpyKind_t kind, + rtStream_t stream); + +/** + * @ingroup dvrt_mem + * @brief asynchronized reduce memcpy + * @param [in] dst destination address pointer + * @param [in] Max length of destination address memory + * @param [in] src source address pointer + * @param [in] count the number of byte to copy + * @param [in] kind memcpy type + * @param [in] type data type + * @param [in] stream asynchronized task stream + * @return RT_ERROR_NONE for ok + * @return RT_ERROR_INVALID_VALUE for error input + */ +RTS_API rtError_t rtReduceAsync(void *dst, uint64_t destMax, const void *src, uint64_t count, rtRecudeKind_t kind, + rtDataType_t type, rtStream_t stream); + +/** + * @ingroup dvrt_mem + * @brief query memory size + * @param [in] aiCoreMemorySize + * @return RT_ERROR_NONE for ok, errno for failed + * @return RT_ERROR_INVALID_VALUE for error input + */ +RTS_API rtError_t rtAiCoreMemorySizes(rtAiCoreMemorySize_t *aiCoreMemorySize); + +/** + * @ingroup dvrt_mem + * @brief set memory size, Setting before model reasoning, Bright screen to prevent model can not be fully + integrated network due to memory limitations.Requirement come from JiaMinHu.Only use for Tiny. + * @param [in] aiCoreMemorySize + * @return RT_ERROR_NONE for ok, errno for failed + * @return RT_ERROR_INVALID_VALUE for error input + */ +RTS_API rtError_t rtSetAiCoreMemorySizes(rtAiCoreMemorySize_t *aiCoreMemorySize); + +/** + * @ingroup dvrt_mem + * @brief set memory with uint32_t value + * @param [in] devPtr + * @param [in] Max length of destination address memory + * @param [in] value + * @param [in] count byte num + * @return RT_ERROR_NONE for ok, errno for failed + * @return RT_ERROR_INVALID_VALUE for error input + */ +RTS_API rtError_t rtMemset(void *devPtr, uint64_t destMax, uint32_t value, uint64_t count); + +/** + * @ingroup dvrt_mem + * @brief set memory with uint32_t value async + * @param [in] devPtr + * @param [in] Max length of destination address memory + * @param [in] value + * @param [in] count byte num + * @param [in] stream + * @return RT_ERROR_NONE for ok, errno for failed + * @return RT_ERROR_INVALID_VALUE for error input + */ +RTS_API rtError_t rtMemsetAsync(void *ptr, uint64_t destMax, uint32_t value, uint64_t count, rtStream_t stream); + +/** + * @ingroup dvrt_mem + * @brief get current device memory total and free + * @param [out] free + * @param [out] total + * @return RT_ERROR_NONE for ok, errno for failed + * @return RT_ERROR_INVALID_VALUE for error input + */ +RTS_API rtError_t rtMemGetInfo(size_t *free, size_t *total); + +/** + * @ingroup dvrt_mem + * @brief get current device memory total and free + * @param [in] memInfoType + * @param [out] free + * @param [out] total + * @return RT_ERROR_NONE for ok, errno for failed + */ +RTS_API rtError_t rtMemGetInfoEx(rtMemInfoType_t memInfoType, size_t *free, size_t *total); + +/** + * @ingroup dvrt_mem + * @brief set memory with uint32_t value + * @param [in] devPtr + * @param [in] len + * @param [in] device + * @return RT_ERROR_NONE for ok, errno for failed + * @return RT_ERROR_INVALID_VALUE for error input + */ +RTS_API rtError_t rtMemPrefetchToDevice(void *devPtr, uint64_t len, int32_t device); + +/** + * @ingroup dvrt_mem + * @brief get memory attribute:Host or Device + * @param [in] ptr + * @param [out] attributes + * @return RT_ERROR_NONE for ok, errno for failed + * @return RT_ERROR_INVALID_VALUE for error input + */ +RTS_API rtError_t rtPointerGetAttributes(rtPointerAttributes_t *attributes, const void *ptr); + +/** + * @ingroup dvrt_mem + * @brief make memory shared interprocess and assigned a name + * @param [in] ptr device memory address pointer + * @param [in] name identification name + * @param [in] byteCount identification byteCount + * @return RT_ERROR_NONE for ok + * @return RT_ERROR_INVALID_VALUE for error input + * @return RT_ERROR_DRV_ERR for driver error + */ +RTS_API rtError_t rtIpcSetMemoryName(const void *ptr, uint64_t byteCount, char *name, uint32_t len); + +/** + * @ingroup dvrt_mem + * @brief destroy a interprocess shared memory + * @param [in] name identification name + * @return RT_ERROR_NONE for ok + * @return RT_ERROR_INVALID_VALUE for error input + * @return RT_ERROR_DRV_ERR for driver error + */ +rtError_t rtIpcDestroyMemoryName(const char *name); + +/** + * @ingroup dvrt_mem + * @brief open a interprocess shared memory + * @param [in|out] ptr device memory address pointer + * @param [in] name identification name + * @return RT_ERROR_NONE for ok + * @return RT_ERROR_INVALID_VALUE for error input + * @return RT_ERROR_DRV_ERR for driver error + */ +RTS_API rtError_t rtIpcOpenMemory(void **ptr, const char *name); + +/** + * @ingroup dvrt_mem + * @brief close a interprocess shared memory + * @param [in] ptr device memory address pointer + * @param [in] name identification name + * @return RT_ERROR_NONE for ok + * @return RT_ERROR_INVALID_VALUE for error input + * @return RT_ERROR_DRV_ERR for driver error + */ +RTS_API rtError_t rtIpcCloseMemory(const void *ptr); + +/** + * @ingroup dvrt_mem + * @brief HCCL Async memory cpy + * @param [in] index sq index + * @param [in] wqe_index moudle index + * @param [in] stream asynchronized task stream + * @return RT_ERROR_NONE for ok + * @return RT_ERROR_INVALID_VALUE for error input + * @return RT_ERROR_DRV_ERR for driver error + */ +RTS_API rtError_t rtRDMASend(uint32_t index, uint32_t wqe_index, rtStream_t stream); + +/** + * @ingroup dvrt_mem + * @brief Ipc set mem pid + * @param [in] name name to be queried + * @param [in] pid process id + * @param [in] num length of pid[] + * @return RT_ERROR_NONE for ok + * @return RT_ERROR_INVALID_VALUE for error input + * @return RT_ERROR_DRV_ERR for driver error + */ +RTS_API rtError_t rtSetIpcMemPid(const char *name, int32_t pid[], int num); + +/** + * @ingroup dvrt_mem + * @brief HCCL Async memory cpy + * @param [in] dbindex single device 0 + * @param [in] dbinfo doorbell info + * @param [in] stream asynchronized task stream + * @return RT_ERROR_NONE for ok + * @return RT_ERROR_INVALID_VALUE for error input + * @return RT_ERROR_DRV_ERR for driver error + */ +RTS_API rtError_t rtRDMADBSend(uint32_t dbIndex, uint64_t dbInfo, rtStream_t stream); + +#if defined(__cplusplus) && !defined(COMPILE_OMG_PACKAGE) +} +#endif + +#endif // __CCE_RUNTIME_MEM_H__ diff --git a/inc/tdt/train_mode.h b/inc/runtime/rt.h similarity index 62% rename from inc/tdt/train_mode.h rename to inc/runtime/rt.h index 0b1475fcc..d3d5956ff 100644 --- a/inc/tdt/train_mode.h +++ b/inc/runtime/rt.h @@ -1,30 +1,31 @@ /** - * Copyright 2019-2020 Huawei Technologies Co., Ltd - * + * Copyright 2020 Huawei Technologies Co., Ltd + * 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 INC_TDT_TRAIN_MODE_H -#define INC_TDT_TRAIN_MODE_H - -enum TrainMode { - NOFLAG = -1, - DPFLAG = 0, - MEFLAG = 1 -}; +*/ -TrainMode GetTrainMode(); +#ifndef __CCE_RUNTIME_RT_H__ +#define __CCE_RUNTIME_RT_H__ -void SetTrainMode(TrainMode mode); +#include "base.h" +#include "config.h" +#include "context.h" +#include "dev.h" +#include "dvfsprofile.h" +#include "event.h" +#include "kernel.h" +#include "mem.h" +#include "rt_model.h" +#include "stream.h" -#endif +#endif // __CCE_RUNTIME_RT_H__ \ No newline at end of file diff --git a/inc/runtime/rt_model.h b/inc/runtime/rt_model.h new file mode 100644 index 000000000..78bb2321c --- /dev/null +++ b/inc/runtime/rt_model.h @@ -0,0 +1,456 @@ +/** + * Copyright 2020 Huawei Technologies Co., Ltd + + * 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 __CCE_RUNTIME_MODEL_H__ +#define __CCE_RUNTIME_MODEL_H__ + +#include "base.h" + +#if defined(__cplusplus) && !defined(COMPILE_OMG_PACKAGE) +extern "C" { +#endif + +typedef enum tagModelTaskType { + RT_MODEL_TASK_KERNEL = 0, + RT_MODEL_TASK_EVENT_RECORD, + RT_MODEL_TASK_EVENT_WAIT, + RT_MODEL_TASK_FUSION_START, + RT_MODEL_TASK_FUSION_END, + RT_MODEL_TASK_KERNEL_EX, + RT_MODEL_TASK_HCCL, + RT_MODEL_TASK_STREAM_SWITCH, + RT_MODEL_TASK_STREAM_ACTIVE, + RT_MODEL_TASK_LABEL_SET, + RT_MODEL_TASK_LABEL_SWITCH, + RT_MODEL_TASK_LABEL_GOTO, + RT_MODEL_TASK_PROFILER_TRACE, + RT_MODEL_TASK_MEMCPY_ASYNC, + RT_MODEL_TASK_NOTIFY_RECORD, + RT_MODEL_TASK_NOTIFY_WAIT, + RT_MODEL_TASK_REDUCE_ASYNC, + RT_MODEL_TASK_RDMA_SEND, + RT_MODEL_TASK_EVENT_RESET = 18, + RT_MODEL_TASK_MODEL_END_GRAPH, + RT_MODEL_TASK_STREAM_SWITCH_N, + RT_MODEL_TASK_RDMA_DB_SEND, + RT_MODEL_TASK_MEMCPY_ADDR_ASYNC, + RT_MODEL_TASK_STREAM_LABEL_SWITCH_BY_INDEX, + RT_MODEL_TASK_STREAM_LABEL_GOTO, + RT_MODEL_TASK_MODEL_EXIT, +} rtModelTaskType_t; + +typedef enum tagModelStreamType { + RT_MODEL_HEAD_STREAM = 0, + RT_MODEL_WAIT_ACTIVE_STREAM = 1 +} rtModelStreamType_t; + +typedef enum tagModelQueueFlag { + RT_MODEL_INPUT_QUEUE = 0, + RT_MODEL_OUTPUT_QUEUE = 1 +} rtModelQueueFlag_t; + +#define EXECUTOR_NONE ((uint32_t)0x0) +#define EXECUTOR_TS ((uint32_t)0x01) +#define EXECUTOR_AICPU ((uint32_t)0x02) + +/* + * @ingroup rt_model + * @brief debug flag for kernel exception dump + */ +#define RT_DEBUG_FLAG_AICORE_OVERFLOW (0x1 << 0) +#define RT_DEBUG_FLAG_ATOMIC_ADD_OVERFLOW (0x1 << 1) + +/** + * @ingroup + * @brief the type defination of aicpu model task command + */ +typedef enum tagTsAicpuModelCmd { + TS_AICPU_MODEL_LOAD = 1, + TS_AICPU_MODEL_EXECUTE, + TS_AICPU_MODEL_DESTROY, + TS_AICPU_MODEL_ABORT, + TS_AICPU_MODEL_RESERVED, +} tsAicpuModelCmd; + +typedef struct tagAicpuTaskInfo { + uint32_t taskID; + uint32_t streamID; + uint32_t kernelType; + uint64_t kernelName; + uint64_t kernelSo; + uint64_t paraBase; + uint32_t taskFlag; +} rtAicpuTaskInfo_t; + +typedef struct tagModelStreamInfo { + uint32_t streamID; + uint32_t streamFlag; +} rtModelStreamInfo_t; + +typedef struct tagModelQueueInfo { + uint32_t queueID; + uint32_t flag; +} rtModelQueueInfo_t; + +typedef struct tagAicpuModelInfo { + uint32_t moduleID; + uint32_t tsId; + uint16_t streamInfoNum; + uint16_t aicpuTaskNum; + uint64_t streamInfoPtr; + uint64_t aicpuTaskPtr; + uint16_t queueSize; + uint64_t queueInfoPtr; +} rtAicpuModelInfo_t; + +typedef struct tagKernelTaskInfo { + uint16_t blockDim; + uint16_t argsCount; + uint16_t argsSize; + uint16_t reserved; + char *stubFunc; + uint8_t *smDesc; + uint8_t *args; + uint16_t *argsOffset; +} rtKernelTaskInfo_t; + +typedef struct tagKernelTaskInfoEx { + uint32_t flags; + uint32_t argsSize; + void *args; + uint32_t reserved[6]; +} rtKernelTaskInfoEx_t; + +typedef struct tagEventTaskInfo { + uint32_t eventID; + uint32_t reserved[9]; +} rtEventTaskInfo_t; + +typedef struct tagStreamSwitchTaskInfo { + int64_t value; + uint64_t pValuePtr; + uint32_t trueStreamID; + uint32_t dataType; + uint32_t reserved[4]; +} rtStreamSwitchTaskInfo_t; + +typedef struct tagStreamSwitchNTaskInfo { + uint64_t pValuePtr; + uint64_t pTrueStreamPtr; + uint32_t size; + uint32_t elementSize; + uint32_t dataType; + uint32_t reserved[3]; +} rtStreamSwitchNTaskInfo_t; + +typedef struct tagStreamActiveTaskInfo { + uint32_t activeStreamID; + uint32_t reserved[9]; +} rtStreamActiveTaskInfo_t; + +typedef struct tagSetTaskInfo { + uint16_t labelId; + uint32_t reserved[9]; +} rtLabelSetTaskInfo_t; + +typedef struct tagSwitchTaskInfo { + uint32_t value; + uint32_t reserved[9]; +} rtLabelSwitchTaskInfo_t; + +typedef struct tagLabelGotoTaskInfo { + uint16_t labelId; + uint32_t reserved[9]; +} rtLabelGotoTaskInfo_t; + +typedef struct tagProfilerTraceTaskInfo { + uint64_t profilerTraceId; + uint32_t notify : 8; + uint32_t reserved_ : 24; + uint32_t flags; + uint32_t reserved[6]; +} rtProfilerTrace_t; + +typedef struct tagrtMemcpyAsyncTaskInfo { + void *dst; + uint64_t destMax; + void *src; + uint64_t count; + uint32_t kind; + uint32_t reserved; +} rtMemcpyAsyncTaskInfo_t; + +typedef struct tagrtNotifyTaskInfo { + uint32_t notifyID; + uint32_t reserved[9]; +} rtNotifyTaskInfo_t; + +typedef struct tagrtReduceAsyncTaskInfo { + void *dst; + uint64_t destMax; + void *src; + uint64_t count; + uint32_t kind; + uint32_t type; +} rtReduceAsyncTaskInfo_t; + +typedef struct tagrtRdmaSendTaskInfo { + uint32_t index; + uint32_t wqe_index; + uint32_t reserved[8]; +} rtRdmaSendTaskInfo_t; + +typedef struct tagrtRdmaDbSendTaskInfo { + uint64_t dbInfo; + uint32_t dbIndex; + uint32_t reserved[7]; // offset 7 +} rtRdmaDbSendTaskInfo_t; + +typedef struct tagrtModelEndGraphTaskInfo { + uint32_t modelId; + uint32_t executorFlag; + uint32_t reserved[8]; +} rtModelEndGraphTaskInfo_t; + +typedef struct tagrtModelExitInfo { + uint32_t modelId; + uint32_t streamId; + uint32_t reserved[8]; +} rtModelExitTaskInfo_t; + + +typedef struct tagrtStreamLabelSwitchByIndexTask_t { + uint64_t indexPtr; + uint64_t labelInfoPtr; + uint32_t max; + uint8_t reserved[20]; +} rtStreamLabelSwitchByIndexTask_t; + +typedef struct tagrtStreamLabelGotoTask_t { + uint16_t labelId; + uint16_t modelId; + uint8_t reserved[36]; +} rtStreamLabelGotoTask_t; + +typedef struct tagTaskInfo { + uint32_t type; + uint32_t streamID; + union { + rtKernelTaskInfoEx_t kernelTaskEx; + rtKernelTaskInfo_t kernelTask; + rtEventTaskInfo_t eventTask; + rtStreamSwitchTaskInfo_t streamSwitchTask; + rtStreamActiveTaskInfo_t streamActiveTask; + rtLabelSetTaskInfo_t labelSetTask; + rtLabelSwitchTaskInfo_t labelSwitchTask; + rtLabelGotoTaskInfo_t labelGotoTask; + rtProfilerTrace_t profilertraceTask; + rtMemcpyAsyncTaskInfo_t memcpyAsyncTask; + rtNotifyTaskInfo_t notifyTask; + rtReduceAsyncTaskInfo_t reduceAsyncTask; + rtRdmaSendTaskInfo_t rdmaSendTask; + rtRdmaDbSendTaskInfo_t rdmaDbSendTask; + rtModelEndGraphTaskInfo_t modelEndGraphTask; + rtModelExitTaskInfo_t modelExitTask; + rtStreamSwitchNTaskInfo_t streamSwitchNTask; + rtStreamLabelSwitchByIndexTask_t streamLabelSwitchIndexTask; + rtStreamLabelGotoTask_t streamLabelGotoTask; + uint32_t reserved[10]; + } u; +} rtTaskInfo_t; + +typedef struct tagLabelDevInfo_t { + uint16_t modelId; + uint16_t streamId; + uint16_t labelId; +}rtLabelDevInfo; + +typedef void *rtModel_t; +typedef rtError_t (*rtTaskGenCallback)(rtModel_t model, rtTaskInfo_t *taskInfo); + +/** + * @ingroup rt_model + * @brief set callback for generate model + * @param [in] callBack callback function + * @return RT_ERROR_NONE for ok + * @return RT_ERROR_INVALID_VALUE for error input + */ +RTS_API rtError_t rtSetTaskGenCallback(rtTaskGenCallback callback); + +/** + * @ingroup rt_model + * @brief create model instance + * @param [out] model created model + * @param [in] flag reserved + * @return RT_ERROR_NONE for ok + * @return RT_ERROR_INVALID_VALUE for error input + */ +RTS_API rtError_t rtModelCreate(rtModel_t *model, uint32_t flag); + +/** + * @ingroup rt_model + * @brief destroy model instance + * @param [in] model model to destroy + * @return RT_ERROR_NONE for ok + * @return RT_ERROR_INVALID_VALUE for error input + */ +RTS_API rtError_t rtModelDestroy(rtModel_t model); + +/** + * @ingroup rt_model + * @brief bind model and stream instance + * @param [in] model binded model + * @param [in] stream binded stream + * @param [in] flag reserved + * @return RT_ERROR_NONE for ok + * @return RT_ERROR_INVALID_VALUE for error input + */ +RTS_API rtError_t rtModelBindStream(rtModel_t model, rtStream_t stream, uint32_t flag); + +/** + * @ingroup rt_model + * @brief unbind model and stream instance + * @param [in] model unbinded model + * @param [in] stream unbinded stream + * @return RT_ERROR_NONE for ok + * @return RT_ERROR_INVALID_VALUE for error input + */ +RTS_API rtError_t rtModelUnbindStream(rtModel_t model, rtStream_t stream); + +/** + * @ingroup rt_model + * @brief tell runtime Model has been Loaded + * @param [in] model model to execute + * @return RT_ERROR_NONE for ok + */ +RTS_API rtError_t rtModelLoadComplete(rtModel_t model); + +/** + * @ingroup rt_model + * @brief execute model instance + * @param [in] model model to execute + * @return RT_ERROR_NONE for ok + * @return RT_ERROR_INVALID_VALUE for error input + */ +RTS_API rtError_t rtModelExecute(rtModel_t model, rtStream_t stream, uint32_t flag); + +/** + * @ingroup rt_model + * @brief get model the last persist task id + * @param [in] model model to execute + * @param [out] taskid last task id of the model + * @param [out] streamid last steam id of the model + * @return RT_ERROR_NONE for ok + * @return RT_ERROR_INVALID_VALUE for error input + */ +RTS_API rtError_t rtModelGetTaskId(rtModel_t model, uint32_t *taskid, uint32_t *streamid); + +/** + * @ingroup rt_model + * @brief add a end graph task to stream + * @param [in] model model to execute + * @param [in] end graph stream + * @return RT_ERROR_NONE for ok + * @return RT_ERROR_INVALID_VALUE for error input + */ +RTS_API rtError_t rtEndGraph(rtModel_t model, rtStream_t stream); + +/** + * @ingroup rt_model + * @brief add a end graph task with flag to stream + * @param [in] model model to execute + * @param [in] end graph stream + * @param [in] flags AICPU datadump + * @return RT_ERROR_NONE for ok + * @return RT_ERROR_INVALID_VALUE for error input + */ +RTS_API rtError_t rtEndGraphEx(rtModel_t model, rtStream_t stream, uint32_t flags); + +/** + * @ingroup rt_model + * @brief add a end graph task to stream + * @param [in] model model to execute + * @param [in] flags EXECUTOR_TS | EXECUTOR_AICPU + * @return RT_ERROR_NONE for ok + * @return RT_ERROR_INVALID_VALUE for error input + */ +RTS_API rtError_t rtModelExecutorSet(rtModel_t model, uint8_t flags); + +/** + * @ingroup rt_model + * @brief abort model + * @param [in] model model to abort + * @return RT_ERROR_NONE for ok + * @return RT_ERROR_INVALID_VALUE for error input + */ +RTS_API rtError_t rtModelAbort(rtModel_t model); + +/** + * @ingroup rt_model + * @brief end graph task to model default stream + * @param [in] model model to execute + * @param [in] end graph stream + * @return RT_ERROR_NONE for ok + * @return RT_ERROR_INVALID_VALUE for error input + */ +RTS_API rtError_t rtModelExit(rtModel_t model, rtStream_t stream); + +/** + * @ingroup rt_model + * @brief bind queue + * @param [in] model model to bind + * @param [in] queueId queueId to bind + * @param [in] flag + * @return RT_ERROR_NONE for ok + * @return RT_ERROR_INVALID_VALUE for error input + */ +RTS_API rtError_t rtModelBindQueue(rtModel_t model, uint32_t queueId, rtModelQueueFlag_t flag); + +/** + * @ingroup rt_model + * @brief get model id + * @param [in] model + * @param [out] modelId model id + * @return RT_ERROR_NONE for ok + * @return RT_ERROR_INVALID_VALUE for error input + */ +RTS_API rtError_t rtModelGetId(rtModel_t model, uint32_t *modelId); + +/* + * @ingroup rt_model + * @brief enable debug for dump overflow exception + * @param [in] addr: ddr address of kernel exception dumpped + * @param [in] model: model handle + * @param [in] flag: debug flag + * @return RT_ERROR_NONE for ok + * @return RT_ERROR_INVALID_VALUE for error input + */ +rtError_t rtDebugRegister(rtModel_t model, uint32_t flag, const void *addr, uint32_t *streamId, uint32_t *taskId); + +/* + * @ingroup rt_model + * @brief disable debug for dump overflow exception + * @param [in] model: model handle + * @return RT_ERROR_NONE for ok + * @return RT_ERROR_INVALID_VALUE for error input + */ +RTS_API rtError_t rtDebugUnRegister(rtModel_t model); + +#if defined(__cplusplus) && !defined(COMPILE_OMG_PACKAGE) +} +#endif + +#endif // __CCE_RUNTIME_MODEL_H__ diff --git a/inc/runtime/stream.h b/inc/runtime/stream.h new file mode 100644 index 000000000..81810a219 --- /dev/null +++ b/inc/runtime/stream.h @@ -0,0 +1,195 @@ +/** + * Copyright 2020 Huawei Technologies Co., Ltd + + * 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 __CCE_RUNTIME_STREAM_H__ +#define __CCE_RUNTIME_STREAM_H__ + +#include "base.h" +#include "event.h" + +#if defined(__cplusplus) && !defined(COMPILE_OMG_PACKAGE) +extern "C" { +#endif + +/** + * @ingroup stream_flags + * @brief stream op bit flags + */ +#define RT_STREAM_DEFAULT (0x00) +#define RT_STREAM_PERSISTENT (0x01) +#define RT_STREAM_FORCE_COPY (0x02) +#define RT_STREAM_HUGE (0x04) +#define RT_STREAM_AICPU (0x08) +#define RT_STREAM_FORBIDDEN_DEFAULT (0x10) +#define RT_STREAM_HEAD (0x20) +#define RT_STREAM_PRIMARY_DEFAULT (0x40) + +/** + * @ingroup stream_type + * @brief stream type + */ +#define RT_NORMAL_STREAM (0x00) +#define RT_HUGE_STREAM (0x01) + +/** + * priority level default value when create a stream + */ +#define RT_STREAM_PRIORITY_DEFAULT (0) + +/** + * @ingroup dvrt_stream + * @brief create stream instance + * @param [in|out] stream created stream + * @param [in] priority stream priority + * @return RT_ERROR_NONE for ok + * @return RT_ERROR_INVALID_VALUE for error input + */ +RTS_API rtError_t rtStreamCreate(rtStream_t *stream, int32_t priority); + +/** + * @ingroup dvrt_stream + * @brief create stream instance + * @param [in|out] stream created stream + * @param [in] priority stream priority + * @param [in] flags stream op flags + * @return RT_ERROR_NONE for ok + * @return RT_ERROR_INVALID_VALUE for error input + */ +RTS_API rtError_t rtStreamCreateWithFlags(rtStream_t *stream, int32_t priority, uint32_t flags); + +/** + * @ingroup dvrt_stream + * @brief destroy stream instance. + * @param [in] stream the stream to destroy + * @return RT_ERROR_NONE for ok + * @return RT_ERROR_INVALID_VALUE for error input + */ +RTS_API rtError_t rtStreamDestroy(rtStream_t stream); + +/** + * @ingroup dvrt_stream + * @brief wait an recorded event for stream + * @param [in] stream the wait stream + * @param [in] event the event to wait + * @return RT_ERROR_NONE for ok + * @return RT_ERROR_INVALID_VALUE for error input + */ +RTS_API rtError_t rtStreamWaitEvent(rtStream_t stream, rtEvent_t event); + +/** + * @ingroup dvrt_stream + * @brief wait stream to be complete + * @param [in] stream stream to wait + * @return RT_ERROR_NONE for ok + * @return RT_ERROR_INVALID_VALUE for error input + */ +RTS_API rtError_t rtStreamSynchronize(rtStream_t stream); + +/** + * @ingroup dvrt_stream + * @brief queries an asynchronous stream for completion status + * @param [in] stream stream to query + * @return RT_ERROR_NONE for complete + * @return RT_ERROR_STREAM_NOT_COMPLETE for not complete + */ +RTS_API rtError_t rtStreamQuery(rtStream_t stream); + +/** + * @ingroup dvrt_stream + * @brief get stream id from a stream handle + * @param [in] stream stream hadle + * @param [in] streamId stream id + * @return RT_ERROR_NONE for complete + * @return RT_ERROR_INVALID_VALUE for error input + */ +RTS_API rtError_t rtGetStreamId(rtStream_t stream, int32_t *streamId); + +/** + * @ingroup dvrt_stream + * @brief inquire max stream count and max task count per stream + * @param [in] streamType Stream Type + * @param [in] MaxStrCount Max stream count + * @param [in] MaxTaskCount max task count per stream + * @return RT_ERROR_NONE for complete + * @return RT_ERROR_INVALID_VALUE for error input + */ +RTS_API rtError_t rtGetMaxStreamAndTask(uint32_t streamType, uint32_t *MaxStrCount, uint32_t *MaxTaskCount); + +/** + * @ingroup dvrt_stream + * @brief Name a stream + * @param [in] stream_ stream to be named + * @param [in] name identification name + * @return RT_ERROR_NONE for complete + * @return RT_ERROR_INVALID_VALUE for error input + */ +RTS_API rtError_t rtNameStream(rtStream_t stream_, const char *name); + +/** + * @ingroup dvrt_stream + * @brief switch to the corresponding stream according to the contents of the ptr + * @param [in] ptr Determine the address where the value of the true and false branches is located + * @param [in] condition switch condition + * @param [in] value switch value + * @param [in] true_stream Stream that needs to be activated when the value is non-zero + * @param [in] stream input stream to init task + * @return RT_ERROR_NONE for complete + * @return RT_ERROR_INVALID_VALUE for error input + */ +RTS_API rtError_t rtStreamSwitch(void *ptr, rtCondition_t condition, int64_t value, rtStream_t true_stream, + rtStream_t stream); + +/** + * @brief execute extensible stream switch task + * @param [in] ptr pointer of value + * @param [in] condition judge condition + * @param [in] value_ptr pointer of target value + * @param [in] true_stream stream to be activated when value is not zero + * @param [in] stream stream id + * @param [in] dataType data type of target value + * @return RT_ERROR_NONE for complete + */ +RTS_API rtError_t rtStreamSwitchEx(void *ptr, rtCondition_t condition, void *value_ptr, rtStream_t true_stream, + rtStream_t stream, rtSwitchDataType_t dataType); + +/** + * @ingroup dvrt_stream + * @brief Active a stream + * @param [in] active_stream stream to be activated + * @param [in] stream input stream to init task + * @return RT_ERROR_NONE for complete + * @return RT_ERROR_INVALID_VALUE for error input + */ +RTS_API rtError_t rtStreamActive(rtStream_t active_stream, rtStream_t stream); + +/** + * @brief execute extensible stream case switch task + * @param [in] ptr pointer of value + * @param [in] size pointer num of value + * @param [in] valuePtr pointer of target value, length = size * elementSize + * @param [in] trueStreamPtr streams to be activated + * @param [in] elementSize size of to be activated true streams + * @param [in] stream input stream to init task + * @param [in] dataType data type of target value + * @return RT_ERROR_NONE for complete + */ +RTS_API rtError_t rtStreamSwitchN(void *ptr, uint32_t size, void *valuePtr, rtStream_t *trueStreamPtr, + uint32_t elementSize, rtStream_t stream, rtSwitchDataType_t dataType); +#if defined(__cplusplus) && !defined(COMPILE_OMG_PACKAGE) +} +#endif + +#endif // __CCE_RUNTIME_STREAM_H__ diff --git a/inc/soft_dp/ExternalSoftDp.h b/inc/soft_dp/ExternalSoftDp.h index 6681fbbac..bef5c05d7 100644 --- a/inc/soft_dp/ExternalSoftDp.h +++ b/inc/soft_dp/ExternalSoftDp.h @@ -1,18 +1,12 @@ /** - * Copyright 2019-2020 Huawei Technologies Co., Ltd - * - * 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. - */ +* @file ExternalSoftDp.h +* +* Copyright (c) Huawei Technologies Co., Ltd. 2012-2018. All rights reserved. +* +* This program is distributed in the hope that it will be useful, +* but WITHOUT ANY WARRANTY; without even the implied warranty of +* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. +*/ #ifndef EXTERNALSOFTDP_H #define EXTERNALSOFTDP_H @@ -30,7 +24,7 @@ struct SoftDpProcsessInfo { uint32_t outputWidth; uint32_t outputHeight; - bool isVBeforeU; // uv : true, uv : false + uint32_t reserved; }; struct DpCropInfo { @@ -41,18 +35,18 @@ struct DpCropInfo { }; /* - * @brief 解码、缩放接口 - * @param [in] SoftDpProcsessInfo& inMsg: 软实现结构体 + * @brief decode and resize interface + * @param [in] SoftDpProcsessInfo& softDpProcsessInfo : soft dp struct * @return success: return 0, fail: return error number */ -uint32_t DecodeAndResizeJpeg(SoftDpProcsessInfo& inMsg); +uint32_t DecodeAndResizeJpeg(SoftDpProcsessInfo& softDpProcsessInfo); /* - * @brief 解码、裁剪、缩放接口 - * @param [in] SoftDpProcsessInfo& inMsg: 软实现结构体 - * @param [in] const DpCropInfo& cropInfo: 裁剪结构体 + * @brief decode crop and resize interface + * @param [in] SoftDpProcsessInfo& softDpProcsessInfo : soft dp struct + * @param [in] const DpCropInfo& cropInfo: crop struct * @return success: return 0, fail: return error number */ -uint32_t DecodeAndCropAndResizeJpeg(SoftDpProcsessInfo& inMsg, const DpCropInfo& cropInfo); +uint32_t DecodeAndCropAndResizeJpeg(SoftDpProcsessInfo& softDpProcsessInfo, const DpCropInfo& cropInfo); } #endif // EXTERNALSOFTDP_H \ No newline at end of file diff --git a/inc/tdt/status.h b/inc/tdt/status.h index 128909393..a42f38a52 100644 --- a/inc/tdt/status.h +++ b/inc/tdt/status.h @@ -100,6 +100,8 @@ enum { TDT_TSD_SEND_HEARTBEAT_FAILED_CODE, TDT_TSD_CLEAN_RESOURCE_FAILED_CODE, TDT_TSD_SEND_MSG_FAILED_CODE, + TDT_TSD_AICPU_SD_PROCESS_ABNORMAL_CODE, + TDT_TSD_CUSTOM_PROCESS_ABNORMAL_CODE, TDT_PPC_DRIVER_INIT_FAIL_CODE, TDT_PPC_SERVER_CLIENT_CREATE_FAIL_CODE, TDT_PPC_SERVER_CLIENT_DESTORY_FAIL_CODE, @@ -510,6 +512,8 @@ TDT_DEF_ERROR_CODE(MODID_TSD_SERVER, TDT_ERROR, TDT_TSD_INIT_HDCSERVER_FAILED, " TDT_DEF_ERROR_CODE(MODID_TSD_SERVER, TDT_ERROR, TDT_TSD_SEND_HEARTBEAT_FAILED, "Tsdaemon get pid fail"); TDT_DEF_ERROR_CODE(MODID_TSD_SERVER, TDT_ERROR, TDT_TSD_CLEAN_RESOURCE_FAILED, "Tsdaemon clean resource fail"); TDT_DEF_ERROR_CODE(MODID_TSD_SERVER, TDT_ERROR, TDT_TSD_SEND_MSG_FAILED, "Tsdaemon send msg fail"); +TDT_DEF_ERROR_CODE(MODID_TSD_SERVER, TDT_ERROR, TDT_TSD_AICPU_SD_PROCESS_ABNORMAL, "aicpu_sd process abnormal"); +TDT_DEF_ERROR_CODE(MODID_TSD_SERVER, TDT_INFO, TDT_TSD_CUSTOM_PROCESS_ABNORMAL, "custom_aicpu_sd process abnormal"); /********************* PPC ****************************/ // create PPC error level error diff --git a/inc/tdt/tdt_device.h b/inc/tdt/tdt_device.h deleted file mode 100644 index 441e39238..000000000 --- a/inc/tdt/tdt_device.h +++ /dev/null @@ -1,53 +0,0 @@ -/** - * Copyright 2019-2020 Huawei Technologies Co., Ltd - * - * 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 HOST_INNER_INC_TDT_DEVICE_H_ -#define HOST_INNER_INC_TDT_DEVICE_H_ - -#include -#include -#include -#include "tdt/data_common.h" - -#ifdef __cplusplus -extern "C" { -#endif // __cplusplus - -namespace tdt { -/** - * @ingroup TdtDevicePushData - * @brief Tdt device push data to queue for ops. - * - * @par Function - * Tdt device push data to queue for ops. - * - * @param channelName [IN] type #String. queue channel name - * @param items [IN] type #vector DataItem is defined in data_common.h. input data - * @retval 0 Success - * @retval OtherValues Fail - * - * @par Dependency - * @li libtdtdevice.so: Library to which the interface belongs. - * @li tdt_device.h: Header file where the interface declaration is located. - * @li data_common.h: Header file where 'DataItem' defined - * - */ -int32_t TdtDevicePushData(const std::string &channelName, std::vector &items); -} // namespace tdt -#ifdef __cplusplus -} -#endif // __cplusplus -#endif // HOST_INNER_INC_TDT_DEVICE_H_ diff --git a/inc/tdt/tdt_host_interface.h b/inc/tdt/tdt_host_interface.h index 0e62a85c1..1cab6fd17 100644 --- a/inc/tdt/tdt_host_interface.h +++ b/inc/tdt/tdt_host_interface.h @@ -135,6 +135,93 @@ int32_t TdtHostPopData(const std::string &channelName, std::vector &it * @li tdt_host_interface.h: Header file where the interface declaration is located. */ int32_t TdtHostStop(const std::string &channelName); + +/** +* @ingroup TdtInFeedInit +* @brief Initialize the interface, start and initialize various general thread, log and other services +* +* @par Function +* Initialize the interface, start and initialize various general thread, log and other services +* +* @param deviceId [IN] type #unsigned int. logic device ID +* @retval #0 Success +* @retval #Not 0 Fail +* +* @par Dependency +* @li libtsdclient.so: Library to which the interface belongs. +* @li tdt_host_interface.h: Header file where the interface declaration is located. +*/ +int32_t TdtInFeedInit(uint32_t deviceId); + +/** +* @ingroup TdtOutFeedInit +* @brief Initialize the interface, start and initialize various general thread, log and other services +* +* @par Function +* Initialize the interface, start and initialize various general thread, log and other services +* +* @param deviceId [IN] type #unsigned int. logic device ID +* @retval #0 Success +* @retval #Not 0 Fail +* +* @par Dependency +* @li libtsdclient.so: Library to which the interface belongs. +* @li tdt_host_interface.h: Header file where the interface declaration is located. +*/ +int32_t TdtOutFeedInit(uint32_t deviceId); + +/** +* @ingroup TdtInFeedDestroy +* @brief Notify TDT component to close related resources +* +* @par Function +* Notify TDT component to close related resources +* +* @param NA +* @retval 0 Success +* @retval OtherValues Fail +* +* @par Dependency +* @li libtsdclient.so: Library to which the interface belongs. +* @li tdt_host_interface.h: Header file where the interface declaration is located. +*/ +int32_t TdtInFeedDestroy(uint32_t deviceId); + +/** +* @ingroup TdtOutFeedDestroy +* @brief Notify TDT component to close related resources +* +* @par Function +* Notify TDT component to close related resources +* +* @param NA +* @retval 0 Success +* @retval OtherValues Fail +* +* @par Dependency +* @li libtsdclient.so: Library to which the interface belongs. +* @li tdt_host_interface.h: Header file where the interface declaration is located. +*/ +int32_t TdtOutFeedDestroy(); + +/** +* @ingroup TdtInFeedData +* @brief Blocking queue. When the queue is full, the Push interface will block. +* +* @par Function +* Blocking queue. When the queue is full, the Push interface will block. +* +* @param channelName [IN] type #String. queue channel name +* @param items [IN] type #vector DataItem is defined in data_common.h. input data +* @retval 0 Success +* @retval OtherValues 0 Fail +* +* @par Dependency +* @li libtsdclient.so: Library to which the interface belongs. +* @li tdt_host_interface.h: Header file where the interface declaration is located. +* @li data_common.h: Header file where 'DataItem' defined +*/ +int32_t TdtInFeedData(const std::string &channelName, const std::vector &item, uint32_t deviceId); } // namespace tdt #ifdef __cplusplus } diff --git a/inc/tdt/tdt_server.h b/inc/tdt/tdt_server.h deleted file mode 100644 index 5d45047b2..000000000 --- a/inc/tdt/tdt_server.h +++ /dev/null @@ -1,83 +0,0 @@ -/** - * Copyright 2019-2020 Huawei Technologies Co., Ltd - * - * 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 INC_TDT_TDT_SERVER_H -#define INC_TDT_TDT_SERVER_H - -#include -#include "tdt/status.h" - -namespace tdt { -/** -* @ingroup TDTServerInit -* @brief Initialization functions, establish TDT Server, -* provide services such as access services, initialization and tuning channels -* -* @par Function -* Initialization functions, establish TDT Server, -* provide services such as access services, initialization and tuning channels -* -* @param deviceID [IN] type #unsigned int. Physical device ID -* @param bindCoreList [IN] type #List bindCoreList. -* device CPU core sequence, the maximum value of the core sequence should not -* exceed the total number of CPU cores -* @retval 0 Success -* @retval OtherValues 0 Fail -* -* @par Dependency -* @li libtdtserver.so: Library to which the interface belongs. -* @li tdt_server.h: Header file where the interface declaration is located. -*/ -TDT_LIB_EXPORT int32_t TDTServerInit(const uint32_t deviceID, const std::list &bindCoreList); - -/** -* @ingroup TDTServerInit -* @brief End TDT Server -* -* @par Function -* End TDT Server -* -* @param NA -* @retval 0 Success -* @retval OtherValues 0 Fail -* -* @par Dependency -* @li libtdtserver.so: Library to which the interface belongs. -* @li tdt_server.h: Header file where the interface declaration is located. -*/ -TDT_LIB_EXPORT int32_t TDTServerStop(); - -class TdtServer { - public: - private: - /** - * @ingroup TdtServer - * @brief TdtServer is a static class, all delete constructs and destructors - */ - TdtServer() = delete; - - /** - * @ingroup TdtServer - * @brief TdtServer destructor - */ - virtual ~TdtServer() = delete; - TdtServer(const TdtServer &) = delete; - TdtServer(TdtServer &&) = delete; - TdtServer &operator=(const TdtServer &) = delete; - TdtServer &operator=(TdtServer &&) = delete; -}; -}; // namespace tdt -#endif // INC_TDT_TDT_SERVER_H diff --git a/inc/tdt/tsd.h b/inc/tdt/tsd.h deleted file mode 100644 index bb7d7cd40..000000000 --- a/inc/tdt/tsd.h +++ /dev/null @@ -1,99 +0,0 @@ -/** - * Copyright 2019-2020 Huawei Technologies Co., Ltd - * - * 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 INC_TDT_TSD_H_ -#define INC_TDT_TSD_H_ - -#include -#include - -#ifdef __cplusplus -extern "C" { -#endif // __cplusplus - -/** -* @ingroup Tsdaemon. -* -* Identifies that HCCP or Compute_process is waiting for -* Tsdaemon to issue a shutdown command. -*/ -typedef enum { - TSD_HCCP = 0, /**< HCCP*/ - TSD_COMPUTE = 1, /**< Compute_process*/ - TSD_WAITTYPE_MAX /**< Max*/ -} TsdWaitType; - -/** -* @ingroup TsdWaitForShutdown -* @brief Wait for the TSD process to issue the shutdown command -* -* @par Function -* Wait for the TSD process to issue the shutdown command -* -* @param NA -* @param deviceID [IN] type #unsigned int. Physical device ID -* @param waitType [IN] type #TsdWaitType. HCCP or CP -* @retval 0 Success -* @retval OtherValues 0 Fail -* -* @par Dependency -* @li libtsdppc.so: Library to which the interface belongs. -* @li tsd.h: Header file where the interface declaration is located. -*/ -int32_t TsdWaitForShutdown(const uint32_t deviceId, const TsdWaitType waitType); - -/** -* @ingroup PpcClientSendHeartbeat -* @brief Ppc client send heartbeat msg to ppc server -* -* @par Function -* Ppc client send heartbeat msg to ppc server -* -* @param NA -* @param deviceID [IN] type #unsigned int. Physical device ID -* @param waitType [IN] type #TsdWaitType. HCCP or CP -* @retval 0 Success -* @retval OtherValues 0 Fail -* -* @par Dependency -* @li libtsdppc.so: Library to which the interface belongs. -* @li tsd.h: Header file where the interface declaration is located. -*/ -int32_t TsdHeartbeatSend(const uint32_t deviceId, const TsdWaitType waitType); - -/** -* @ingroup PpcClientSendAbnormalMsg -* @brief Ppc client send abnormal msg to ppc server -* -* @par Function -* Ppc client send abnormal msg to ppc server -* -* @param NA -* @param deviceID [IN] type #unsigned int. Physical device ID -* @param waitType [IN] type #TsdWaitType. HCCP or CP -* @retval 0 Success -* @retval OtherValues 0 Fail -* -* @par Dependency -* @li libtsdppc.so: Library to which the interface belongs. -* @li tsd.h: Header file where the interface declaration is located. -*/ -int32_t TsdDestory(const uint32_t deviceId, const TsdWaitType waitType); - -#ifdef __cplusplus -} -#endif // __cplusplus -#endif // INC_TDT_TSD_H_ diff --git a/inc/toolchain/adx_datadump_server.h b/inc/toolchain/adx_datadump_server.h new file mode 100644 index 000000000..a1c39a51a --- /dev/null +++ b/inc/toolchain/adx_datadump_server.h @@ -0,0 +1,36 @@ +/** +* @file adx_datadump_server.h +* +* Copyright (c) Huawei Technologies Co., Ltd. 2020-2020. All rights reserved. +* +* This program is distributed in the hope that it will be useful, +* but WITHOUT ANY WARRANTY; without even the implied warranty of +* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. +*/ + +#ifndef ADX_DATADUMP_SERVER_H +#define ADX_DATADUMP_SERVER_H +#ifdef __cplusplus +extern "C" { +#endif +/** + * @brief initialize server for normal datadump function. + * @return + * IDE_DAEMON_OK: datadump server init success + * IDE_DAEMON_ERROR: datadump server init failed + */ +int AdxDataDumpServerInit(); + +/** + * @brief uninitialize server for normal datadump function. + * @return + * IDE_DAEMON_OK: datadump server uninit success + * IDE_DAEMON_ERROR: datadump server uninit failed + */ +int AdxDataDumpServerUnInit(); + +#ifdef __cplusplus +} +#endif +#endif + diff --git a/inc/toolchain/bbox/bbox_ddr_data.h b/inc/toolchain/bbox/bbox_ddr_data.h deleted file mode 100644 index bec57ac1e..000000000 --- a/inc/toolchain/bbox/bbox_ddr_data.h +++ /dev/null @@ -1,126 +0,0 @@ -/** - * Copyright 2019-2020 Huawei Technologies Co., Ltd - * - * 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 BBOX_DDR_DATA_H -#define BBOX_DDR_DATA_H - -/* ELEM_OUTPUT_BIN - * key: - * 0x00000000 FFFF FFFF FFFF FFFF - * 0x00000010 FFFF FFFF FFFF FFFF - * - * ELEM_OUTPUT_STR - * key: qwertyuiop - * - * ELEM_OUTPUT_STR_NL - * key: - * qwertyuiop - * - * ELEM_OUTPUT_HEX - * key: FFFFFFFFFFFFFFFF - * - * ELEM_OUTPUT_INT - * key: 0xFF - */ -#define ELEM_OUTPUT_CHAR_LEN 1 -#define ELEM_OUTPUT_SHORT_LEN 2 -#define ELEM_OUTPUT_INT_LEN 4 -#define ELEM_OUTPUT_LONG_LEN 8 -#define ELEM_OUTPUT_HEX_MAX_LEN 32 -#define ELEM_OUTPUT_DIVIDE_MAX_LEN 15 -#define ELEMENT_NAME_MAX_LEN 32 - -enum ModelElementType { - ELEM_OUTPUT_TYPE = 0x0, - ELEM_OUTPUT_BIN = 0x1, // name = func(offset, size); 整片二进制输出,按16进制显示 - ELEM_OUTPUT_STR = 0x2, // name = func(offset, maxSize); 换行字符串输出 - ELEM_OUTPUT_STR_NL = 0x3, // name = func(offset, maxSize); 不换行字符串输出 - ELEM_OUTPUT_HEX = 0x4, // name = func(offset, size); 每个字节按hex输出,最多输出16个字节 - ELEM_OUTPUT_INT = 0x5, // name = func(offset, size); 1,2,4,8字节整型输出 - ELEM_OUTPUT_CHAR = 0x6, // name = func(offset, size); 按长度,字符输出 - ELEM_OUTPUT_INT_CONST = 0x7, // name = value; 整型:value(size) - ELEM_OUTPUT_STR_CONST = 0x8, // name; 字符串:value(0) size(0) - ELEM_OUTPUT_NL = 0x9, // \n - ELEM_OUTPUT_DIVIDE = 0xa, // ==========name========== - ELEM_OUTPUT_MAX = 0xFFF, - - ELEM_FEATURE_TYPE = 0x1000, - ELEM_FEATURE_TABLE = 0x1001, - ELEM_FEATURE_COMPARE = 0x1002, - ELEM_FEATURE_LOOPBUF = 0x1003, - ELEM_FEATURE_CHARLOG = 0x1004, - ELEM_FEATURE_STRUCTLOG = 0x1005, - ELEM_FEATURE_MAX = 0x1FFF, - - ELEM_CTRL_TYPE = 0x2000, - ELEM_CTRL_TABLE = 0x2000, // ELEM_FEATURE_TABLE 控制类 - ELEM_CTRL_TABLE_GOTO = 0x2000, // (tableEnumType, 0);跳转表的PlaintextTableType enum类型值,非显示项 - ELEM_CTRL_TABLE_RANGE = 0x2001, // (indexOffset, indexCnt);子表开始地址和长度,非显示项 - ELEM_CTRL_COMPARE = 0x2100, // ELEM_FEATURE_COMPARE 控制类 - ELEM_CTRL_COM_VALUE = 0x2100, // (offset, size);需要比较的值所在位置和长度,非显示项 - ELEM_CTRL_CMP_JUMP_NE = 0x2101, // (compareValue, jumpIndex);如果不等于则跳转,非显示项 - ELEM_CTRL_CMP_JUMP_LE = 0x2102, // (compareValue, jumpIndex);如果不大于则跳转,非显示项 - ELEM_CTRL_CMP_JUMP_LT = 0x2103, // (compareValue, jumpIndex);如果小于则跳转,非显示项 - ELEM_CTRL_CMP_JUMP_GE = 0x2104, // (compareValue, jumpIndex);如果不小于则跳转,非显示项 - ELEM_CTRL_CMP_JUMP_GT = 0x2105, // (compareValue, jumpIndex);如果大于则跳转,非显示项 - ELEM_CTRL_CMP_JUMP_EQ = 0x2106, // (compareValue, jumpIndex);如果等于则跳转,非显示项 - ELEM_CTRL_LOOPBUF = 0x2200, // ELEM_FEATURE_LOOPBUF 控制类 - ELEM_CTRL_LPBF_HEAD = 0x2200, // value;循环buffer头结构体长度,非显示项 - ELEM_CTRL_LPBF_READ = 0x2201, // name: OutPutFunc(offset, size); 循环buffer读指针在结构体中偏移位置 - ELEM_CTRL_LPBF_WRITE = 0x2203, // name: OutPutFunc(offset, size); 循环buffer写指针在结构体中偏移位置 - ELEM_CTRL_LPBF_SIZE = 0x2202, // name: OutPutFunc(offset, size); 循环buffer总大小在结构体中偏移位置 - ELEM_CTRL_LPBF_SIZE_C = 0x2202, // name: value; 循环buffer总长度,以固定值设置 - ELEM_CTRL_LPBF_ROLLBK = 0x2203, // (offset, size); roll-back标记位,标记buffer是否翻转,非显示项 - ELEM_CTRL_MAX = 0xFFFF, -}; - -enum ElemConditionType { - ELEM_EQUAL = 1 << 0, // 0x001 - ELEM_GRATER = 1 << 1, // 0x010 - ELEM_LESS = 1 << 2, // 0x100 -}; - -struct ModelElement { - char name[ELEMENT_NAME_MAX_LEN]; - unsigned int type; - union { - unsigned int arg1; - unsigned int offset; - unsigned int value; - unsigned int index; - }; - union { - unsigned int arg2; - unsigned int size; - unsigned int maxSize; - unsigned int mark; - unsigned int indexOffset; - }; -}; - -#define MODEL_VECTOR(NAME) struct ModelElement MODEL_VECTOR_OBJECT_##NAME[] -#define MODEL_VECTOR_OBJECT(NAME) (&MODEL_VECTOR_OBJECT_##NAME[0]) -#define MODEL_VECTOR_ITEM(NAME, i) (&MODEL_VECTOR_OBJECT_##NAME[i]) -#define MODEL_VECTOR_SIZE(NAME) (sizeof(MODEL_VECTOR_OBJECT_##NAME) / sizeof(struct ModelElement)) -#define DEFINE_DATA_MODEL(name) DATA_MODEL_##name - -#define ELEMENT_CLASSIFY(type) ((type) & 0xFFFF) -#define OUTPUT_ELEMENT(type) (ELEMENT_CLASSIFY(type) > ELEM_OUTPUT_TYPE && ELEMENT_CLASSIFY(type) < ELEM_OUTPUT_MAX) -#define CTRL_ELEMENT(type) (ELEMENT_CLASSIFY(type) >= ELEM_CTRL_TYPE && ELEMENT_CLASSIFY(type) < ELEM_CTRL_MAX) -#define CMP_ELEMENT(type) (((type) & 0xFFF0) == ELEM_CTRL_COM_VALUE) -#define ELEM_CMP_CONDITION(type) ((type) & 0x000F) - -#endif diff --git a/inc/toolchain/bbox/bbox_ddr_data_cloud.h b/inc/toolchain/bbox/bbox_ddr_data_cloud.h deleted file mode 100644 index 32bdd6133..000000000 --- a/inc/toolchain/bbox/bbox_ddr_data_cloud.h +++ /dev/null @@ -1,1183 +0,0 @@ -/** - * Copyright 2019-2020 Huawei Technologies Co., Ltd - * - * 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 BBOX_DDR_DATA_CLOUD_H -#define BBOX_DDR_DATA_CLOUD_H - -#include "bbox_ddr_data.h" - -/* each Module need define as follows */ -#define DATA_MODEL_LPFW MODEL_VECTOR(LPFW) = { \ - {"****exc****reg**", ELEM_OUTPUT_STR, {0x00}, {0x8}}, \ - {"reset_reason", ELEM_OUTPUT_INT, {0x80}, {0x4}}, \ - {"slice", ELEM_OUTPUT_INT, {0x88}, {0x4}}, \ - {"rtc", ELEM_OUTPUT_INT, {0x90}, {0x4}}, \ - {"REGSP", ELEM_OUTPUT_INT, {0x98}, {0x8}}, \ - {"REGPC", ELEM_OUTPUT_INT, {0xa0}, {0x8}}, \ - {"REGELR", ELEM_OUTPUT_INT, {0xa8}, {0x8}}, \ - {"REGCPSR", ELEM_OUTPUT_INT, {0xb0}, {0x8}}, \ - {"REGSPSR", ELEM_OUTPUT_INT, {0xb8}, {0x8}}, \ - {"ESR", ELEM_OUTPUT_INT, {0xc0}, {0x8}}, \ - {"FAR", ELEM_OUTPUT_INT, {0xc8}, {0x8}}, \ - {"excTrace", ELEM_OUTPUT_INT, {0xd0}, {0x1}}, \ - {"ddrExc", ELEM_OUTPUT_INT, {0xd1}, {0x1}}, \ - {"irqId", ELEM_OUTPUT_INT, {0xd2}, {0x2}}, \ - {"taskId", ELEM_OUTPUT_INT, {0xd4}, {0x4}}, \ - {"**backup**reg***", ELEM_OUTPUT_STR, {0x00}, {0x8}}, \ - {"reg_backup_index", ELEM_OUTPUT_INT, {0x280}, {0x4}}, \ - {"reason_0", ELEM_OUTPUT_INT, {0x284}, {0x4}}, \ - {"reason_1", ELEM_OUTPUT_INT, {0x288}, {0x4}}, \ - {"reason_2", ELEM_OUTPUT_INT, {0x28C}, {0x4}}, \ - {"x0", ELEM_OUTPUT_INT, {0x290}, {0x8}}, \ - {"x1", ELEM_OUTPUT_INT, {0x298}, {0x8}}, \ - {"x2", ELEM_OUTPUT_INT, {0x2a0}, {0x8}}, \ - {"x3", ELEM_OUTPUT_INT, {0x2a8}, {0x8}}, \ - {"x4", ELEM_OUTPUT_INT, {0x2b0}, {0x8}}, \ - {"x5", ELEM_OUTPUT_INT, {0x2b8}, {0x8}}, \ - {"x6", ELEM_OUTPUT_INT, {0x2c0}, {0x8}}, \ - {"x7", ELEM_OUTPUT_INT, {0x2c8}, {0x8}}, \ - {"x8", ELEM_OUTPUT_INT, {0x2d0}, {0x8}}, \ - {"x9", ELEM_OUTPUT_INT, {0x2d8}, {0x8}}, \ - {"x10", ELEM_OUTPUT_INT, {0x2e0}, {0x8}}, \ - {"x11", ELEM_OUTPUT_INT, {0x2e8}, {0x8}}, \ - {"x12", ELEM_OUTPUT_INT, {0x2f0}, {0x8}}, \ - {"x13", ELEM_OUTPUT_INT, {0x2f8}, {0x8}}, \ - {"x14", ELEM_OUTPUT_INT, {0x300}, {0x8}}, \ - {"x15", ELEM_OUTPUT_INT, {0x308}, {0x8}}, \ - {"x16", ELEM_OUTPUT_INT, {0x310}, {0x8}}, \ - {"x17", ELEM_OUTPUT_INT, {0x318}, {0x8}}, \ - {"x18", ELEM_OUTPUT_INT, {0x320}, {0x8}}, \ - {"x19", ELEM_OUTPUT_INT, {0x328}, {0x8}}, \ - {"x20", ELEM_OUTPUT_INT, {0x330}, {0x8}}, \ - {"x21", ELEM_OUTPUT_INT, {0x338}, {0x8}}, \ - {"x22", ELEM_OUTPUT_INT, {0x340}, {0x8}}, \ - {"x23", ELEM_OUTPUT_INT, {0x348}, {0x8}}, \ - {"x24", ELEM_OUTPUT_INT, {0x350}, {0x8}}, \ - {"x25", ELEM_OUTPUT_INT, {0x358}, {0x8}}, \ - {"x26", ELEM_OUTPUT_INT, {0x360}, {0x8}}, \ - {"x27", ELEM_OUTPUT_INT, {0x368}, {0x8}}, \ - {"x28", ELEM_OUTPUT_INT, {0x370}, {0x8}}, \ - {"x29", ELEM_OUTPUT_INT, {0x378}, {0x8}}, \ - {"x30", ELEM_OUTPUT_INT, {0x380}, {0x8}}, \ - {"XZR", ELEM_OUTPUT_INT, {0x388}, {0x8}}, \ - {"ESR", ELEM_OUTPUT_INT, {0x390}, {0x8}}, \ - {"FAR", ELEM_OUTPUT_INT, {0x398}, {0x8}}, \ - {"SPSR", ELEM_OUTPUT_INT, {0x3a0}, {0x8}}, \ - {"ELR", ELEM_OUTPUT_INT, {0x3a8}, {0x8}}, \ - {"PC", ELEM_OUTPUT_INT, {0x3b0}, {0x8}}, \ - {"SP", ELEM_OUTPUT_INT, {0x3b8}, {0x8}}, \ - {"CPSR", ELEM_OUTPUT_INT, {0x3c0}, {0x8}}, \ - {"Exceptioncode", ELEM_OUTPUT_INT, {0x3c8}, {0x8}}, \ - {"**runtime*******", ELEM_OUTPUT_STR, {0x00}, {0x8}}, \ - {"T-AIC00", ELEM_OUTPUT_INT, {0xD380}, {0x1}}, \ - {"T-AIC01", ELEM_OUTPUT_INT, {0xD381}, {0x1}}, \ - {"T-AIC02", ELEM_OUTPUT_INT, {0xD382}, {0x1}}, \ - {"T-AIC03", ELEM_OUTPUT_INT, {0xD383}, {0x1}}, \ - {"T-AIC04", ELEM_OUTPUT_INT, {0xD384}, {0x1}}, \ - {"T-AIC05", ELEM_OUTPUT_INT, {0xD385}, {0x1}}, \ - {"T-AIC06", ELEM_OUTPUT_INT, {0xD386}, {0x1}}, \ - {"T-AIC07", ELEM_OUTPUT_INT, {0xD387}, {0x1}}, \ - {"T-AIC08", ELEM_OUTPUT_INT, {0xD388}, {0x1}}, \ - {"T-AIC09", ELEM_OUTPUT_INT, {0xD389}, {0x1}}, \ - {"T-AIC10", ELEM_OUTPUT_INT, {0xD38A}, {0x1}}, \ - {"T-AIC11", ELEM_OUTPUT_INT, {0xD38B}, {0x1}}, \ - {"T-AIC12", ELEM_OUTPUT_INT, {0xD38C}, {0x1}}, \ - {"T-AIC13", ELEM_OUTPUT_INT, {0xD38D}, {0x1}}, \ - {"T-AIC14", ELEM_OUTPUT_INT, {0xD38E}, {0x1}}, \ - {"T-AIC15", ELEM_OUTPUT_INT, {0xD38F}, {0x1}}, \ - {"T-AIC16", ELEM_OUTPUT_INT, {0xD390}, {0x1}}, \ - {"T-AIC17", ELEM_OUTPUT_INT, {0xD391}, {0x1}}, \ - {"T-AIC18", ELEM_OUTPUT_INT, {0xD392}, {0x1}}, \ - {"T-AIC19", ELEM_OUTPUT_INT, {0xD393}, {0x1}}, \ - {"T-AIC20", ELEM_OUTPUT_INT, {0xD394}, {0x1}}, \ - {"T-AIC21", ELEM_OUTPUT_INT, {0xD395}, {0x1}}, \ - {"T-AIC22", ELEM_OUTPUT_INT, {0xD396}, {0x1}}, \ - {"T-AIC23", ELEM_OUTPUT_INT, {0xD397}, {0x1}}, \ - {"T-AIC24", ELEM_OUTPUT_INT, {0xD398}, {0x1}}, \ - {"T-AIC25", ELEM_OUTPUT_INT, {0xD399}, {0x1}}, \ - {"T-AIC26", ELEM_OUTPUT_INT, {0xD39A}, {0x1}}, \ - {"T-AIC27", ELEM_OUTPUT_INT, {0xD39B}, {0x1}}, \ - {"T-AIC28", ELEM_OUTPUT_INT, {0xD39C}, {0x1}}, \ - {"T-AIC29", ELEM_OUTPUT_INT, {0xD39D}, {0x1}}, \ - {"T-AIC30", ELEM_OUTPUT_INT, {0xD39E}, {0x1}}, \ - {"T-AIC31", ELEM_OUTPUT_INT, {0xD39F}, {0x1}}, \ - {"T-AICPU0", ELEM_OUTPUT_INT, {0xD3A0}, {0x1}}, \ - {"T-AICPU1", ELEM_OUTPUT_INT, {0xD3A1}, {0x1}}, \ - {"T-AICPU2", ELEM_OUTPUT_INT, {0xD3A2}, {0x1}}, \ - {"T-AICPU3", ELEM_OUTPUT_INT, {0xD3A3}, {0x1}}, \ - {"T-HBMPHY0", ELEM_OUTPUT_INT, {0xD3A4}, {0x1}}, \ - {"T-HBMPHY1", ELEM_OUTPUT_INT, {0xD3A5}, {0x1}}, \ - {"T-HBMPHY2", ELEM_OUTPUT_INT, {0xD3A6}, {0x1}}, \ - {"T-HBMPHY3", ELEM_OUTPUT_INT, {0xD3A7}, {0x1}}, \ - {"T-DDRPHY", ELEM_OUTPUT_INT, {0xD3A8}, {0x1}}, \ - {"T-NIMBUS", ELEM_OUTPUT_INT, {0xD3A9}, {0x1}}, \ - {"T-HBMDEV0", ELEM_OUTPUT_INT, {0xD3AA}, {0x1}}, \ - {"T-HBMDEV1", ELEM_OUTPUT_INT, {0xD3AB}, {0x1}}, \ - {"T-HBMDEV2", ELEM_OUTPUT_INT, {0xD3AC}, {0x1}}, \ - {"T-HBMDEV3", ELEM_OUTPUT_INT, {0xD3AD}, {0x1}}, \ - {"T-ZONE-AIC", ELEM_OUTPUT_INT, {0xD3B0}, {0x1}}, \ - {"T-ZONE-AICPU", ELEM_OUTPUT_INT, {0xD3B1}, {0x1}}, \ - {"T-ZONE-HBMPHY", ELEM_OUTPUT_INT, {0xD3B2}, {0x1}}, \ - {"T-ZONE-DDRPHY", ELEM_OUTPUT_INT, {0xD3B3}, {0x1}}, \ - {"T-ZONE-NIMBUS", ELEM_OUTPUT_INT, {0xD3B4}, {0x1}}, \ - {"T-ZONE-HBMDEV", ELEM_OUTPUT_INT, {0xD3B5}, {0x1}}, \ - {"TMP_STATUS", ELEM_OUTPUT_INT, {0xD3B8}, {0x2}}, \ - {"EDP_AVG_CURRENT", ELEM_OUTPUT_INT, {0xD3BA}, {0x2}}, \ - {"EDP_HEART_ADDR", ELEM_OUTPUT_INT, {0xD3BC}, {0x4}}, \ - {"EDP_IRQ_COUNT", ELEM_OUTPUT_INT, {0xD3C0}, {0x4}}, \ - {"EDP_DOWN_COUNT", ELEM_OUTPUT_INT, {0xD3C4}, {0x2}}, \ - {"EDP_UP_COUNT", ELEM_OUTPUT_INT, {0xD3C6}, {0x2}}, \ - {"EDP_TIMER_COUNT", ELEM_OUTPUT_INT, {0xD3C8}, {0x4}}, \ - {"THERMAL_TIMER_CNT",ELEM_OUTPUT_INT, {0xD3CC}, {0x4}}, \ - {"VOLT_VALUE", ELEM_OUTPUT_INT, {0XD3D4}, {0x4}}, \ - {"CURRENT_VALUE", ELEM_OUTPUT_INT, {0XD3D8}, {0x4}}, \ - {"POWER_VALUE", ELEM_OUTPUT_INT, {0XD3DC}, {0x4}}, \ - {"LPNV_MAGIC", ELEM_OUTPUT_INT, {0xD3E0}, {0x4}}, \ - {"HI_EDP", ELEM_OUTPUT_INT, {0xD3E4}, {0x1}}, \ - {"EDP_SCALE", ELEM_OUTPUT_INT, {0xD3E5}, {0x1}}, \ - {"EDP_PERIOD", ELEM_OUTPUT_INT, {0xD3E6}, {0x2}}, \ - {"EDP_MAX_CURRENT", ELEM_OUTPUT_INT, {0xD3E8}, {0x2}}, \ - {"EDP_AVE_CURRENT", ELEM_OUTPUT_INT, {0xD3EA}, {0x2}}, \ - {"AVS_NV", ELEM_OUTPUT_INT, {0xD3EC}, {0x1}}, \ - {"SVFD_NV", ELEM_OUTPUT_INT, {0xD3ED}, {0x1}}, \ - {"PLLMODE", ELEM_OUTPUT_INT, {0xD3EE}, {0x1}}, \ - {"HOT_RESET", ELEM_OUTPUT_INT, {0xD3EF}, {0x1}}, \ - {"RESERVED_CTRL", ELEM_OUTPUT_INT, {0xD3F0}, {0x2}}, \ - {"RESERVED_EN", ELEM_OUTPUT_INT, {0xD3F2}, {0x2}}, \ - {"RESERVED_IMU", ELEM_OUTPUT_INT, {0xD3F4}, {0x2}}, \ - {"LP_MNTN", ELEM_OUTPUT_INT, {0xD3F6}, {0x1}}, \ - {"THERMAL_CTRL", ELEM_OUTPUT_INT, {0xD3F7}, {0x1}}, \ - {"THERMAL_SHUTDOWN", ELEM_OUTPUT_INT, {0xD3F8}, {0x1}}, \ - {"THERMAL_FREQ_STEP",ELEM_OUTPUT_INT, {0xD3F9}, {0x1}}, \ - {"THERMAL_HWRST", ELEM_OUTPUT_INT, {0xD3FA}, {0x1}}, \ - {"THERMAL_SWRST", ELEM_OUTPUT_INT, {0xD3FB}, {0x1}}, \ - {"THERMAL_HIGH_TEMP",ELEM_OUTPUT_INT, {0xD3FC}, {0x1}}, \ - {"THERMAL_NOR_TEMP", ELEM_OUTPUT_INT, {0xD3FD}, {0x1}}, \ - {"THERMAL_SLOW_PER", ELEM_OUTPUT_INT, {0xD3FE}, {0x1}}, \ - {"THERMAL_FAST_PER", ELEM_OUTPUT_INT, {0xD3FF}, {0x1}}, \ - {"THERMAL_COOL_CNT", ELEM_OUTPUT_INT, {0xD400}, {0x2}}, \ - {"UTRALSOC_DIS", ELEM_OUTPUT_INT, {0xD402}, {0x1}}, \ - {"POWERBRAKE_EN", ELEM_OUTPUT_INT, {0xD403}, {0x1}}, \ - {"POWERBRAKE_SCALE", ELEM_OUTPUT_INT, {0xD404}, {0x2}}, \ - {"FLOOR_FREQ", ELEM_OUTPUT_INT, {0xD406}, {0x2}}, \ - {"HBM_DEBUG_LEVEL", ELEM_OUTPUT_INT, {0xD410}, {0x1}}, \ - {"HBM_MP_INIT", ELEM_OUTPUT_INT, {0xD411}, {0x1}}, \ - {"HBM_ECC_EN", ELEM_OUTPUT_INT, {0xD412}, {0x1}}, \ - {"HBM_RASC_EN", ELEM_OUTPUT_INT, {0xD413}, {0x1}}, \ - {"HBM_PATROL_SCRUB", ELEM_OUTPUT_INT, {0xD414}, {0x1}}, \ - {"HBM_CLEAN_MEM_EN", ELEM_OUTPUT_INT, {0xD415}, {0x1}}, \ - {"HBM_POISON_EN", ELEM_OUTPUT_INT, {0xD416}, {0x1}}, \ - {"HBM_FW_PATCH_EN", ELEM_OUTPUT_INT, {0xD417}, {0x1}}, \ - {"HBM_FW_SFC_MRS_EN",ELEM_OUTPUT_INT, {0xD418}, {0x1}}, \ - {"HBM_TMON_EN", ELEM_OUTPUT_INT, {0xD419}, {0x1}}, \ - {"HBM_PD", ELEM_OUTPUT_INT, {0xD41A}, {0x1}}, \ - {"HBM_HIGH_TEMP", ELEM_OUTPUT_INT, {0xD41B}, {0x1}}, \ - {"HBM_RESERVED_0", ELEM_OUTPUT_INT, {0xD41C}, {0x1}}, \ - {"HBM_RESERVED_1", ELEM_OUTPUT_INT, {0xD41D}, {0x1}}, \ - {"HBM_RESERVED_2", ELEM_OUTPUT_INT, {0xD41E}, {0x1}}, \ - {"HBM_FREQ", ELEM_OUTPUT_INT, {0xD420}, {0x2}}, \ - {"DDR_DEBUG_LEVEL", ELEM_OUTPUT_INT, {0xD422}, {0x1}}, \ - {"DDR_MP_INIT", ELEM_OUTPUT_INT, {0xD423}, {0x1}}, \ - {"DDR_ECC_EN", ELEM_OUTPUT_INT, {0xD424}, {0x1}}, \ - {"DDR_RASC_EN", ELEM_OUTPUT_INT, {0xD425}, {0x1}}, \ - {"DDR_PD_EN", ELEM_OUTPUT_INT, {0xD426}, {0x1}}, \ - {"DDR_LP_EN", ELEM_OUTPUT_INT, {0xD427}, {0x1}}, \ - {"DDR_RASC_ALGO", ELEM_OUTPUT_INT, {0xD428}, {0x1}}, \ - {"DDR_CA_PARITY_EN", ELEM_OUTPUT_INT, {0xD429}, {0x1}}, \ - {"DDR_POISON_EN", ELEM_OUTPUT_INT, {0xD42A}, {0x1}}, \ - {"DDR_PATROL_SCRUB", ELEM_OUTPUT_INT, {0xD42B}, {0x1}}, \ - {"DDR_TMON_EN", ELEM_OUTPUT_INT, {0xD42C}, {0x1}}, \ - {"DDR_HIGH_TEMP", ELEM_OUTPUT_INT, {0xD42D}, {0x1}}, \ - {"DDR_RESERVED_0", ELEM_OUTPUT_INT, {0xD42E}, {0x1}}, \ - {"DDR_RESERVED_1", ELEM_OUTPUT_INT, {0xD42F}, {0x1}}, \ - {"DDR_RESERVED_2", ELEM_OUTPUT_INT, {0xD430}, {0x1}}, \ - {"DDR_FREQ", ELEM_OUTPUT_INT, {0xD432}, {0x2}}, \ - {"AVS_CALCU_VOLT", ELEM_OUTPUT_INT, {0xD444}, {0x4}}, \ - {"AVS_WORK_VOLT", ELEM_OUTPUT_INT, {0xD448}, {0x4}}, \ - {"BBOX_BASE", ELEM_OUTPUT_INT, {0xD460}, {0x8}}, \ - {"BBOX_SIZE", ELEM_OUTPUT_INT, {0xD468}, {0x4}}, \ - {"BACKUP_BBOX_ADDR", ELEM_OUTPUT_INT, {0xD470}, {0x8}}, \ - {"BACKUP_BBOX_SIZE", ELEM_OUTPUT_INT, {0xD478}, {0x4}}, \ - {"PMBUS_CHECK0", ELEM_OUTPUT_INT, {0xD4A0}, {0x2}}, \ - {"PMBUS_CHECK1", ELEM_OUTPUT_INT, {0xD4A2}, {0x2}}, \ - {"PMBUS_CHECK2", ELEM_OUTPUT_INT, {0xD4A4}, {0x2}}, \ - {"PMBUS_CHECK3", ELEM_OUTPUT_INT, {0xD4A6}, {0x2}}, \ - {"PMBUS_CHECK4", ELEM_OUTPUT_INT, {0xD4A8}, {0x2}}, \ - {"PMBUS_CHECK5", ELEM_OUTPUT_INT, {0xD4AA}, {0x2}}, \ - {"LP_STARTUP_EXCEPTION", ELEM_OUTPUT_INT, {0xD4B0}, {0x4}}, \ - {"**GIC*******", ELEM_OUTPUT_STR, {0x00}, {0x8}}, \ - {"ENABLE[0]", ELEM_OUTPUT_INT, {0x1280}, {0x4}}, \ - {"ENABLE[1]", ELEM_OUTPUT_INT, {0x1284}, {0x4}}, \ - {"ENABLE[2]", ELEM_OUTPUT_INT, {0x1288}, {0x4}}, \ - {"ENABLE[3]", ELEM_OUTPUT_INT, {0x128C}, {0x4}}, \ - {"ENABLE[4]", ELEM_OUTPUT_INT, {0x1290}, {0x4}}, \ - {"ENABLE[5]", ELEM_OUTPUT_INT, {0x1294}, {0x4}}, \ - {"ENABLE[6]", ELEM_OUTPUT_INT, {0x1298}, {0x4}}, \ - {"ENABLE[7]", ELEM_OUTPUT_INT, {0x129C}, {0x4}}, \ - {"ENABLE[8]", ELEM_OUTPUT_INT, {0x12A0}, {0x4}}, \ - {"ENABLE[9]", ELEM_OUTPUT_INT, {0x12A4}, {0x4}}, \ - {"ENABLE[10]", ELEM_OUTPUT_INT, {0x12A8}, {0x4}}, \ - {"ENABLE[11]", ELEM_OUTPUT_INT, {0x12AC}, {0x4}}, \ - {"ENABLE[12]", ELEM_OUTPUT_INT, {0x12B0}, {0x4}}, \ - {"PENDING[0]", ELEM_OUTPUT_INT, {0x12B4}, {0x4}}, \ - {"PENDING[1]", ELEM_OUTPUT_INT, {0x12B8}, {0x4}}, \ - {"PENDING[2]", ELEM_OUTPUT_INT, {0x12BC}, {0x4}}, \ - {"**IPC*******", ELEM_OUTPUT_STR, {0x00}, {0x8}}, \ - {"IPC_MBX", ELEM_OUTPUT_INT, {0x15080}, {0x4}}, \ - {"IPC_SRC", ELEM_OUTPUT_INT, {0x15084}, {0x4}}, \ - {"IPC_MODE", ELEM_OUTPUT_INT, {0x15088}, {0x4}}, \ - {"IPC_ICLR", ELEM_OUTPUT_INT, {0x1508c}, {0x4}}, \ - {"IPC_DATA0", ELEM_OUTPUT_INT, {0x15090}, {0x4}}, \ - {"IPC_DATA1", ELEM_OUTPUT_INT, {0x15094}, {0x4}}, \ - {"IPC_DATA2", ELEM_OUTPUT_INT, {0x15098}, {0x4}}, \ - {"IPC_DATA3", ELEM_OUTPUT_INT, {0x1509c}, {0x4}}, \ - {"IPC_DATA4", ELEM_OUTPUT_INT, {0x150a0}, {0x4}}, \ - {"IPC_DATA5", ELEM_OUTPUT_INT, {0x150a4}, {0x4}}, \ - {"IPC_DATA6", ELEM_OUTPUT_INT, {0x150a8}, {0x4}}, \ - {"IPC_DATA7", ELEM_OUTPUT_INT, {0x150ac}, {0x4}}, \ - {"IPC_Q0_DATA0", ELEM_OUTPUT_INT, {0x150c0}, {0x4}}, \ - {"IPC_Q0_DATA1", ELEM_OUTPUT_INT, {0x150c4}, {0x4}}, \ - {"IPC_Q0_DATA2", ELEM_OUTPUT_INT, {0x150c8}, {0x4}}, \ - {"IPC_Q0_DATA3", ELEM_OUTPUT_INT, {0x150cc}, {0x4}}, \ - {"IPC_Q0_DATA4", ELEM_OUTPUT_INT, {0x150d0}, {0x4}}, \ - {"IPC_Q0_DATA5", ELEM_OUTPUT_INT, {0x150d4}, {0x4}}, \ - {"IPC_Q0_DATA6", ELEM_OUTPUT_INT, {0x150d8}, {0x4}}, \ - {"IPC_Q0_DATA7", ELEM_OUTPUT_INT, {0x150dc}, {0x4}}, \ - {"IPC_Q0_SYSCNT", ELEM_OUTPUT_INT, {0x150e0}, {0x4}}, \ - {"IPC_Q1_DATA0", ELEM_OUTPUT_INT, {0x150e4}, {0x4}}, \ - {"IPC_Q1_DATA1", ELEM_OUTPUT_INT, {0x150e8}, {0x4}}, \ - {"IPC_Q1_DATA2", ELEM_OUTPUT_INT, {0x150ec}, {0x4}}, \ - {"IPC_Q1_DATA3", ELEM_OUTPUT_INT, {0x150f0}, {0x4}}, \ - {"IPC_Q1_DATA4", ELEM_OUTPUT_INT, {0x150f4}, {0x4}}, \ - {"IPC_Q1_DATA5", ELEM_OUTPUT_INT, {0x150f8}, {0x4}}, \ - {"IPC_Q1_DATA6", ELEM_OUTPUT_INT, {0x150fc}, {0x4}}, \ - {"IPC_Q1_DATA7", ELEM_OUTPUT_INT, {0x15100}, {0x4}}, \ - {"IPC_Q1_SYSCNT", ELEM_OUTPUT_INT, {0x15104}, {0x4}}, \ - {"IPC_Q2_DATA0", ELEM_OUTPUT_INT, {0x15108}, {0x4}}, \ - {"IPC_Q2_DATA1", ELEM_OUTPUT_INT, {0x1510c}, {0x4}}, \ - {"IPC_Q2_DATA2", ELEM_OUTPUT_INT, {0x15110}, {0x4}}, \ - {"IPC_Q2_DATA3", ELEM_OUTPUT_INT, {0x15114}, {0x4}}, \ - {"IPC_Q2_DATA4", ELEM_OUTPUT_INT, {0x15118}, {0x4}}, \ - {"IPC_Q2_DATA5", ELEM_OUTPUT_INT, {0x1511c}, {0x4}}, \ - {"IPC_Q2_DATA6", ELEM_OUTPUT_INT, {0x15120}, {0x4}}, \ - {"IPC_Q2_DATA7", ELEM_OUTPUT_INT, {0x15124}, {0x4}}, \ - {"IPC_Q2_SYSCNT", ELEM_OUTPUT_INT, {0x15128}, {0x4}}, \ - {"IPC_Q3_DATA0", ELEM_OUTPUT_INT, {0x1512c}, {0x4}}, \ - {"IPC_Q3_DATA1", ELEM_OUTPUT_INT, {0x15130}, {0x4}}, \ - {"IPC_Q3_DATA2", ELEM_OUTPUT_INT, {0x15134}, {0x4}}, \ - {"IPC_Q3_DATA3", ELEM_OUTPUT_INT, {0x15138}, {0x4}}, \ - {"IPC_Q3_DATA4", ELEM_OUTPUT_INT, {0x1513c}, {0x4}}, \ - {"IPC_Q3_DATA5", ELEM_OUTPUT_INT, {0x15140}, {0x4}}, \ - {"IPC_Q3_DATA6", ELEM_OUTPUT_INT, {0x15144}, {0x4}}, \ - {"IPC_Q3_DATA7", ELEM_OUTPUT_INT, {0x15148}, {0x4}}, \ - {"IPC_Q3_SYSCNT", ELEM_OUTPUT_INT, {0x1514c}, {0x4}}, \ - {"IPC_Q4_DATA0", ELEM_OUTPUT_INT, {0x15150}, {0x4}}, \ - {"IPC_Q4_DATA1", ELEM_OUTPUT_INT, {0x15154}, {0x4}}, \ - {"IPC_Q4_DATA2", ELEM_OUTPUT_INT, {0x15158}, {0x4}}, \ - {"IPC_Q4_DATA3", ELEM_OUTPUT_INT, {0x1515c}, {0x4}}, \ - {"IPC_Q4_DATA4", ELEM_OUTPUT_INT, {0x15160}, {0x4}}, \ - {"IPC_Q4_DATA5", ELEM_OUTPUT_INT, {0x15164}, {0x4}}, \ - {"IPC_Q4_DATA6", ELEM_OUTPUT_INT, {0x15168}, {0x4}}, \ - {"IPC_Q4_DATA7", ELEM_OUTPUT_INT, {0x1516c}, {0x4}}, \ - {"IPC_Q4_SYSCNT", ELEM_OUTPUT_INT, {0x15170}, {0x4}}, \ - {"IPC_Q5_DATA0", ELEM_OUTPUT_INT, {0x15174}, {0x4}}, \ - {"IPC_Q5_DATA1", ELEM_OUTPUT_INT, {0x15178}, {0x4}}, \ - {"IPC_Q5_DATA2", ELEM_OUTPUT_INT, {0x1517c}, {0x4}}, \ - {"IPC_Q5_DATA3", ELEM_OUTPUT_INT, {0x15180}, {0x4}}, \ - {"IPC_Q5_DATA4", ELEM_OUTPUT_INT, {0x15184}, {0x4}}, \ - {"IPC_Q5_DATA5", ELEM_OUTPUT_INT, {0x15188}, {0x4}}, \ - {"IPC_Q5_DATA6", ELEM_OUTPUT_INT, {0x1518c}, {0x4}}, \ - {"IPC_Q5_DATA7", ELEM_OUTPUT_INT, {0x15190}, {0x4}}, \ - {"IPC_Q5_SYSCNT", ELEM_OUTPUT_INT, {0x15194}, {0x4}}, \ - {"IPC_Q6_DATA0", ELEM_OUTPUT_INT, {0x15198}, {0x4}}, \ - {"IPC_Q6_DATA1", ELEM_OUTPUT_INT, {0x1519C}, {0x4}}, \ - {"IPC_Q6_DATA2", ELEM_OUTPUT_INT, {0x151A0}, {0x4}}, \ - {"IPC_Q6_DATA3", ELEM_OUTPUT_INT, {0x151A4}, {0x4}}, \ - {"IPC_Q6_DATA4", ELEM_OUTPUT_INT, {0x151A8}, {0x4}}, \ - {"IPC_Q6_DATA5", ELEM_OUTPUT_INT, {0x151AC}, {0x4}}, \ - {"IPC_Q6_DATA6", ELEM_OUTPUT_INT, {0x151B0}, {0x4}}, \ - {"IPC_Q6_DATA7", ELEM_OUTPUT_INT, {0x151B4}, {0x4}}, \ - {"IPC_Q6_SYSCNT", ELEM_OUTPUT_INT, {0x151B8}, {0x4}}, \ - {"IPC_Q7_DATA0", ELEM_OUTPUT_INT, {0x151BC}, {0x4}}, \ - {"IPC_Q7_DATA1", ELEM_OUTPUT_INT, {0x151C0}, {0x4}}, \ - {"IPC_Q7_DATA2", ELEM_OUTPUT_INT, {0x151C4}, {0x4}}, \ - {"IPC_Q7_DATA3", ELEM_OUTPUT_INT, {0x151C8}, {0x4}}, \ - {"IPC_Q7_DATA4", ELEM_OUTPUT_INT, {0x151CC}, {0x4}}, \ - {"IPC_Q7_DATA5", ELEM_OUTPUT_INT, {0x151D0}, {0x4}}, \ - {"IPC_Q7_DATA6", ELEM_OUTPUT_INT, {0x151D4}, {0x4}}, \ - {"IPC_Q7_DATA7", ELEM_OUTPUT_INT, {0x151D8}, {0x4}}, \ - {"IPC_Q7_SYSCNT", ELEM_OUTPUT_INT, {0x151DC}, {0x4}}, \ - {"IPC_Q8_DATA0", ELEM_OUTPUT_INT, {0x151E0}, {0x4}}, \ - {"IPC_Q8_DATA1", ELEM_OUTPUT_INT, {0x151E4}, {0x4}}, \ - {"IPC_Q8_DATA2", ELEM_OUTPUT_INT, {0x151E8}, {0x4}}, \ - {"IPC_Q8_DATA3", ELEM_OUTPUT_INT, {0x151EC}, {0x4}}, \ - {"IPC_Q8_DATA4", ELEM_OUTPUT_INT, {0x151F0}, {0x4}}, \ - {"IPC_Q8_DATA5", ELEM_OUTPUT_INT, {0x151F4}, {0x4}}, \ - {"IPC_Q8_DATA6", ELEM_OUTPUT_INT, {0x151F8}, {0x4}}, \ - {"IPC_Q8_DATA7", ELEM_OUTPUT_INT, {0x151FC}, {0x4}}, \ - {"IPC_Q8_SYSCNT", ELEM_OUTPUT_INT, {0x15200}, {0x4}}, \ - {"IPC_Q9_DATA0", ELEM_OUTPUT_INT, {0x15204}, {0x4}}, \ - {"IPC_Q9_DATA1", ELEM_OUTPUT_INT, {0x15208}, {0x4}}, \ - {"IPC_Q9_DATA2", ELEM_OUTPUT_INT, {0x1520C}, {0x4}}, \ - {"IPC_Q9_DATA3", ELEM_OUTPUT_INT, {0x15210}, {0x4}}, \ - {"IPC_Q9_DATA4", ELEM_OUTPUT_INT, {0x15214}, {0x4}}, \ - {"IPC_Q9_DATA5", ELEM_OUTPUT_INT, {0x15218}, {0x4}}, \ - {"IPC_Q9_DATA6", ELEM_OUTPUT_INT, {0x1521C}, {0x4}}, \ - {"IPC_Q9_DATA7", ELEM_OUTPUT_INT, {0x15220}, {0x4}}, \ - {"IPC_Q9_SYSCNT", ELEM_OUTPUT_INT, {0x15224}, {0x4}}, \ - {"***RAS*******", ELEM_OUTPUT_STR, {0x00}, {0x8}}, \ - {"RAS_DATA0", ELEM_OUTPUT_INT, {0x13c80}, {0x4}}, \ - {"RAS_DATA1", ELEM_OUTPUT_INT, {0x13c88}, {0x4}}, \ - {"***DDR_REG_DUMP*******", ELEM_OUTPUT_STR, {0x00}, {0x8}}, \ - {"DDR_REG_DUMP0", ELEM_OUTPUT_INT, {0x15580}, {0x8}}, \ - {"DDR_REG_DUMP1", ELEM_OUTPUT_INT, {0x15588}, {0x8}}, \ - {"DDR_REG_DUMP2", ELEM_OUTPUT_INT, {0x15590}, {0x8}}, \ - {"DDR_REG_DUMP3", ELEM_OUTPUT_INT, {0x15598}, {0x8}}, \ - {"DDR_REG_DUMP4", ELEM_OUTPUT_INT, {0x155A0}, {0x8}}, \ - {"DDR_REG_DUMP5", ELEM_OUTPUT_INT, {0x155A8}, {0x8}}, \ - {"DDR_REG_DUMP6", ELEM_OUTPUT_INT, {0x155B0}, {0x8}}, \ - {"DDR_REG_DUMP7", ELEM_OUTPUT_INT, {0x155B8}, {0x8}}, \ -} - -#define DATA_MODEL_LPFW_SRAM MODEL_VECTOR(LPFW_SRAM) = { \ - {"****exc****reg**", ELEM_OUTPUT_STR, {0x00}, {0x8}}, \ - {"reset_reason", ELEM_OUTPUT_INT, {0x00}, {0x4}}, \ - {"slice", ELEM_OUTPUT_INT, {0x08}, {0x4}}, \ - {"rtc", ELEM_OUTPUT_INT, {0x10}, {0x4}}, \ - {"REGSP", ELEM_OUTPUT_INT, {0x18}, {0x8}}, \ - {"REGPC", ELEM_OUTPUT_INT, {0x20}, {0x8}}, \ - {"REGELR", ELEM_OUTPUT_INT, {0x28}, {0x8}}, \ - {"REGCPSR", ELEM_OUTPUT_INT, {0x30}, {0x8}}, \ - {"REGSPSR", ELEM_OUTPUT_INT, {0x38}, {0x8}}, \ - {"ESR", ELEM_OUTPUT_INT, {0x40}, {0x8}}, \ - {"FAR", ELEM_OUTPUT_INT, {0x48}, {0x8}}, \ - {"excTrace", ELEM_OUTPUT_INT, {0x50}, {0x1}}, \ - {"ddrExc", ELEM_OUTPUT_INT, {0x51}, {0x1}}, \ - {"irqId", ELEM_OUTPUT_INT, {0x52}, {0x2}}, \ - {"taskId", ELEM_OUTPUT_INT, {0x54}, {0x4}}, \ - {"**backup**reg***", ELEM_OUTPUT_STR, {0x00}, {0x8}}, \ - {"reg_backup_index", ELEM_OUTPUT_INT, {0x820}, {0x4}}, \ - {"reason_0", ELEM_OUTPUT_INT, {0x824}, {0x4}}, \ - {"reason_1", ELEM_OUTPUT_INT, {0x828}, {0x4}}, \ - {"reason_2", ELEM_OUTPUT_INT, {0x82C}, {0x4}}, \ - {"x0", ELEM_OUTPUT_INT, {0x830}, {0x8}}, \ - {"x1", ELEM_OUTPUT_INT, {0x848}, {0x8}}, \ - {"x2", ELEM_OUTPUT_INT, {0x850}, {0x8}}, \ - {"x3", ELEM_OUTPUT_INT, {0x858}, {0x8}}, \ - {"x4", ELEM_OUTPUT_INT, {0x860}, {0x8}}, \ - {"x5", ELEM_OUTPUT_INT, {0x868}, {0x8}}, \ - {"x6", ELEM_OUTPUT_INT, {0x870}, {0x8}}, \ - {"x7", ELEM_OUTPUT_INT, {0x878}, {0x8}}, \ - {"x8", ELEM_OUTPUT_INT, {0x880}, {0x8}}, \ - {"x9", ELEM_OUTPUT_INT, {0x888}, {0x8}}, \ - {"x10", ELEM_OUTPUT_INT, {0x890}, {0x8}}, \ - {"x11", ELEM_OUTPUT_INT, {0x898}, {0x8}}, \ - {"x12", ELEM_OUTPUT_INT, {0x8A0}, {0x8}}, \ - {"x13", ELEM_OUTPUT_INT, {0x8A8}, {0x8}}, \ - {"x14", ELEM_OUTPUT_INT, {0x8B0}, {0x8}}, \ - {"x15", ELEM_OUTPUT_INT, {0x8B8}, {0x8}}, \ - {"x16", ELEM_OUTPUT_INT, {0x8C0}, {0x8}}, \ - {"x17", ELEM_OUTPUT_INT, {0x8C8}, {0x8}}, \ - {"x18", ELEM_OUTPUT_INT, {0x8D0}, {0x8}}, \ - {"x19", ELEM_OUTPUT_INT, {0x8D8}, {0x8}}, \ - {"x20", ELEM_OUTPUT_INT, {0x8E0}, {0x8}}, \ - {"x21", ELEM_OUTPUT_INT, {0x8E8}, {0x8}}, \ - {"x22", ELEM_OUTPUT_INT, {0x8F0}, {0x8}}, \ - {"x23", ELEM_OUTPUT_INT, {0x8F8}, {0x8}}, \ - {"x24", ELEM_OUTPUT_INT, {0x900}, {0x8}}, \ - {"x25", ELEM_OUTPUT_INT, {0x908}, {0x8}}, \ - {"x26", ELEM_OUTPUT_INT, {0x910}, {0x8}}, \ - {"x27", ELEM_OUTPUT_INT, {0x918}, {0x8}}, \ - {"x28", ELEM_OUTPUT_INT, {0x920}, {0x8}}, \ - {"x29", ELEM_OUTPUT_INT, {0x928}, {0x8}}, \ - {"x30", ELEM_OUTPUT_INT, {0x930}, {0x8}}, \ - {"XZR", ELEM_OUTPUT_INT, {0x938}, {0x8}}, \ - {"ESR", ELEM_OUTPUT_INT, {0x940}, {0x8}}, \ - {"FAR", ELEM_OUTPUT_INT, {0x948}, {0x8}}, \ - {"SPSR", ELEM_OUTPUT_INT, {0x950}, {0x8}}, \ - {"ELR", ELEM_OUTPUT_INT, {0x958}, {0x8}}, \ - {"PC", ELEM_OUTPUT_INT, {0x960}, {0x8}}, \ - {"SP", ELEM_OUTPUT_INT, {0x968}, {0x8}}, \ - {"CPSR", ELEM_OUTPUT_INT, {0x970}, {0x8}}, \ - {"**GIC*******", ELEM_OUTPUT_STR, {0x00}, {0x8}}, \ - {"ENABLE[0]", ELEM_OUTPUT_INT, {0x2820}, {0x4}}, \ - {"ENABLE[1]", ELEM_OUTPUT_INT, {0x2824}, {0x4}}, \ - {"ENABLE[2]", ELEM_OUTPUT_INT, {0x2828}, {0x4}}, \ - {"ENABLE[3]", ELEM_OUTPUT_INT, {0x282C}, {0x4}}, \ - {"ENABLE[4]", ELEM_OUTPUT_INT, {0x2830}, {0x4}}, \ - {"ENABLE[5]", ELEM_OUTPUT_INT, {0x2834}, {0x4}}, \ - {"ENABLE[6]", ELEM_OUTPUT_INT, {0x2838}, {0x4}}, \ - {"ENABLE[7]", ELEM_OUTPUT_INT, {0x283C}, {0x4}}, \ - {"ENABLE[8]", ELEM_OUTPUT_INT, {0x2840}, {0x4}}, \ - {"ENABLE[9]", ELEM_OUTPUT_INT, {0x2844}, {0x4}}, \ - {"ENABLE[10]", ELEM_OUTPUT_INT, {0x2848}, {0x4}}, \ - {"ENABLE[11]", ELEM_OUTPUT_INT, {0x284C}, {0x4}}, \ - {"ENABLE[12]", ELEM_OUTPUT_INT, {0x2850}, {0x4}}, \ - {"PENDING[0]", ELEM_OUTPUT_INT, {0x2854}, {0x4}}, \ - {"PENDING[1]", ELEM_OUTPUT_INT, {0x2858}, {0x4}}, \ - {"PENDING[2]", ELEM_OUTPUT_INT, {0x285C}, {0x4}}, \ - {"**IPC*******", ELEM_OUTPUT_STR, {0x00}, {0x8}}, \ - {"IPC_MBX", ELEM_OUTPUT_INT, {0x1000}, {0x4}}, \ - {"IPC_SRC", ELEM_OUTPUT_INT, {0x1004}, {0x4}}, \ - {"IPC_MODE", ELEM_OUTPUT_INT, {0x1008}, {0x4}}, \ - {"IPC_ICLR", ELEM_OUTPUT_INT, {0x100c}, {0x4}}, \ - {"IPC_DATA0", ELEM_OUTPUT_INT, {0x1010}, {0x4}}, \ - {"IPC_DATA1", ELEM_OUTPUT_INT, {0x1014}, {0x4}}, \ - {"IPC_DATA2", ELEM_OUTPUT_INT, {0x1018}, {0x4}}, \ - {"IPC_DATA3", ELEM_OUTPUT_INT, {0x101c}, {0x4}}, \ - {"IPC_DATA4", ELEM_OUTPUT_INT, {0x1020}, {0x4}}, \ - {"IPC_DATA5", ELEM_OUTPUT_INT, {0x1024}, {0x4}}, \ - {"IPC_DATA6", ELEM_OUTPUT_INT, {0x1028}, {0x4}}, \ - {"IPC_DATA7", ELEM_OUTPUT_INT, {0x102c}, {0x4}}, \ - {"IPC_Q0_DATA0", ELEM_OUTPUT_INT, {0x1040}, {0x4}}, \ - {"IPC_Q0_DATA1", ELEM_OUTPUT_INT, {0x1044}, {0x4}}, \ - {"IPC_Q0_DATA2", ELEM_OUTPUT_INT, {0x1048}, {0x4}}, \ - {"IPC_Q0_DATA3", ELEM_OUTPUT_INT, {0x104c}, {0x4}}, \ - {"IPC_Q0_DATA4", ELEM_OUTPUT_INT, {0x1050}, {0x4}}, \ - {"IPC_Q0_DATA5", ELEM_OUTPUT_INT, {0x1054}, {0x4}}, \ - {"IPC_Q0_DATA6", ELEM_OUTPUT_INT, {0x1058}, {0x4}}, \ - {"IPC_Q0_DATA7", ELEM_OUTPUT_INT, {0x105c}, {0x4}}, \ - {"IPC_Q0_SYSCNT", ELEM_OUTPUT_INT, {0x1060}, {0x4}}, \ - {"IPC_Q1_DATA0", ELEM_OUTPUT_INT, {0x1064}, {0x4}}, \ - {"IPC_Q1_DATA1", ELEM_OUTPUT_INT, {0x1068}, {0x4}}, \ - {"IPC_Q1_DATA2", ELEM_OUTPUT_INT, {0x106c}, {0x4}}, \ - {"IPC_Q1_DATA3", ELEM_OUTPUT_INT, {0x1070}, {0x4}}, \ - {"IPC_Q1_DATA4", ELEM_OUTPUT_INT, {0x1074}, {0x4}}, \ - {"IPC_Q1_DATA5", ELEM_OUTPUT_INT, {0x1078}, {0x4}}, \ - {"IPC_Q1_DATA6", ELEM_OUTPUT_INT, {0x107c}, {0x4}}, \ - {"IPC_Q1_DATA7", ELEM_OUTPUT_INT, {0x1080}, {0x4}}, \ - {"IPC_Q1_SYSCNT", ELEM_OUTPUT_INT, {0x1084}, {0x4}}, \ - {"IPC_Q2_DATA0", ELEM_OUTPUT_INT, {0x1088}, {0x4}}, \ - {"IPC_Q2_DATA1", ELEM_OUTPUT_INT, {0x108c}, {0x4}}, \ - {"IPC_Q2_DATA2", ELEM_OUTPUT_INT, {0x1190}, {0x4}}, \ - {"IPC_Q2_DATA3", ELEM_OUTPUT_INT, {0x1194}, {0x4}}, \ - {"IPC_Q2_DATA4", ELEM_OUTPUT_INT, {0x1198}, {0x4}}, \ - {"IPC_Q2_DATA5", ELEM_OUTPUT_INT, {0x119c}, {0x4}}, \ - {"IPC_Q2_DATA6", ELEM_OUTPUT_INT, {0x11A0}, {0x4}}, \ - {"IPC_Q2_DATA7", ELEM_OUTPUT_INT, {0x11A4}, {0x4}}, \ - {"IPC_Q2_SYSCNT", ELEM_OUTPUT_INT, {0x11A8}, {0x4}}, \ - {"IPC_Q3_DATA0", ELEM_OUTPUT_INT, {0x11Ac}, {0x4}}, \ - {"IPC_Q3_DATA1", ELEM_OUTPUT_INT, {0x11B0}, {0x4}}, \ - {"IPC_Q3_DATA2", ELEM_OUTPUT_INT, {0x11B4}, {0x4}}, \ - {"IPC_Q3_DATA3", ELEM_OUTPUT_INT, {0x11B8}, {0x4}}, \ - {"IPC_Q3_DATA4", ELEM_OUTPUT_INT, {0x11Bc}, {0x4}}, \ - {"IPC_Q3_DATA5", ELEM_OUTPUT_INT, {0x11C0}, {0x4}}, \ - {"IPC_Q3_DATA6", ELEM_OUTPUT_INT, {0x11C4}, {0x4}}, \ - {"IPC_Q3_DATA7", ELEM_OUTPUT_INT, {0x11C8}, {0x4}}, \ - {"IPC_Q3_SYSCNT", ELEM_OUTPUT_INT, {0x11Cc}, {0x4}}, \ - {"IPC_Q4_DATA0", ELEM_OUTPUT_INT, {0x11D0}, {0x4}}, \ - {"IPC_Q4_DATA1", ELEM_OUTPUT_INT, {0x11D4}, {0x4}}, \ - {"IPC_Q4_DATA2", ELEM_OUTPUT_INT, {0x11D8}, {0x4}}, \ - {"IPC_Q4_DATA3", ELEM_OUTPUT_INT, {0x11Dc}, {0x4}}, \ - {"IPC_Q4_DATA4", ELEM_OUTPUT_INT, {0x11E0}, {0x4}}, \ - {"IPC_Q4_DATA5", ELEM_OUTPUT_INT, {0x11E4}, {0x4}}, \ - {"IPC_Q4_DATA6", ELEM_OUTPUT_INT, {0x11E8}, {0x4}}, \ - {"IPC_Q4_DATA7", ELEM_OUTPUT_INT, {0x11Ec}, {0x4}}, \ - {"IPC_Q4_SYSCNT", ELEM_OUTPUT_INT, {0x11F0}, {0x4}}, \ - {"IPC_Q5_DATA0", ELEM_OUTPUT_INT, {0x11F4}, {0x4}}, \ - {"IPC_Q5_DATA1", ELEM_OUTPUT_INT, {0x11F8}, {0x4}}, \ - {"IPC_Q5_DATA2", ELEM_OUTPUT_INT, {0x11Fc}, {0x4}}, \ - {"IPC_Q5_DATA3", ELEM_OUTPUT_INT, {0x1200}, {0x4}}, \ - {"IPC_Q5_DATA4", ELEM_OUTPUT_INT, {0x1204}, {0x4}}, \ - {"IPC_Q5_DATA5", ELEM_OUTPUT_INT, {0x1208}, {0x4}}, \ - {"IPC_Q5_DATA6", ELEM_OUTPUT_INT, {0x120c}, {0x4}}, \ - {"IPC_Q5_DATA7", ELEM_OUTPUT_INT, {0x1210}, {0x4}}, \ - {"IPC_Q5_SYSCNT", ELEM_OUTPUT_INT, {0x1214}, {0x4}}, \ - {"IPC_Q6_DATA0", ELEM_OUTPUT_INT, {0x1218}, {0x4}}, \ - {"IPC_Q6_DATA1", ELEM_OUTPUT_INT, {0x121C}, {0x4}}, \ - {"IPC_Q6_DATA2", ELEM_OUTPUT_INT, {0x1220}, {0x4}}, \ - {"IPC_Q6_DATA3", ELEM_OUTPUT_INT, {0x1224}, {0x4}}, \ - {"IPC_Q6_DATA4", ELEM_OUTPUT_INT, {0x1228}, {0x4}}, \ - {"IPC_Q6_DATA5", ELEM_OUTPUT_INT, {0x122C}, {0x4}}, \ - {"IPC_Q6_DATA6", ELEM_OUTPUT_INT, {0x1230}, {0x4}}, \ - {"IPC_Q6_DATA7", ELEM_OUTPUT_INT, {0x1234}, {0x4}}, \ - {"IPC_Q6_SYSCNT", ELEM_OUTPUT_INT, {0x1238}, {0x4}}, \ - {"IPC_Q7_DATA0", ELEM_OUTPUT_INT, {0x123C}, {0x4}}, \ - {"IPC_Q7_DATA1", ELEM_OUTPUT_INT, {0x1240}, {0x4}}, \ - {"IPC_Q7_DATA2", ELEM_OUTPUT_INT, {0x1244}, {0x4}}, \ - {"IPC_Q7_DATA3", ELEM_OUTPUT_INT, {0x1248}, {0x4}}, \ - {"IPC_Q7_DATA4", ELEM_OUTPUT_INT, {0x124C}, {0x4}}, \ - {"IPC_Q7_DATA5", ELEM_OUTPUT_INT, {0x1250}, {0x4}}, \ - {"IPC_Q7_DATA6", ELEM_OUTPUT_INT, {0x1254}, {0x4}}, \ - {"IPC_Q7_DATA7", ELEM_OUTPUT_INT, {0x1258}, {0x4}}, \ - {"IPC_Q7_SYSCNT", ELEM_OUTPUT_INT, {0x125C}, {0x4}}, \ - {"IPC_Q8_DATA0", ELEM_OUTPUT_INT, {0x1260}, {0x4}}, \ - {"IPC_Q8_DATA1", ELEM_OUTPUT_INT, {0x1264}, {0x4}}, \ - {"IPC_Q8_DATA2", ELEM_OUTPUT_INT, {0x1268}, {0x4}}, \ - {"IPC_Q8_DATA3", ELEM_OUTPUT_INT, {0x126C}, {0x4}}, \ - {"IPC_Q8_DATA4", ELEM_OUTPUT_INT, {0x1270}, {0x4}}, \ - {"IPC_Q8_DATA5", ELEM_OUTPUT_INT, {0x1274}, {0x4}}, \ - {"IPC_Q8_DATA6", ELEM_OUTPUT_INT, {0x1278}, {0x4}}, \ - {"IPC_Q8_DATA7", ELEM_OUTPUT_INT, {0x127C}, {0x4}}, \ - {"IPC_Q8_SYSCNT", ELEM_OUTPUT_INT, {0x1280}, {0x4}}, \ - {"IPC_Q9_DATA0", ELEM_OUTPUT_INT, {0x1284}, {0x4}}, \ - {"IPC_Q9_DATA1", ELEM_OUTPUT_INT, {0x1288}, {0x4}}, \ - {"IPC_Q9_DATA2", ELEM_OUTPUT_INT, {0x128C}, {0x4}}, \ - {"IPC_Q9_DATA3", ELEM_OUTPUT_INT, {0x1290}, {0x4}}, \ - {"IPC_Q9_DATA4", ELEM_OUTPUT_INT, {0x1294}, {0x4}}, \ - {"IPC_Q9_DATA5", ELEM_OUTPUT_INT, {0x1298}, {0x4}}, \ - {"IPC_Q9_DATA6", ELEM_OUTPUT_INT, {0x129C}, {0x4}}, \ - {"IPC_Q9_DATA7", ELEM_OUTPUT_INT, {0x12A0}, {0x4}}, \ - {"IPC_Q9_SYSCNT", ELEM_OUTPUT_INT, {0x12A4}, {0x4}}, \ - {"***DDR_REG_DUMP*******", ELEM_OUTPUT_STR, {0x00}, {0x8}}, \ - {"DDR_REG_DUMP0", ELEM_OUTPUT_INT, {0x3C60}, {0x8}}, \ - {"DDR_REG_DUMP1", ELEM_OUTPUT_INT, {0x3C68}, {0x8}}, \ - {"DDR_REG_DUMP2", ELEM_OUTPUT_INT, {0x3C70}, {0x8}}, \ - {"DDR_REG_DUMP3", ELEM_OUTPUT_INT, {0x3C78}, {0x8}}, \ - {"DDR_REG_DUMP4", ELEM_OUTPUT_INT, {0x3C80}, {0x8}}, \ - {"DDR_REG_DUMP5", ELEM_OUTPUT_INT, {0x3C88}, {0x8}}, \ - {"DDR_REG_DUMP6", ELEM_OUTPUT_INT, {0x3C90}, {0x8}}, \ - {"DDR_REG_DUMP7", ELEM_OUTPUT_INT, {0x3C98}, {0x8}}, \ -} - -#define DATA_MODEL_LPFW_PMU MODEL_VECTOR(LPFW_PMU) = { \ - {"cpuid", ELEM_OUTPUT_INT, {0x0000}, {0x1}}, \ - {"slaveid", ELEM_OUTPUT_INT, {0x0001}, {0x1}}, \ - {"loopid", ELEM_OUTPUT_INT, {0x0002}, {0x1}}, \ - {"79H", ELEM_OUTPUT_HEX, {0x0004}, {0x2}}, \ - {"7AH", ELEM_OUTPUT_HEX, {0x0006}, {0x1}}, \ - {"7BH", ELEM_OUTPUT_HEX, {0x0007}, {0x1}}, \ - {"7CH", ELEM_OUTPUT_HEX, {0x0008}, {0x1}}, \ - {"7DH", ELEM_OUTPUT_HEX, {0x0009}, {0x1}}, \ - {"7EH", ELEM_OUTPUT_HEX, {0x000A}, {0x1}}, \ - {"80H", ELEM_OUTPUT_HEX, {0x000B}, {0x1}}, \ - {"88H", ELEM_OUTPUT_HEX, {0x000C}, {0x2}}, \ - {"89H", ELEM_OUTPUT_HEX, {0x000E}, {0x2}}, \ - {"8BH", ELEM_OUTPUT_HEX, {0x0010}, {0x2}}, \ - {"8CH", ELEM_OUTPUT_HEX, {0x0012}, {0x2}}, \ - {"8DH", ELEM_OUTPUT_HEX, {0x0014}, {0x2}}, \ - {"96H", ELEM_OUTPUT_HEX, {0x0016}, {0x2}}, \ - {"97H", ELEM_OUTPUT_HEX, {0x0018}, {0x2}}, \ - {"20H", ELEM_OUTPUT_HEX, {0x001A}, {0x1}}, \ - {"21H", ELEM_OUTPUT_HEX, {0x001C}, {0x2}}, \ -} - -/* TEE module */ -#define DATA_MODEL_TEE MODEL_VECTOR(TEE) = { \ - {"tee info", ELEM_OUTPUT_STR_NL, {0x0}, {0x10000}}, \ -} - -/* TF module */ -#define DATA_MODEL_TF MODEL_VECTOR(TF) = { \ - {"x0", ELEM_OUTPUT_HEX, {0x0}, {0x8}}, \ - {"x1", ELEM_OUTPUT_HEX, {0x8}, {0x8}}, \ - {"x30", ELEM_OUTPUT_HEX, {0x10}, {0x8}}, \ - {"x2", ELEM_OUTPUT_HEX, {0x18}, {0x8}}, \ - {"x3", ELEM_OUTPUT_HEX, {0x20}, {0x8}}, \ - {"x4", ELEM_OUTPUT_HEX, {0x28}, {0x8}}, \ - {"x5", ELEM_OUTPUT_HEX, {0x30}, {0x8}}, \ - {"x6", ELEM_OUTPUT_HEX, {0x38}, {0x8}}, \ - {"x7", ELEM_OUTPUT_HEX, {0x40}, {0x8}}, \ - {"x8", ELEM_OUTPUT_HEX, {0x48}, {0x8}}, \ - {"x9", ELEM_OUTPUT_HEX, {0x50}, {0x8}}, \ - {"x10", ELEM_OUTPUT_HEX, {0x58}, {0x8}}, \ - {"x11", ELEM_OUTPUT_HEX, {0x60}, {0x8}}, \ - {"x12", ELEM_OUTPUT_HEX, {0x68}, {0x8}}, \ - {"x13", ELEM_OUTPUT_HEX, {0x70}, {0x8}}, \ - {"x14", ELEM_OUTPUT_HEX, {0x78}, {0x8}}, \ - {"x15", ELEM_OUTPUT_HEX, {0x80}, {0x8}}, \ - {"x16", ELEM_OUTPUT_HEX, {0x88}, {0x8}}, \ - {"x17", ELEM_OUTPUT_HEX, {0x90}, {0x8}}, \ - {"x18", ELEM_OUTPUT_HEX, {0x98}, {0x8}}, \ - {"x19", ELEM_OUTPUT_HEX, {0xA0}, {0x8}}, \ - {"x20", ELEM_OUTPUT_HEX, {0xA8}, {0x8}}, \ - {"x21", ELEM_OUTPUT_HEX, {0xB0}, {0x8}}, \ - {"x22", ELEM_OUTPUT_HEX, {0xB8}, {0x8}}, \ - {"x23", ELEM_OUTPUT_HEX, {0xC0}, {0x8}}, \ - {"x24", ELEM_OUTPUT_HEX, {0xC8}, {0x8}}, \ - {"x25", ELEM_OUTPUT_HEX, {0xD0}, {0x8}}, \ - {"x26", ELEM_OUTPUT_HEX, {0xD8}, {0x8}}, \ - {"x27", ELEM_OUTPUT_HEX, {0xE0}, {0x8}}, \ - {"x28", ELEM_OUTPUT_HEX, {0xE8}, {0x8}}, \ - {"x29", ELEM_OUTPUT_HEX, {0xF0}, {0x8}}, \ - {"scr_el3", ELEM_OUTPUT_HEX, {0xF8}, {0x8}}, \ - {"sctlr_el3", ELEM_OUTPUT_HEX, {0x100}, {0x8}}, \ - {"cptr_el3", ELEM_OUTPUT_HEX, {0x108}, {0x8}}, \ - {"tcr_el3", ELEM_OUTPUT_HEX, {0x110}, {0x8}}, \ - {"daif", ELEM_OUTPUT_HEX, {0x118}, {0x8}}, \ - {"mair_el3", ELEM_OUTPUT_HEX, {0x120}, {0x8}}, \ - {"spsr_el3", ELEM_OUTPUT_HEX, {0x128}, {0x8}}, \ - {"elr_el3", ELEM_OUTPUT_HEX, {0x130}, {0x8}}, \ - {"ttbr0_el3", ELEM_OUTPUT_HEX, {0x138}, {0x8}}, \ - {"esr_el3", ELEM_OUTPUT_HEX, {0x140}, {0x8}}, \ - {"far_el3", ELEM_OUTPUT_HEX, {0x148}, {0x8}}, \ -} - -/* DVPP module */ -#define DATA_MODEL_DVPP MODEL_VECTOR(DVPP) = { \ - {"dvpp info", ELEM_OUTPUT_STR_NL, {0x0}, {0x10000}}, \ -} - -/* DRIVE module */ -#define DATA_MODEL_DRIVER MODEL_VECTOR(DRIVER) = { \ - {"driver info", ELEM_OUTPUT_STR_NL, {0x0}, {0x20000}}, \ -} - -/* TS module */ -#define DATA_MODEL_TS MODEL_VECTOR(TS) = { \ - {"ts info", ELEM_OUTPUT_CHAR, {0x0}, {0x100000}}, \ -} - -/* TS module, start */ -#define DATA_MODEL_TS_START MODEL_VECTOR(TS_START) = { \ - {"ts start info", ELEM_OUTPUT_STR_NL, {0x0}, {0xC800}}, \ -} - -/* AP module, early print */ -#define DATA_MODEL_AP_EPRINT MODEL_VECTOR(AP_EPRINT) = { \ - {"early print info", ELEM_OUTPUT_STR_NL, {0x0}, {0x400}}, \ -} - -/* BIOS module */ -#define DATA_MODEL_BIOS MODEL_VECTOR(BIOS) = { \ - {"bios info", ELEM_OUTPUT_STR_NL, {0x0}, {0x50000}}, \ -} - -/* BIOS module, sram */ -#define DATA_MODEL_BIOS_SRAM MODEL_VECTOR(BIOS_SRAM) = { \ - {"LPM3_WAKE_UP_STATUS", ELEM_OUTPUT_INT, {0x0}, {0x4}}, \ - {"DEBUG_TIME_POWERUP_DONE", ELEM_OUTPUT_INT, {0x28}, {0x4}}, \ - {"DEBUG_TIME_PERSTHIGH_DONE", ELEM_OUTPUT_INT, {0x2C}, {0x4}}, \ - {"DEBUG_TIME_PCIEPHY_DONE", ELEM_OUTPUT_INT, {0x30}, {0x4}}, \ - {"DEBUG_TIME_PHY_FIRMWARE_DONE", ELEM_OUTPUT_INT, {0x34}, {0x4}}, \ - {"DEBUG_TIME_PCIECTRL_DONE", ELEM_OUTPUT_INT, {0x38}, {0x4}}, \ - {"DEBUG_TIME_IMG_DONE", ELEM_OUTPUT_INT, {0x3C}, {0x4}}, \ - {"DEBUG_TIME_SECURE_DONE", ELEM_OUTPUT_INT, {0x40}, {0x4}}, \ - {"DEBUG_VERSION_ADDR", ELEM_OUTPUT_HEX, {0x50}, {0x10}}, \ - {"XLOADER_RESET_REG", ELEM_OUTPUT_INT, {0x200}, {0x4}}, \ - {"XLOADER_KEY_POINT", ELEM_OUTPUT_INT, {0x204}, {0x4}}, \ - {"XLOADER_TIME_POWERUP_DONE", ELEM_OUTPUT_INT, {0x228}, {0x4}}, \ - {"XLOADER_TIME_PERSTHIGH_DONE", ELEM_OUTPUT_INT, {0x22C}, {0x4}}, \ - {"XLOADER_TIME_PCIEPHY_DONE", ELEM_OUTPUT_INT, {0x230}, {0x4}}, \ - {"XLOADER_TIME_PHY_FIRMWARE_DONE", ELEM_OUTPUT_INT, {0x234}, {0x4}}, \ - {"XLOADER_TIME_PCIECTRL_DONE", ELEM_OUTPUT_INT, {0x238}, {0x4}}, \ - {"XLOADER_TIME_PCIE_DETECT_DONE", ELEM_OUTPUT_INT, {0x23C}, {0x4}}, \ - {"UEFI_LAST_KEYPOINT", ELEM_OUTPUT_INT, {0x320}, {0x4}}, \ - {"SD_LOAD_FILE_STATUS", ELEM_OUTPUT_INT, {0x350}, {0x4}}, \ -} - -/* NETWORK module */ -#define DATA_MODEL_NETWORK MODEL_VECTOR(NETWORK) = { \ - {"network info", ELEM_OUTPUT_STR, {0x0}, {0x20000}}, \ -} - -#define DATA_MODEL_IMU_BOOT_LOG MODEL_VECTOR(IMU_BOOT_LOG) = { \ - {"imu log buffer", ELEM_FEATURE_LOOPBUF, {1}, {6}}, \ - {"buf_read", ELEM_CTRL_LPBF_READ, {0x0}, {0x4}}, \ - {"buf_len", ELEM_CTRL_LPBF_SIZE, {0x4}, {0x4}}, \ - {"log_level", ELEM_OUTPUT_INT, {0x8}, {0x4}}, \ - {"rollback", ELEM_CTRL_LPBF_ROLLBK, {0x10}, {0x4}}, \ - {"buf_write", ELEM_CTRL_LPBF_WRITE, {0x40}, {0x4}}, \ - {"buf_head_len", ELEM_CTRL_LPBF_HEAD, {0x80}, {0x4}}, \ - {"imu log data", ELEM_FEATURE_CHARLOG, {1}, {1}}, \ - {"imu log", ELEM_OUTPUT_STR_NL, {0x80}, {0xFFF80}}, \ -} - -#define DATA_MODEL_IMU_UEFI_BOOT MODEL_VECTOR(IMU_UEFI_BOOT) = { \ - {"imu log buffer", ELEM_FEATURE_LOOPBUF, {1}, {6}}, \ - {"buf_read", ELEM_CTRL_LPBF_READ, {0x0}, {0x4}}, \ - {"buf_len", ELEM_CTRL_LPBF_SIZE, {0x4}, {0x4}}, \ - {"log_level", ELEM_OUTPUT_INT, {0x8}, {0x4}}, \ - {"rollback", ELEM_CTRL_LPBF_ROLLBK, {0x10}, {0x4}}, \ - {"buf_write", ELEM_CTRL_LPBF_WRITE, {0x40}, {0x4}}, \ - {"buf_head_len", ELEM_CTRL_LPBF_HEAD, {0x80}, {0x4}}, \ - {"imu log data", ELEM_FEATURE_CHARLOG, {1}, {1}}, \ - {"imu log", ELEM_OUTPUT_STR_NL, {0x80}, {0x2FFF80}}, \ -} - -#define DATA_MODEL_IMU_RUN_LOG MODEL_VECTOR(IMU_RUN_LOG) = { \ - {"imu log buffer", ELEM_FEATURE_LOOPBUF, {1}, {6}}, \ - {"buf_read", ELEM_CTRL_LPBF_READ, {0x0}, {0x4}}, \ - {"buf_len", ELEM_CTRL_LPBF_SIZE, {0x4}, {0x4}}, \ - {"log_level", ELEM_OUTPUT_INT, {0x8}, {0x4}}, \ - {"rollback", ELEM_CTRL_LPBF_ROLLBK, {0x10}, {0x4}}, \ - {"buf_write", ELEM_CTRL_LPBF_WRITE, {0x40}, {0x4}}, \ - {"buf_head_len", ELEM_CTRL_LPBF_HEAD, {0x80}, {0x4}}, \ - {"imu log data", ELEM_FEATURE_CHARLOG, {1}, {1}}, \ - {"imu log", ELEM_OUTPUT_STR_NL, {0x80}, {0x3FFF80}}, \ -} - -// lpfw exception with imu log -#define DATA_MODEL_LPFW_LOG MODEL_VECTOR(LPFW_LOG) = { \ - {"IMU BOOT LOG", ELEM_CTRL_TABLE_GOTO, {0x0}, {0x100000}}, \ - {"table_index", ELEM_CTRL_TABLE_RANGE, {PLAINTEXT_TABLE_IMU_BOOT_LOG}, {0x1}}, \ - {"IMU RUN LOG", ELEM_CTRL_TABLE_GOTO, {0x400000}, {0x400000}}, \ - {"table_index", ELEM_CTRL_TABLE_RANGE, {PLAINTEXT_TABLE_IMU_RUN_LOG}, {0x1}}, \ -} - -// bbox kbox info -#define DATA_MODEL_BBOX_KBOX MODEL_VECTOR(BBOX_KBOX) = { \ - {"CONSOLE START", ELEM_OUTPUT_DIVIDE, {0x0}, {0x2D}}, \ - {"[console info]", ELEM_OUTPUT_STR_NL, {0x0}, {0x10000}}, \ - {"CONSOLE END", ELEM_OUTPUT_DIVIDE, {0x0}, {0x2D}}, \ - {"MESSAGE START", ELEM_OUTPUT_DIVIDE, {0x0}, {0x2D}}, \ - {"[message info]", ELEM_OUTPUT_STR_NL, {0x10000}, {0x40000}}, \ - {"MESSAGE END", ELEM_OUTPUT_DIVIDE, {0x0}, {0x2D}}, \ - {"if panic", ELEM_CTRL_COMPARE, {0x50000}, {0x1}}, \ - {"", ELEM_CTRL_CMP_JUMP_EQ, {0x0}, {0x3}}, \ - {"PANIC START", ELEM_OUTPUT_DIVIDE, {0x0}, {0x2D}}, \ - {"[panic info]", ELEM_OUTPUT_STR_NL, {0x50000}, {0x8000}}, \ - {"PANIC END", ELEM_OUTPUT_DIVIDE, {0x0}, {0x2D}}, \ - {"if emerge", ELEM_CTRL_COMPARE, {0x58000}, {0x1}}, \ - {"", ELEM_CTRL_CMP_JUMP_EQ, {0x0}, {0x3}}, \ - {"EMERGE START", ELEM_OUTPUT_DIVIDE, {0x0}, {0x2D}}, \ - {"[emerge info]", ELEM_OUTPUT_STR_NL, {0x58000}, {0x8000}}, \ - {"EMERGE END", ELEM_OUTPUT_DIVIDE, {0x0}, {0x2D}}, \ - {"if die", ELEM_CTRL_COMPARE, {0x60000}, {0x1}}, \ - {"", ELEM_CTRL_CMP_JUMP_EQ, {0x0}, {0x3}}, \ - {"DIE START", ELEM_OUTPUT_DIVIDE, {0x0}, {0x2D}}, \ - {"[die info]", ELEM_OUTPUT_STR_NL, {0x60000}, {0x20000}}, \ - {"DIE END", ELEM_OUTPUT_DIVIDE, {0x0}, {0x2D}}, \ -} - -/** - * the whole space is 512k, used for histroy data record - * the struct distribution is as follows: - * +-------------------+ - * | head info(1k) | region: area: module block: - * +-------------------+ +--------------------+ +-----------------+ +-----------------+ - * | boot region |---->| first area |---->| module block |---->| block head | - * +-------------------+ +--------------------+ +-----------------+ +-----------------+ - * | run region | | second area | | module block | | block data | - * +-------------------+ +--------------------+ +-----------------+ +-----------------+ - * | reserved | | ...... | | ...... | - * +-------------------+ +--------------------+ +-----------------+ - */ -#define DATA_MODEL_HDR_BOOT_BIOS MODEL_VECTOR(HDR_BOOT_BIOS) = { \ - {"magic", ELEM_OUTPUT_INT, {0x0}, {0x4}}, \ - {"version", ELEM_OUTPUT_INT, {0x4}, {0x4}}, \ - {"module id", ELEM_OUTPUT_INT, {0x8}, {0x4}}, \ - {"if", ELEM_CTRL_COMPARE, {0xC}, {0x4}}, \ - {"is used", ELEM_CTRL_CMP_JUMP_NE, {0x1}, {0xFF}}, \ - {"err code", ELEM_OUTPUT_INT, {0x10}, {0x4}}, \ - {"reason", ELEM_OUTPUT_INT, {0x14}, {0x4}}, \ - {"hot reset index", ELEM_OUTPUT_INT, {0x18}, {0x4}}, \ - {"bsbc point", ELEM_OUTPUT_INT, {0x1C}, {0x4}}, \ - {"bsbc exc point", ELEM_OUTPUT_INT, {0x20}, {0x4}}, \ - {"hboot1 point", ELEM_OUTPUT_INT, {0x24}, {0x4}}, \ - {"hboot1 exc point", ELEM_OUTPUT_INT, {0x28}, {0x4}}, \ - {"hboot2 point", ELEM_OUTPUT_INT, {0x2C}, {0x4}}, \ - {"hboot2 exc point", ELEM_OUTPUT_INT, {0x30}, {0x4}}, \ - {"[BIOS info]", ELEM_OUTPUT_STR_NL, {0x480}, {0x2780}}, \ -} - -#define DATA_MODEL_HDR_BOOT_DDR MODEL_VECTOR(HDR_BOOT_DDR) = { \ - {"magic", ELEM_OUTPUT_INT, {0x0}, {0x4}}, \ - {"version", ELEM_OUTPUT_INT, {0x4}, {0x4}}, \ - {"module id", ELEM_OUTPUT_INT, {0x8}, {0x4}}, \ - {"if", ELEM_CTRL_COMPARE, {0xC}, {0x4}}, \ - {"is used", ELEM_CTRL_CMP_JUMP_NE, {0x1}, {0xFF}}, \ - {"err code", ELEM_OUTPUT_INT, {0x10}, {0x4}}, \ - {"reason", ELEM_OUTPUT_INT, {0x14}, {0x4}}, \ - {"hot reset index", ELEM_OUTPUT_INT, {0x18}, {0x4}}, \ - {"magic_begin", ELEM_OUTPUT_INT, {0x1C}, {0x4}}, \ - {"init_keypoint", ELEM_OUTPUT_INT, {0x20}, {0x4}}, \ - {"ldo8_vol", ELEM_OUTPUT_INT, {0x24}, {0x4}}, \ - {"buck3_status", ELEM_OUTPUT_INT, {0x28}, {0x4}}, \ - {"buck3_vol", ELEM_OUTPUT_INT, {0x2C}, {0x4}}, \ - {"buck5_status", ELEM_OUTPUT_INT, {0x30}, {0x4}}, \ - {"buck5_vol", ELEM_OUTPUT_INT, {0x34}, {0x4}}, \ - {"wr_test_result", ELEM_OUTPUT_INT, {0x38}, {0x4}}, \ - {"rint_status[0]", ELEM_OUTPUT_INT, {0x3C}, {0x4}}, \ - {"rint_status[1]", ELEM_OUTPUT_INT, {0x40}, {0x4}}, \ - {"rint_status[2]", ELEM_OUTPUT_INT, {0x44}, {0x4}}, \ - {"rint_status[3]", ELEM_OUTPUT_INT, {0x48}, {0x4}}, \ - {"rint_status[4]", ELEM_OUTPUT_INT, {0x4C}, {0x4}}, \ - {"rint_status[5]", ELEM_OUTPUT_INT, {0x50}, {0x4}}, \ - {"rint_status[6]", ELEM_OUTPUT_INT, {0x54}, {0x4}}, \ - {"rint_status[7]", ELEM_OUTPUT_INT, {0x58}, {0x4}}, \ - {"SOC_SCTRL_DDRRETENTION_ADDR", ELEM_OUTPUT_INT, {0x5C}, {0x4}}, \ - {"SOC_SCTRL_DDRRETENTIONCLR_ADDR", ELEM_OUTPUT_INT, {0x60}, {0x4}}, \ - {"SOC_SCTRL_DRAMRETENTION_ADDR", ELEM_OUTPUT_INT, {0x64}, {0x4}}, \ - {"SC_DDRC_0_3_RESET_REQ", ELEM_OUTPUT_INT, {0x68}, {0x4}}, \ - {"SC_DDRC_4_7_RESET_REQ", ELEM_OUTPUT_INT, {0x6C}, {0x4}}, \ - {"SC_DDRC_0_3_PACK_RESET_REQ", ELEM_OUTPUT_INT, {0x70}, {0x4}}, \ - {"SC_DDRC_4_7_PACK_RESET_REQ", ELEM_OUTPUT_INT, {0x74}, {0x4}}, \ - {"SC_DDRC_EXMBIST0_REGS_RESET_REQ", ELEM_OUTPUT_INT, {0x78}, {0x4}}, \ - {"SC_DDRC_EXMBIST1_REGS_RESET_REQ", ELEM_OUTPUT_INT, {0x7C}, {0x4}}, \ - {"SOC_SCTRL_DDRC_0_3_AO_RST_ADDR", ELEM_OUTPUT_INT, {0x80}, {0x4}}, \ - {"SOC_SCTRL_DDRC_4_7_AO_RST_ADDR", ELEM_OUTPUT_INT, {0x84}, {0x4}}, \ - {"SOC_PMCTRL_PPLLBYPASS0_ADDR", ELEM_OUTPUT_INT, {0x88}, {0x4}}, \ - {"SOC_PMCTRL_PPLLBYPASS1_ADDR", ELEM_OUTPUT_INT, {0x8C}, {0x4}}, \ - {"SOC_PMCTRL_PPLL3FCTRL_ADDR", ELEM_OUTPUT_INT, {0x90}, {0x4}}, \ - {"SOC_PMCTRL_PPLL3FCTRL_FRAC_ADDR", ELEM_OUTPUT_INT, {0x94}, {0x4}}, \ - {"SOC_PMCTRL_PPLL4FCTRL_ADDR", ELEM_OUTPUT_INT, {0x98}, {0x4}}, \ - {"SOC_PMCTRL_PPLL4FCTRL_FRAC_ADDR", ELEM_OUTPUT_INT, {0x9C}, {0x4}}, \ - {"SOC_PMCTRL_PPLLOCKSTATUS_ADDR", ELEM_OUTPUT_INT, {0x100}, {0x4}}, \ - {"SC_DDRC_0_3_BYPASS_MODE_CTRL", ELEM_OUTPUT_INT, {0x104}, {0x4}}, \ - {"SC_DDRC_4_7_BYPASS_MODE_CTRL", ELEM_OUTPUT_INT, {0x108}, {0x4}}, \ - {"SC_PLL_PROF_CFG1", ELEM_OUTPUT_INT, {0x10C}, {0x4}}, \ -} - -#define DATA_MODEL_HDR_BOOT_TEE MODEL_VECTOR(HDR_BOOT_TEE) = { \ - {"magic", ELEM_OUTPUT_INT, {0x0}, {0x4}}, \ - {"version", ELEM_OUTPUT_INT, {0x4}, {0x4}}, \ - {"module id", ELEM_OUTPUT_INT, {0x8}, {0x4}}, \ - {"if", ELEM_CTRL_COMPARE, {0xC}, {0x4}}, \ - {"is used", ELEM_CTRL_CMP_JUMP_NE, {0x1}, {0xFF}}, \ - {"err code", ELEM_OUTPUT_INT, {0x10}, {0x4}}, \ - {"reason", ELEM_OUTPUT_INT, {0x14}, {0x4}}, \ - {"hot reset index", ELEM_OUTPUT_INT, {0x18}, {0x4}}, \ - {"[BOOT FATAL INFO SIZE]", ELEM_OUTPUT_INT, {0x1C}, {0x4}}, \ - {"[BOOT FATAL INFO]", ELEM_OUTPUT_STR_NL, {0x20}, {0x7E0}}, \ - {"[run point tail]", ELEM_OUTPUT_INT, {0x800}, {0x4}}, \ - {"[boot point info]", ELEM_OUTPUT_HEX, {0x804}, {0x20}}, \ - {"[run point info]", ELEM_OUTPUT_HEX, {0x884}, {0x20}}, \ - {"[last log size]", ELEM_OUTPUT_INT, {0xC00}, {0x4}}, \ - {"[last log data]", ELEM_OUTPUT_STR_NL, {0xC04}, {0x3FC}}, \ -} - -#define DATA_MODEL_HDR_BOOT_ATF MODEL_VECTOR(HDR_BOOT_ATF) = { \ - {"magic", ELEM_OUTPUT_INT, {0x0}, {0x4}}, \ - {"version", ELEM_OUTPUT_INT, {0x4}, {0x4}}, \ - {"module id", ELEM_OUTPUT_INT, {0x8}, {0x4}}, \ - {"if", ELEM_CTRL_COMPARE, {0xC}, {0x4}}, \ - {"is used", ELEM_CTRL_CMP_JUMP_NE, {0x1}, {0xFF}}, \ - {"err code", ELEM_OUTPUT_INT, {0x10}, {0x4}}, \ - {"reason", ELEM_OUTPUT_INT, {0x14}, {0x4}}, \ - {"hot reset index", ELEM_OUTPUT_INT, {0x18}, {0x4}}, \ - {"[ATF info]", ELEM_OUTPUT_STR_NL, {0x1C}, {0xFE4}}, \ -} - -#define DATA_MODEL_HDR_BOOT_AREA MODEL_VECTOR(HDR_BOOT_AREA) = { \ - {"BIOS INFO", ELEM_OUTPUT_DIVIDE, {0x0}, {0x2D}}, \ - {"HDR_BOOT_BIOS", ELEM_CTRL_TABLE_GOTO, {0x0}, {0x3000}}, \ - {"table_index", ELEM_CTRL_TABLE_RANGE, {PLAINTEXT_TABLE_HDR_BOOT_BIOS}, {0x1}}, \ - {"NL", ELEM_OUTPUT_NL, {0x0}, {0x0}}, \ - {"DDR INFO", ELEM_OUTPUT_DIVIDE, {0x0}, {0x2D}}, \ - {"HDR_BOOT_DDR", ELEM_CTRL_TABLE_GOTO, {0x3000}, {0x1000}}, \ - {"table_index", ELEM_CTRL_TABLE_RANGE, {PLAINTEXT_TABLE_HDR_BOOT_DDR}, {0x1}}, \ - {"NL", ELEM_OUTPUT_NL, {0x0}, {0x0}}, \ - {"TEE INFO", ELEM_OUTPUT_DIVIDE, {0x0}, {0x2D}}, \ - {"HDR_BOOT_TEE", ELEM_CTRL_TABLE_GOTO, {0x4000}, {0x1000}}, \ - {"table_index", ELEM_CTRL_TABLE_RANGE, {PLAINTEXT_TABLE_HDR_BOOT_TEE}, {0x1}}, \ - {"NL", ELEM_OUTPUT_NL, {0x0}, {0x0}}, \ - {"ATF INFO", ELEM_OUTPUT_DIVIDE, {0x0}, {0x2D}}, \ - {"HDR_BOOT_ATF", ELEM_CTRL_TABLE_GOTO, {0x5000}, {0x1000}}, \ - {"table_index", ELEM_CTRL_TABLE_RANGE, {PLAINTEXT_TABLE_HDR_BOOT_ATF}, {0x1}}, \ - {"NL", ELEM_OUTPUT_NL, {0x0}, {0x0}}, \ -} - -#define DATA_MODEL_HDR_RUN_OS MODEL_VECTOR(HDR_RUN_OS) = { \ - {"magic", ELEM_OUTPUT_INT, {0x0}, {0x4}}, \ - {"version", ELEM_OUTPUT_INT, {0x4}, {0x4}}, \ - {"module id", ELEM_OUTPUT_INT, {0x8}, {0x4}}, \ - {"if", ELEM_CTRL_COMPARE, {0xC}, {0x4}}, \ - {"is used", ELEM_CTRL_CMP_JUMP_NE, {0x1}, {0xFF}}, \ - {"err code", ELEM_OUTPUT_INT, {0x10}, {0x4}}, \ - {"reason", ELEM_OUTPUT_INT, {0x14}, {0x4}}, \ - {"hot reset index", ELEM_OUTPUT_INT, {0x18}, {0x4}}, \ - {"[OS info]", ELEM_OUTPUT_STR_CONST, {0x0}, {0x0}}, \ - {"event_flag", ELEM_OUTPUT_INT, {0x1C}, {0x4}}, \ - {"dump_flag", ELEM_OUTPUT_INT, {0x20}, {0x4}}, \ - {"err num", ELEM_OUTPUT_INT, {0x24}, {0x4}}, \ - {"[OS log]", ELEM_OUTPUT_STR_NL, {0x100}, {0xF00}}, \ -} - -#define DATA_MODEL_HDR_RUN_LPFW MODEL_VECTOR(HDR_RUN_LPFW) = { \ - {"magic", ELEM_OUTPUT_INT, {0x0}, {0x4}}, \ - {"version", ELEM_OUTPUT_INT, {0x4}, {0x4}}, \ - {"module id", ELEM_OUTPUT_INT, {0x8}, {0x4}}, \ - {"if", ELEM_CTRL_COMPARE, {0xC}, {0x4}}, \ - {"is used", ELEM_CTRL_CMP_JUMP_NE, {0x1}, {0x200}}, \ - {"err code", ELEM_OUTPUT_INT, {0x10}, {0x4}}, \ - {"reason", ELEM_OUTPUT_INT, {0x14}, {0x4}}, \ - {"hot reset index", ELEM_OUTPUT_INT, {0x18}, {0x4}}, \ - {"[LPFW log]", ELEM_OUTPUT_STR_NL, {0x40}, {0x400}}, \ -} - -#define DATA_MODEL_HDR_RUN_TEE MODEL_VECTOR(HDR_RUN_TEE) = { \ - {"magic", ELEM_OUTPUT_INT, {0x0}, {0x4}}, \ - {"version", ELEM_OUTPUT_INT, {0x4}, {0x4}}, \ - {"module id", ELEM_OUTPUT_INT, {0x8}, {0x4}}, \ - {"if", ELEM_CTRL_COMPARE, {0xC}, {0x4}}, \ - {"is used", ELEM_CTRL_CMP_JUMP_NE, {0x1}, {0xFF}}, \ - {"err code", ELEM_OUTPUT_INT, {0x10}, {0x4}}, \ - {"reason", ELEM_OUTPUT_INT, {0x14}, {0x4}}, \ - {"hot reset index", ELEM_OUTPUT_INT, {0x18}, {0x4}}, \ - {"[RUN FATAL INFO SIZE]", ELEM_OUTPUT_INT, {0x1C}, {0x4}}, \ - {"[RUN FATAL INFO]", ELEM_OUTPUT_STR_NL, {0x20}, {0x7E0}}, \ -} - -#define DATA_MODEL_HDR_RUN_ATF MODEL_VECTOR(HDR_RUN_ATF) = {\ - {"magic", ELEM_OUTPUT_INT, {0x0}, {0x4}}, \ - {"version", ELEM_OUTPUT_INT, {0x4}, {0x4}}, \ - {"module id", ELEM_OUTPUT_INT, {0x8}, {0x4}}, \ - {"if", ELEM_CTRL_COMPARE, {0xC}, {0x4}}, \ - {"is used", ELEM_CTRL_CMP_JUMP_NE, {0x1}, {0xFF}}, \ - {"err code", ELEM_OUTPUT_INT, {0x10}, {0x4}}, \ - {"reason", ELEM_OUTPUT_INT, {0x14}, {0x4}}, \ - {"hot reset index", ELEM_OUTPUT_INT, {0x18}, {0x4}}, \ - {"[ATF info]", ELEM_OUTPUT_STR_NL, {0x1C}, {0x7E4}}, \ -} - -#define DATA_MODEL_HDR_RUN_AREA MODEL_VECTOR(HDR_RUN_AREA) = { \ - {"TEE INFO", ELEM_OUTPUT_DIVIDE, {0x0}, {0x2D}}, \ - {"HDR_RUN_TEE", ELEM_CTRL_TABLE_GOTO, {0x0}, {0x800}}, \ - {"table_index", ELEM_CTRL_TABLE_RANGE, {PLAINTEXT_TABLE_HDR_RUN_TEE}, {0x1}}, \ - {"NL", ELEM_OUTPUT_NL, {0x0}, {0x0}}, \ - {"ATF INFO", ELEM_OUTPUT_DIVIDE, {0x0}, {0x2D}}, \ - {"HDR_RUN_ATF", ELEM_CTRL_TABLE_GOTO, {0x800}, {0x800}}, \ - {"table_index", ELEM_CTRL_TABLE_RANGE, {PLAINTEXT_TABLE_HDR_RUN_ATF}, {0x1}}, \ - {"NL", ELEM_OUTPUT_NL, {0x0}, {0x0}}, \ - {"LPFW INFO", ELEM_OUTPUT_DIVIDE, {0x0}, {0x2D}}, \ - {"HDR_RUN_LPFW", ELEM_CTRL_TABLE_GOTO, {0x1000}, {0x1000}}, \ - {"table_index", ELEM_CTRL_TABLE_RANGE, {PLAINTEXT_TABLE_HDR_RUN_LPFW}, {0x1}}, \ - {"NL", ELEM_OUTPUT_NL, {0x0}, {0x0}}, \ - {"OS INFO", ELEM_OUTPUT_DIVIDE, {0x0}, {0x2D}}, \ - {"HDR_RUN_OS", ELEM_CTRL_TABLE_GOTO, {0x2000}, {0x1000}}, \ - {"table_index", ELEM_CTRL_TABLE_RANGE, {PLAINTEXT_TABLE_HDR_RUN_OS}, {0x1}}, \ - {"NL", ELEM_OUTPUT_NL, {0x0}, {0x0}}, \ -} - -#define DATA_MODEL_HDR_BOOT MODEL_VECTOR(HDR_BOOT) = { \ - {"area 0", ELEM_OUTPUT_DIVIDE, {0x0}, {0x3D}}, \ - {"HDR_BOOT_AREA", ELEM_CTRL_TABLE_GOTO, {0x0}, {0x7800}}, \ - {"table_index", ELEM_CTRL_TABLE_RANGE, {PLAINTEXT_TABLE_HDR_BOOT_AREA}, {0x1}}, \ - {"NL", ELEM_OUTPUT_NL, {0x0}, {0x0}}, \ - {"area 1", ELEM_OUTPUT_DIVIDE, {0x0}, {0x3D}}, \ - {"HDR_BOOT_AREA", ELEM_CTRL_TABLE_GOTO, {0x7800}, {0x7800}}, \ - {"table_index", ELEM_CTRL_TABLE_RANGE, {PLAINTEXT_TABLE_HDR_BOOT_AREA}, {0x1}}, \ - {"NL", ELEM_OUTPUT_NL, {0x0}, {0x0}}, \ - {"area 2", ELEM_OUTPUT_DIVIDE, {0x0}, {0x3D}}, \ - {"HDR_BOOT_AREA", ELEM_CTRL_TABLE_GOTO, {0xF000}, {0x7800}}, \ - {"table_index", ELEM_CTRL_TABLE_RANGE, {PLAINTEXT_TABLE_HDR_BOOT_AREA}, {0x1}}, \ - {"NL", ELEM_OUTPUT_NL, {0x0}, {0x0}}, \ - {"area 3", ELEM_OUTPUT_DIVIDE, {0x0}, {0x3D}}, \ - {"HDR_BOOT_AREA", ELEM_CTRL_TABLE_GOTO, {0x16800}, {0x7800}}, \ - {"table_index", ELEM_CTRL_TABLE_RANGE, {PLAINTEXT_TABLE_HDR_BOOT_AREA}, {0x1}}, \ - {"NL", ELEM_OUTPUT_NL, {0x0}, {0x0}}, \ - {"area 4", ELEM_OUTPUT_DIVIDE, {0x0}, {0x3D}}, \ - {"HDR_BOOT_AREA", ELEM_CTRL_TABLE_GOTO, {0x1E000}, {0x7800}}, \ - {"table_index", ELEM_CTRL_TABLE_RANGE, {PLAINTEXT_TABLE_HDR_BOOT_AREA}, {0x1}}, \ - {"NL", ELEM_OUTPUT_NL, {0x0}, {0x0}}, \ - {"area 5", ELEM_OUTPUT_DIVIDE, {0x0}, {0x3D}}, \ - {"HDR_BOOT_AREA", ELEM_CTRL_TABLE_GOTO, {0x25800}, {0x7800}}, \ - {"table_index", ELEM_CTRL_TABLE_RANGE, {PLAINTEXT_TABLE_HDR_BOOT_AREA}, {0x1}}, \ - {"NL", ELEM_OUTPUT_NL, {0x0}, {0x0}}, \ - {"area 6", ELEM_OUTPUT_DIVIDE, {0x0}, {0x3D}}, \ - {"HDR_BOOT_AREA", ELEM_CTRL_TABLE_GOTO, {0x2D000}, {0x7800}}, \ - {"table_index", ELEM_CTRL_TABLE_RANGE, {PLAINTEXT_TABLE_HDR_BOOT_AREA}, {0x1}}, \ -} - -#define DATA_MODEL_HDR_RUN MODEL_VECTOR(HDR_RUN) = { \ - {"area 0", ELEM_OUTPUT_DIVIDE, {0x0}, {0x3D}}, \ - {"HDR_RUN_AREA", ELEM_CTRL_TABLE_GOTO, {0x0}, {0x3C00}}, \ - {"table_index", ELEM_CTRL_TABLE_RANGE, {PLAINTEXT_TABLE_HDR_RUN_AREA}, {0x1}}, \ - {"NL", ELEM_OUTPUT_NL, {0x0}, {0x0}}, \ - {"area 1", ELEM_OUTPUT_DIVIDE, {0x0}, {0x3D}}, \ - {"HDR_RUN_AREA", ELEM_CTRL_TABLE_GOTO, {0x3C00}, {0x3C00}}, \ - {"table_index", ELEM_CTRL_TABLE_RANGE, {PLAINTEXT_TABLE_HDR_RUN_AREA}, {0x1}}, \ - {"NL", ELEM_OUTPUT_NL, {0x0}, {0x0}}, \ - {"area 2", ELEM_OUTPUT_DIVIDE, {0x0}, {0x3D}}, \ - {"HDR_RUN_AREA", ELEM_CTRL_TABLE_GOTO, {0x7800}, {0x3C00}}, \ - {"table_index", ELEM_CTRL_TABLE_RANGE, {PLAINTEXT_TABLE_HDR_RUN_AREA}, {0x1}}, \ - {"NL", ELEM_OUTPUT_NL, {0x0}, {0x0}}, \ - {"area 3", ELEM_OUTPUT_DIVIDE, {0x0}, {0x3D}}, \ - {"HDR_RUN_AREA", ELEM_CTRL_TABLE_GOTO, {0xB400}, {0x3C00}}, \ - {"table_index", ELEM_CTRL_TABLE_RANGE, {PLAINTEXT_TABLE_HDR_RUN_AREA}, {0x1}}, \ - {"NL", ELEM_OUTPUT_NL, {0x0}, {0x0}}, \ - {"area 4", ELEM_OUTPUT_DIVIDE, {0x0}, {0x3D}}, \ - {"HDR_RUN_AREA", ELEM_CTRL_TABLE_GOTO, {0xF000}, {0x3C00}}, \ - {"table_index", ELEM_CTRL_TABLE_RANGE, {PLAINTEXT_TABLE_HDR_RUN_AREA}, {0x1}}, \ - {"NL", ELEM_OUTPUT_NL, {0x0}, {0x0}}, \ - {"area 5", ELEM_OUTPUT_DIVIDE, {0x0}, {0x3D}}, \ - {"HDR_RUN_AREA", ELEM_CTRL_TABLE_GOTO, {0x12C00}, {0x3C00}}, \ - {"table_index", ELEM_CTRL_TABLE_RANGE, {PLAINTEXT_TABLE_HDR_RUN_AREA}, {0x1}}, \ - {"NL", ELEM_OUTPUT_NL, {0x0}, {0x0}}, \ - {"area 6", ELEM_OUTPUT_DIVIDE, {0x0}, {0x3D}}, \ - {"HDR_RUN_AREA", ELEM_CTRL_TABLE_GOTO, {0x16800}, {0x3C00}}, \ - {"table_index", ELEM_CTRL_TABLE_RANGE, {PLAINTEXT_TABLE_HDR_RUN_AREA}, {0x1}}, \ -} - -#define DATA_MODEL_HDR_BOOT_INFO MODEL_VECTOR(HDR_BOOT_INFO) = { \ - {"region offset", ELEM_OUTPUT_INT, {0x0}, {0x4}}, \ - {"region size", ELEM_OUTPUT_INT, {0x4}, {0x4}}, \ - {"NL", ELEM_OUTPUT_NL, {0x0}, {0x0}}, \ - {"region config", ELEM_OUTPUT_DIVIDE, {0x0}, {0x2D}}, \ - {"total area", ELEM_OUTPUT_INT, {0x8}, {0x4}}, \ - {"history area", ELEM_OUTPUT_INT, {0xC}, {0x4}}, \ - {"error area", ELEM_OUTPUT_INT, {0x10}, {0x4}}, \ - {"area config:", ELEM_OUTPUT_STR_CONST, {0x0}, {0x0}}, \ - {" used module count", ELEM_OUTPUT_INT, {0x14}, {0x4}}, \ - {"NL", ELEM_OUTPUT_NL, {0x0}, {0x0}}, \ - {"module config:", ELEM_OUTPUT_STR_CONST, {0x0}, {0x0}}, \ - {" module 0 offset", ELEM_OUTPUT_INT, {0x1C}, {0x4}}, \ - {" module 0 size", ELEM_OUTPUT_INT, {0x20}, {0x4}}, \ - {"NL", ELEM_OUTPUT_NL, {0x0}, {0x0}}, \ - {" module 1 offset", ELEM_OUTPUT_INT, {0x24}, {0x4}}, \ - {" module 1 size", ELEM_OUTPUT_INT, {0x28}, {0x4}}, \ - {"NL", ELEM_OUTPUT_NL, {0x0}, {0x0}}, \ - {" module 2 offset", ELEM_OUTPUT_INT, {0x2C}, {0x4}}, \ - {" module 2 size", ELEM_OUTPUT_INT, {0x30}, {0x4}}, \ - {"NL", ELEM_OUTPUT_NL, {0x0}, {0x0}}, \ - {" module 3 offset", ELEM_OUTPUT_INT, {0x34}, {0x4}}, \ - {" module 3 size", ELEM_OUTPUT_INT, {0x38}, {0x4}}, \ - {"NL", ELEM_OUTPUT_NL, {0x0}, {0x0}}, \ - {"region control", ELEM_OUTPUT_DIVIDE, {0x0}, {0x2D}}, \ - {"area index", ELEM_OUTPUT_INT, {0x6C}, {0x4}}, \ - {"error area count", ELEM_OUTPUT_INT, {0x70}, {0x4}}, \ - {"NL", ELEM_OUTPUT_NL, {0x0}, {0x0}}, \ - {"[area 0 control info]", ELEM_OUTPUT_STR_CONST, {0x0}, {0x0}}, \ - {" flag", ELEM_OUTPUT_INT, {0x74}, {0x4}}, \ - {" tag", ELEM_OUTPUT_INT, {0x78}, {0x4}}, \ - {" exception type", ELEM_OUTPUT_INT, {0x7C}, {0x4}}, \ - {" module id", ELEM_OUTPUT_INT, {0x80}, {0x4}}, \ - {" exception id", ELEM_OUTPUT_INT, {0x84}, {0x4}}, \ - {" reset number", ELEM_OUTPUT_INT, {0x88}, {0x4}}, \ - {"NL", ELEM_OUTPUT_NL, {0x0}, {0x0}}, \ - {"[area 1 control info]", ELEM_OUTPUT_STR_CONST, {0x0}, {0x0}}, \ - {" flag", ELEM_OUTPUT_INT, {0x8C}, {0x4}}, \ - {" tag", ELEM_OUTPUT_INT, {0x90}, {0x4}}, \ - {" exception type", ELEM_OUTPUT_INT, {0x94}, {0x4}}, \ - {" module id", ELEM_OUTPUT_INT, {0x98}, {0x4}}, \ - {" exception id", ELEM_OUTPUT_INT, {0x9C}, {0x4}}, \ - {" reset number", ELEM_OUTPUT_INT, {0xA0}, {0x4}}, \ - {"NL", ELEM_OUTPUT_NL, {0x0}, {0x0}}, \ - {"[area 2 control info]", ELEM_OUTPUT_STR_CONST, {0x0}, {0x0}}, \ - {" flag", ELEM_OUTPUT_INT, {0xA4}, {0x4}}, \ - {" tag", ELEM_OUTPUT_INT, {0xA8}, {0x4}}, \ - {" exception type", ELEM_OUTPUT_INT, {0xAC}, {0x4}}, \ - {" module id", ELEM_OUTPUT_INT, {0xB0}, {0x4}}, \ - {" exception id", ELEM_OUTPUT_INT, {0xB4}, {0x4}}, \ - {" reset number", ELEM_OUTPUT_INT, {0xB8}, {0x4}}, \ - {"NL", ELEM_OUTPUT_NL, {0x0}, {0x0}}, \ - {"[area 3 control info]", ELEM_OUTPUT_STR_CONST, {0x0}, {0x0}}, \ - {" flag", ELEM_OUTPUT_INT, {0xBC}, {0x4}}, \ - {" tag", ELEM_OUTPUT_INT, {0xC0}, {0x4}}, \ - {" exception type", ELEM_OUTPUT_INT, {0xC4}, {0x4}}, \ - {" module id", ELEM_OUTPUT_INT, {0xC8}, {0x4}}, \ - {" exception id", ELEM_OUTPUT_INT, {0xCC}, {0x4}}, \ - {" reset number", ELEM_OUTPUT_INT, {0xD0}, {0x4}}, \ - {"NL", ELEM_OUTPUT_NL, {0x0}, {0x0}}, \ - {"[area 4 control info]", ELEM_OUTPUT_STR_CONST, {0x0}, {0x0}}, \ - {" flag", ELEM_OUTPUT_INT, {0xD4}, {0x4}}, \ - {" tag", ELEM_OUTPUT_INT, {0xD8}, {0x4}}, \ - {" exception type", ELEM_OUTPUT_INT, {0xDC}, {0x4}}, \ - {" module id", ELEM_OUTPUT_INT, {0xE0}, {0x4}}, \ - {" exception id", ELEM_OUTPUT_INT, {0xE4}, {0x4}}, \ - {" reset number", ELEM_OUTPUT_INT, {0xE8}, {0x4}}, \ - {"NL", ELEM_OUTPUT_NL, {0x0}, {0x0}}, \ - {"[area 5 control info]", ELEM_OUTPUT_STR_CONST, {0x0}, {0x0}}, \ - {" flag", ELEM_OUTPUT_INT, {0xEC}, {0x4}}, \ - {" tag", ELEM_OUTPUT_INT, {0xF0}, {0x4}}, \ - {" exception type", ELEM_OUTPUT_INT, {0xF4}, {0x4}}, \ - {" module id", ELEM_OUTPUT_INT, {0xF8}, {0x4}}, \ - {" exception id", ELEM_OUTPUT_INT, {0xFC}, {0x4}}, \ - {" reset number", ELEM_OUTPUT_INT, {0x100}, {0x4}}, \ - {"NL", ELEM_OUTPUT_NL, {0x0}, {0x0}}, \ - {"[area 6 control info]", ELEM_OUTPUT_STR_CONST, {0x0}, {0x0}}, \ - {" flag", ELEM_OUTPUT_INT, {0x104}, {0x4}}, \ - {" tag", ELEM_OUTPUT_INT, {0x108}, {0x4}}, \ - {" exception type", ELEM_OUTPUT_INT, {0x10C}, {0x4}}, \ - {" module id", ELEM_OUTPUT_INT, {0x110}, {0x4}}, \ - {" exception id", ELEM_OUTPUT_INT, {0x114}, {0x4}}, \ - {" reset number", ELEM_OUTPUT_INT, {0x118}, {0x4}}, \ -} - -#define DATA_MODEL_HDR_RUN_INFO MODEL_VECTOR(HDR_RUN_INFO) = { \ - {"region offset", ELEM_OUTPUT_INT, {0x0}, {0x4}}, \ - {"region size", ELEM_OUTPUT_INT, {0x4}, {0x4}}, \ - {"NL", ELEM_OUTPUT_NL, {0x0}, {0x0}}, \ - {"region config", ELEM_OUTPUT_DIVIDE, {0x0}, {0x2D}}, \ - {"total area", ELEM_OUTPUT_INT, {0x8}, {0x4}}, \ - {"history area", ELEM_OUTPUT_INT, {0xC}, {0x4}}, \ - {"error area", ELEM_OUTPUT_INT, {0x10}, {0x4}}, \ - {"area config:", ELEM_OUTPUT_STR_CONST, {0x0}, {0x0}}, \ - {" used module count", ELEM_OUTPUT_INT, {0x14}, {0x4}}, \ - {"NL", ELEM_OUTPUT_NL, {0x0}, {0x0}}, \ - {"module config:", ELEM_OUTPUT_STR_CONST, {0x0}, {0x0}}, \ - {" module 0 offset", ELEM_OUTPUT_INT, {0x1C}, {0x4}}, \ - {" module 0 size", ELEM_OUTPUT_INT, {0x20}, {0x4}}, \ - {"NL", ELEM_OUTPUT_NL, {0x0}, {0x0}}, \ - {" module 1 offset", ELEM_OUTPUT_INT, {0x24}, {0x4}}, \ - {" module 1 size", ELEM_OUTPUT_INT, {0x28}, {0x4}}, \ - {"NL", ELEM_OUTPUT_NL, {0x0}, {0x0}}, \ - {" module 2 offset", ELEM_OUTPUT_INT, {0x2C}, {0x4}}, \ - {" module 2 size", ELEM_OUTPUT_INT, {0x30}, {0x4}}, \ - {"NL", ELEM_OUTPUT_NL, {0x0}, {0x0}}, \ - {" module 3 offset", ELEM_OUTPUT_INT, {0x34}, {0x4}}, \ - {" module 3 size", ELEM_OUTPUT_INT, {0x38}, {0x4}}, \ - {"NL", ELEM_OUTPUT_NL, {0x0}, {0x0}}, \ - {"region control", ELEM_OUTPUT_DIVIDE, {0x0}, {0x2D}}, \ - {"area index", ELEM_OUTPUT_INT, {0x6C}, {0x4}}, \ - {"error area count", ELEM_OUTPUT_INT, {0x70}, {0x4}}, \ - {"NL", ELEM_OUTPUT_NL, {0x0}, {0x0}}, \ - {"[area 0 control info]", ELEM_OUTPUT_STR_CONST, {0x0}, {0x0}}, \ - {" flag", ELEM_OUTPUT_INT, {0x74}, {0x4}}, \ - {" tag", ELEM_OUTPUT_INT, {0x78}, {0x4}}, \ - {" exception type", ELEM_OUTPUT_INT, {0x7C}, {0x4}}, \ - {" reset number", ELEM_OUTPUT_INT, {0x88}, {0x4}}, \ - {"NL", ELEM_OUTPUT_NL, {0x0}, {0x0}}, \ - {"[area 1 control info]", ELEM_OUTPUT_STR_CONST, {0x0}, {0x0}}, \ - {" flag", ELEM_OUTPUT_INT, {0x8C}, {0x4}}, \ - {" tag", ELEM_OUTPUT_INT, {0x90}, {0x4}}, \ - {" exception type", ELEM_OUTPUT_INT, {0x94}, {0x4}}, \ - {" reset number", ELEM_OUTPUT_INT, {0xA0}, {0x4}}, \ - {"NL", ELEM_OUTPUT_NL, {0x0}, {0x0}}, \ - {"[area 2 control info]", ELEM_OUTPUT_STR_CONST, {0x0}, {0x0}}, \ - {" flag", ELEM_OUTPUT_INT, {0xA4}, {0x4}}, \ - {" tag", ELEM_OUTPUT_INT, {0xA8}, {0x4}}, \ - {" exception type", ELEM_OUTPUT_INT, {0xAC}, {0x4}}, \ - {" reset number", ELEM_OUTPUT_INT, {0xB8}, {0x4}}, \ - {"NL", ELEM_OUTPUT_NL, {0x0}, {0x0}}, \ - {"[area 3 control info]", ELEM_OUTPUT_STR_CONST, {0x0}, {0x0}}, \ - {" flag", ELEM_OUTPUT_INT, {0xBC}, {0x4}}, \ - {" tag", ELEM_OUTPUT_INT, {0xC0}, {0x4}}, \ - {" exception type", ELEM_OUTPUT_INT, {0xC4}, {0x4}}, \ - {" reset number", ELEM_OUTPUT_INT, {0xD0}, {0x4}}, \ - {"NL", ELEM_OUTPUT_NL, {0x0}, {0x0}}, \ - {"[area 4 control info]", ELEM_OUTPUT_STR_CONST, {0x0}, {0x0}}, \ - {" flag", ELEM_OUTPUT_INT, {0xD4}, {0x4}}, \ - {" tag", ELEM_OUTPUT_INT, {0xD8}, {0x4}}, \ - {" exception type", ELEM_OUTPUT_INT, {0xDC}, {0x4}}, \ - {" reset number", ELEM_OUTPUT_INT, {0xE8}, {0x4}}, \ - {"NL", ELEM_OUTPUT_NL, {0x0}, {0x0}}, \ - {"[area 5 control info]", ELEM_OUTPUT_STR_CONST, {0x0}, {0x0}}, \ - {" flag", ELEM_OUTPUT_INT, {0xEC}, {0x4}}, \ - {" tag", ELEM_OUTPUT_INT, {0xF0}, {0x4}}, \ - {" exception type", ELEM_OUTPUT_INT, {0xF4}, {0x4}}, \ - {" reset number", ELEM_OUTPUT_INT, {0x100}, {0x4}}, \ - {"NL", ELEM_OUTPUT_NL, {0x0}, {0x0}}, \ - {"[area 6 control info]", ELEM_OUTPUT_STR_CONST, {0x0}, {0x0}}, \ - {" flag", ELEM_OUTPUT_INT, {0x104}, {0x4}}, \ - {" tag", ELEM_OUTPUT_INT, {0x108}, {0x4}}, \ - {" exception type", ELEM_OUTPUT_INT, {0x10C}, {0x4}}, \ - {" reset number", ELEM_OUTPUT_INT, {0x118}, {0x4}}, \ -} - -#define DATA_MODEL_HDR MODEL_VECTOR(HDR) = { \ - {"head info", ELEM_OUTPUT_DIVIDE, {0x0}, {0x3D}}, \ - {"magic", ELEM_OUTPUT_INT, {0x0}, {0x4}}, \ - {"version", ELEM_OUTPUT_INT, {0x4}, {0x4}}, \ - {"reset count", ELEM_OUTPUT_INT, {0x8}, {0x4}}, \ - {"NL", ELEM_OUTPUT_NL, {0x0}, {0x0}}, \ - {"boot region", ELEM_OUTPUT_DIVIDE, {0x0}, {0x3D}}, \ - {"HDR_BOOT_INFO", ELEM_CTRL_TABLE_GOTO, {0XC}, {0x168}}, \ - {"table_index", ELEM_CTRL_TABLE_RANGE, {PLAINTEXT_TABLE_HDR_BOOT_INFO}, {0x1}}, \ - {"NL", ELEM_OUTPUT_NL, {0x0}, {0x0}}, \ - {"HDR_BOOT", ELEM_CTRL_TABLE_GOTO, {0x400}, {0xA000}}, \ - {"table_index", ELEM_CTRL_TABLE_RANGE, {PLAINTEXT_TABLE_HDR_BOOT}, {0x1}}, \ - {"NL", ELEM_OUTPUT_NL, {0x0}, {0x0}}, \ - {"run region", ELEM_OUTPUT_DIVIDE, {0x0}, {0x3D}}, \ - {"HDR_RUN_INFO", ELEM_CTRL_TABLE_GOTO, {0x170}, {0x164}}, \ - {"table_index", ELEM_CTRL_TABLE_RANGE, {PLAINTEXT_TABLE_HDR_RUN_INFO}, {0x1}}, \ - {"NL", ELEM_OUTPUT_NL, {0x0}, {0x0}}, \ - {"HDR_RUN", ELEM_CTRL_TABLE_GOTO, {0x4B400}, {0xA000}}, \ - {"table_index", ELEM_CTRL_TABLE_RANGE, {PLAINTEXT_TABLE_HDR_RUN}, {0x1}}, \ -} - -#endif // BBOX_DDR_DATA_CLOUD_H diff --git a/inc/toolchain/bbox/bbox_ddr_data_dc.h b/inc/toolchain/bbox/bbox_ddr_data_dc.h deleted file mode 100644 index 1fe23d793..000000000 --- a/inc/toolchain/bbox/bbox_ddr_data_dc.h +++ /dev/null @@ -1,458 +0,0 @@ -/** - * Copyright 2019-2020 Huawei Technologies Co., Ltd - * - * 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 BBOX_DDR_DATA_DC_H -#define BBOX_DDR_DATA_DC_H - -#include "bbox_ddr_data.h" - -/* each Module need define as follows */ -/* LPM module */ -#define DATA_MODEL_LPM_START MODEL_VECTOR(LPM_START) = { \ - {"start_steps", ELEM_OUTPUT_STR_NL, {0x0}, {0x800}}, \ -} - -#define DATA_MODEL_LPM MODEL_VECTOR(LPM) = { \ - {"****exc****reg**", ELEM_OUTPUT_STR, {0x0}, {0x8}}, \ - {"fault_regs_dfsr", ELEM_OUTPUT_INT, {0x1410}, {0x4}}, \ - {"fault_regs_ifsr", ELEM_OUTPUT_INT, {0x1414}, {0x4}}, \ - {"fault_regs_adfsr", ELEM_OUTPUT_INT, {0x1418}, {0x4}}, \ - {"fault_regs_aifsr", ELEM_OUTPUT_INT, {0x141c}, {0x4}}, \ - {"fault_regs_dfar", ELEM_OUTPUT_INT, {0x1420}, {0x4}}, \ - {"fault_regs_ifar", ELEM_OUTPUT_INT, {0x1424}, {0x4}}, \ - {"usr_regs_r13", ELEM_OUTPUT_INT, {0x1428}, {0x4}}, \ - {"usr_regs_r14", ELEM_OUTPUT_INT, {0x142c}, {0x4}}, \ - {"svc_regs_regs_r13", ELEM_OUTPUT_INT, {0x1430}, {0x4}}, \ - {"svc_regs_regs_r14", ELEM_OUTPUT_INT, {0x1434}, {0x4}}, \ - {"svc_regs_regs_spsr", ELEM_OUTPUT_INT, {0x1438}, {0x4}}, \ - {"irq_regs_regs_r13", ELEM_OUTPUT_INT, {0x143c}, {0x4}}, \ - {"irq_regs_regs_r14", ELEM_OUTPUT_INT, {0x1440}, {0x4}}, \ - {"irq_regs_regs_spsr", ELEM_OUTPUT_INT, {0x1444}, {0x4}}, \ - {"fiq_regs_regs_r13", ELEM_OUTPUT_INT, {0x1448}, {0x4}}, \ - {"fiq_regs_regs_r14", ELEM_OUTPUT_INT, {0x144c}, {0x4}}, \ - {"fiq_regs_regs_spsr", ELEM_OUTPUT_INT, {0x1450}, {0x4}}, \ - {"und_regs_regs_r13", ELEM_OUTPUT_INT, {0x1454}, {0x4}}, \ - {"und_regs_regs_r14", ELEM_OUTPUT_INT, {0x1458}, {0x4}}, \ - {"und_regs_regs_spsr", ELEM_OUTPUT_INT, {0x145c}, {0x4}}, \ - {"abort_regs_regs_r13", ELEM_OUTPUT_INT, {0x1460}, {0x4}}, \ - {"abort_regs_regs_r14", ELEM_OUTPUT_INT, {0x1464}, {0x4}}, \ - {"abort_regs_regs_spsr", ELEM_OUTPUT_INT, {0x1468}, {0x4}}, \ - {"data_regs_r1", ELEM_OUTPUT_INT, {0x146c}, {0x4}}, \ - {"data_regs_r2", ELEM_OUTPUT_INT, {0x1470}, {0x4}}, \ - {"data_regs_r3", ELEM_OUTPUT_INT, {0x1474}, {0x4}}, \ - {"data_regs_r4", ELEM_OUTPUT_INT, {0x1478}, {0x4}}, \ - {"data_regs_r5", ELEM_OUTPUT_INT, {0x147c}, {0x4}}, \ - {"data_regs_r6", ELEM_OUTPUT_INT, {0x1480}, {0x4}}, \ - {"data_regs_r7", ELEM_OUTPUT_INT, {0x1484}, {0x4}}, \ - {"data_regs_r8", ELEM_OUTPUT_INT, {0x1488}, {0x4}}, \ - {"data_regs_r9", ELEM_OUTPUT_INT, {0x148c}, {0x4}}, \ - {"data_regs_r10", ELEM_OUTPUT_INT, {0x1490}, {0x4}}, \ - {"data_regs_r11", ELEM_OUTPUT_INT, {0x1494}, {0x4}}, \ - {"data_regs_r12", ELEM_OUTPUT_INT, {0x1498}, {0x4}}, \ - {"data_regs_r13", ELEM_OUTPUT_INT, {0x149c}, {0x4}}, \ - {"data_regs_r14", ELEM_OUTPUT_INT, {0x14a0}, {0x4}}, \ - {"data_regs_r15", ELEM_OUTPUT_INT, {0x14a4}, {0x4}}, \ - {"prog_regs_cpsr", ELEM_OUTPUT_INT, {0x14a8}, {0x4}}, \ - {"prog_regs_spsr", ELEM_OUTPUT_INT, {0x14ac}, {0x4}}, \ - {"log", ELEM_OUTPUT_STR_NL, {0xDC80}, {0x400}}, \ -} - -#define DATA_MODEL_LPM_PMU MODEL_VECTOR(LPM_PMU) = { \ - {"cpuid", ELEM_OUTPUT_INT, {0x0000}, {0x1}}, \ - {"2CCH", ELEM_OUTPUT_HEX, {0x0001}, {0x1}}, \ - {"2CDH", ELEM_OUTPUT_HEX, {0x0002}, {0x1}}, \ - {"2CEH", ELEM_OUTPUT_HEX, {0x0003}, {0x1}}, \ - {"2CFH", ELEM_OUTPUT_HEX, {0x0004}, {0x1}}, \ - {"2D0H", ELEM_OUTPUT_HEX, {0x0005}, {0x1}}, \ - {"2D1H", ELEM_OUTPUT_HEX, {0x0006}, {0x1}}, \ - {"2D2H", ELEM_OUTPUT_HEX, {0x0007}, {0x1}}, \ - {"2D3H", ELEM_OUTPUT_HEX, {0x0008}, {0x1}}, \ - {"2D4H", ELEM_OUTPUT_HEX, {0x0009}, {0x1}}, \ - {"2D5H", ELEM_OUTPUT_HEX, {0x000A}, {0x1}}, \ - {"2D6H", ELEM_OUTPUT_HEX, {0x000B}, {0x1}}, \ - {"2D7H", ELEM_OUTPUT_HEX, {0x000C}, {0x1}}, \ - {"2D8H", ELEM_OUTPUT_HEX, {0x000D}, {0x1}}, \ - {"2D9H", ELEM_OUTPUT_HEX, {0x000E}, {0x1}}, \ - {"2DAH", ELEM_OUTPUT_HEX, {0x000F}, {0x1}}, \ - {"2DBH", ELEM_OUTPUT_HEX, {0x0010}, {0x1}}, \ - {"2DCH", ELEM_OUTPUT_HEX, {0x0011}, {0x1}}, \ - {"2DDH", ELEM_OUTPUT_HEX, {0x0012}, {0x1}}, \ - {"2DEH", ELEM_OUTPUT_HEX, {0x0013}, {0x1}}, \ - {"2DFH", ELEM_OUTPUT_HEX, {0x0014}, {0x1}}, \ - {"2E0H", ELEM_OUTPUT_HEX, {0x0015}, {0x1}}, \ - {"2E1H", ELEM_OUTPUT_HEX, {0x0016}, {0x1}}, \ - {"2E2H", ELEM_OUTPUT_HEX, {0x0017}, {0x1}}, \ - {"2E3H", ELEM_OUTPUT_HEX, {0x0018}, {0x1}}, \ - {"2E4H", ELEM_OUTPUT_HEX, {0x0019}, {0x1}}, \ - {"2E5H", ELEM_OUTPUT_HEX, {0x001A}, {0x1}}, \ - {"2E6H", ELEM_OUTPUT_HEX, {0x001B}, {0x1}}, \ - {"2E7H", ELEM_OUTPUT_HEX, {0x001C}, {0x1}}, \ - {"slave0", ELEM_OUTPUT_HEX, {0x0020}, {0x1}}, \ - {"E0", ELEM_OUTPUT_HEX, {0x0021}, {0x1}}, \ - {"E1", ELEM_OUTPUT_HEX, {0x0022}, {0x1}}, \ - {"E2", ELEM_OUTPUT_HEX, {0x0023}, {0x1}}, \ - {"reserve", ELEM_OUTPUT_HEX, {0x0024}, {0x1}}, \ - {"reserve", ELEM_OUTPUT_HEX, {0x0025}, {0x1}}, \ - {"reserve", ELEM_OUTPUT_HEX, {0x0026}, {0x1}}, \ - {"slave1", ELEM_OUTPUT_HEX, {0x0040}, {0x1}}, \ - {"E0", ELEM_OUTPUT_HEX, {0x0041}, {0x1}}, \ - {"E1", ELEM_OUTPUT_HEX, {0x0042}, {0x1}}, \ - {"E2", ELEM_OUTPUT_HEX, {0x0043}, {0x1}}, \ - {"reserve", ELEM_OUTPUT_HEX, {0x0044}, {0x1}}, \ - {"reserve", ELEM_OUTPUT_HEX, {0x0045}, {0x1}}, \ - {"reserve", ELEM_OUTPUT_HEX, {0x0046}, {0x1}}, \ - {"aicSlave", ELEM_OUTPUT_HEX, {0x0060}, {0x1}}, \ - {"0x79", ELEM_OUTPUT_HEX, {0x0061}, {0x2}}, \ - {"0x7A", ELEM_OUTPUT_HEX, {0x0063}, {0x1}}, \ - {"0x7B", ELEM_OUTPUT_HEX, {0x0064}, {0x1}}, \ - {"0x7C", ELEM_OUTPUT_HEX, {0x0065}, {0x1}}, \ - {"0x7D", ELEM_OUTPUT_HEX, {0x0066}, {0x1}}, \ - {"0x7E", ELEM_OUTPUT_HEX, {0x0067}, {0x1}}, \ - {"dvppSlave", ELEM_OUTPUT_HEX, {0x0080}, {0x1}}, \ - {"0x79", ELEM_OUTPUT_HEX, {0x0081}, {0x2}}, \ - {"0x7A", ELEM_OUTPUT_HEX, {0x0083}, {0x1}}, \ - {"0x7B", ELEM_OUTPUT_HEX, {0x0084}, {0x1}}, \ - {"0x7C", ELEM_OUTPUT_HEX, {0x0085}, {0x1}}, \ - {"0x7D", ELEM_OUTPUT_HEX, {0x0086}, {0x1}}, \ - {"0x7E", ELEM_OUTPUT_HEX, {0x0087}, {0x1}}, \ - {"cpuSlave", ELEM_OUTPUT_HEX, {0x00A0}, {0x1}}, \ - {"0x79", ELEM_OUTPUT_HEX, {0x00A1}, {0x2}}, \ - {"0x7A", ELEM_OUTPUT_HEX, {0x00A3}, {0x1}}, \ - {"0x7B", ELEM_OUTPUT_HEX, {0x00A4}, {0x1}}, \ - {"0x7C", ELEM_OUTPUT_HEX, {0x00A5}, {0x1}}, \ - {"0x7D", ELEM_OUTPUT_HEX, {0x00A6}, {0x1}}, \ - {"0x7E", ELEM_OUTPUT_HEX, {0x00A7}, {0x1}}, \ -} - -/* (LPM)DDR module */ -#define DATA_MODEL_DDR_SRAM MODEL_VECTOR(DDR_SRAM) = { \ - {"dram type", ELEM_OUTPUT_INT, {0x00}, {0x4}}, \ - {"dram size", ELEM_OUTPUT_INT, {0x04}, {0x4}}, \ - {"rank num", ELEM_OUTPUT_INT, {0x08}, {0x4}}, \ - {"chn bit map", ELEM_OUTPUT_INT, {0x0c}, {0x4}}, \ - {"manufacteryId[0]", ELEM_OUTPUT_INT, {0x10}, {0x4}}, \ - {"manufacteryId[1]", ELEM_OUTPUT_INT, {0x14}, {0x4}}, \ - {"manufacteryId[2]", ELEM_OUTPUT_INT, {0x18}, {0x4}}, \ - {"manufacteryId[3]", ELEM_OUTPUT_INT, {0x1c}, {0x4}}, \ - {"manufacteryId[4]", ELEM_OUTPUT_INT, {0x20}, {0x4}}, \ - {"manufacteryId[5]", ELEM_OUTPUT_INT, {0x24}, {0x4}}, \ - {"manufacteryId[6]", ELEM_OUTPUT_INT, {0x28}, {0x4}}, \ - {"manufacteryId[7]", ELEM_OUTPUT_INT, {0x2c}, {0x4}}, \ - {"manufacteryId[8]", ELEM_OUTPUT_INT, {0x30}, {0x4}}, \ - {"manufacteryId[9]", ELEM_OUTPUT_INT, {0x34}, {0x4}}, \ - {"manufacteryId[10]", ELEM_OUTPUT_INT, {0x38}, {0x4}}, \ - {"manufacteryId[11]", ELEM_OUTPUT_INT, {0x3c}, {0x4}}, \ - {"manufacteryId[12]", ELEM_OUTPUT_INT, {0x40}, {0x4}}, \ - {"manufacteryId[13]", ELEM_OUTPUT_INT, {0x44}, {0x4}}, \ - {"manufacteryId[14]", ELEM_OUTPUT_INT, {0x48}, {0x4}}, \ - {"manufacteryId[15]", ELEM_OUTPUT_INT, {0x4c}, {0x4}}, \ - {"manufacteryId[16]", ELEM_OUTPUT_INT, {0x50}, {0x4}}, \ - {"manufacteryId[17]", ELEM_OUTPUT_INT, {0x54}, {0x4}}, \ - {"manufacteryId[18]", ELEM_OUTPUT_INT, {0x58}, {0x4}}, \ - {"manufacteryId[19]", ELEM_OUTPUT_INT, {0x5c}, {0x4}}, \ - {"manufacteryId[20]", ELEM_OUTPUT_INT, {0x60}, {0x4}}, \ - {"manufacteryId[21]", ELEM_OUTPUT_INT, {0x64}, {0x4}}, \ - {"manufacteryId[22]", ELEM_OUTPUT_INT, {0x68}, {0x4}}, \ - {"manufacteryId[23]", ELEM_OUTPUT_INT, {0x6c}, {0x4}}, \ - {"iecc", ELEM_OUTPUT_INT, {0x70}, {0x4}}, \ - {"swap type", ELEM_OUTPUT_INT, {0x74}, {0x4}}, \ - {"freq", ELEM_OUTPUT_INT, {0x78}, {0x4}}, \ -} - -/* TEE module */ -#define DATA_MODEL_TEE MODEL_VECTOR(TEE) = { \ - {"tee info", ELEM_OUTPUT_CHAR, {0x0}, {0x20000}}, \ -} - -/* DVPP module */ -#define DATA_MODEL_DVPP MODEL_VECTOR(DVPP) = { \ - {"dvpp info", ELEM_OUTPUT_STR_NL, {0x0}, {0x10000}}, \ -} - -/* DRIVE module */ -#define DATA_MODEL_DRIVER MODEL_VECTOR(DRIVER) = { \ - {"driver info", ELEM_OUTPUT_STR_NL, {0x0}, {0x20000}}, \ -} - -/* TS module, start */ -#define DATA_MODEL_TS_START MODEL_VECTOR(TS_START) = { \ - {"ts start info", ELEM_OUTPUT_STR_NL, {0x0}, {0x19000}}, \ -} - -/* TS module */ -#define DATA_MODEL_TS MODEL_VECTOR(TS) = { \ - {"ts info", ELEM_OUTPUT_STR_NL, {0x0}, {0x1E6E00}}, \ -} - -/* HSM module */ -#define DATA_MODEL_HSM MODEL_VECTOR(HSM) = { \ - {"hsm info", ELEM_OUTPUT_STR_NL, {0x0}, {0x1000}}, \ -} - -/* HSM module, start */ -#define DATA_MODEL_HSM_START MODEL_VECTOR(HSM_START) = { \ - {"hsm start info", ELEM_OUTPUT_STR_NL, {0x0}, {0x1000}}, \ -} - -/* DP module */ -#define DATA_MODEL_DP MODEL_VECTOR(DP) = { \ - {"os kbox info", ELEM_OUTPUT_STR_NL, {0x3000}, {0x4FD000}}, \ -} - -// lpm common log data -#define DATA_MODEL_LPM_LOG MODEL_VECTOR(LPM_LOG) = { \ - {"lpm log buffer", ELEM_FEATURE_LOOPBUF, {1}, {6}}, \ - {"buf_read", ELEM_CTRL_LPBF_READ, {0x0}, {0x4}}, \ - {"buf_len", ELEM_CTRL_LPBF_SIZE, {0x4}, {0x4}}, \ - {"buf_write", ELEM_CTRL_LPBF_WRITE, {0x40}, {0x4}}, \ - {"log_level", ELEM_OUTPUT_INT, {0x44}, {0x4}}, \ - {"buf_head_len", ELEM_CTRL_LPBF_HEAD, {0x80}, {0x4}}, \ - {"lpm log data", ELEM_FEATURE_CHARLOG, {1}, {1}}, \ - {"lpm log", ELEM_OUTPUT_STR_NL, {0x80}, {0x1FF80}}, \ -} - -// hsm common log data -#define DATA_MODEL_HSM_LOG MODEL_VECTOR(HSM_LOG) = { \ - {"hsm log buffer", ELEM_FEATURE_LOOPBUF, {1}, {6}}, \ - {"buf_read", ELEM_CTRL_LPBF_READ, {0x0}, {0x4}}, \ - {"buf_len", ELEM_CTRL_LPBF_SIZE, {0x4}, {0x4}}, \ - {"buf_write", ELEM_CTRL_LPBF_WRITE, {0x40}, {0x4}}, \ - {"log_level", ELEM_OUTPUT_INT, {0x44}, {0x4}}, \ - {"buf_head_len", ELEM_CTRL_LPBF_HEAD, {0x80}, {0x4}}, \ - {"hsm log data", ELEM_FEATURE_CHARLOG, {1}, {1}}, \ - {"hsm log", ELEM_OUTPUT_STR_NL, {0x80}, {0x1FF80}}, \ -} - -/* DVPP module */ -#define DATA_MODEL_DVPP MODEL_VECTOR(DVPP) = { \ - {"dvpp info", ELEM_OUTPUT_STR_NL, {0x0}, {0x10000}}, \ -} - -/* TF module */ -#define DATA_MODEL_TF MODEL_VECTOR(TF) = { \ - {"x0", ELEM_OUTPUT_HEX, {0x0}, {0x8}}, \ - {"x1", ELEM_OUTPUT_HEX, {0x8}, {0x8}}, \ - {"x30", ELEM_OUTPUT_HEX, {0x10}, {0x8}}, \ - {"x2", ELEM_OUTPUT_HEX, {0x18}, {0x8}}, \ - {"x3", ELEM_OUTPUT_HEX, {0x20}, {0x8}}, \ - {"x4", ELEM_OUTPUT_HEX, {0x28}, {0x8}}, \ - {"x5", ELEM_OUTPUT_HEX, {0x30}, {0x8}}, \ - {"x6", ELEM_OUTPUT_HEX, {0x38}, {0x8}}, \ - {"x7", ELEM_OUTPUT_HEX, {0x40}, {0x8}}, \ - {"x8", ELEM_OUTPUT_HEX, {0x48}, {0x8}}, \ - {"x9", ELEM_OUTPUT_HEX, {0x50}, {0x8}}, \ - {"x10", ELEM_OUTPUT_HEX, {0x58}, {0x8}}, \ - {"x11", ELEM_OUTPUT_HEX, {0x60}, {0x8}}, \ - {"x12", ELEM_OUTPUT_HEX, {0x68}, {0x8}}, \ - {"x13", ELEM_OUTPUT_HEX, {0x70}, {0x8}}, \ - {"x14", ELEM_OUTPUT_HEX, {0x78}, {0x8}}, \ - {"x15", ELEM_OUTPUT_HEX, {0x80}, {0x8}}, \ - {"x16", ELEM_OUTPUT_HEX, {0x88}, {0x8}}, \ - {"x17", ELEM_OUTPUT_HEX, {0x90}, {0x8}}, \ - {"x18", ELEM_OUTPUT_HEX, {0x98}, {0x8}}, \ - {"x19", ELEM_OUTPUT_HEX, {0xA0}, {0x8}}, \ - {"x20", ELEM_OUTPUT_HEX, {0xA8}, {0x8}}, \ - {"x21", ELEM_OUTPUT_HEX, {0xB0}, {0x8}}, \ - {"x22", ELEM_OUTPUT_HEX, {0xB8}, {0x8}}, \ - {"x23", ELEM_OUTPUT_HEX, {0xC0}, {0x8}}, \ - {"x24", ELEM_OUTPUT_HEX, {0xC8}, {0x8}}, \ - {"x25", ELEM_OUTPUT_HEX, {0xD0}, {0x8}}, \ - {"x26", ELEM_OUTPUT_HEX, {0xD8}, {0x8}}, \ - {"x27", ELEM_OUTPUT_HEX, {0xE0}, {0x8}}, \ - {"x28", ELEM_OUTPUT_HEX, {0xE8}, {0x8}}, \ - {"x29", ELEM_OUTPUT_HEX, {0xF0}, {0x8}}, \ - {"scr_el3", ELEM_OUTPUT_HEX, {0xF8}, {0x8}}, \ - {"sctlr_el3", ELEM_OUTPUT_HEX, {0x100}, {0x8}}, \ - {"cptr_el3", ELEM_OUTPUT_HEX, {0x108}, {0x8}}, \ - {"tcr_el3", ELEM_OUTPUT_HEX, {0x110}, {0x8}}, \ - {"daif", ELEM_OUTPUT_HEX, {0x118}, {0x8}}, \ - {"mair_el3", ELEM_OUTPUT_HEX, {0x120}, {0x8}}, \ - {"spsr_el3", ELEM_OUTPUT_HEX, {0x128}, {0x8}}, \ - {"elr_el3", ELEM_OUTPUT_HEX, {0x130}, {0x8}}, \ - {"ttbr0_el3", ELEM_OUTPUT_HEX, {0x138}, {0x8}}, \ - {"esr_el3", ELEM_OUTPUT_HEX, {0x140}, {0x8}}, \ - {"far_el3", ELEM_OUTPUT_HEX, {0x148}, {0x8}}, \ -} - -/** - * the whole space is 512k, used for histroy data record - * the struct distribution is as follows: - * +-------------------+ - * | head info(1k) | region: area: module block: - * +-------------------+ +--------------------+ +-----------------+ +-----------------+ - * | boot region |---->| first area |---->| module block |---->| block head | - * +-------------------+ +--------------------+ +-----------------+ +-----------------+ - * | run region | | second area | | module block | | block data | - * +-------------------+ +--------------------+ +-----------------+ +-----------------+ - * | reserved | | ...... | | ...... | - * +-------------------+ +--------------------+ +-----------------+ - */ -#define DATA_MODEL_HDR_BOOT_BIOS MODEL_VECTOR(HDR_BOOT_BIOS) = { \ - {"magic", ELEM_OUTPUT_INT, {0x0}, {0x4}}, \ - {"version", ELEM_OUTPUT_INT, {0x4}, {0x4}}, \ - {"module id", ELEM_OUTPUT_INT, {0x8}, {0x4}}, \ - {"if", ELEM_CTRL_COMPARE, {0xC}, {0x4}}, \ - {"is used", ELEM_CTRL_CMP_JUMP_NE, {0x1}, {0xFF}}, \ - {"err code", ELEM_OUTPUT_INT, {0x10}, {0x4}}, \ - {"reason", ELEM_OUTPUT_INT, {0x14}, {0x4}}, \ - {"hot reset index", ELEM_OUTPUT_INT, {0x18}, {0x4}}, \ - {"bsbc point", ELEM_OUTPUT_INT, {0x1C}, {0x4}}, \ - {"bsbc exc point", ELEM_OUTPUT_INT, {0x20}, {0x4}}, \ - {"hboot1 point", ELEM_OUTPUT_INT, {0x24}, {0x4}}, \ - {"hboot1 exc point", ELEM_OUTPUT_INT, {0x28}, {0x4}}, \ - {"hboot2 point", ELEM_OUTPUT_INT, {0x2C}, {0x4}}, \ - {"hboot2 exc point", ELEM_OUTPUT_INT, {0x30}, {0x4}}, \ - {"[BIOS info]", ELEM_OUTPUT_STR_NL, {0x480}, {0x2780}}, \ -} - -#define DATA_MODEL_HDR_BOOT_AREA MODEL_VECTOR(HDR_BOOT_AREA) = { \ - {"BIOS INFO", ELEM_OUTPUT_DIVIDE, {0x0}, {0x2D}}, \ - {"HDR_BOOT_BIOS", ELEM_CTRL_TABLE_GOTO, {0x0}, {0x3000}}, \ - {"table_index", ELEM_CTRL_TABLE_RANGE, {PLAINTEXT_TABLE_HDR_BOOT_BIOS}, {0x1}}, \ - {"NL", ELEM_OUTPUT_NL, {0x0}, {0x0}}, \ -} - -#define DATA_MODEL_HDR_BOOT MODEL_VECTOR(HDR_BOOT) = { \ - {"area 0", ELEM_OUTPUT_DIVIDE, {0x0}, {0x3D}}, \ - {"HDR_BOOT_AREA", ELEM_CTRL_TABLE_GOTO, {0x0}, {0x7800}}, \ - {"table_index", ELEM_CTRL_TABLE_RANGE, {PLAINTEXT_TABLE_HDR_BOOT_AREA}, {0x1}}, \ - {"NL", ELEM_OUTPUT_NL, {0x0}, {0x0}}, \ - {"area 1", ELEM_OUTPUT_DIVIDE, {0x0}, {0x3D}}, \ - {"HDR_BOOT_AREA", ELEM_CTRL_TABLE_GOTO, {0x7800}, {0x7800}}, \ - {"table_index", ELEM_CTRL_TABLE_RANGE, {PLAINTEXT_TABLE_HDR_BOOT_AREA}, {0x1}}, \ - {"NL", ELEM_OUTPUT_NL, {0x0}, {0x0}}, \ - {"area 2", ELEM_OUTPUT_DIVIDE, {0x0}, {0x3D}}, \ - {"HDR_BOOT_AREA", ELEM_CTRL_TABLE_GOTO, {0xF000}, {0x7800}}, \ - {"table_index", ELEM_CTRL_TABLE_RANGE, {PLAINTEXT_TABLE_HDR_BOOT_AREA}, {0x1}}, \ - {"NL", ELEM_OUTPUT_NL, {0x0}, {0x0}}, \ - {"area 3", ELEM_OUTPUT_DIVIDE, {0x0}, {0x3D}}, \ - {"HDR_BOOT_AREA", ELEM_CTRL_TABLE_GOTO, {0x16800}, {0x7800}}, \ - {"table_index", ELEM_CTRL_TABLE_RANGE, {PLAINTEXT_TABLE_HDR_BOOT_AREA}, {0x1}}, \ - {"NL", ELEM_OUTPUT_NL, {0x0}, {0x0}}, \ - {"area 4", ELEM_OUTPUT_DIVIDE, {0x0}, {0x3D}}, \ - {"HDR_BOOT_AREA", ELEM_CTRL_TABLE_GOTO, {0x1E000}, {0x7800}}, \ - {"table_index", ELEM_CTRL_TABLE_RANGE, {PLAINTEXT_TABLE_HDR_BOOT_AREA}, {0x1}}, \ - {"NL", ELEM_OUTPUT_NL, {0x0}, {0x0}}, \ - {"area 5", ELEM_OUTPUT_DIVIDE, {0x0}, {0x3D}}, \ - {"HDR_BOOT_AREA", ELEM_CTRL_TABLE_GOTO, {0x25800}, {0x7800}}, \ - {"table_index", ELEM_CTRL_TABLE_RANGE, {PLAINTEXT_TABLE_HDR_BOOT_AREA}, {0x1}}, \ - {"NL", ELEM_OUTPUT_NL, {0x0}, {0x0}}, \ - {"area 6", ELEM_OUTPUT_DIVIDE, {0x0}, {0x3D}}, \ - {"HDR_BOOT_AREA", ELEM_CTRL_TABLE_GOTO, {0x2D000}, {0x7800}}, \ - {"table_index", ELEM_CTRL_TABLE_RANGE, {PLAINTEXT_TABLE_HDR_BOOT_AREA}, {0x1}}, \ -} - -#define DATA_MODEL_HDR_BOOT_INFO MODEL_VECTOR(HDR_BOOT_INFO) = { \ - {"region offset", ELEM_OUTPUT_INT, {0x0}, {0x4}}, \ - {"region size", ELEM_OUTPUT_INT, {0x4}, {0x4}}, \ - {"NL", ELEM_OUTPUT_NL, {0x0}, {0x0}}, \ - {"region config", ELEM_OUTPUT_DIVIDE, {0x0}, {0x2D}}, \ - {"total area", ELEM_OUTPUT_INT, {0x8}, {0x4}}, \ - {"history area", ELEM_OUTPUT_INT, {0xC}, {0x4}}, \ - {"error area", ELEM_OUTPUT_INT, {0x10}, {0x4}}, \ - {"area config:", ELEM_OUTPUT_STR_CONST, {0x0}, {0x0}}, \ - {" used module count", ELEM_OUTPUT_INT, {0x14}, {0x4}}, \ - {"NL", ELEM_OUTPUT_NL, {0x0}, {0x0}}, \ - {"module config:", ELEM_OUTPUT_STR_CONST, {0x0}, {0x0}}, \ - {" module 0 offset", ELEM_OUTPUT_INT, {0x1C}, {0x4}}, \ - {" module 0 size", ELEM_OUTPUT_INT, {0x20}, {0x4}}, \ - {"NL", ELEM_OUTPUT_NL, {0x0}, {0x0}}, \ - {" module 1 offset", ELEM_OUTPUT_INT, {0x24}, {0x4}}, \ - {" module 1 size", ELEM_OUTPUT_INT, {0x28}, {0x4}}, \ - {"NL", ELEM_OUTPUT_NL, {0x0}, {0x0}}, \ - {" module 2 offset", ELEM_OUTPUT_INT, {0x2C}, {0x4}}, \ - {" module 2 size", ELEM_OUTPUT_INT, {0x30}, {0x4}}, \ - {"NL", ELEM_OUTPUT_NL, {0x0}, {0x0}}, \ - {" module 3 offset", ELEM_OUTPUT_INT, {0x34}, {0x4}}, \ - {" module 3 size", ELEM_OUTPUT_INT, {0x38}, {0x4}}, \ - {"NL", ELEM_OUTPUT_NL, {0x0}, {0x0}}, \ - {"region control", ELEM_OUTPUT_DIVIDE, {0x0}, {0x2D}}, \ - {"area index", ELEM_OUTPUT_INT, {0x6C}, {0x4}}, \ - {"error area count", ELEM_OUTPUT_INT, {0x70}, {0x4}}, \ - {"NL", ELEM_OUTPUT_NL, {0x0}, {0x0}}, \ - {"[area 0 control info]", ELEM_OUTPUT_STR_CONST, {0x0}, {0x0}}, \ - {" flag", ELEM_OUTPUT_INT, {0x74}, {0x4}}, \ - {" tag", ELEM_OUTPUT_INT, {0x78}, {0x4}}, \ - {" exception type", ELEM_OUTPUT_INT, {0x7C}, {0x4}}, \ - {" module id", ELEM_OUTPUT_INT, {0x80}, {0x4}}, \ - {" exception id", ELEM_OUTPUT_INT, {0x84}, {0x4}}, \ - {" reset number", ELEM_OUTPUT_INT, {0x88}, {0x4}}, \ - {"NL", ELEM_OUTPUT_NL, {0x0}, {0x0}}, \ - {"[area 1 control info]", ELEM_OUTPUT_STR_CONST, {0x0}, {0x0}}, \ - {" flag", ELEM_OUTPUT_INT, {0x8C}, {0x4}}, \ - {" tag", ELEM_OUTPUT_INT, {0x90}, {0x4}}, \ - {" exception type", ELEM_OUTPUT_INT, {0x94}, {0x4}}, \ - {" module id", ELEM_OUTPUT_INT, {0x98}, {0x4}}, \ - {" exception id", ELEM_OUTPUT_INT, {0x9C}, {0x4}}, \ - {" reset number", ELEM_OUTPUT_INT, {0xA0}, {0x4}}, \ - {"NL", ELEM_OUTPUT_NL, {0x0}, {0x0}}, \ - {"[area 2 control info]", ELEM_OUTPUT_STR_CONST, {0x0}, {0x0}}, \ - {" flag", ELEM_OUTPUT_INT, {0xA4}, {0x4}}, \ - {" tag", ELEM_OUTPUT_INT, {0xA8}, {0x4}}, \ - {" exception type", ELEM_OUTPUT_INT, {0xAC}, {0x4}}, \ - {" module id", ELEM_OUTPUT_INT, {0xB0}, {0x4}}, \ - {" exception id", ELEM_OUTPUT_INT, {0xB4}, {0x4}}, \ - {" reset number", ELEM_OUTPUT_INT, {0xB8}, {0x4}}, \ - {"NL", ELEM_OUTPUT_NL, {0x0}, {0x0}}, \ - {"[area 3 control info]", ELEM_OUTPUT_STR_CONST, {0x0}, {0x0}}, \ - {" flag", ELEM_OUTPUT_INT, {0xBC}, {0x4}}, \ - {" tag", ELEM_OUTPUT_INT, {0xC0}, {0x4}}, \ - {" exception type", ELEM_OUTPUT_INT, {0xC4}, {0x4}}, \ - {" module id", ELEM_OUTPUT_INT, {0xC8}, {0x4}}, \ - {" exception id", ELEM_OUTPUT_INT, {0xCC}, {0x4}}, \ - {" reset number", ELEM_OUTPUT_INT, {0xD0}, {0x4}}, \ - {"NL", ELEM_OUTPUT_NL, {0x0}, {0x0}}, \ - {"[area 4 control info]", ELEM_OUTPUT_STR_CONST, {0x0}, {0x0}}, \ - {" flag", ELEM_OUTPUT_INT, {0xD4}, {0x4}}, \ - {" tag", ELEM_OUTPUT_INT, {0xD8}, {0x4}}, \ - {" exception type", ELEM_OUTPUT_INT, {0xDC}, {0x4}}, \ - {" module id", ELEM_OUTPUT_INT, {0xE0}, {0x4}}, \ - {" exception id", ELEM_OUTPUT_INT, {0xE4}, {0x4}}, \ - {" reset number", ELEM_OUTPUT_INT, {0xE8}, {0x4}}, \ - {"NL", ELEM_OUTPUT_NL, {0x0}, {0x0}}, \ - {"[area 5 control info]", ELEM_OUTPUT_STR_CONST, {0x0}, {0x0}}, \ - {" flag", ELEM_OUTPUT_INT, {0xEC}, {0x4}}, \ - {" tag", ELEM_OUTPUT_INT, {0xF0}, {0x4}}, \ - {" exception type", ELEM_OUTPUT_INT, {0xF4}, {0x4}}, \ - {" module id", ELEM_OUTPUT_INT, {0xF8}, {0x4}}, \ - {" exception id", ELEM_OUTPUT_INT, {0xFC}, {0x4}}, \ - {" reset number", ELEM_OUTPUT_INT, {0x100}, {0x4}}, \ - {"NL", ELEM_OUTPUT_NL, {0x0}, {0x0}}, \ - {"[area 6 control info]", ELEM_OUTPUT_STR_CONST, {0x0}, {0x0}}, \ - {" flag", ELEM_OUTPUT_INT, {0x104}, {0x4}}, \ - {" tag", ELEM_OUTPUT_INT, {0x108}, {0x4}}, \ - {" exception type", ELEM_OUTPUT_INT, {0x10C}, {0x4}}, \ - {" module id", ELEM_OUTPUT_INT, {0x110}, {0x4}}, \ - {" exception id", ELEM_OUTPUT_INT, {0x114}, {0x4}}, \ - {" reset number", ELEM_OUTPUT_INT, {0x118}, {0x4}}, \ -} - -#define DATA_MODEL_HDR MODEL_VECTOR(HDR) = { \ - {"head info", ELEM_OUTPUT_DIVIDE, {0x0}, {0x3D}}, \ - {"magic", ELEM_OUTPUT_INT, {0x0}, {0x4}}, \ - {"version", ELEM_OUTPUT_INT, {0x4}, {0x4}}, \ - {"reset count", ELEM_OUTPUT_INT, {0x8}, {0x4}}, \ - {"NL", ELEM_OUTPUT_NL, {0x0}, {0x0}}, \ - {"boot region", ELEM_OUTPUT_DIVIDE, {0x0}, {0x3D}}, \ - {"HDR_BOOT_INFO", ELEM_CTRL_TABLE_GOTO, {0XC}, {0x168}}, \ - {"table_index", ELEM_CTRL_TABLE_RANGE, {PLAINTEXT_TABLE_HDR_BOOT_INFO}, {0x1}}, \ - {"NL", ELEM_OUTPUT_NL, {0x0}, {0x0}}, \ - {"HDR_BOOT", ELEM_CTRL_TABLE_GOTO, {0x400}, {0xA000}}, \ - {"table_index", ELEM_CTRL_TABLE_RANGE, {PLAINTEXT_TABLE_HDR_BOOT}, {0x1}}, \ - {"NL", ELEM_OUTPUT_NL, {0x0}, {0x0}}, \ -} - -#endif // BBOX_DDR_DATA_DC_H diff --git a/inc/toolchain/bbox/bbox_ddr_data_mdc.h b/inc/toolchain/bbox/bbox_ddr_data_mdc.h deleted file mode 100644 index 5c35fdfab..000000000 --- a/inc/toolchain/bbox/bbox_ddr_data_mdc.h +++ /dev/null @@ -1,474 +0,0 @@ -/** - * Copyright 2019-2020 Huawei Technologies Co., Ltd - * - * 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 BBOX_DDR_DATA_MDC_H -#define BBOX_DDR_DATA_MDC_H - -#include "bbox_ddr_data.h" - -/* each Module need define as follows */ -/* LPM module */ -#define DATA_MODEL_LPM_START MODEL_VECTOR(LPM_START) = { \ - {"start_steps", ELEM_OUTPUT_STR_NL, {0x0}, {0x800}}, \ -} - -#define DATA_MODEL_LPM MODEL_VECTOR(LPM) = { \ - {"****exc****reg**", ELEM_OUTPUT_STR, {0x0}, {0x8}}, \ - {"fault_regs_dfsr", ELEM_OUTPUT_INT, {0x1410}, {0x4}}, \ - {"fault_regs_ifsr", ELEM_OUTPUT_INT, {0x1414}, {0x4}}, \ - {"fault_regs_adfsr", ELEM_OUTPUT_INT, {0x1418}, {0x4}}, \ - {"fault_regs_aifsr", ELEM_OUTPUT_INT, {0x141c}, {0x4}}, \ - {"fault_regs_dfar", ELEM_OUTPUT_INT, {0x1420}, {0x4}}, \ - {"fault_regs_ifar", ELEM_OUTPUT_INT, {0x1424}, {0x4}}, \ - {"usr_regs_r13", ELEM_OUTPUT_INT, {0x1428}, {0x4}}, \ - {"usr_regs_r14", ELEM_OUTPUT_INT, {0x142c}, {0x4}}, \ - {"svc_regs_regs_r13", ELEM_OUTPUT_INT, {0x1430}, {0x4}}, \ - {"svc_regs_regs_r14", ELEM_OUTPUT_INT, {0x1434}, {0x4}}, \ - {"svc_regs_regs_spsr", ELEM_OUTPUT_INT, {0x1438}, {0x4}}, \ - {"irq_regs_regs_r13", ELEM_OUTPUT_INT, {0x143c}, {0x4}}, \ - {"irq_regs_regs_r14", ELEM_OUTPUT_INT, {0x1440}, {0x4}}, \ - {"irq_regs_regs_spsr", ELEM_OUTPUT_INT, {0x1444}, {0x4}}, \ - {"fiq_regs_regs_r13", ELEM_OUTPUT_INT, {0x1448}, {0x4}}, \ - {"fiq_regs_regs_r14", ELEM_OUTPUT_INT, {0x144c}, {0x4}}, \ - {"fiq_regs_regs_spsr", ELEM_OUTPUT_INT, {0x1450}, {0x4}}, \ - {"und_regs_regs_r13", ELEM_OUTPUT_INT, {0x1454}, {0x4}}, \ - {"und_regs_regs_r14", ELEM_OUTPUT_INT, {0x1458}, {0x4}}, \ - {"und_regs_regs_spsr", ELEM_OUTPUT_INT, {0x145c}, {0x4}}, \ - {"abort_regs_regs_r13", ELEM_OUTPUT_INT, {0x1460}, {0x4}}, \ - {"abort_regs_regs_r14", ELEM_OUTPUT_INT, {0x1464}, {0x4}}, \ - {"abort_regs_regs_spsr", ELEM_OUTPUT_INT, {0x1468}, {0x4}}, \ - {"data_regs_r1", ELEM_OUTPUT_INT, {0x146c}, {0x4}}, \ - {"data_regs_r2", ELEM_OUTPUT_INT, {0x1470}, {0x4}}, \ - {"data_regs_r3", ELEM_OUTPUT_INT, {0x1474}, {0x4}}, \ - {"data_regs_r4", ELEM_OUTPUT_INT, {0x1478}, {0x4}}, \ - {"data_regs_r5", ELEM_OUTPUT_INT, {0x147c}, {0x4}}, \ - {"data_regs_r6", ELEM_OUTPUT_INT, {0x1480}, {0x4}}, \ - {"data_regs_r7", ELEM_OUTPUT_INT, {0x1484}, {0x4}}, \ - {"data_regs_r8", ELEM_OUTPUT_INT, {0x1488}, {0x4}}, \ - {"data_regs_r9", ELEM_OUTPUT_INT, {0x148c}, {0x4}}, \ - {"data_regs_r10", ELEM_OUTPUT_INT, {0x1490}, {0x4}}, \ - {"data_regs_r11", ELEM_OUTPUT_INT, {0x1494}, {0x4}}, \ - {"data_regs_r12", ELEM_OUTPUT_INT, {0x1498}, {0x4}}, \ - {"data_regs_r13", ELEM_OUTPUT_INT, {0x149c}, {0x4}}, \ - {"data_regs_r14", ELEM_OUTPUT_INT, {0x14a0}, {0x4}}, \ - {"data_regs_r15", ELEM_OUTPUT_INT, {0x14a4}, {0x4}}, \ - {"prog_regs_cpsr", ELEM_OUTPUT_INT, {0x14a8}, {0x4}}, \ - {"prog_regs_spsr", ELEM_OUTPUT_INT, {0x14ac}, {0x4}}, \ - {"log", ELEM_OUTPUT_STR_NL, {0xDC80}, {0x400}}, \ -} - -#define DATA_MODEL_LPM_PMU MODEL_VECTOR(LPM_PMU) = { \ - {"cpuid", ELEM_OUTPUT_INT, {0x0000}, {0x1}}, \ - {"2CCH", ELEM_OUTPUT_HEX, {0x0001}, {0x1}}, \ - {"2CDH", ELEM_OUTPUT_HEX, {0x0002}, {0x1}}, \ - {"2CEH", ELEM_OUTPUT_HEX, {0x0003}, {0x1}}, \ - {"2CFH", ELEM_OUTPUT_HEX, {0x0004}, {0x1}}, \ - {"2D0H", ELEM_OUTPUT_HEX, {0x0005}, {0x1}}, \ - {"2D1H", ELEM_OUTPUT_HEX, {0x0006}, {0x1}}, \ - {"2D2H", ELEM_OUTPUT_HEX, {0x0007}, {0x1}}, \ - {"2D3H", ELEM_OUTPUT_HEX, {0x0008}, {0x1}}, \ - {"2D4H", ELEM_OUTPUT_HEX, {0x0009}, {0x1}}, \ - {"2D5H", ELEM_OUTPUT_HEX, {0x000A}, {0x1}}, \ - {"2D6H", ELEM_OUTPUT_HEX, {0x000B}, {0x1}}, \ - {"2D7H", ELEM_OUTPUT_HEX, {0x000C}, {0x1}}, \ - {"2D8H", ELEM_OUTPUT_HEX, {0x000D}, {0x1}}, \ - {"2D9H", ELEM_OUTPUT_HEX, {0x000E}, {0x1}}, \ - {"2DAH", ELEM_OUTPUT_HEX, {0x000F}, {0x1}}, \ - {"2DBH", ELEM_OUTPUT_HEX, {0x0010}, {0x1}}, \ - {"2DCH", ELEM_OUTPUT_HEX, {0x0011}, {0x1}}, \ - {"2DDH", ELEM_OUTPUT_HEX, {0x0012}, {0x1}}, \ - {"2DEH", ELEM_OUTPUT_HEX, {0x0013}, {0x1}}, \ - {"2DFH", ELEM_OUTPUT_HEX, {0x0014}, {0x1}}, \ - {"2E0H", ELEM_OUTPUT_HEX, {0x0015}, {0x1}}, \ - {"2E1H", ELEM_OUTPUT_HEX, {0x0016}, {0x1}}, \ - {"2E2H", ELEM_OUTPUT_HEX, {0x0017}, {0x1}}, \ - {"2E3H", ELEM_OUTPUT_HEX, {0x0018}, {0x1}}, \ - {"2E4H", ELEM_OUTPUT_HEX, {0x0019}, {0x1}}, \ - {"2E5H", ELEM_OUTPUT_HEX, {0x001A}, {0x1}}, \ - {"2E6H", ELEM_OUTPUT_HEX, {0x001B}, {0x1}}, \ - {"2E7H", ELEM_OUTPUT_HEX, {0x001C}, {0x1}}, \ - {"slave0", ELEM_OUTPUT_HEX, {0x0020}, {0x1}}, \ - {"E0", ELEM_OUTPUT_HEX, {0x0021}, {0x1}}, \ - {"E1", ELEM_OUTPUT_HEX, {0x0022}, {0x1}}, \ - {"E2", ELEM_OUTPUT_HEX, {0x0023}, {0x1}}, \ - {"reserve", ELEM_OUTPUT_HEX, {0x0024}, {0x1}}, \ - {"reserve", ELEM_OUTPUT_HEX, {0x0025}, {0x1}}, \ - {"reserve", ELEM_OUTPUT_HEX, {0x0026}, {0x1}}, \ - {"slave1", ELEM_OUTPUT_HEX, {0x0040}, {0x1}}, \ - {"E0", ELEM_OUTPUT_HEX, {0x0041}, {0x1}}, \ - {"E1", ELEM_OUTPUT_HEX, {0x0042}, {0x1}}, \ - {"E2", ELEM_OUTPUT_HEX, {0x0043}, {0x1}}, \ - {"reserve", ELEM_OUTPUT_HEX, {0x0044}, {0x1}}, \ - {"reserve", ELEM_OUTPUT_HEX, {0x0045}, {0x1}}, \ - {"reserve", ELEM_OUTPUT_HEX, {0x0046}, {0x1}}, \ - {"aicSlave", ELEM_OUTPUT_HEX, {0x0060}, {0x1}}, \ - {"0x79", ELEM_OUTPUT_HEX, {0x0061}, {0x2}}, \ - {"0x7A", ELEM_OUTPUT_HEX, {0x0063}, {0x1}}, \ - {"0x7B", ELEM_OUTPUT_HEX, {0x0064}, {0x1}}, \ - {"0x7C", ELEM_OUTPUT_HEX, {0x0065}, {0x1}}, \ - {"0x7D", ELEM_OUTPUT_HEX, {0x0066}, {0x1}}, \ - {"0x7E", ELEM_OUTPUT_HEX, {0x0067}, {0x1}}, \ - {"dvppSlave", ELEM_OUTPUT_HEX, {0x0080}, {0x1}}, \ - {"0x79", ELEM_OUTPUT_HEX, {0x0081}, {0x2}}, \ - {"0x7A", ELEM_OUTPUT_HEX, {0x0083}, {0x1}}, \ - {"0x7B", ELEM_OUTPUT_HEX, {0x0084}, {0x1}}, \ - {"0x7C", ELEM_OUTPUT_HEX, {0x0085}, {0x1}}, \ - {"0x7D", ELEM_OUTPUT_HEX, {0x0086}, {0x1}}, \ - {"0x7E", ELEM_OUTPUT_HEX, {0x0087}, {0x1}}, \ - {"cpuSlave", ELEM_OUTPUT_HEX, {0x00A0}, {0x1}}, \ - {"0x79", ELEM_OUTPUT_HEX, {0x00A1}, {0x2}}, \ - {"0x7A", ELEM_OUTPUT_HEX, {0x00A3}, {0x1}}, \ - {"0x7B", ELEM_OUTPUT_HEX, {0x00A4}, {0x1}}, \ - {"0x7C", ELEM_OUTPUT_HEX, {0x00A5}, {0x1}}, \ - {"0x7D", ELEM_OUTPUT_HEX, {0x00A6}, {0x1}}, \ - {"0x7E", ELEM_OUTPUT_HEX, {0x00A7}, {0x1}}, \ -} - -/* (LPM)DDR module */ -#define DATA_MODEL_DDR_SRAM MODEL_VECTOR(DDR_SRAM) = { \ - {"dram type", ELEM_OUTPUT_INT, {0x00}, {0x4}}, \ - {"dram size", ELEM_OUTPUT_INT, {0x04}, {0x4}}, \ - {"rank num", ELEM_OUTPUT_INT, {0x08}, {0x4}}, \ - {"chn bit map", ELEM_OUTPUT_INT, {0x0c}, {0x4}}, \ - {"manufacteryId[0]", ELEM_OUTPUT_INT, {0x10}, {0x4}}, \ - {"manufacteryId[1]", ELEM_OUTPUT_INT, {0x14}, {0x4}}, \ - {"manufacteryId[2]", ELEM_OUTPUT_INT, {0x18}, {0x4}}, \ - {"manufacteryId[3]", ELEM_OUTPUT_INT, {0x1c}, {0x4}}, \ - {"manufacteryId[4]", ELEM_OUTPUT_INT, {0x20}, {0x4}}, \ - {"manufacteryId[5]", ELEM_OUTPUT_INT, {0x24}, {0x4}}, \ - {"manufacteryId[6]", ELEM_OUTPUT_INT, {0x28}, {0x4}}, \ - {"manufacteryId[7]", ELEM_OUTPUT_INT, {0x2c}, {0x4}}, \ - {"manufacteryId[8]", ELEM_OUTPUT_INT, {0x30}, {0x4}}, \ - {"manufacteryId[9]", ELEM_OUTPUT_INT, {0x34}, {0x4}}, \ - {"manufacteryId[10]", ELEM_OUTPUT_INT, {0x38}, {0x4}}, \ - {"manufacteryId[11]", ELEM_OUTPUT_INT, {0x3c}, {0x4}}, \ - {"manufacteryId[12]", ELEM_OUTPUT_INT, {0x40}, {0x4}}, \ - {"manufacteryId[13]", ELEM_OUTPUT_INT, {0x44}, {0x4}}, \ - {"manufacteryId[14]", ELEM_OUTPUT_INT, {0x48}, {0x4}}, \ - {"manufacteryId[15]", ELEM_OUTPUT_INT, {0x4c}, {0x4}}, \ - {"manufacteryId[16]", ELEM_OUTPUT_INT, {0x50}, {0x4}}, \ - {"manufacteryId[17]", ELEM_OUTPUT_INT, {0x54}, {0x4}}, \ - {"manufacteryId[18]", ELEM_OUTPUT_INT, {0x58}, {0x4}}, \ - {"manufacteryId[19]", ELEM_OUTPUT_INT, {0x5c}, {0x4}}, \ - {"manufacteryId[20]", ELEM_OUTPUT_INT, {0x60}, {0x4}}, \ - {"manufacteryId[21]", ELEM_OUTPUT_INT, {0x64}, {0x4}}, \ - {"manufacteryId[22]", ELEM_OUTPUT_INT, {0x68}, {0x4}}, \ - {"manufacteryId[23]", ELEM_OUTPUT_INT, {0x6c}, {0x4}}, \ - {"iecc", ELEM_OUTPUT_INT, {0x70}, {0x4}}, \ - {"swap type", ELEM_OUTPUT_INT, {0x74}, {0x4}}, \ - {"freq", ELEM_OUTPUT_INT, {0x78}, {0x4}}, \ -} - -/* TEE module */ -#define DATA_MODEL_TEE MODEL_VECTOR(TEE) = { \ - {"tee info", ELEM_OUTPUT_CHAR, {0x0}, {0x20000}}, \ -} - -/* DVPP module */ -#define DATA_MODEL_DVPP MODEL_VECTOR(DVPP) = { \ - {"dvpp info", ELEM_OUTPUT_STR_NL, {0x0}, {0x10000}}, \ -} - -/* DRIVE module */ -#define DATA_MODEL_DRIVER MODEL_VECTOR(DRIVER) = { \ - {"driver info", ELEM_OUTPUT_STR_NL, {0x0}, {0x20000}}, \ -} - -/* TS module, start */ -#define DATA_MODEL_TS_START MODEL_VECTOR(TS_START) = { \ - {"ts0 start info", ELEM_OUTPUT_STR_NL, {0x0}, {0x19000}}, \ - {"ts1 start info", ELEM_OUTPUT_STR_NL, {0x19000}, {0x19000}}, \ -} - -/* TS module */ -#define DATA_MODEL_TS MODEL_VECTOR(TS) = { \ - {"ts info", ELEM_OUTPUT_STR_NL, {0x0}, {0xE6F00}}, \ -} - -/* HSM module */ -#define DATA_MODEL_HSM MODEL_VECTOR(HSM) = { \ - {"hsm info", ELEM_OUTPUT_STR_NL, {0x0}, {0x1000}}, \ -} - -/* HSM module, start */ -#define DATA_MODEL_HSM_START MODEL_VECTOR(HSM_START) = { \ - {"hsm start info", ELEM_OUTPUT_STR_NL, {0x0}, {0x1000}}, \ -} - -// lpm common log data -#define DATA_MODEL_LPM_LOG MODEL_VECTOR(LPM_LOG) = { \ - {"lpm log buffer", ELEM_FEATURE_LOOPBUF, {1}, {6}}, \ - {"buf_read", ELEM_CTRL_LPBF_READ, {0x0}, {0x4}}, \ - {"buf_len", ELEM_CTRL_LPBF_SIZE, {0x4}, {0x4}}, \ - {"buf_write", ELEM_CTRL_LPBF_WRITE, {0x40}, {0x4}}, \ - {"log_level", ELEM_OUTPUT_INT, {0x44}, {0x4}}, \ - {"buf_head_len", ELEM_CTRL_LPBF_HEAD, {0x80}, {0x4}}, \ - {"lpm log data", ELEM_FEATURE_CHARLOG, {1}, {1}}, \ - {"lpm log", ELEM_OUTPUT_STR_NL, {0x80}, {0x1FF80}}, \ -} - -// hsm common log data -#define DATA_MODEL_HSM_LOG MODEL_VECTOR(HSM_LOG) = { \ - {"hsm log buffer", ELEM_FEATURE_LOOPBUF, {1}, {6}}, \ - {"buf_read", ELEM_CTRL_LPBF_READ, {0x0}, {0x4}}, \ - {"buf_len", ELEM_CTRL_LPBF_SIZE, {0x4}, {0x4}}, \ - {"buf_write", ELEM_CTRL_LPBF_WRITE, {0x40}, {0x4}}, \ - {"log_level", ELEM_OUTPUT_INT, {0x44}, {0x4}}, \ - {"buf_head_len", ELEM_CTRL_LPBF_HEAD, {0x80}, {0x4}}, \ - {"hsm log data", ELEM_FEATURE_CHARLOG, {1}, {1}}, \ - {"hsm log", ELEM_OUTPUT_STR_NL, {0x80}, {0x1FF80}}, \ -} - -/* isp bbox data */ -#define DATA_MODEL_ISP MODEL_VECTOR(ISP) = { \ - {"isp log", ELEM_OUTPUT_STR_NL, {0}, {0x40000}}, \ -} - -/* isp module, start */ -#define DATA_MODEL_ISP_START MODEL_VECTOR(ISP_START) = { \ - {"isp start info", ELEM_OUTPUT_STR_NL, {0x0}, {0x1000}}, \ -} - -/* DVPP module */ -#define DATA_MODEL_DVPP MODEL_VECTOR(DVPP) = { \ - {"dvpp info", ELEM_OUTPUT_STR_NL, {0x0}, {0x10000}}, \ -} - -/* DP module */ -#define DATA_MODEL_DP MODEL_VECTOR(DP) = { \ - {"os kbox info", ELEM_OUTPUT_STR_NL, {0x3000}, {0x4FD000}}, \ -} - -/* safetyisland module */ -#define DATA_MODEL_SAFETYISLAND MODEL_VECTOR(SAFETYISLAND) = { \ - {"safetyisland info", ELEM_OUTPUT_STR_NL, {0x0}, {0xC800}}, \ -} - -/* TF module */ -#define DATA_MODEL_TF MODEL_VECTOR(TF) = { \ - {"x0", ELEM_OUTPUT_HEX, {0x0}, {0x8}}, \ - {"x1", ELEM_OUTPUT_HEX, {0x8}, {0x8}}, \ - {"x30", ELEM_OUTPUT_HEX, {0x10}, {0x8}}, \ - {"x2", ELEM_OUTPUT_HEX, {0x18}, {0x8}}, \ - {"x3", ELEM_OUTPUT_HEX, {0x20}, {0x8}}, \ - {"x4", ELEM_OUTPUT_HEX, {0x28}, {0x8}}, \ - {"x5", ELEM_OUTPUT_HEX, {0x30}, {0x8}}, \ - {"x6", ELEM_OUTPUT_HEX, {0x38}, {0x8}}, \ - {"x7", ELEM_OUTPUT_HEX, {0x40}, {0x8}}, \ - {"x8", ELEM_OUTPUT_HEX, {0x48}, {0x8}}, \ - {"x9", ELEM_OUTPUT_HEX, {0x50}, {0x8}}, \ - {"x10", ELEM_OUTPUT_HEX, {0x58}, {0x8}}, \ - {"x11", ELEM_OUTPUT_HEX, {0x60}, {0x8}}, \ - {"x12", ELEM_OUTPUT_HEX, {0x68}, {0x8}}, \ - {"x13", ELEM_OUTPUT_HEX, {0x70}, {0x8}}, \ - {"x14", ELEM_OUTPUT_HEX, {0x78}, {0x8}}, \ - {"x15", ELEM_OUTPUT_HEX, {0x80}, {0x8}}, \ - {"x16", ELEM_OUTPUT_HEX, {0x88}, {0x8}}, \ - {"x17", ELEM_OUTPUT_HEX, {0x90}, {0x8}}, \ - {"x18", ELEM_OUTPUT_HEX, {0x98}, {0x8}}, \ - {"x19", ELEM_OUTPUT_HEX, {0xA0}, {0x8}}, \ - {"x20", ELEM_OUTPUT_HEX, {0xA8}, {0x8}}, \ - {"x21", ELEM_OUTPUT_HEX, {0xB0}, {0x8}}, \ - {"x22", ELEM_OUTPUT_HEX, {0xB8}, {0x8}}, \ - {"x23", ELEM_OUTPUT_HEX, {0xC0}, {0x8}}, \ - {"x24", ELEM_OUTPUT_HEX, {0xC8}, {0x8}}, \ - {"x25", ELEM_OUTPUT_HEX, {0xD0}, {0x8}}, \ - {"x26", ELEM_OUTPUT_HEX, {0xD8}, {0x8}}, \ - {"x27", ELEM_OUTPUT_HEX, {0xE0}, {0x8}}, \ - {"x28", ELEM_OUTPUT_HEX, {0xE8}, {0x8}}, \ - {"x29", ELEM_OUTPUT_HEX, {0xF0}, {0x8}}, \ - {"scr_el3", ELEM_OUTPUT_HEX, {0xF8}, {0x8}}, \ - {"sctlr_el3", ELEM_OUTPUT_HEX, {0x100}, {0x8}}, \ - {"cptr_el3", ELEM_OUTPUT_HEX, {0x108}, {0x8}}, \ - {"tcr_el3", ELEM_OUTPUT_HEX, {0x110}, {0x8}}, \ - {"daif", ELEM_OUTPUT_HEX, {0x118}, {0x8}}, \ - {"mair_el3", ELEM_OUTPUT_HEX, {0x120}, {0x8}}, \ - {"spsr_el3", ELEM_OUTPUT_HEX, {0x128}, {0x8}}, \ - {"elr_el3", ELEM_OUTPUT_HEX, {0x130}, {0x8}}, \ - {"ttbr0_el3", ELEM_OUTPUT_HEX, {0x138}, {0x8}}, \ - {"esr_el3", ELEM_OUTPUT_HEX, {0x140}, {0x8}}, \ - {"far_el3", ELEM_OUTPUT_HEX, {0x148}, {0x8}}, \ -} - -/** - * the whole space is 512k, used for histroy data record - * the struct distribution is as follows: - * +-------------------+ - * | head info(1k) | region: area: module block: - * +-------------------+ +--------------------+ +-----------------+ +-----------------+ - * | boot region |---->| first area |---->| module block |---->| block head | - * +-------------------+ +--------------------+ +-----------------+ +-----------------+ - * | run region | | second area | | module block | | block data | - * +-------------------+ +--------------------+ +-----------------+ +-----------------+ - * | reserved | | ...... | | ...... | - * +-------------------+ +--------------------+ +-----------------+ - */ -#define DATA_MODEL_HDR_BOOT_BIOS MODEL_VECTOR(HDR_BOOT_BIOS) = { \ - {"magic", ELEM_OUTPUT_INT, {0x0}, {0x4}}, \ - {"version", ELEM_OUTPUT_INT, {0x4}, {0x4}}, \ - {"module id", ELEM_OUTPUT_INT, {0x8}, {0x4}}, \ - {"if", ELEM_CTRL_COMPARE, {0xC}, {0x4}}, \ - {"is used", ELEM_CTRL_CMP_JUMP_NE, {0x1}, {0xFF}}, \ - {"err code", ELEM_OUTPUT_INT, {0x10}, {0x4}}, \ - {"reason", ELEM_OUTPUT_INT, {0x14}, {0x4}}, \ - {"hot reset index", ELEM_OUTPUT_INT, {0x18}, {0x4}}, \ - {"bsbc point", ELEM_OUTPUT_INT, {0x1C}, {0x4}}, \ - {"bsbc exc point", ELEM_OUTPUT_INT, {0x20}, {0x4}}, \ - {"hboot1 point", ELEM_OUTPUT_INT, {0x24}, {0x4}}, \ - {"hboot1 exc point", ELEM_OUTPUT_INT, {0x28}, {0x4}}, \ - {"hboot2 point", ELEM_OUTPUT_INT, {0x2C}, {0x4}}, \ - {"hboot2 exc point", ELEM_OUTPUT_INT, {0x30}, {0x4}}, \ - {"[BIOS info]", ELEM_OUTPUT_STR_NL, {0x480}, {0x2780}}, \ -} - -#define DATA_MODEL_HDR_BOOT_AREA MODEL_VECTOR(HDR_BOOT_AREA) = { \ - {"BIOS INFO", ELEM_OUTPUT_DIVIDE, {0x0}, {0x2D}}, \ - {"HDR_BOOT_BIOS", ELEM_CTRL_TABLE_GOTO, {0x0}, {0x3000}}, \ - {"table_index", ELEM_CTRL_TABLE_RANGE, {PLAINTEXT_TABLE_HDR_BOOT_BIOS}, {0x1}}, \ - {"NL", ELEM_OUTPUT_NL, {0x0}, {0x0}}, \ -} - -#define DATA_MODEL_HDR_BOOT MODEL_VECTOR(HDR_BOOT) = { \ - {"area 0", ELEM_OUTPUT_DIVIDE, {0x0}, {0x3D}}, \ - {"HDR_BOOT_AREA", ELEM_CTRL_TABLE_GOTO, {0x0}, {0x7800}}, \ - {"table_index", ELEM_CTRL_TABLE_RANGE, {PLAINTEXT_TABLE_HDR_BOOT_AREA}, {0x1}}, \ - {"NL", ELEM_OUTPUT_NL, {0x0}, {0x0}}, \ - {"area 1", ELEM_OUTPUT_DIVIDE, {0x0}, {0x3D}}, \ - {"HDR_BOOT_AREA", ELEM_CTRL_TABLE_GOTO, {0x7800}, {0x7800}}, \ - {"table_index", ELEM_CTRL_TABLE_RANGE, {PLAINTEXT_TABLE_HDR_BOOT_AREA}, {0x1}}, \ - {"NL", ELEM_OUTPUT_NL, {0x0}, {0x0}}, \ - {"area 2", ELEM_OUTPUT_DIVIDE, {0x0}, {0x3D}}, \ - {"HDR_BOOT_AREA", ELEM_CTRL_TABLE_GOTO, {0xF000}, {0x7800}}, \ - {"table_index", ELEM_CTRL_TABLE_RANGE, {PLAINTEXT_TABLE_HDR_BOOT_AREA}, {0x1}}, \ - {"NL", ELEM_OUTPUT_NL, {0x0}, {0x0}}, \ - {"area 3", ELEM_OUTPUT_DIVIDE, {0x0}, {0x3D}}, \ - {"HDR_BOOT_AREA", ELEM_CTRL_TABLE_GOTO, {0x16800}, {0x7800}}, \ - {"table_index", ELEM_CTRL_TABLE_RANGE, {PLAINTEXT_TABLE_HDR_BOOT_AREA}, {0x1}}, \ - {"NL", ELEM_OUTPUT_NL, {0x0}, {0x0}}, \ - {"area 4", ELEM_OUTPUT_DIVIDE, {0x0}, {0x3D}}, \ - {"HDR_BOOT_AREA", ELEM_CTRL_TABLE_GOTO, {0x1E000}, {0x7800}}, \ - {"table_index", ELEM_CTRL_TABLE_RANGE, {PLAINTEXT_TABLE_HDR_BOOT_AREA}, {0x1}}, \ - {"NL", ELEM_OUTPUT_NL, {0x0}, {0x0}}, \ - {"area 5", ELEM_OUTPUT_DIVIDE, {0x0}, {0x3D}}, \ - {"HDR_BOOT_AREA", ELEM_CTRL_TABLE_GOTO, {0x25800}, {0x7800}}, \ - {"table_index", ELEM_CTRL_TABLE_RANGE, {PLAINTEXT_TABLE_HDR_BOOT_AREA}, {0x1}}, \ - {"NL", ELEM_OUTPUT_NL, {0x0}, {0x0}}, \ - {"area 6", ELEM_OUTPUT_DIVIDE, {0x0}, {0x3D}}, \ - {"HDR_BOOT_AREA", ELEM_CTRL_TABLE_GOTO, {0x2D000}, {0x7800}}, \ - {"table_index", ELEM_CTRL_TABLE_RANGE, {PLAINTEXT_TABLE_HDR_BOOT_AREA}, {0x1}}, \ -} - -#define DATA_MODEL_HDR_BOOT_INFO MODEL_VECTOR(HDR_BOOT_INFO) = { \ - {"region offset", ELEM_OUTPUT_INT, {0x0}, {0x4}}, \ - {"region size", ELEM_OUTPUT_INT, {0x4}, {0x4}}, \ - {"NL", ELEM_OUTPUT_NL, {0x0}, {0x0}}, \ - {"region config", ELEM_OUTPUT_DIVIDE, {0x0}, {0x2D}}, \ - {"total area", ELEM_OUTPUT_INT, {0x8}, {0x4}}, \ - {"history area", ELEM_OUTPUT_INT, {0xC}, {0x4}}, \ - {"error area", ELEM_OUTPUT_INT, {0x10}, {0x4}}, \ - {"area config:", ELEM_OUTPUT_STR_CONST, {0x0}, {0x0}}, \ - {" used module count", ELEM_OUTPUT_INT, {0x14}, {0x4}}, \ - {"NL", ELEM_OUTPUT_NL, {0x0}, {0x0}}, \ - {"module config:", ELEM_OUTPUT_STR_CONST, {0x0}, {0x0}}, \ - {" module 0 offset", ELEM_OUTPUT_INT, {0x1C}, {0x4}}, \ - {" module 0 size", ELEM_OUTPUT_INT, {0x20}, {0x4}}, \ - {"NL", ELEM_OUTPUT_NL, {0x0}, {0x0}}, \ - {" module 1 offset", ELEM_OUTPUT_INT, {0x24}, {0x4}}, \ - {" module 1 size", ELEM_OUTPUT_INT, {0x28}, {0x4}}, \ - {"NL", ELEM_OUTPUT_NL, {0x0}, {0x0}}, \ - {" module 2 offset", ELEM_OUTPUT_INT, {0x2C}, {0x4}}, \ - {" module 2 size", ELEM_OUTPUT_INT, {0x30}, {0x4}}, \ - {"NL", ELEM_OUTPUT_NL, {0x0}, {0x0}}, \ - {" module 3 offset", ELEM_OUTPUT_INT, {0x34}, {0x4}}, \ - {" module 3 size", ELEM_OUTPUT_INT, {0x38}, {0x4}}, \ - {"NL", ELEM_OUTPUT_NL, {0x0}, {0x0}}, \ - {"region control", ELEM_OUTPUT_DIVIDE, {0x0}, {0x2D}}, \ - {"area index", ELEM_OUTPUT_INT, {0x6C}, {0x4}}, \ - {"error area count", ELEM_OUTPUT_INT, {0x70}, {0x4}}, \ - {"NL", ELEM_OUTPUT_NL, {0x0}, {0x0}}, \ - {"[area 0 control info]", ELEM_OUTPUT_STR_CONST, {0x0}, {0x0}}, \ - {" flag", ELEM_OUTPUT_INT, {0x74}, {0x4}}, \ - {" tag", ELEM_OUTPUT_INT, {0x78}, {0x4}}, \ - {" exception type", ELEM_OUTPUT_INT, {0x7C}, {0x4}}, \ - {" module id", ELEM_OUTPUT_INT, {0x80}, {0x4}}, \ - {" exception id", ELEM_OUTPUT_INT, {0x84}, {0x4}}, \ - {" reset number", ELEM_OUTPUT_INT, {0x88}, {0x4}}, \ - {"NL", ELEM_OUTPUT_NL, {0x0}, {0x0}}, \ - {"[area 1 control info]", ELEM_OUTPUT_STR_CONST, {0x0}, {0x0}}, \ - {" flag", ELEM_OUTPUT_INT, {0x8C}, {0x4}}, \ - {" tag", ELEM_OUTPUT_INT, {0x90}, {0x4}}, \ - {" exception type", ELEM_OUTPUT_INT, {0x94}, {0x4}}, \ - {" module id", ELEM_OUTPUT_INT, {0x98}, {0x4}}, \ - {" exception id", ELEM_OUTPUT_INT, {0x9C}, {0x4}}, \ - {" reset number", ELEM_OUTPUT_INT, {0xA0}, {0x4}}, \ - {"NL", ELEM_OUTPUT_NL, {0x0}, {0x0}}, \ - {"[area 2 control info]", ELEM_OUTPUT_STR_CONST, {0x0}, {0x0}}, \ - {" flag", ELEM_OUTPUT_INT, {0xA4}, {0x4}}, \ - {" tag", ELEM_OUTPUT_INT, {0xA8}, {0x4}}, \ - {" exception type", ELEM_OUTPUT_INT, {0xAC}, {0x4}}, \ - {" module id", ELEM_OUTPUT_INT, {0xB0}, {0x4}}, \ - {" exception id", ELEM_OUTPUT_INT, {0xB4}, {0x4}}, \ - {" reset number", ELEM_OUTPUT_INT, {0xB8}, {0x4}}, \ - {"NL", ELEM_OUTPUT_NL, {0x0}, {0x0}}, \ - {"[area 3 control info]", ELEM_OUTPUT_STR_CONST, {0x0}, {0x0}}, \ - {" flag", ELEM_OUTPUT_INT, {0xBC}, {0x4}}, \ - {" tag", ELEM_OUTPUT_INT, {0xC0}, {0x4}}, \ - {" exception type", ELEM_OUTPUT_INT, {0xC4}, {0x4}}, \ - {" module id", ELEM_OUTPUT_INT, {0xC8}, {0x4}}, \ - {" exception id", ELEM_OUTPUT_INT, {0xCC}, {0x4}}, \ - {" reset number", ELEM_OUTPUT_INT, {0xD0}, {0x4}}, \ - {"NL", ELEM_OUTPUT_NL, {0x0}, {0x0}}, \ - {"[area 4 control info]", ELEM_OUTPUT_STR_CONST, {0x0}, {0x0}}, \ - {" flag", ELEM_OUTPUT_INT, {0xD4}, {0x4}}, \ - {" tag", ELEM_OUTPUT_INT, {0xD8}, {0x4}}, \ - {" exception type", ELEM_OUTPUT_INT, {0xDC}, {0x4}}, \ - {" module id", ELEM_OUTPUT_INT, {0xE0}, {0x4}}, \ - {" exception id", ELEM_OUTPUT_INT, {0xE4}, {0x4}}, \ - {" reset number", ELEM_OUTPUT_INT, {0xE8}, {0x4}}, \ - {"NL", ELEM_OUTPUT_NL, {0x0}, {0x0}}, \ - {"[area 5 control info]", ELEM_OUTPUT_STR_CONST, {0x0}, {0x0}}, \ - {" flag", ELEM_OUTPUT_INT, {0xEC}, {0x4}}, \ - {" tag", ELEM_OUTPUT_INT, {0xF0}, {0x4}}, \ - {" exception type", ELEM_OUTPUT_INT, {0xF4}, {0x4}}, \ - {" module id", ELEM_OUTPUT_INT, {0xF8}, {0x4}}, \ - {" exception id", ELEM_OUTPUT_INT, {0xFC}, {0x4}}, \ - {" reset number", ELEM_OUTPUT_INT, {0x100}, {0x4}}, \ - {"NL", ELEM_OUTPUT_NL, {0x0}, {0x0}}, \ - {"[area 6 control info]", ELEM_OUTPUT_STR_CONST, {0x0}, {0x0}}, \ - {" flag", ELEM_OUTPUT_INT, {0x104}, {0x4}}, \ - {" tag", ELEM_OUTPUT_INT, {0x108}, {0x4}}, \ - {" exception type", ELEM_OUTPUT_INT, {0x10C}, {0x4}}, \ - {" module id", ELEM_OUTPUT_INT, {0x110}, {0x4}}, \ - {" exception id", ELEM_OUTPUT_INT, {0x114}, {0x4}}, \ - {" reset number", ELEM_OUTPUT_INT, {0x118}, {0x4}}, \ -} - -#define DATA_MODEL_HDR MODEL_VECTOR(HDR) = { \ - {"head info", ELEM_OUTPUT_DIVIDE, {0x0}, {0x3D}}, \ - {"magic", ELEM_OUTPUT_INT, {0x0}, {0x4}}, \ - {"version", ELEM_OUTPUT_INT, {0x4}, {0x4}}, \ - {"reset count", ELEM_OUTPUT_INT, {0x8}, {0x4}}, \ - {"NL", ELEM_OUTPUT_NL, {0x0}, {0x0}}, \ - {"boot region", ELEM_OUTPUT_DIVIDE, {0x0}, {0x3D}}, \ - {"HDR_BOOT_INFO", ELEM_CTRL_TABLE_GOTO, {0XC}, {0x168}}, \ - {"table_index", ELEM_CTRL_TABLE_RANGE, {PLAINTEXT_TABLE_HDR_BOOT_INFO}, {0x1}}, \ - {"NL", ELEM_OUTPUT_NL, {0x0}, {0x0}}, \ - {"HDR_BOOT", ELEM_CTRL_TABLE_GOTO, {0x400}, {0xA000}}, \ - {"table_index", ELEM_CTRL_TABLE_RANGE, {PLAINTEXT_TABLE_HDR_BOOT}, {0x1}}, \ - {"NL", ELEM_OUTPUT_NL, {0x0}, {0x0}}, \ -} - -#endif // BBOX_DDR_DATA_MDC_H diff --git a/inc/toolchain/bbox/bbox_ddr_data_mini.h b/inc/toolchain/bbox/bbox_ddr_data_mini.h deleted file mode 100644 index 02aaeb33d..000000000 --- a/inc/toolchain/bbox/bbox_ddr_data_mini.h +++ /dev/null @@ -1,1278 +0,0 @@ -/** - * Copyright 2019-2020 Huawei Technologies Co., Ltd - * - * 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 BBOX_DDR_DATA_MINI_H -#define BBOX_DDR_DATA_MINI_H - -#include "bbox_ddr_data.h" - -/* each Module need define as follows */ -/* LPM3 module */ -#define DATA_MODEL_LPM3_START MODEL_VECTOR(LPM3_START) = { \ - {"start_step 1", ELEM_OUTPUT_INT, {0x0}, {0x1}}, \ - {"start_step 2", ELEM_OUTPUT_INT, {0x1}, {0x1}}, \ - {"start_step 3", ELEM_OUTPUT_INT, {0x2}, {0x1}}, \ - {"start_step 4", ELEM_OUTPUT_INT, {0x3}, {0x1}}, \ - {"start_step 5", ELEM_OUTPUT_INT, {0x4}, {0x1}}, \ - {"start_step 6", ELEM_OUTPUT_INT, {0x5}, {0x1}}, \ - {"start_step 7", ELEM_OUTPUT_INT, {0x6}, {0x1}}, \ - {"start_step 8", ELEM_OUTPUT_INT, {0x7}, {0x1}}, \ - {"start_step 9", ELEM_OUTPUT_INT, {0x8}, {0x1}}, \ - {"start_step 10", ELEM_OUTPUT_INT, {0x9}, {0x1}}, \ - {"start_step 11", ELEM_OUTPUT_INT, {0xa}, {0x1}}, \ - {"start_step 12", ELEM_OUTPUT_INT, {0xb}, {0x1}}, \ - {"start_step 13", ELEM_OUTPUT_INT, {0xc}, {0x1}}, \ - {"start_step 14", ELEM_OUTPUT_INT, {0xd}, {0x1}}, \ - {"start_step 15", ELEM_OUTPUT_INT, {0xe}, {0x1}}, \ - {"start_step 16", ELEM_OUTPUT_INT, {0xf}, {0x1}}, \ - {"start_step 17", ELEM_OUTPUT_INT, {0x10}, {0x1}}, \ - {"start_step 18", ELEM_OUTPUT_INT, {0x11}, {0x1}}, \ - {"start_step 19", ELEM_OUTPUT_INT, {0x12}, {0x1}}, \ - {"start_step 20", ELEM_OUTPUT_INT, {0x13}, {0x1}}, \ - {"start_step 21", ELEM_OUTPUT_INT, {0x14}, {0x1}}, \ - {"start_step 22", ELEM_OUTPUT_INT, {0x15}, {0x1}}, \ - {"start_step 23", ELEM_OUTPUT_INT, {0x16}, {0x1}}, \ - {"start_step 24", ELEM_OUTPUT_INT, {0x17}, {0x1}}, \ - {"start_step 25", ELEM_OUTPUT_INT, {0x18}, {0x1}}, \ - {"start_step 26", ELEM_OUTPUT_INT, {0x19}, {0x1}}, \ - {"start_step 27", ELEM_OUTPUT_INT, {0x1a}, {0x1}}, \ -} - -#define DATA_MODEL_LPM3 MODEL_VECTOR(LPM3) = { \ - {"****exc****reg**", ELEM_OUTPUT_STR, {0x00}, {0x8}}, \ - {"reset_reason", ELEM_OUTPUT_INT, {0x80}, {0x4}}, \ - {"slice", ELEM_OUTPUT_INT, {0x84}, {0x4}}, \ - {"rtc", ELEM_OUTPUT_INT, {0x88}, {0x4}}, \ - {"r13", ELEM_OUTPUT_INT, {0x8C}, {0x4}}, \ - {"lr1", ELEM_OUTPUT_INT, {0x90}, {0x4}}, \ - {"pc", ELEM_OUTPUT_INT, {0x94}, {0x4}}, \ - {"xpsr", ELEM_OUTPUT_INT, {0x98}, {0x4}}, \ - {"cfsr", ELEM_OUTPUT_INT, {0x9C}, {0x4}}, \ - {"hfsr", ELEM_OUTPUT_INT, {0xa0}, {0x4}}, \ - {"bfar", ELEM_OUTPUT_INT, {0xa4}, {0x4}}, \ - {"exc_trace", ELEM_OUTPUT_INT, {0xa8}, {0x1}}, \ - {"ddr_exc", ELEM_OUTPUT_INT, {0xa9}, {0x1}}, \ - {"irq_id", ELEM_OUTPUT_INT, {0xaa}, {0x2}}, \ - {"task_id", ELEM_OUTPUT_INT, {0xac}, {0x4}}, \ - {"**backup**reg***", ELEM_OUTPUT_STR, {0x00}, {0x8}}, \ - {"reg_backup_index", ELEM_OUTPUT_INT, {0x200}, {0x4}}, \ - {"reason_0", ELEM_OUTPUT_INT, {0x204}, {0x4}}, \ - {"reason_1", ELEM_OUTPUT_INT, {0x208}, {0x4}}, \ - {"reason_2", ELEM_OUTPUT_INT, {0x20C}, {0x4}}, \ - {"r0", ELEM_OUTPUT_INT, {0x210}, {0x4}}, \ - {"r1", ELEM_OUTPUT_INT, {0x214}, {0x4}}, \ - {"r2", ELEM_OUTPUT_INT, {0x218}, {0x4}}, \ - {"r3", ELEM_OUTPUT_INT, {0x21c}, {0x4}}, \ - {"r4", ELEM_OUTPUT_INT, {0x220}, {0x4}}, \ - {"r5", ELEM_OUTPUT_INT, {0x224}, {0x4}}, \ - {"r6", ELEM_OUTPUT_INT, {0x228}, {0x4}}, \ - {"r7", ELEM_OUTPUT_INT, {0x22c}, {0x4}}, \ - {"r8", ELEM_OUTPUT_INT, {0x230}, {0x4}}, \ - {"r9", ELEM_OUTPUT_INT, {0x234}, {0x4}}, \ - {"r10", ELEM_OUTPUT_INT, {0x238}, {0x4}}, \ - {"r11", ELEM_OUTPUT_INT, {0x23c}, {0x4}}, \ - {"r12", ELEM_OUTPUT_INT, {0x240}, {0x4}}, \ - {"r13", ELEM_OUTPUT_INT, {0x244}, {0x4}}, \ - {"msp", ELEM_OUTPUT_INT, {0x248}, {0x4}}, \ - {"psp", ELEM_OUTPUT_INT, {0x24c}, {0x4}}, \ - {"lr0_ctrl", ELEM_OUTPUT_INT, {0x250}, {0x4}}, \ - {"lr1", ELEM_OUTPUT_INT, {0x254}, {0x4}}, \ - {"pc", ELEM_OUTPUT_INT, {0x258}, {0x4}}, \ - {"xpsr", ELEM_OUTPUT_INT, {0x25c}, {0x4}}, \ - {"primask", ELEM_OUTPUT_INT, {0x260}, {0x4}}, \ - {"basepri", ELEM_OUTPUT_INT, {0x264}, {0x4}}, \ - {"faultmask", ELEM_OUTPUT_INT, {0x268}, {0x4}}, \ - {"control", ELEM_OUTPUT_INT, {0x26c}, {0x4}}, \ - {"**runtime*******", ELEM_OUTPUT_STR, {0x00}, {0x8}}, \ - {"RT_BBX_MAGIC_NUM", ELEM_OUTPUT_INT, {0x7940}, {0x4}}, \ - {"RT_BBX_SIZE", ELEM_OUTPUT_INT, {0x7948}, {0x4}}, \ - {"TSENSOR_A55", ELEM_OUTPUT_INT, {0x7960}, {0x1}}, \ - {"TSENSOR_PERI", ELEM_OUTPUT_INT, {0x7961}, {0x1}}, \ - {"TSENSOR_AIC0", ELEM_OUTPUT_INT, {0x7962}, {0x1}}, \ - {"TSENSOR_AIC1", ELEM_OUTPUT_INT, {0x7963}, {0x1}}, \ - {"DDR_T_GRADE", ELEM_OUTPUT_INT, {0x7964}, {0x1}}, \ - {"EDP_SCALE_0", ELEM_OUTPUT_INT, {0x7965}, {0x1}}, \ - {"EDP_SCALE_1", ELEM_OUTPUT_INT, {0x7966}, {0x1}}, \ - {"TMP_STATUS", ELEM_OUTPUT_INT, {0x7967}, {0x1}}, \ - {"TMP_CTRL_ST", ELEM_OUTPUT_INT, {0x7968}, {0x1}}, \ - {"AIC_FREQ_ST", ELEM_OUTPUT_INT, {0x7969}, {0x1}}, \ - {"A55_FREQ_ST", ELEM_OUTPUT_INT, {0x796A}, {0x1}}, \ - {"AIC_NUM_ST", ELEM_OUTPUT_INT, {0x796B}, {0x1}}, \ - {"TMP_RST", ELEM_OUTPUT_INT, {0x796C}, {0x1}}, \ - {"TMP_HIGH", ELEM_OUTPUT_INT, {0x796D}, {0x1}}, \ - {"TMP_NOR", ELEM_OUTPUT_INT, {0x796E}, {0x1}}, \ - {"TMP_PERIOD", ELEM_OUTPUT_INT, {0x796F}, {0x1}}, \ - {"T_RST_STATUS", ELEM_OUTPUT_INT, {0x797D}, {0x1}}, \ - {"T_ERR_TSENSOR", ELEM_OUTPUT_INT, {0x797E}, {0x1}}, \ - {"T_ERR_EFUSE", ELEM_OUTPUT_INT, {0x797F}, {0x1}}, \ - {"**NV*******", ELEM_OUTPUT_STR, {0x00}, {0x8}}, \ - {"LPNV_MAGIC",ELEM_OUTPUT_INT, {0x7980}, {0x4}}, \ - {"LP_LPALL_NV",ELEM_OUTPUT_INT, {0x7984}, {0x1}}, \ - {"LP_AVS_NV",ELEM_OUTPUT_INT, {0x7985}, {0x1}}, \ - {"LP_SVFD_NV",ELEM_OUTPUT_INT, {0x7986}, {0x1}}, \ - {"LP_PLLMOD_SEL_NV",ELEM_OUTPUT_INT, {0x7987}, {0x1}}, \ - {"LP_DEEP_SLEEP_NV",ELEM_OUTPUT_INT, {0x7988}, {0x1}}, \ - {"LP_HIMNTN_NV",ELEM_OUTPUT_INT, {0x7989}, {0x1}}, \ - {"LP_LOGBUF_CTRL",ELEM_OUTPUT_INT, {0x798A}, {0x1}}, \ - {"LP_WDT_RST_NV",ELEM_OUTPUT_INT, {0x798B}, {0x1}}, \ - {"LP_RDRLOG_CTRL",ELEM_OUTPUT_INT, {0x798C}, {0x1}}, \ - {"THERMAL_EN_NV", ELEM_OUTPUT_INT, {0x798D}, {0x1}}, \ - {"TMP_HWRST_EN_NV", ELEM_OUTPUT_INT, {0x798E}, {0x1}}, \ - {"TMP_GCTRL_EN_NV", ELEM_OUTPUT_INT, {0x798F}, {0x1}}, \ - {"TMP_GCTRL_SCALE_NV", ELEM_OUTPUT_INT, {0x7990}, {0x1}}, \ - {"TMP_RST_NV", ELEM_OUTPUT_INT, {0x7991}, {0x1}}, \ - {"TMP_HIGH_NV", ELEM_OUTPUT_INT, {0x7992}, {0x1}}, \ - {"TMP_NOR_NV", ELEM_OUTPUT_INT, {0x7993}, {0x1}}, \ - {"TMP_PERIOD_NV", ELEM_OUTPUT_INT, {0x7994}, {0x1}}, \ - {"DDR_ALL_NV", ELEM_OUTPUT_INT, {0x7995}, {0x1}}, \ - {"DDR_THERMAL_NV", ELEM_OUTPUT_INT, {0x7996}, {0x1}}, \ - {"DDR_EXMBIST_NV", ELEM_OUTPUT_INT, {0x7997}, {0x1}}, \ - {"DDR_SWAP_NV", ELEM_OUTPUT_INT, {0x7998}, {0x1}}, \ - {"DDR_IECC_NV", ELEM_OUTPUT_INT, {0x7999}, {0x1}}, \ - {"DDR_PASR_NV", ELEM_OUTPUT_INT, {0x799A}, {0x1}}, \ - {"DDR_UDIS_NV", ELEM_OUTPUT_INT, {0x799B}, {0x1}}, \ - {"DDR_TDIS_NV", ELEM_OUTPUT_INT, {0x799C}, {0x1}}, \ - {"DDR_FREQ_NV", ELEM_OUTPUT_INT, {0x799D}, {0x1}}, \ - {"**DDR_RUNTIME***", ELEM_OUTPUT_STR, {0x00}, {0x8}}, \ - {"DDR_STATUS", ELEM_OUTPUT_INT, {0x79C0}, {0x2}}, \ - {"INITFREQ", ELEM_OUTPUT_INT, {0x79C2}, {0x1}}, \ - {"DDR_TMP_PERIOD", ELEM_OUTPUT_INT, {0x79C3}, {0x1}}, \ - {"DDR_PD_PRD", ELEM_OUTPUT_INT, {0x79C4}, {0x2}}, \ - {"DDR_ASREF_PRD", ELEM_OUTPUT_INT, {0x79C6}, {0x2}}, \ - {"DDR_FREQ_LOAD", ELEM_OUTPUT_HEX, {0x79C8}, {0x10}}, \ - {"DDR_MIN", ELEM_OUTPUT_INT, {0x79D8}, {0x1}}, \ - {"DDR_MAX", ELEM_OUTPUT_INT, {0x79D9}, {0x1}}, \ - {"DDR_LAST", ELEM_OUTPUT_INT, {0x79DA}, {0x1}}, \ - {"DDR_CURRENT", ELEM_OUTPUT_INT, {0x79DB}, {0x1}}, \ - {"DDR_TARGET", ELEM_OUTPUT_INT, {0x79DC}, {0x1}}, \ - {"DDR_DN_LIMIT", ELEM_OUTPUT_INT, {0x79DD}, {0x1}}, \ - {"DDR_UP_LIMIT", ELEM_OUTPUT_INT, {0x79DE}, {0x1}}, \ - {"DDR_PLL", ELEM_OUTPUT_INT, {0x79DF}, {0x1}}, \ - {"DDR_LAST_PLL", ELEM_OUTPUT_INT, {0x79E0}, {0x4}}, \ - {"CMD_CNT", ELEM_OUTPUT_HEX, {0x79E4}, {0x10}}, \ - {"DATA_CNT", ELEM_OUTPUT_INT, {0x79F4}, {0x4}}, \ - {"**AVS*******", ELEM_OUTPUT_STR, {0x00}, {0x8}}, \ - {"AICORE0_HIGHTEMP_VOLT", ELEM_OUTPUT_INT, {0x7AE0}, {0x4}}, \ - {"AICORE1_HIGHTEMP_VOLT", ELEM_OUTPUT_INT, {0x7AE4}, {0x4}}, \ - {"CPU_HIGHTEMP_VOLT", ELEM_OUTPUT_INT, {0x7AE8}, {0x4}}, \ - {"AIMEMORY_HIGHTEMP_VOLT", ELEM_OUTPUT_INT, {0x7AEC}, {0x4}}, \ - {"PERI_HIGHTEMP_VOLT", ELEM_OUTPUT_INT, {0x7AF0}, {0x4}}, \ - {"AICORE0_CUR_VOLT", ELEM_OUTPUT_INT, {0x7AF4}, {0x4}}, \ - {"AICORE1_CUR_VOLT", ELEM_OUTPUT_INT, {0x7AF8}, {0x4}}, \ - {"CPU_CUR_VOLT", ELEM_OUTPUT_INT, {0x7AFC}, {0x4}}, \ - {"AIMEMORY_CUR_VOLT", ELEM_OUTPUT_INT, {0x7B00}, {0x4}}, \ - {"PERI_CUR_VOLT", ELEM_OUTPUT_INT, {0x7B04}, {0x4}}, \ - {"AICORE0_SVFD_VOLT", ELEM_OUTPUT_INT, {0x7B08}, {0x4}}, \ - {"AICORE1_SVFD_VOLT", ELEM_OUTPUT_INT, {0x7B0C}, {0x4}}, \ - {"AICORE0_SVFD_CPM", ELEM_OUTPUT_INT, {0x7B10}, {0x2}}, \ - {"AICORE1_SVFD_CPM", ELEM_OUTPUT_INT, {0x7B12}, {0x2}}, \ - {"AICORE0_NOTIFY_ST", ELEM_OUTPUT_INT, {0x7B14}, {0x1}}, \ - {"AICORE1_NOTIFY_ST", ELEM_OUTPUT_INT, {0x7B15}, {0x1}}, \ - {"CPU_NOTIFY_ST", ELEM_OUTPUT_INT, {0x7B16}, {0x1}}, \ - {"AIMEMORY_NOTIFY_ST", ELEM_OUTPUT_INT, {0x7B17}, {0x1}}, \ - {"PERI_NOTIFY_ST", ELEM_OUTPUT_INT, {0x7B18}, {0x1}}, \ - {"AICORE0_TZONE", ELEM_OUTPUT_INT, {0x7B19}, {0x1}}, \ - {"AICORE1_TZONE", ELEM_OUTPUT_INT, {0x7B1A}, {0x1}}, \ - {"CPU_TZONE", ELEM_OUTPUT_INT, {0x7B1B}, {0x1}}, \ - {"AIMEMORY_TZONE", ELEM_OUTPUT_INT, {0x7B1C}, {0x1}}, \ - {"PERI_TZONE", ELEM_OUTPUT_INT, {0x7B1D}, {0x1}}, \ - {"VOLT_RISE_TEMP", ELEM_OUTPUT_INT, {0x7B1E}, {0x1}}, \ - {"VOLT_DECREASE_TEMP", ELEM_OUTPUT_INT, {0x7B1F}, {0x1}}, \ - {"**efuse*******", ELEM_OUTPUT_STR, {0x00}, {0x8}}, \ - {"TSENSOR_EFUSE", ELEM_OUTPUT_INT, {0x7B28}, {0x8}}, \ -} - -#define DATA_MODEL_LPM3_SRAM MODEL_VECTOR(LPM3_SRAM) = { \ - {"magic_begin", ELEM_OUTPUT_INT, {0x5000}, {0x4}}, \ - {"slice_time", ELEM_OUTPUT_INT, {0x5004}, {0x4}}, \ - {"mod_reason", ELEM_OUTPUT_INT, {0x5008}, {0x4}}, \ - {"ddr_freq_id", ELEM_OUTPUT_INT, {0x500C}, {0x4}}, \ - {"uce_exc", ELEM_OUTPUT_INT, {0x5010}, {0x4}}, \ - {"reserved0-2", ELEM_OUTPUT_INT, {0x5014}, {0x4}}, \ - {"reg_save_addr", ELEM_OUTPUT_INT, {0x5020}, {0x4}}, \ - {"DDRRETENTION", ELEM_OUTPUT_INT, {0x5024}, {0x4}}, \ - {"DDRRETENTIONCLR", ELEM_OUTPUT_INT, {0x5028}, {0x4}}, \ - {"DRAMRETENTION", ELEM_OUTPUT_INT, {0x502C}, {0x4}}, \ - {"DDRC_0_3_RESET", ELEM_OUTPUT_INT, {0x5030}, {0x4}}, \ - {"DDRC_4_7_RESET", ELEM_OUTPUT_INT, {0x5034}, {0x4}}, \ - {"DDRC_0_3_PACK_RESET", ELEM_OUTPUT_INT, {0x5038}, {0x4}}, \ - {"DDRC_4_7_PACK_RESET", ELEM_OUTPUT_INT, {0x503C}, {0x4}}, \ - {"DDRC_EXMBIST0_REGS_RESET",ELEM_OUTPUT_INT, {0x5040}, {0x4}}, \ - {"DDRC_EXMBIST1_REGS_RESET",ELEM_OUTPUT_INT, {0x5044}, {0x4}}, \ - {"DDRC_0_3_PACK_RESET", ELEM_OUTPUT_INT, {0x5048}, {0x4}}, \ - {"DDRC_4_7_PACK_RESET", ELEM_OUTPUT_INT, {0x504C}, {0x4}}, \ - {"SCTRL_DDRC_0_3_AO_RST", ELEM_OUTPUT_INT, {0x5050}, {0x4}}, \ - {"SCTRL_DDRC_4_7_AO_RST", ELEM_OUTPUT_INT, {0x5054}, {0x4}}, \ - {"PPLLBYPASS0", ELEM_OUTPUT_INT, {0x5058}, {0x4}}, \ - {"PPLLBYPASS1", ELEM_OUTPUT_INT, {0x505C}, {0x4}}, \ - {"PPLL3FCTRL", ELEM_OUTPUT_INT, {0x5060}, {0x4}}, \ - {"PPLL3FCTRL_FRAC", ELEM_OUTPUT_INT, {0x5064}, {0x4}}, \ - {"PPLL4FCTRL", ELEM_OUTPUT_INT, {0x5068}, {0x4}}, \ - {"PPLL4FCTRL_FRAC", ELEM_OUTPUT_INT, {0x506C}, {0x4}}, \ - {"PPLLOCKSTATUS", ELEM_OUTPUT_INT, {0x5070}, {0x4}}, \ - {"DDRC_0_3_BYPASS_MODE", ELEM_OUTPUT_INT, {0x5074}, {0x4}}, \ - {"DDRC_4_7_BYPASS_MODE", ELEM_OUTPUT_INT, {0x5078}, {0x4}}, \ - {"PLL_PROF_CFG1", ELEM_OUTPUT_INT, {0x507C}, {0x4}}, \ -} - -/* TEE module */ -#define DATA_MODEL_TEE MODEL_VECTOR(TEE) = { \ - {"tee info", ELEM_OUTPUT_STR_NL, {0x0}, {0x10000}}, \ -} - -/* TF module */ -#define DATA_MODEL_TF MODEL_VECTOR(TF) = { \ - {"tf info", ELEM_OUTPUT_STR_NL, {0x8}, {0xFFF8}}, \ -} - -/* DVPP module */ -#define DATA_MODEL_DVPP MODEL_VECTOR(DVPP) = { \ - {"dvpp info", ELEM_OUTPUT_STR_NL, {0x0}, {0x10000}}, \ -} - -/* DRIVE module */ -#define DATA_MODEL_DRIVER MODEL_VECTOR(DRIVER) = { \ - {"driver info", ELEM_OUTPUT_STR_NL, {0x0}, {0x20000}}, \ -} - -/* TS module */ -#define DATA_MODEL_TS MODEL_VECTOR(TS) = { \ - {"ts info", ELEM_OUTPUT_CHAR, {0x0}, {0x100000}}, \ -} - -/* TS module, start */ -#define DATA_MODEL_TS_START MODEL_VECTOR(TS_START) = { \ - {"ts start info", ELEM_OUTPUT_STR_NL, {0x0}, {0xC800}}, \ -} - -/* AP module, early print */ -#define DATA_MODEL_AP_EPRINT MODEL_VECTOR(AP_EPRINT) = { \ - {"early print info", ELEM_OUTPUT_STR_NL, {0x0}, {0x400}}, \ -} - -/* BIOS module */ -#define DATA_MODEL_BIOS MODEL_VECTOR(BIOS) = { \ - {"bios info", ELEM_OUTPUT_STR_NL, {0x0}, {0x50000}}, \ -} - -/* BIOS module, sram */ -#define DATA_MODEL_BIOS_SRAM MODEL_VECTOR(BIOS_SRAM) = { \ - {"LPM3_WAKE_UP_STATUS", ELEM_OUTPUT_INT, {0x0}, {0x4}}, \ - {"DEBUG_TIME_POWERUP_DONE", ELEM_OUTPUT_INT, {0x28}, {0x4}}, \ - {"DEBUG_TIME_PERSTHIGH_DONE", ELEM_OUTPUT_INT, {0x2C}, {0x4}}, \ - {"DEBUG_TIME_PCIEPHY_DONE", ELEM_OUTPUT_INT, {0x30}, {0x4}}, \ - {"DEBUG_TIME_PHY_FIRMWARE_DONE", ELEM_OUTPUT_INT, {0x34}, {0x4}}, \ - {"DEBUG_TIME_PCIECTRL_DONE", ELEM_OUTPUT_INT, {0x38}, {0x4}}, \ - {"DEBUG_TIME_IMG_DONE", ELEM_OUTPUT_INT, {0x3C}, {0x4}}, \ - {"DEBUG_TIME_SECURE_DONE", ELEM_OUTPUT_INT, {0x40}, {0x4}}, \ - {"DEBUG_VERSION_ADDR", ELEM_OUTPUT_HEX, {0x50}, {0x10}}, \ - {"XLOADER_RESET_REG", ELEM_OUTPUT_INT, {0x200}, {0x4}}, \ - {"XLOADER_KEY_POINT", ELEM_OUTPUT_INT, {0x204}, {0x4}}, \ - {"XLOADER_TIME_POWERUP_DONE", ELEM_OUTPUT_INT, {0x228}, {0x4}}, \ - {"XLOADER_TIME_PERSTHIGH_DONE", ELEM_OUTPUT_INT, {0x22C}, {0x4}}, \ - {"XLOADER_TIME_PCIEPHY_DONE", ELEM_OUTPUT_INT, {0x230}, {0x4}}, \ - {"XLOADER_TIME_PHY_FIRMWARE_DONE", ELEM_OUTPUT_INT, {0x234}, {0x4}}, \ - {"XLOADER_TIME_PCIECTRL_DONE", ELEM_OUTPUT_INT, {0x238}, {0x4}}, \ - {"XLOADER_TIME_PCIE_DETECT_DONE", ELEM_OUTPUT_INT, {0x23C}, {0x4}}, \ - {"UEFI_LAST_KEYPOINT", ELEM_OUTPUT_INT, {0x320}, {0x4}}, \ - {"SD_LOAD_FILE_STATUS", ELEM_OUTPUT_INT, {0x350}, {0x4}}, \ -} - - -/* DDR_SRAM module */ -#define DATA_MODEL_DDR_SRAM MODEL_VECTOR(DDR_SRAM) = {\ - {"magic_begin", ELEM_OUTPUT_INT, {0x0}, {0x4}}, \ - {"slice_time", ELEM_OUTPUT_INT, {0x4}, {0x4}}, \ - {"mod_reason", ELEM_OUTPUT_INT, {0x8}, {0x4}}, \ - {"ddr_freq_id", ELEM_OUTPUT_INT, {0xC}, {0x4}}, \ - {"ddr_status", ELEM_OUTPUT_INT, {0x10}, {0x4}}, \ - {"uce_exc", ELEM_OUTPUT_INT, {0x14}, {0x4}}, \ - {"SC_TSENSOR_INFO_ADDR", ELEM_OUTPUT_INT, {0x18}, {0x4}}, \ - {"SC_TSENSOR_AICORE_LIMIT", ELEM_OUTPUT_INT, {0x1C}, {0x4}}, \ - {"SC_TSENSOR_MAX_TEMP", ELEM_OUTPUT_INT, {0x20}, {0x4}}, \ - {"channel_mask", ELEM_OUTPUT_INT, {0x24}, {0x4}}, \ - {"channel_num", ELEM_OUTPUT_INT, {0x28}, {0x4}}, \ - {"rank_num", ELEM_OUTPUT_INT, {0x2C}, {0x4}}, \ - {"ddr_size", ELEM_OUTPUT_INT, {0x30}, {0x4}}, \ - {"manufactery_id", ELEM_OUTPUT_INT, {0x34}, {0x4}}, \ - {"iecc_cerr_thresh[0]", ELEM_OUTPUT_INT, {0x38}, {0x4}}, \ - {"iecc_cerr_thresh[1]", ELEM_OUTPUT_INT, {0x3C}, {0x4}}, \ - {"iecc_cerr_thresh[2]", ELEM_OUTPUT_INT, {0x40}, {0x4}}, \ - {"iecc_cerr_thresh[3]", ELEM_OUTPUT_INT, {0x44}, {0x4}}, \ - {"iecc_cerr_thresh[4]", ELEM_OUTPUT_INT, {0x48}, {0x4}}, \ - {"iecc_cerr_thresh[5]", ELEM_OUTPUT_INT, {0x4C}, {0x4}}, \ - {"iecc_cerr_thresh[6]", ELEM_OUTPUT_INT, {0x50}, {0x4}}, \ - {"iecc_cerr_thresh[7]", ELEM_OUTPUT_INT, {0x54}, {0x4}}, \ - {"iecc_ctrl[0]", ELEM_OUTPUT_INT, {0x58}, {0x4}}, \ - {"iecc_ctrl[1]", ELEM_OUTPUT_INT, {0x5C}, {0x4}}, \ - {"iecc_ctrl[2]", ELEM_OUTPUT_INT, {0x60}, {0x4}}, \ - {"iecc_ctrl[3]", ELEM_OUTPUT_INT, {0x64}, {0x4}}, \ - {"iecc_ctrl[4]", ELEM_OUTPUT_INT, {0x68}, {0x4}}, \ - {"iecc_ctrl[5]", ELEM_OUTPUT_INT, {0x6C}, {0x4}}, \ - {"iecc_ctrl[6]", ELEM_OUTPUT_INT, {0x70}, {0x4}}, \ - {"iecc_ctrl[7]", ELEM_OUTPUT_INT, {0x74}, {0x4}}, \ - {"iecc_cerr_cnt[0]", ELEM_OUTPUT_INT, {0x78}, {0x4}}, \ - {"iecc_cerr_cnt[1]", ELEM_OUTPUT_INT, {0x7C}, {0x4}}, \ - {"iecc_cerr_cnt[2]", ELEM_OUTPUT_INT, {0x80}, {0x4}}, \ - {"iecc_cerr_cnt[3]", ELEM_OUTPUT_INT, {0x84}, {0x4}}, \ - {"iecc_cerr_cnt[4]", ELEM_OUTPUT_INT, {0x88}, {0x4}}, \ - {"iecc_cerr_cnt[5]", ELEM_OUTPUT_INT, {0x8C}, {0x4}}, \ - {"iecc_cerr_cnt[6]", ELEM_OUTPUT_INT, {0x90}, {0x4}}, \ - {"iecc_cerr_cnt[7]", ELEM_OUTPUT_INT, {0x94}, {0x4}}, \ - {"iecc_uerr_cnt[0]", ELEM_OUTPUT_INT, {0x98}, {0x4}}, \ - {"iecc_uerr_cnt[1]", ELEM_OUTPUT_INT, {0x9C}, {0x4}}, \ - {"iecc_uerr_cnt[2]", ELEM_OUTPUT_INT, {0xA0}, {0x4}}, \ - {"iecc_uerr_cnt[3]", ELEM_OUTPUT_INT, {0xA4}, {0x4}}, \ - {"iecc_uerr_cnt[4]", ELEM_OUTPUT_INT, {0xA8}, {0x4}}, \ - {"iecc_uerr_cnt[5]", ELEM_OUTPUT_INT, {0xAC}, {0x4}}, \ - {"iecc_uerr_cnt[6]", ELEM_OUTPUT_INT, {0xB0}, {0x4}}, \ - {"iecc_uerr_cnt[7]", ELEM_OUTPUT_INT, {0xB4}, {0x4}}, \ - {"magic_byte", ELEM_OUTPUT_INT, {0x100}, {0x1}}, \ - {"err_max", ELEM_OUTPUT_INT, {0x104}, {0x1}}, \ - {"irq_count", ELEM_OUTPUT_INT, {0x108}, {0x1}}, \ - {"index", ELEM_OUTPUT_INT, {0x10C}, {0x1}}, \ - {"rate[0].time", ELEM_OUTPUT_INT, {0x100}, {0x4}}, \ - {"rate[0].rate_per_rank[0]", ELEM_OUTPUT_INT, {0x104}, {0x1}}, \ - {"rate[0].rate_per_rank[1]", ELEM_OUTPUT_INT, {0x105}, {0x1}}, \ - {"rate[0].rate_per_rank[2]", ELEM_OUTPUT_INT, {0x106}, {0x1}}, \ - {"rate[0].rate_per_rank[3]", ELEM_OUTPUT_INT, {0x107}, {0x1}}, \ - {"rate[0].rate_per_rank[4]", ELEM_OUTPUT_INT, {0x108}, {0x1}}, \ - {"rate[0].rate_per_rank[5]", ELEM_OUTPUT_INT, {0x109}, {0x1}}, \ - {"rate[0].rate_per_rank[6]", ELEM_OUTPUT_INT, {0x10A}, {0x1}}, \ - {"rate[0].rate_per_rank[7]", ELEM_OUTPUT_INT, {0x10B}, {0x1}}, \ - {"rate[0].rate_per_rank[8]", ELEM_OUTPUT_INT, {0x10C}, {0x1}}, \ - {"rate[0].rate_per_rank[9]", ELEM_OUTPUT_INT, {0x10D}, {0x1}}, \ - {"rate[0].rate_per_rank[A]", ELEM_OUTPUT_INT, {0x10E}, {0x1}}, \ - {"rate[0].rate_per_rank[B]", ELEM_OUTPUT_INT, {0x10F}, {0x1}}, \ - {"rate[0].rate_per_rank[C]", ELEM_OUTPUT_INT, {0x110}, {0x1}}, \ - {"rate[0].rate_per_rank[D]", ELEM_OUTPUT_INT, {0x111}, {0x1}}, \ - {"rate[0].rate_per_rank[E]", ELEM_OUTPUT_INT, {0x112}, {0x1}}, \ - {"rate[0].rate_per_rank[F]", ELEM_OUTPUT_INT, {0x113}, {0x1}}, \ - {"rate[1].time", ELEM_OUTPUT_INT, {0x114}, {0x4}}, \ - {"rate[1].rate_per_rank[0]", ELEM_OUTPUT_INT, {0x118}, {0x1}}, \ - {"rate[1].rate_per_rank[1]", ELEM_OUTPUT_INT, {0x119}, {0x1}}, \ - {"rate[1].rate_per_rank[2]", ELEM_OUTPUT_INT, {0x11A}, {0x1}}, \ - {"rate[1].rate_per_rank[3]", ELEM_OUTPUT_INT, {0x11B}, {0x1}}, \ - {"rate[1].rate_per_rank[4]", ELEM_OUTPUT_INT, {0x11C}, {0x1}}, \ - {"rate[1].rate_per_rank[5]", ELEM_OUTPUT_INT, {0x11D}, {0x1}}, \ - {"rate[1].rate_per_rank[6]", ELEM_OUTPUT_INT, {0x11E}, {0x1}}, \ - {"rate[1].rate_per_rank[7]", ELEM_OUTPUT_INT, {0x11F}, {0x1}}, \ - {"rate[1].rate_per_rank[8]", ELEM_OUTPUT_INT, {0x120}, {0x1}}, \ - {"rate[1].rate_per_rank[9]", ELEM_OUTPUT_INT, {0x121}, {0x1}}, \ - {"rate[1].rate_per_rank[A]", ELEM_OUTPUT_INT, {0x122}, {0x1}}, \ - {"rate[1].rate_per_rank[B]", ELEM_OUTPUT_INT, {0x123}, {0x1}}, \ - {"rate[1].rate_per_rank[C]", ELEM_OUTPUT_INT, {0x124}, {0x1}}, \ - {"rate[1].rate_per_rank[D]", ELEM_OUTPUT_INT, {0x125}, {0x1}}, \ - {"rate[1].rate_per_rank[E]", ELEM_OUTPUT_INT, {0x126}, {0x1}}, \ - {"rate[1].rate_per_rank[F]", ELEM_OUTPUT_INT, {0x127}, {0x1}}, \ - {"rate[2].time", ELEM_OUTPUT_INT, {0x128}, {0x4}}, \ - {"rate[2].rate_per_rank[0]", ELEM_OUTPUT_INT, {0x12C}, {0x1}}, \ - {"rate[2].rate_per_rank[1]", ELEM_OUTPUT_INT, {0x12D}, {0x1}}, \ - {"rate[2].rate_per_rank[2]", ELEM_OUTPUT_INT, {0x12E}, {0x1}}, \ - {"rate[2].rate_per_rank[3]", ELEM_OUTPUT_INT, {0x12F}, {0x1}}, \ - {"rate[2].rate_per_rank[4]", ELEM_OUTPUT_INT, {0x130}, {0x1}}, \ - {"rate[2].rate_per_rank[5]", ELEM_OUTPUT_INT, {0x131}, {0x1}}, \ - {"rate[2].rate_per_rank[6]", ELEM_OUTPUT_INT, {0x132}, {0x1}}, \ - {"rate[2].rate_per_rank[7]", ELEM_OUTPUT_INT, {0x133}, {0x1}}, \ - {"rate[2].rate_per_rank[8]", ELEM_OUTPUT_INT, {0x134}, {0x1}}, \ - {"rate[2].rate_per_rank[9]", ELEM_OUTPUT_INT, {0x135}, {0x1}}, \ - {"rate[2].rate_per_rank[A]", ELEM_OUTPUT_INT, {0x136}, {0x1}}, \ - {"rate[2].rate_per_rank[B]", ELEM_OUTPUT_INT, {0x137}, {0x1}}, \ - {"rate[2].rate_per_rank[C]", ELEM_OUTPUT_INT, {0x138}, {0x1}}, \ - {"rate[2].rate_per_rank[D]", ELEM_OUTPUT_INT, {0x139}, {0x1}}, \ - {"rate[2].rate_per_rank[E]", ELEM_OUTPUT_INT, {0x13A}, {0x1}}, \ - {"rate[2].rate_per_rank[F]", ELEM_OUTPUT_INT, {0x13B}, {0x1}}, \ - {"rate[3].time", ELEM_OUTPUT_INT, {0x13C}, {0x4}}, \ - {"rate[3].rate_per_rank[0]", ELEM_OUTPUT_INT, {0x140}, {0x1}}, \ - {"rate[3].rate_per_rank[1]", ELEM_OUTPUT_INT, {0x141}, {0x1}}, \ - {"rate[3].rate_per_rank[2]", ELEM_OUTPUT_INT, {0x142}, {0x1}}, \ - {"rate[3].rate_per_rank[3]", ELEM_OUTPUT_INT, {0x143}, {0x1}}, \ - {"rate[3].rate_per_rank[4]", ELEM_OUTPUT_INT, {0x144}, {0x1}}, \ - {"rate[3].rate_per_rank[5]", ELEM_OUTPUT_INT, {0x145}, {0x1}}, \ - {"rate[3].rate_per_rank[6]", ELEM_OUTPUT_INT, {0x146}, {0x1}}, \ - {"rate[3].rate_per_rank[7]", ELEM_OUTPUT_INT, {0x147}, {0x1}}, \ - {"rate[3].rate_per_rank[8]", ELEM_OUTPUT_INT, {0x148}, {0x1}}, \ - {"rate[3].rate_per_rank[9]", ELEM_OUTPUT_INT, {0x149}, {0x1}}, \ - {"rate[3].rate_per_rank[A]", ELEM_OUTPUT_INT, {0x14A}, {0x1}}, \ - {"rate[3].rate_per_rank[B]", ELEM_OUTPUT_INT, {0x14B}, {0x1}}, \ - {"rate[3].rate_per_rank[C]", ELEM_OUTPUT_INT, {0x14C}, {0x1}}, \ - {"rate[3].rate_per_rank[D]", ELEM_OUTPUT_INT, {0x14D}, {0x1}}, \ - {"rate[3].rate_per_rank[E]", ELEM_OUTPUT_INT, {0x14E}, {0x1}}, \ - {"rate[3].rate_per_rank[F]", ELEM_OUTPUT_INT, {0x14F}, {0x1}}, \ - {"rate[4].time", ELEM_OUTPUT_INT, {0x150}, {0x4}}, \ - {"rate[4].rate_per_rank[0]", ELEM_OUTPUT_INT, {0x154}, {0x1}}, \ - {"rate[4].rate_per_rank[1]", ELEM_OUTPUT_INT, {0x155}, {0x1}}, \ - {"rate[4].rate_per_rank[2]", ELEM_OUTPUT_INT, {0x156}, {0x1}}, \ - {"rate[4].rate_per_rank[3]", ELEM_OUTPUT_INT, {0x157}, {0x1}}, \ - {"rate[4].rate_per_rank[4]", ELEM_OUTPUT_INT, {0x158}, {0x1}}, \ - {"rate[4].rate_per_rank[5]", ELEM_OUTPUT_INT, {0x159}, {0x1}}, \ - {"rate[4].rate_per_rank[6]", ELEM_OUTPUT_INT, {0x15A}, {0x1}}, \ - {"rate[4].rate_per_rank[7]", ELEM_OUTPUT_INT, {0x15B}, {0x1}}, \ - {"rate[4].rate_per_rank[8]", ELEM_OUTPUT_INT, {0x15C}, {0x1}}, \ - {"rate[4].rate_per_rank[9]", ELEM_OUTPUT_INT, {0x15D}, {0x1}}, \ - {"rate[4].rate_per_rank[A]", ELEM_OUTPUT_INT, {0x15E}, {0x1}}, \ - {"rate[4].rate_per_rank[B]", ELEM_OUTPUT_INT, {0x15F}, {0x1}}, \ - {"rate[4].rate_per_rank[C]", ELEM_OUTPUT_INT, {0x160}, {0x1}}, \ - {"rate[4].rate_per_rank[D]", ELEM_OUTPUT_INT, {0x161}, {0x1}}, \ - {"rate[4].rate_per_rank[E]", ELEM_OUTPUT_INT, {0x162}, {0x1}}, \ - {"rate[4].rate_per_rank[F]", ELEM_OUTPUT_INT, {0x163}, {0x1}}, \ - {"rate[5].time", ELEM_OUTPUT_INT, {0x164}, {0x4}}, \ - {"rate[5].rate_per_rank[0]", ELEM_OUTPUT_INT, {0x168}, {0x1}}, \ - {"rate[5].rate_per_rank[1]", ELEM_OUTPUT_INT, {0x169}, {0x1}}, \ - {"rate[5].rate_per_rank[2]", ELEM_OUTPUT_INT, {0x16A}, {0x1}}, \ - {"rate[5].rate_per_rank[3]", ELEM_OUTPUT_INT, {0x16B}, {0x1}}, \ - {"rate[5].rate_per_rank[4]", ELEM_OUTPUT_INT, {0x16C}, {0x1}}, \ - {"rate[5].rate_per_rank[5]", ELEM_OUTPUT_INT, {0x16D}, {0x1}}, \ - {"rate[5].rate_per_rank[6]", ELEM_OUTPUT_INT, {0x16E}, {0x1}}, \ - {"rate[5].rate_per_rank[7]", ELEM_OUTPUT_INT, {0x16F}, {0x1}}, \ - {"rate[5].rate_per_rank[8]", ELEM_OUTPUT_INT, {0x170}, {0x1}}, \ - {"rate[5].rate_per_rank[9]", ELEM_OUTPUT_INT, {0x171}, {0x1}}, \ - {"rate[5].rate_per_rank[A]", ELEM_OUTPUT_INT, {0x172}, {0x1}}, \ - {"rate[5].rate_per_rank[B]", ELEM_OUTPUT_INT, {0x173}, {0x1}}, \ - {"rate[5].rate_per_rank[C]", ELEM_OUTPUT_INT, {0x174}, {0x1}}, \ - {"rate[5].rate_per_rank[D]", ELEM_OUTPUT_INT, {0x175}, {0x1}}, \ - {"rate[5].rate_per_rank[E]", ELEM_OUTPUT_INT, {0x176}, {0x1}}, \ - {"rate[5].rate_per_rank[F]", ELEM_OUTPUT_INT, {0x177}, {0x1}}, \ - {"rate[6].time", ELEM_OUTPUT_INT, {0x178}, {0x4}}, \ - {"rate[6].rate_per_rank[0]", ELEM_OUTPUT_INT, {0x17C}, {0x1}}, \ - {"rate[6].rate_per_rank[1]", ELEM_OUTPUT_INT, {0x17D}, {0x1}}, \ - {"rate[6].rate_per_rank[2]", ELEM_OUTPUT_INT, {0x17E}, {0x1}}, \ - {"rate[6].rate_per_rank[3]", ELEM_OUTPUT_INT, {0x17F}, {0x1}}, \ - {"rate[6].rate_per_rank[4]", ELEM_OUTPUT_INT, {0x180}, {0x1}}, \ - {"rate[6].rate_per_rank[5]", ELEM_OUTPUT_INT, {0x181}, {0x1}}, \ - {"rate[6].rate_per_rank[6]", ELEM_OUTPUT_INT, {0x182}, {0x1}}, \ - {"rate[6].rate_per_rank[7]", ELEM_OUTPUT_INT, {0x183}, {0x1}}, \ - {"rate[6].rate_per_rank[8]", ELEM_OUTPUT_INT, {0x184}, {0x1}}, \ - {"rate[6].rate_per_rank[9]", ELEM_OUTPUT_INT, {0x185}, {0x1}}, \ - {"rate[6].rate_per_rank[A]", ELEM_OUTPUT_INT, {0x186}, {0x1}}, \ - {"rate[6].rate_per_rank[B]", ELEM_OUTPUT_INT, {0x187}, {0x1}}, \ - {"rate[6].rate_per_rank[C]", ELEM_OUTPUT_INT, {0x188}, {0x1}}, \ - {"rate[6].rate_per_rank[D]", ELEM_OUTPUT_INT, {0x189}, {0x1}}, \ - {"rate[6].rate_per_rank[E]", ELEM_OUTPUT_INT, {0x18A}, {0x1}}, \ - {"rate[6].rate_per_rank[F]", ELEM_OUTPUT_INT, {0x18B}, {0x1}}, \ - {"rate[7].time", ELEM_OUTPUT_INT, {0x18C}, {0x4}}, \ - {"rate[7].rate_per_rank[0]", ELEM_OUTPUT_INT, {0x190}, {0x1}}, \ - {"rate[7].rate_per_rank[1]", ELEM_OUTPUT_INT, {0x191}, {0x1}}, \ - {"rate[7].rate_per_rank[2]", ELEM_OUTPUT_INT, {0x192}, {0x1}}, \ - {"rate[7].rate_per_rank[3]", ELEM_OUTPUT_INT, {0x193}, {0x1}}, \ - {"rate[7].rate_per_rank[4]", ELEM_OUTPUT_INT, {0x194}, {0x1}}, \ - {"rate[7].rate_per_rank[5]", ELEM_OUTPUT_INT, {0x195}, {0x1}}, \ - {"rate[7].rate_per_rank[6]", ELEM_OUTPUT_INT, {0x196}, {0x1}}, \ - {"rate[7].rate_per_rank[7]", ELEM_OUTPUT_INT, {0x197}, {0x1}}, \ - {"rate[7].rate_per_rank[8]", ELEM_OUTPUT_INT, {0x198}, {0x1}}, \ - {"rate[7].rate_per_rank[9]", ELEM_OUTPUT_INT, {0x199}, {0x1}}, \ - {"rate[7].rate_per_rank[A]", ELEM_OUTPUT_INT, {0x19A}, {0x1}}, \ - {"rate[7].rate_per_rank[B]", ELEM_OUTPUT_INT, {0x19B}, {0x1}}, \ - {"rate[7].rate_per_rank[C]", ELEM_OUTPUT_INT, {0x19C}, {0x1}}, \ - {"rate[7].rate_per_rank[D]", ELEM_OUTPUT_INT, {0x19D}, {0x1}}, \ - {"rate[7].rate_per_rank[E]", ELEM_OUTPUT_INT, {0x19E}, {0x1}}, \ - {"rate[7].rate_per_rank[F]", ELEM_OUTPUT_INT, {0x1AF}, {0x1}}, \ - {"rate[8].time", ELEM_OUTPUT_INT, {0x1B0}, {0x4}}, \ - {"rate[8].rate_per_rank[0]", ELEM_OUTPUT_INT, {0x1B4}, {0x1}}, \ - {"rate[8].rate_per_rank[1]", ELEM_OUTPUT_INT, {0x1B5}, {0x1}}, \ - {"rate[8].rate_per_rank[2]", ELEM_OUTPUT_INT, {0x1B6}, {0x1}}, \ - {"rate[8].rate_per_rank[3]", ELEM_OUTPUT_INT, {0x1B7}, {0x1}}, \ - {"rate[8].rate_per_rank[4]", ELEM_OUTPUT_INT, {0x1B8}, {0x1}}, \ - {"rate[8].rate_per_rank[5]", ELEM_OUTPUT_INT, {0x1B9}, {0x1}}, \ - {"rate[8].rate_per_rank[6]", ELEM_OUTPUT_INT, {0x1BA}, {0x1}}, \ - {"rate[8].rate_per_rank[7]", ELEM_OUTPUT_INT, {0x1BB}, {0x1}}, \ - {"rate[8].rate_per_rank[8]", ELEM_OUTPUT_INT, {0x1BC}, {0x1}}, \ - {"rate[8].rate_per_rank[9]", ELEM_OUTPUT_INT, {0x1BD}, {0x1}}, \ - {"rate[8].rate_per_rank[A]", ELEM_OUTPUT_INT, {0x1BE}, {0x1}}, \ - {"rate[8].rate_per_rank[B]", ELEM_OUTPUT_INT, {0x1BF}, {0x1}}, \ - {"rate[8].rate_per_rank[C]", ELEM_OUTPUT_INT, {0x1C0}, {0x1}}, \ - {"rate[8].rate_per_rank[D]", ELEM_OUTPUT_INT, {0x1C1}, {0x1}}, \ - {"rate[8].rate_per_rank[E]", ELEM_OUTPUT_INT, {0x1C2}, {0x1}}, \ - {"rate[8].rate_per_rank[F]", ELEM_OUTPUT_INT, {0x1C3}, {0x1}}, \ - {"rate[9].time", ELEM_OUTPUT_INT, {0x1C4}, {0x4}}, \ - {"rate[9].rate_per_rank[0]", ELEM_OUTPUT_INT, {0x1C8}, {0x1}}, \ - {"rate[9].rate_per_rank[1]", ELEM_OUTPUT_INT, {0x1C9}, {0x1}}, \ - {"rate[9].rate_per_rank[2]", ELEM_OUTPUT_INT, {0x1CA}, {0x1}}, \ - {"rate[9].rate_per_rank[3]", ELEM_OUTPUT_INT, {0x1CB}, {0x1}}, \ - {"rate[9].rate_per_rank[4]", ELEM_OUTPUT_INT, {0x1CC}, {0x1}}, \ - {"rate[9].rate_per_rank[5]", ELEM_OUTPUT_INT, {0x1CD}, {0x1}}, \ - {"rate[9].rate_per_rank[6]", ELEM_OUTPUT_INT, {0x1CE}, {0x1}}, \ - {"rate[9].rate_per_rank[7]", ELEM_OUTPUT_INT, {0x1CF}, {0x1}}, \ - {"rate[9].rate_per_rank[8]", ELEM_OUTPUT_INT, {0x1D0}, {0x1}}, \ - {"rate[9].rate_per_rank[9]", ELEM_OUTPUT_INT, {0x1D1}, {0x1}}, \ - {"rate[9].rate_per_rank[A]", ELEM_OUTPUT_INT, {0x1D2}, {0x1}}, \ - {"rate[9].rate_per_rank[B]", ELEM_OUTPUT_INT, {0x1D3}, {0x1}}, \ - {"rate[9].rate_per_rank[C]", ELEM_OUTPUT_INT, {0x1D4}, {0x1}}, \ - {"rate[9].rate_per_rank[D]", ELEM_OUTPUT_INT, {0x1D5}, {0x1}}, \ - {"rate[9].rate_per_rank[E]", ELEM_OUTPUT_INT, {0x1D6}, {0x1}}, \ - {"rate[9].rate_per_rank[F]", ELEM_OUTPUT_INT, {0x1D7}, {0x1}}, \ - {"mrr4_0.count", ELEM_OUTPUT_INT, {0x1D8}, {0x1}}, \ - {"mrr4_0.happen", ELEM_OUTPUT_INT, {0x1D9}, {0x1}}, \ - {"shake_count.count", ELEM_OUTPUT_INT, {0x1DA}, {0x1}}, \ - {"shake_count.happen", ELEM_OUTPUT_INT, {0x1DB}, {0x1}}, \ - {"sfc_record0", ELEM_OUTPUT_INT, {0x1DC}, {0x1}}, \ - {"sfc_record1", ELEM_OUTPUT_INT, {0x1DD}, {0x1}}, \ - {"sfc_mr5", ELEM_OUTPUT_INT, {0x1DE}, {0x1}}, \ -} - -// bbox kbox info -#define DATA_MODEL_BBOX_KBOX MODEL_VECTOR(BBOX_KBOX) = { \ - {"CONSOLE START", ELEM_OUTPUT_DIVIDE, {0x0}, {0x2D}}, \ - {"[console info]", ELEM_OUTPUT_STR_NL, {0x0}, {0x10000}}, \ - {"CONSOLE END", ELEM_OUTPUT_DIVIDE, {0x0}, {0x2D}}, \ - {"MESSAGE START", ELEM_OUTPUT_DIVIDE, {0x0}, {0x2D}}, \ - {"[message info]", ELEM_OUTPUT_STR_NL, {0x10000}, {0x40000}}, \ - {"MESSAGE END", ELEM_OUTPUT_DIVIDE, {0x0}, {0x2D}}, \ - {"if panic", ELEM_CTRL_COMPARE, {0x50000}, {0x1}}, \ - {"", ELEM_CTRL_CMP_JUMP_EQ, {0x0}, {0x3}}, \ - {"PANIC START", ELEM_OUTPUT_DIVIDE, {0x0}, {0x2D}}, \ - {"[panic info]", ELEM_OUTPUT_STR_NL, {0x50000}, {0x8000}}, \ - {"PANIC END", ELEM_OUTPUT_DIVIDE, {0x0}, {0x2D}}, \ - {"if emerge", ELEM_CTRL_COMPARE, {0x58000}, {0x1}}, \ - {"", ELEM_CTRL_CMP_JUMP_EQ, {0x0}, {0x3}}, \ - {"EMERGE START", ELEM_OUTPUT_DIVIDE, {0x0}, {0x2D}}, \ - {"[emerge info]", ELEM_OUTPUT_STR_NL, {0x58000}, {0x8000}}, \ - {"EMERGE END", ELEM_OUTPUT_DIVIDE, {0x0}, {0x2D}}, \ - {"if die", ELEM_CTRL_COMPARE, {0x60000}, {0x1}}, \ - {"", ELEM_CTRL_CMP_JUMP_EQ, {0x0}, {0x3}}, \ - {"DIE START", ELEM_OUTPUT_DIVIDE, {0x0}, {0x2D}}, \ - {"[die info]", ELEM_OUTPUT_STR_NL, {0x60000}, {0x20000}}, \ - {"DIE END", ELEM_OUTPUT_DIVIDE, {0x0}, {0x2D}}, \ -} - -/** - * the whole space is 512k, used for histroy data record - * the struct distribution is as follows: - * +-------------------+ - * | head info(1k) | region: area: module block: - * +-------------------+ +--------------------+ +-----------------+ +-----------------+ - * | boot region |---->| first area |---->| module block |---->| block head | - * +-------------------+ +--------------------+ +-----------------+ +-----------------+ - * | run region | | second area | | module block | | block data | - * +-------------------+ +--------------------+ +-----------------+ +-----------------+ - * | reserved | | ...... | | ...... | - * +-------------------+ +--------------------+ +-----------------+ - */ -#define DATA_MODEL_HDR_BOOT_BIOS MODEL_VECTOR(HDR_BOOT_BIOS) = { \ - {"magic", ELEM_OUTPUT_INT, {0x0}, {0x4}}, \ - {"version", ELEM_OUTPUT_INT, {0x4}, {0x4}}, \ - {"module id", ELEM_OUTPUT_INT, {0x8}, {0x4}}, \ - {"if", ELEM_CTRL_COMPARE, {0xC}, {0x4}}, \ - {"is used", ELEM_CTRL_CMP_JUMP_NE, {0x1}, {0xFF}}, \ - {"err code", ELEM_OUTPUT_INT, {0x10}, {0x4}}, \ - {"reason", ELEM_OUTPUT_INT, {0x14}, {0x4}}, \ - {"hot reset index", ELEM_OUTPUT_INT, {0x18}, {0x4}}, \ - {"bsbc point", ELEM_OUTPUT_INT, {0x1C}, {0x4}}, \ - {"bsbc exc point", ELEM_OUTPUT_INT, {0x20}, {0x4}}, \ - {"hboot1 point", ELEM_OUTPUT_INT, {0x24}, {0x4}}, \ - {"hboot1 exc point", ELEM_OUTPUT_INT, {0x28}, {0x4}}, \ - {"hboot2 point", ELEM_OUTPUT_INT, {0x2C}, {0x4}}, \ - {"hboot2 exc point", ELEM_OUTPUT_INT, {0x30}, {0x4}}, \ - {"[BIOS info]", ELEM_OUTPUT_STR_NL, {0x480}, {0x2780}}, \ -} - -#define DATA_MODEL_HDR_BOOT_DDR MODEL_VECTOR(HDR_BOOT_DDR) = { \ - {"magic", ELEM_OUTPUT_INT, {0x0}, {0x4}}, \ - {"version", ELEM_OUTPUT_INT, {0x4}, {0x4}}, \ - {"module id", ELEM_OUTPUT_INT, {0x8}, {0x4}}, \ - {"if", ELEM_CTRL_COMPARE, {0xC}, {0x4}}, \ - {"is used", ELEM_CTRL_CMP_JUMP_NE, {0x1}, {0xFF}}, \ - {"err code", ELEM_OUTPUT_INT, {0x10}, {0x4}}, \ - {"reason", ELEM_OUTPUT_INT, {0x14}, {0x4}}, \ - {"hot reset index", ELEM_OUTPUT_INT, {0x18}, {0x4}}, \ - {"magic_begin", ELEM_OUTPUT_INT, {0x1C}, {0x4}}, \ - {"init_keypoint", ELEM_OUTPUT_INT, {0x20}, {0x4}}, \ - {"ldo8_vol", ELEM_OUTPUT_INT, {0x24}, {0x4}}, \ - {"buck3_status", ELEM_OUTPUT_INT, {0x28}, {0x4}}, \ - {"buck3_vol", ELEM_OUTPUT_INT, {0x2C}, {0x4}}, \ - {"buck5_status", ELEM_OUTPUT_INT, {0x30}, {0x4}}, \ - {"buck5_vol", ELEM_OUTPUT_INT, {0x34}, {0x4}}, \ - {"wr_test_result", ELEM_OUTPUT_INT, {0x38}, {0x4}}, \ - {"rint_status[0]", ELEM_OUTPUT_INT, {0x3C}, {0x4}}, \ - {"rint_status[1]", ELEM_OUTPUT_INT, {0x40}, {0x4}}, \ - {"rint_status[2]", ELEM_OUTPUT_INT, {0x44}, {0x4}}, \ - {"rint_status[3]", ELEM_OUTPUT_INT, {0x48}, {0x4}}, \ - {"rint_status[4]", ELEM_OUTPUT_INT, {0x4C}, {0x4}}, \ - {"rint_status[5]", ELEM_OUTPUT_INT, {0x50}, {0x4}}, \ - {"rint_status[6]", ELEM_OUTPUT_INT, {0x54}, {0x4}}, \ - {"rint_status[7]", ELEM_OUTPUT_INT, {0x58}, {0x4}}, \ - {"SOC_SCTRL_DDRRETENTION_ADDR", ELEM_OUTPUT_INT, {0x5C}, {0x4}}, \ - {"SOC_SCTRL_DDRRETENTIONCLR_ADDR", ELEM_OUTPUT_INT, {0x60}, {0x4}}, \ - {"SOC_SCTRL_DRAMRETENTION_ADDR", ELEM_OUTPUT_INT, {0x64}, {0x4}}, \ - {"SC_DDRC_0_3_RESET_REQ", ELEM_OUTPUT_INT, {0x68}, {0x4}}, \ - {"SC_DDRC_4_7_RESET_REQ", ELEM_OUTPUT_INT, {0x6C}, {0x4}}, \ - {"SC_DDRC_0_3_PACK_RESET_REQ", ELEM_OUTPUT_INT, {0x70}, {0x4}}, \ - {"SC_DDRC_4_7_PACK_RESET_REQ", ELEM_OUTPUT_INT, {0x74}, {0x4}}, \ - {"SC_DDRC_EXMBIST0_REGS_RESET_REQ", ELEM_OUTPUT_INT, {0x78}, {0x4}}, \ - {"SC_DDRC_EXMBIST1_REGS_RESET_REQ", ELEM_OUTPUT_INT, {0x7C}, {0x4}}, \ - {"SOC_SCTRL_DDRC_0_3_AO_RST_ADDR", ELEM_OUTPUT_INT, {0x80}, {0x4}}, \ - {"SOC_SCTRL_DDRC_4_7_AO_RST_ADDR", ELEM_OUTPUT_INT, {0x84}, {0x4}}, \ - {"SOC_PMCTRL_PPLLBYPASS0_ADDR", ELEM_OUTPUT_INT, {0x88}, {0x4}}, \ - {"SOC_PMCTRL_PPLLBYPASS1_ADDR", ELEM_OUTPUT_INT, {0x8C}, {0x4}}, \ - {"SOC_PMCTRL_PPLL3FCTRL_ADDR", ELEM_OUTPUT_INT, {0x90}, {0x4}}, \ - {"SOC_PMCTRL_PPLL3FCTRL_FRAC_ADDR", ELEM_OUTPUT_INT, {0x94}, {0x4}}, \ - {"SOC_PMCTRL_PPLL4FCTRL_ADDR", ELEM_OUTPUT_INT, {0x98}, {0x4}}, \ - {"SOC_PMCTRL_PPLL4FCTRL_FRAC_ADDR", ELEM_OUTPUT_INT, {0x9C}, {0x4}}, \ - {"SOC_PMCTRL_PPLLOCKSTATUS_ADDR", ELEM_OUTPUT_INT, {0x100}, {0x4}}, \ - {"SC_DDRC_0_3_BYPASS_MODE_CTRL", ELEM_OUTPUT_INT, {0x104}, {0x4}}, \ - {"SC_DDRC_4_7_BYPASS_MODE_CTRL", ELEM_OUTPUT_INT, {0x108}, {0x4}}, \ - {"SC_PLL_PROF_CFG1", ELEM_OUTPUT_INT, {0x10C}, {0x4}}, \ -} - -#define DATA_MODEL_HDR_BOOT_TEE MODEL_VECTOR(HDR_BOOT_TEE) = { \ - {"magic", ELEM_OUTPUT_INT, {0x0}, {0x4}}, \ - {"version", ELEM_OUTPUT_INT, {0x4}, {0x4}}, \ - {"module id", ELEM_OUTPUT_INT, {0x8}, {0x4}}, \ - {"if", ELEM_CTRL_COMPARE, {0xC}, {0x4}}, \ - {"is used", ELEM_CTRL_CMP_JUMP_NE, {0x1}, {0xFF}}, \ - {"err code", ELEM_OUTPUT_INT, {0x10}, {0x4}}, \ - {"reason", ELEM_OUTPUT_INT, {0x14}, {0x4}}, \ - {"hot reset index", ELEM_OUTPUT_INT, {0x18}, {0x4}}, \ - {"[BOOT FATAL INFO SIZE]", ELEM_OUTPUT_INT, {0x1C}, {0x4}}, \ - {"[BOOT FATAL INFO]", ELEM_OUTPUT_STR_NL, {0x20}, {0x7E0}}, \ - {"[run point tail]", ELEM_OUTPUT_INT, {0x800}, {0x4}}, \ - {"[boot point info]", ELEM_OUTPUT_HEX, {0x804}, {0x20}}, \ - {"[run point info]", ELEM_OUTPUT_HEX, {0x884}, {0x20}}, \ - {"[last log size]", ELEM_OUTPUT_INT, {0xC00}, {0x4}}, \ - {"[last log data]", ELEM_OUTPUT_STR_NL, {0xC04}, {0x3FC}}, \ -} - -#define DATA_MODEL_HDR_BOOT_ATF MODEL_VECTOR(HDR_BOOT_ATF) = { \ - {"magic", ELEM_OUTPUT_INT, {0x0}, {0x4}}, \ - {"version", ELEM_OUTPUT_INT, {0x4}, {0x4}}, \ - {"module id", ELEM_OUTPUT_INT, {0x8}, {0x4}}, \ - {"if", ELEM_CTRL_COMPARE, {0xC}, {0x4}}, \ - {"is used", ELEM_CTRL_CMP_JUMP_NE, {0x1}, {0xFF}}, \ - {"err code", ELEM_OUTPUT_INT, {0x10}, {0x4}}, \ - {"reason", ELEM_OUTPUT_INT, {0x14}, {0x4}}, \ - {"hot reset index", ELEM_OUTPUT_INT, {0x18}, {0x4}}, \ - {"[ATF info]", ELEM_OUTPUT_STR_NL, {0x1C}, {0xFE4}}, \ -} - -#define DATA_MODEL_HDR_BOOT_AREA MODEL_VECTOR(HDR_BOOT_AREA) = { \ - {"BIOS INFO", ELEM_OUTPUT_DIVIDE, {0x0}, {0x2D}}, \ - {"HDR_BOOT_BIOS", ELEM_CTRL_TABLE_GOTO, {0x0}, {0x3000}}, \ - {"table_index", ELEM_CTRL_TABLE_RANGE, {PLAINTEXT_TABLE_HDR_BOOT_BIOS}, {0x1}}, \ - {"NL", ELEM_OUTPUT_NL, {0x0}, {0x0}}, \ - {"DDR INFO", ELEM_OUTPUT_DIVIDE, {0x0}, {0x2D}}, \ - {"HDR_BOOT_DDR", ELEM_CTRL_TABLE_GOTO, {0x3000}, {0x1000}}, \ - {"table_index", ELEM_CTRL_TABLE_RANGE, {PLAINTEXT_TABLE_HDR_BOOT_DDR}, {0x1}}, \ - {"NL", ELEM_OUTPUT_NL, {0x0}, {0x0}}, \ - {"TEE INFO", ELEM_OUTPUT_DIVIDE, {0x0}, {0x2D}}, \ - {"HDR_BOOT_TEE", ELEM_CTRL_TABLE_GOTO, {0x4000}, {0x1000}}, \ - {"table_index", ELEM_CTRL_TABLE_RANGE, {PLAINTEXT_TABLE_HDR_BOOT_TEE}, {0x1}}, \ - {"NL", ELEM_OUTPUT_NL, {0x0}, {0x0}}, \ - {"ATF INFO", ELEM_OUTPUT_DIVIDE, {0x0}, {0x2D}}, \ - {"HDR_BOOT_ATF", ELEM_CTRL_TABLE_GOTO, {0x5000}, {0x1000}}, \ - {"table_index", ELEM_CTRL_TABLE_RANGE, {PLAINTEXT_TABLE_HDR_BOOT_ATF}, {0x1}}, \ - {"NL", ELEM_OUTPUT_NL, {0x0}, {0x0}}, \ -} - -#define DATA_MODEL_HDR_RUN_OS MODEL_VECTOR(HDR_RUN_OS) = { \ - {"magic", ELEM_OUTPUT_INT, {0x0}, {0x4}}, \ - {"version", ELEM_OUTPUT_INT, {0x4}, {0x4}}, \ - {"module id", ELEM_OUTPUT_INT, {0x8}, {0x4}}, \ - {"if", ELEM_CTRL_COMPARE, {0xC}, {0x4}}, \ - {"is used", ELEM_CTRL_CMP_JUMP_NE, {0x1}, {0xFF}}, \ - {"err code", ELEM_OUTPUT_INT, {0x10}, {0x4}}, \ - {"reason", ELEM_OUTPUT_INT, {0x14}, {0x4}}, \ - {"hot reset index", ELEM_OUTPUT_INT, {0x18}, {0x4}}, \ - {"[OS info]", ELEM_OUTPUT_STR_CONST, {0x0}, {0x0}}, \ - {"event_flag", ELEM_OUTPUT_INT, {0x1C}, {0x4}}, \ - {"dump_flag", ELEM_OUTPUT_INT, {0x20}, {0x4}}, \ - {"err num", ELEM_OUTPUT_INT, {0x24}, {0x4}}, \ - {"[OS log]", ELEM_OUTPUT_STR_NL, {0x100}, {0xF00}}, \ -} - -#define DATA_MODEL_HDR_RUN_LPM MODEL_VECTOR(HDR_RUN_LPM) = { \ - {"magic", ELEM_OUTPUT_INT, {0x0}, {0x4}}, \ - {"version", ELEM_OUTPUT_INT, {0x4}, {0x4}}, \ - {"module id", ELEM_OUTPUT_INT, {0x8}, {0x4}}, \ - {"if", ELEM_CTRL_COMPARE, {0xC}, {0x4}}, \ - {"is used", ELEM_CTRL_CMP_JUMP_NE, {0x1}, {0x200}}, \ - {"err code", ELEM_OUTPUT_INT, {0x10}, {0x4}}, \ - {"reason", ELEM_OUTPUT_INT, {0x14}, {0x4}}, \ - {"hot reset index", ELEM_OUTPUT_INT, {0x18}, {0x4}}, \ - {"[LPM log]", ELEM_OUTPUT_STR_NL, {0x40}, {0x400}}, \ - {"NL", ELEM_OUTPUT_NL, {0x0}, {0x0}}, \ - {"[LPM data]:", ELEM_OUTPUT_STR_CONST, {0x0}, {0x0}}, \ - {"reset_reason", ELEM_OUTPUT_INT, {0x440}, {0x4}}, \ - {"slice", ELEM_OUTPUT_INT, {0x444}, {0x4}}, \ - {"rtc", ELEM_OUTPUT_INT, {0x448}, {0x4}}, \ - {"r13", ELEM_OUTPUT_INT, {0x44C}, {0x4}}, \ - {"lr1", ELEM_OUTPUT_INT, {0x450}, {0x4}}, \ - {"pc", ELEM_OUTPUT_INT, {0x454}, {0x4}}, \ - {"xpsr", ELEM_OUTPUT_INT, {0x458}, {0x4}}, \ - {"cfsr", ELEM_OUTPUT_INT, {0x45C}, {0x4}}, \ - {"hfsr", ELEM_OUTPUT_INT, {0x460}, {0x4}}, \ - {"bfar", ELEM_OUTPUT_INT, {0x464}, {0x4}}, \ - {"exc_trace", ELEM_OUTPUT_INT, {0x468}, {0x1}}, \ - {"ddr_exc", ELEM_OUTPUT_INT, {0x469}, {0x1}}, \ - {"irq_id", ELEM_OUTPUT_INT, {0x46A}, {0x2}}, \ - {"task_id", ELEM_OUTPUT_INT, {0x46C}, {0x4}}, \ - {"TSENSOR_A55", ELEM_OUTPUT_INT, {0x470}, {0x1}}, \ - {"TSENSOR_PERI", ELEM_OUTPUT_INT, {0x471}, {0x1}}, \ - {"TSENSOR_AIC0", ELEM_OUTPUT_INT, {0x472}, {0x1}}, \ - {"TSENSOR_AIC1", ELEM_OUTPUT_INT, {0x473}, {0x1}}, \ - {"DDR_T_GRADE", ELEM_OUTPUT_INT, {0x474}, {0x1}}, \ - {"EDP_SCALE_0", ELEM_OUTPUT_INT, {0x475}, {0x1}}, \ - {"EDP_SCALE_1", ELEM_OUTPUT_INT, {0x476}, {0x1}}, \ - {"TMP_STATUS", ELEM_OUTPUT_INT, {0x477}, {0x1}}, \ - {"TMP_CTRL_ST", ELEM_OUTPUT_INT, {0x478}, {0x1}}, \ - {"AIC_FREQ_ST", ELEM_OUTPUT_INT, {0x479}, {0x1}}, \ - {"A55_FREQ_ST", ELEM_OUTPUT_INT, {0x47a}, {0x1}}, \ - {"AIC_NUM_ST", ELEM_OUTPUT_INT, {0x47b}, {0x1}}, \ - {"TMP_RST", ELEM_OUTPUT_INT, {0x47c}, {0x1}}, \ - {"TMP_HIGH", ELEM_OUTPUT_INT, {0x47d}, {0x1}}, \ - {"TMP_NOR", ELEM_OUTPUT_INT, {0x47e}, {0x1}}, \ - {"TMP_PERIOD", ELEM_OUTPUT_INT, {0x47f}, {0x1}}, \ - {"T_RST_STATUS", ELEM_OUTPUT_INT, {0x48D}, {0x1}}, \ - {"T_ERR_TSENSOR", ELEM_OUTPUT_INT, {0x48e}, {0x1}}, \ - {"T_ERR_EFUSE", ELEM_OUTPUT_INT, {0x48f}, {0x1}}, \ - {"AICORE0_HIGHTEMP_VOLT", ELEM_OUTPUT_INT, {0x490}, {0x4}}, \ - {"AICORE1_HIGHTEMP_VOLT", ELEM_OUTPUT_INT, {0x494}, {0x4}}, \ - {"CPU_HIGHTEMP_VOLT", ELEM_OUTPUT_INT, {0x498}, {0x4}}, \ - {"AIMEMORY_HIGHTEMP_VOLT", ELEM_OUTPUT_INT, {0x49c}, {0x4}}, \ - {"PERI_HIGHTEMP_VOLT", ELEM_OUTPUT_INT, {0x4a0}, {0x4}}, \ - {"AICORE0_CUR_VOLT", ELEM_OUTPUT_INT, {0x4a4}, {0x4}}, \ - {"AICORE1_CUR_VOLT", ELEM_OUTPUT_INT, {0x4a8}, {0x4}}, \ - {"CPU_CUR_VOLT", ELEM_OUTPUT_INT, {0x4ac}, {0x4}}, \ - {"AIMEMORY_CUR_VOLT", ELEM_OUTPUT_INT, {0x4b0}, {0x4}}, \ - {"PERI_CUR_VOLT", ELEM_OUTPUT_INT, {0x4b4}, {0x4}}, \ - {"AICORE0_SVFD_VOLT", ELEM_OUTPUT_INT, {0x4b8}, {0x4}}, \ - {"AICORE1_SVFD_VOLT", ELEM_OUTPUT_INT, {0x4bc}, {0x4}}, \ - {"AICORE0_SVFD_CPM", ELEM_OUTPUT_INT, {0x4c0}, {0x2}}, \ - {"AICORE1_SVFD_CPM", ELEM_OUTPUT_INT, {0x4c2}, {0x2}}, \ - {"AICORE0_NOTIFY_ST", ELEM_OUTPUT_INT, {0x4c4}, {0x1}}, \ - {"AICORE1_NOTIFY_ST", ELEM_OUTPUT_INT, {0x4c5}, {0x1}}, \ - {"CPU_NOTIFY_ST", ELEM_OUTPUT_INT, {0x4c6}, {0x1}}, \ - {"AIMEMORY_NOTIFY_ST", ELEM_OUTPUT_INT, {0x4c7}, {0x1}}, \ - {"PERI_NOTIFY_ST", ELEM_OUTPUT_INT, {0x4c8}, {0x1}}, \ - {"AICORE0_TZONE", ELEM_OUTPUT_INT, {0x4c9}, {0x1}}, \ - {"AICORE1_TZONE", ELEM_OUTPUT_INT, {0x4ca}, {0x1}}, \ - {"CPU_TZONE", ELEM_OUTPUT_INT, {0x4cb}, {0x1}}, \ - {"AIMEMORY_TZONE", ELEM_OUTPUT_INT, {0x4cc}, {0x1}}, \ - {"PERI_TZONE", ELEM_OUTPUT_INT, {0x4cd}, {0x1}}, \ - {"VOLT_RISE_TEMP", ELEM_OUTPUT_INT, {0x4ce}, {0x1}}, \ - {"VOLT_DECREASE_TEMP", ELEM_OUTPUT_INT, {0x4cf}, {0x1}}, \ - {"NL", ELEM_OUTPUT_NL, {0x0}, {0x0}}, /* below for ddr */ \ - {"[DDR data]:", ELEM_OUTPUT_STR_CONST, {0x0}, {0x0}}, \ - {"magic_begin", ELEM_OUTPUT_INT, {0x800}, {0x4}}, \ - {"slice_time", ELEM_OUTPUT_INT, {0x804}, {0x4}}, \ - {"mod_reason", ELEM_OUTPUT_INT, {0x808}, {0x4}}, \ - {"ddr_freq_id", ELEM_OUTPUT_INT, {0x80C}, {0x4}}, \ - {"ddr_status", ELEM_OUTPUT_INT, {0x810}, {0x4}}, \ - {"uce_exc", ELEM_OUTPUT_INT, {0x814}, {0x4}}, \ - {"SC_TSENSOR_INFO_ADDR", ELEM_OUTPUT_INT, {0x818}, {0x4}}, \ - {"SC_TSENSOR_AICORE_LIMIT", ELEM_OUTPUT_INT, {0x81C}, {0x4}}, \ - {"SC_TSENSOR_MAX_TEMP", ELEM_OUTPUT_INT, {0x820}, {0x4}}, \ - {"channel_mask", ELEM_OUTPUT_INT, {0x824}, {0x4}}, \ - {"channel_num", ELEM_OUTPUT_INT, {0x828}, {0x4}}, \ - {"rank_num", ELEM_OUTPUT_INT, {0x82C}, {0x4}}, \ - {"ddr_size", ELEM_OUTPUT_INT, {0x830}, {0x4}}, \ - {"manufactery_id", ELEM_OUTPUT_INT, {0x834}, {0x4}}, \ - {"iecc_cerr_thresh[0]", ELEM_OUTPUT_INT, {0x838}, {0x4}}, \ - {"iecc_cerr_thresh[1]", ELEM_OUTPUT_INT, {0x83C}, {0x4}}, \ - {"iecc_cerr_thresh[2]", ELEM_OUTPUT_INT, {0x840}, {0x4}}, \ - {"iecc_cerr_thresh[3]", ELEM_OUTPUT_INT, {0x844}, {0x4}}, \ - {"iecc_cerr_thresh[4]", ELEM_OUTPUT_INT, {0x848}, {0x4}}, \ - {"iecc_cerr_thresh[5]", ELEM_OUTPUT_INT, {0x84C}, {0x4}}, \ - {"iecc_cerr_thresh[6]", ELEM_OUTPUT_INT, {0x850}, {0x4}}, \ - {"iecc_cerr_thresh[7]", ELEM_OUTPUT_INT, {0x854}, {0x4}}, \ - {"iecc_ctrl[0]", ELEM_OUTPUT_INT, {0x858}, {0x4}}, \ - {"iecc_ctrl[1]", ELEM_OUTPUT_INT, {0x85C}, {0x4}}, \ - {"iecc_ctrl[2]", ELEM_OUTPUT_INT, {0x860}, {0x4}}, \ - {"iecc_ctrl[3]", ELEM_OUTPUT_INT, {0x864}, {0x4}}, \ - {"iecc_ctrl[4]", ELEM_OUTPUT_INT, {0x868}, {0x4}}, \ - {"iecc_ctrl[5]", ELEM_OUTPUT_INT, {0x86C}, {0x4}}, \ - {"iecc_ctrl[6]", ELEM_OUTPUT_INT, {0x870}, {0x4}}, \ - {"iecc_ctrl[7]", ELEM_OUTPUT_INT, {0x874}, {0x4}}, \ - {"iecc_cerr_cnt[0]", ELEM_OUTPUT_INT, {0x878}, {0x4}}, \ - {"iecc_cerr_cnt[1]", ELEM_OUTPUT_INT, {0x87C}, {0x4}}, \ - {"iecc_cerr_cnt[2]", ELEM_OUTPUT_INT, {0x880}, {0x4}}, \ - {"iecc_cerr_cnt[3]", ELEM_OUTPUT_INT, {0x884}, {0x4}}, \ - {"iecc_cerr_cnt[4]", ELEM_OUTPUT_INT, {0x888}, {0x4}}, \ - {"iecc_cerr_cnt[5]", ELEM_OUTPUT_INT, {0x88C}, {0x4}}, \ - {"iecc_cerr_cnt[6]", ELEM_OUTPUT_INT, {0x890}, {0x4}}, \ - {"iecc_cerr_cnt[7]", ELEM_OUTPUT_INT, {0x894}, {0x4}}, \ - {"iecc_uerr_cnt[0]", ELEM_OUTPUT_INT, {0x898}, {0x4}}, \ - {"iecc_uerr_cnt[1]", ELEM_OUTPUT_INT, {0x89C}, {0x4}}, \ - {"iecc_uerr_cnt[2]", ELEM_OUTPUT_INT, {0x8A0}, {0x4}}, \ - {"iecc_uerr_cnt[3]", ELEM_OUTPUT_INT, {0x8A4}, {0x4}}, \ - {"iecc_uerr_cnt[4]", ELEM_OUTPUT_INT, {0x8A8}, {0x4}}, \ - {"iecc_uerr_cnt[5]", ELEM_OUTPUT_INT, {0x8AC}, {0x4}}, \ - {"iecc_uerr_cnt[6]", ELEM_OUTPUT_INT, {0x8B0}, {0x4}}, \ - {"iecc_uerr_cnt[7]", ELEM_OUTPUT_INT, {0x8B4}, {0x4}}, \ - {"magic_byte", ELEM_OUTPUT_INT, {0x900}, {0x1}}, \ - {"err_max", ELEM_OUTPUT_INT, {0x904}, {0x1}}, \ - {"irq_count", ELEM_OUTPUT_INT, {0x908}, {0x1}}, \ - {"index", ELEM_OUTPUT_INT, {0x90C}, {0x1}}, \ - {"rate[0].time", ELEM_OUTPUT_INT, {0x900}, {0x4}}, \ - {"rate[0].rate_per_rank[0]", ELEM_OUTPUT_INT, {0x904}, {0x1}}, \ - {"rate[0].rate_per_rank[1]", ELEM_OUTPUT_INT, {0x905}, {0x1}}, \ - {"rate[0].rate_per_rank[2]", ELEM_OUTPUT_INT, {0x906}, {0x1}}, \ - {"rate[0].rate_per_rank[3]", ELEM_OUTPUT_INT, {0x907}, {0x1}}, \ - {"rate[0].rate_per_rank[4]", ELEM_OUTPUT_INT, {0x908}, {0x1}}, \ - {"rate[0].rate_per_rank[5]", ELEM_OUTPUT_INT, {0x909}, {0x1}}, \ - {"rate[0].rate_per_rank[6]", ELEM_OUTPUT_INT, {0x90A}, {0x1}}, \ - {"rate[0].rate_per_rank[7]", ELEM_OUTPUT_INT, {0x90B}, {0x1}}, \ - {"rate[0].rate_per_rank[8]", ELEM_OUTPUT_INT, {0x90C}, {0x1}}, \ - {"rate[0].rate_per_rank[9]", ELEM_OUTPUT_INT, {0x90D}, {0x1}}, \ - {"rate[0].rate_per_rank[A]", ELEM_OUTPUT_INT, {0x90E}, {0x1}}, \ - {"rate[0].rate_per_rank[B]", ELEM_OUTPUT_INT, {0x90F}, {0x1}}, \ - {"rate[0].rate_per_rank[C]", ELEM_OUTPUT_INT, {0x910}, {0x1}}, \ - {"rate[0].rate_per_rank[D]", ELEM_OUTPUT_INT, {0x911}, {0x1}}, \ - {"rate[0].rate_per_rank[E]", ELEM_OUTPUT_INT, {0x912}, {0x1}}, \ - {"rate[0].rate_per_rank[F]", ELEM_OUTPUT_INT, {0x913}, {0x1}}, \ - {"rate[1].time", ELEM_OUTPUT_INT, {0x914}, {0x4}}, \ - {"rate[1].rate_per_rank[0]", ELEM_OUTPUT_INT, {0x918}, {0x1}}, \ - {"rate[1].rate_per_rank[1]", ELEM_OUTPUT_INT, {0x919}, {0x1}}, \ - {"rate[1].rate_per_rank[2]", ELEM_OUTPUT_INT, {0x91A}, {0x1}}, \ - {"rate[1].rate_per_rank[3]", ELEM_OUTPUT_INT, {0x91B}, {0x1}}, \ - {"rate[1].rate_per_rank[4]", ELEM_OUTPUT_INT, {0x91C}, {0x1}}, \ - {"rate[1].rate_per_rank[5]", ELEM_OUTPUT_INT, {0x91D}, {0x1}}, \ - {"rate[1].rate_per_rank[6]", ELEM_OUTPUT_INT, {0x91E}, {0x1}}, \ - {"rate[1].rate_per_rank[7]", ELEM_OUTPUT_INT, {0x91F}, {0x1}}, \ - {"rate[1].rate_per_rank[8]", ELEM_OUTPUT_INT, {0x920}, {0x1}}, \ - {"rate[1].rate_per_rank[9]", ELEM_OUTPUT_INT, {0x921}, {0x1}}, \ - {"rate[1].rate_per_rank[A]", ELEM_OUTPUT_INT, {0x922}, {0x1}}, \ - {"rate[1].rate_per_rank[B]", ELEM_OUTPUT_INT, {0x923}, {0x1}}, \ - {"rate[1].rate_per_rank[C]", ELEM_OUTPUT_INT, {0x924}, {0x1}}, \ - {"rate[1].rate_per_rank[D]", ELEM_OUTPUT_INT, {0x925}, {0x1}}, \ - {"rate[1].rate_per_rank[E]", ELEM_OUTPUT_INT, {0x926}, {0x1}}, \ - {"rate[1].rate_per_rank[F]", ELEM_OUTPUT_INT, {0x927}, {0x1}}, \ - {"rate[2].time", ELEM_OUTPUT_INT, {0x928}, {0x4}}, \ - {"rate[2].rate_per_rank[0]", ELEM_OUTPUT_INT, {0x92C}, {0x1}}, \ - {"rate[2].rate_per_rank[1]", ELEM_OUTPUT_INT, {0x92D}, {0x1}}, \ - {"rate[2].rate_per_rank[2]", ELEM_OUTPUT_INT, {0x92E}, {0x1}}, \ - {"rate[2].rate_per_rank[3]", ELEM_OUTPUT_INT, {0x92F}, {0x1}}, \ - {"rate[2].rate_per_rank[4]", ELEM_OUTPUT_INT, {0x930}, {0x1}}, \ - {"rate[2].rate_per_rank[5]", ELEM_OUTPUT_INT, {0x931}, {0x1}}, \ - {"rate[2].rate_per_rank[6]", ELEM_OUTPUT_INT, {0x932}, {0x1}}, \ - {"rate[2].rate_per_rank[7]", ELEM_OUTPUT_INT, {0x933}, {0x1}}, \ - {"rate[2].rate_per_rank[8]", ELEM_OUTPUT_INT, {0x934}, {0x1}}, \ - {"rate[2].rate_per_rank[9]", ELEM_OUTPUT_INT, {0x935}, {0x1}}, \ - {"rate[2].rate_per_rank[A]", ELEM_OUTPUT_INT, {0x936}, {0x1}}, \ - {"rate[2].rate_per_rank[B]", ELEM_OUTPUT_INT, {0x937}, {0x1}}, \ - {"rate[2].rate_per_rank[C]", ELEM_OUTPUT_INT, {0x938}, {0x1}}, \ - {"rate[2].rate_per_rank[D]", ELEM_OUTPUT_INT, {0x939}, {0x1}}, \ - {"rate[2].rate_per_rank[E]", ELEM_OUTPUT_INT, {0x93A}, {0x1}}, \ - {"rate[2].rate_per_rank[F]", ELEM_OUTPUT_INT, {0x93B}, {0x1}}, \ - {"rate[3].time", ELEM_OUTPUT_INT, {0x93C}, {0x4}}, \ - {"rate[3].rate_per_rank[0]", ELEM_OUTPUT_INT, {0x940}, {0x1}}, \ - {"rate[3].rate_per_rank[1]", ELEM_OUTPUT_INT, {0x941}, {0x1}}, \ - {"rate[3].rate_per_rank[2]", ELEM_OUTPUT_INT, {0x942}, {0x1}}, \ - {"rate[3].rate_per_rank[3]", ELEM_OUTPUT_INT, {0x943}, {0x1}}, \ - {"rate[3].rate_per_rank[4]", ELEM_OUTPUT_INT, {0x944}, {0x1}}, \ - {"rate[3].rate_per_rank[5]", ELEM_OUTPUT_INT, {0x945}, {0x1}}, \ - {"rate[3].rate_per_rank[6]", ELEM_OUTPUT_INT, {0x946}, {0x1}}, \ - {"rate[3].rate_per_rank[7]", ELEM_OUTPUT_INT, {0x947}, {0x1}}, \ - {"rate[3].rate_per_rank[8]", ELEM_OUTPUT_INT, {0x948}, {0x1}}, \ - {"rate[3].rate_per_rank[9]", ELEM_OUTPUT_INT, {0x949}, {0x1}}, \ - {"rate[3].rate_per_rank[A]", ELEM_OUTPUT_INT, {0x94A}, {0x1}}, \ - {"rate[3].rate_per_rank[B]", ELEM_OUTPUT_INT, {0x94B}, {0x1}}, \ - {"rate[3].rate_per_rank[C]", ELEM_OUTPUT_INT, {0x94C}, {0x1}}, \ - {"rate[3].rate_per_rank[D]", ELEM_OUTPUT_INT, {0x94D}, {0x1}}, \ - {"rate[3].rate_per_rank[E]", ELEM_OUTPUT_INT, {0x94E}, {0x1}}, \ - {"rate[3].rate_per_rank[F]", ELEM_OUTPUT_INT, {0x94F}, {0x1}}, \ - {"rate[4].time", ELEM_OUTPUT_INT, {0x950}, {0x4}}, \ - {"rate[4].rate_per_rank[0]", ELEM_OUTPUT_INT, {0x954}, {0x1}}, \ - {"rate[4].rate_per_rank[1]", ELEM_OUTPUT_INT, {0x955}, {0x1}}, \ - {"rate[4].rate_per_rank[2]", ELEM_OUTPUT_INT, {0x956}, {0x1}}, \ - {"rate[4].rate_per_rank[3]", ELEM_OUTPUT_INT, {0x957}, {0x1}}, \ - {"rate[4].rate_per_rank[4]", ELEM_OUTPUT_INT, {0x958}, {0x1}}, \ - {"rate[4].rate_per_rank[5]", ELEM_OUTPUT_INT, {0x959}, {0x1}}, \ - {"rate[4].rate_per_rank[6]", ELEM_OUTPUT_INT, {0x95A}, {0x1}}, \ - {"rate[4].rate_per_rank[7]", ELEM_OUTPUT_INT, {0x95B}, {0x1}}, \ - {"rate[4].rate_per_rank[8]", ELEM_OUTPUT_INT, {0x95C}, {0x1}}, \ - {"rate[4].rate_per_rank[9]", ELEM_OUTPUT_INT, {0x95D}, {0x1}}, \ - {"rate[4].rate_per_rank[A]", ELEM_OUTPUT_INT, {0x95E}, {0x1}}, \ - {"rate[4].rate_per_rank[B]", ELEM_OUTPUT_INT, {0x95F}, {0x1}}, \ - {"rate[4].rate_per_rank[C]", ELEM_OUTPUT_INT, {0x960}, {0x1}}, \ - {"rate[4].rate_per_rank[D]", ELEM_OUTPUT_INT, {0x961}, {0x1}}, \ - {"rate[4].rate_per_rank[E]", ELEM_OUTPUT_INT, {0x962}, {0x1}}, \ - {"rate[4].rate_per_rank[F]", ELEM_OUTPUT_INT, {0x963}, {0x1}}, \ - {"rate[5].time", ELEM_OUTPUT_INT, {0x964}, {0x4}}, \ - {"rate[5].rate_per_rank[0]", ELEM_OUTPUT_INT, {0x968}, {0x1}}, \ - {"rate[5].rate_per_rank[1]", ELEM_OUTPUT_INT, {0x969}, {0x1}}, \ - {"rate[5].rate_per_rank[2]", ELEM_OUTPUT_INT, {0x96A}, {0x1}}, \ - {"rate[5].rate_per_rank[3]", ELEM_OUTPUT_INT, {0x96B}, {0x1}}, \ - {"rate[5].rate_per_rank[4]", ELEM_OUTPUT_INT, {0x96C}, {0x1}}, \ - {"rate[5].rate_per_rank[5]", ELEM_OUTPUT_INT, {0x96D}, {0x1}}, \ - {"rate[5].rate_per_rank[6]", ELEM_OUTPUT_INT, {0x96E}, {0x1}}, \ - {"rate[5].rate_per_rank[7]", ELEM_OUTPUT_INT, {0x96F}, {0x1}}, \ - {"rate[5].rate_per_rank[8]", ELEM_OUTPUT_INT, {0x970}, {0x1}}, \ - {"rate[5].rate_per_rank[9]", ELEM_OUTPUT_INT, {0x971}, {0x1}}, \ - {"rate[5].rate_per_rank[A]", ELEM_OUTPUT_INT, {0x972}, {0x1}}, \ - {"rate[5].rate_per_rank[B]", ELEM_OUTPUT_INT, {0x973}, {0x1}}, \ - {"rate[5].rate_per_rank[C]", ELEM_OUTPUT_INT, {0x974}, {0x1}}, \ - {"rate[5].rate_per_rank[D]", ELEM_OUTPUT_INT, {0x975}, {0x1}}, \ - {"rate[5].rate_per_rank[E]", ELEM_OUTPUT_INT, {0x976}, {0x1}}, \ - {"rate[5].rate_per_rank[F]", ELEM_OUTPUT_INT, {0x977}, {0x1}}, \ - {"rate[6].time", ELEM_OUTPUT_INT, {0x978}, {0x4}}, \ - {"rate[6].rate_per_rank[0]", ELEM_OUTPUT_INT, {0x97C}, {0x1}}, \ - {"rate[6].rate_per_rank[1]", ELEM_OUTPUT_INT, {0x97D}, {0x1}}, \ - {"rate[6].rate_per_rank[2]", ELEM_OUTPUT_INT, {0x97E}, {0x1}}, \ - {"rate[6].rate_per_rank[3]", ELEM_OUTPUT_INT, {0x97F}, {0x1}}, \ - {"rate[6].rate_per_rank[4]", ELEM_OUTPUT_INT, {0x980}, {0x1}}, \ - {"rate[6].rate_per_rank[5]", ELEM_OUTPUT_INT, {0x981}, {0x1}}, \ - {"rate[6].rate_per_rank[6]", ELEM_OUTPUT_INT, {0x982}, {0x1}}, \ - {"rate[6].rate_per_rank[7]", ELEM_OUTPUT_INT, {0x983}, {0x1}}, \ - {"rate[6].rate_per_rank[8]", ELEM_OUTPUT_INT, {0x984}, {0x1}}, \ - {"rate[6].rate_per_rank[9]", ELEM_OUTPUT_INT, {0x985}, {0x1}}, \ - {"rate[6].rate_per_rank[A]", ELEM_OUTPUT_INT, {0x986}, {0x1}}, \ - {"rate[6].rate_per_rank[B]", ELEM_OUTPUT_INT, {0x987}, {0x1}}, \ - {"rate[6].rate_per_rank[C]", ELEM_OUTPUT_INT, {0x988}, {0x1}}, \ - {"rate[6].rate_per_rank[D]", ELEM_OUTPUT_INT, {0x989}, {0x1}}, \ - {"rate[6].rate_per_rank[E]", ELEM_OUTPUT_INT, {0x98A}, {0x1}}, \ - {"rate[6].rate_per_rank[F]", ELEM_OUTPUT_INT, {0x98B}, {0x1}}, \ - {"rate[7].time", ELEM_OUTPUT_INT, {0x98C}, {0x4}}, \ - {"rate[7].rate_per_rank[0]", ELEM_OUTPUT_INT, {0x990}, {0x1}}, \ - {"rate[7].rate_per_rank[1]", ELEM_OUTPUT_INT, {0x991}, {0x1}}, \ - {"rate[7].rate_per_rank[2]", ELEM_OUTPUT_INT, {0x992}, {0x1}}, \ - {"rate[7].rate_per_rank[3]", ELEM_OUTPUT_INT, {0x993}, {0x1}}, \ - {"rate[7].rate_per_rank[4]", ELEM_OUTPUT_INT, {0x994}, {0x1}}, \ - {"rate[7].rate_per_rank[5]", ELEM_OUTPUT_INT, {0x995}, {0x1}}, \ - {"rate[7].rate_per_rank[6]", ELEM_OUTPUT_INT, {0x996}, {0x1}}, \ - {"rate[7].rate_per_rank[7]", ELEM_OUTPUT_INT, {0x997}, {0x1}}, \ - {"rate[7].rate_per_rank[8]", ELEM_OUTPUT_INT, {0x998}, {0x1}}, \ - {"rate[7].rate_per_rank[9]", ELEM_OUTPUT_INT, {0x999}, {0x1}}, \ - {"rate[7].rate_per_rank[A]", ELEM_OUTPUT_INT, {0x99A}, {0x1}}, \ - {"rate[7].rate_per_rank[B]", ELEM_OUTPUT_INT, {0x99B}, {0x1}}, \ - {"rate[7].rate_per_rank[C]", ELEM_OUTPUT_INT, {0x99C}, {0x1}}, \ - {"rate[7].rate_per_rank[D]", ELEM_OUTPUT_INT, {0x99D}, {0x1}}, \ - {"rate[7].rate_per_rank[E]", ELEM_OUTPUT_INT, {0x99E}, {0x1}}, \ - {"rate[7].rate_per_rank[F]", ELEM_OUTPUT_INT, {0x9AF}, {0x1}}, \ - {"rate[8].time", ELEM_OUTPUT_INT, {0x9B0}, {0x4}}, \ - {"rate[8].rate_per_rank[0]", ELEM_OUTPUT_INT, {0x9B4}, {0x1}}, \ - {"rate[8].rate_per_rank[1]", ELEM_OUTPUT_INT, {0x9B5}, {0x1}}, \ - {"rate[8].rate_per_rank[2]", ELEM_OUTPUT_INT, {0x9B6}, {0x1}}, \ - {"rate[8].rate_per_rank[3]", ELEM_OUTPUT_INT, {0x9B7}, {0x1}}, \ - {"rate[8].rate_per_rank[4]", ELEM_OUTPUT_INT, {0x9B8}, {0x1}}, \ - {"rate[8].rate_per_rank[5]", ELEM_OUTPUT_INT, {0x9B9}, {0x1}}, \ - {"rate[8].rate_per_rank[6]", ELEM_OUTPUT_INT, {0x9BA}, {0x1}}, \ - {"rate[8].rate_per_rank[7]", ELEM_OUTPUT_INT, {0x9BB}, {0x1}}, \ - {"rate[8].rate_per_rank[8]", ELEM_OUTPUT_INT, {0x9BC}, {0x1}}, \ - {"rate[8].rate_per_rank[9]", ELEM_OUTPUT_INT, {0x9BD}, {0x1}}, \ - {"rate[8].rate_per_rank[A]", ELEM_OUTPUT_INT, {0x9BE}, {0x1}}, \ - {"rate[8].rate_per_rank[B]", ELEM_OUTPUT_INT, {0x9BF}, {0x1}}, \ - {"rate[8].rate_per_rank[C]", ELEM_OUTPUT_INT, {0x9C0}, {0x1}}, \ - {"rate[8].rate_per_rank[D]", ELEM_OUTPUT_INT, {0x9C1}, {0x1}}, \ - {"rate[8].rate_per_rank[E]", ELEM_OUTPUT_INT, {0x9C2}, {0x1}}, \ - {"rate[8].rate_per_rank[F]", ELEM_OUTPUT_INT, {0x9C3}, {0x1}}, \ - {"rate[9].time", ELEM_OUTPUT_INT, {0x9C4}, {0x4}}, \ - {"rate[9].rate_per_rank[0]", ELEM_OUTPUT_INT, {0x9C8}, {0x1}}, \ - {"rate[9].rate_per_rank[1]", ELEM_OUTPUT_INT, {0x9C9}, {0x1}}, \ - {"rate[9].rate_per_rank[2]", ELEM_OUTPUT_INT, {0x9CA}, {0x1}}, \ - {"rate[9].rate_per_rank[3]", ELEM_OUTPUT_INT, {0x9CB}, {0x1}}, \ - {"rate[9].rate_per_rank[4]", ELEM_OUTPUT_INT, {0x9CC}, {0x1}}, \ - {"rate[9].rate_per_rank[5]", ELEM_OUTPUT_INT, {0x9CD}, {0x1}}, \ - {"rate[9].rate_per_rank[6]", ELEM_OUTPUT_INT, {0x9CE}, {0x1}}, \ - {"rate[9].rate_per_rank[7]", ELEM_OUTPUT_INT, {0x9CF}, {0x1}}, \ - {"rate[9].rate_per_rank[8]", ELEM_OUTPUT_INT, {0x9D0}, {0x1}}, \ - {"rate[9].rate_per_rank[9]", ELEM_OUTPUT_INT, {0x9D1}, {0x1}}, \ - {"rate[9].rate_per_rank[A]", ELEM_OUTPUT_INT, {0x9D2}, {0x1}}, \ - {"rate[9].rate_per_rank[B]", ELEM_OUTPUT_INT, {0x9D3}, {0x1}}, \ - {"rate[9].rate_per_rank[C]", ELEM_OUTPUT_INT, {0x9D4}, {0x1}}, \ - {"rate[9].rate_per_rank[D]", ELEM_OUTPUT_INT, {0x9D5}, {0x1}}, \ - {"rate[9].rate_per_rank[E]", ELEM_OUTPUT_INT, {0x9D6}, {0x1}}, \ - {"rate[9].rate_per_rank[F]", ELEM_OUTPUT_INT, {0x9D7}, {0x1}}, \ - {"mrr4_0.count", ELEM_OUTPUT_INT, {0x9D8}, {0x1}}, \ - {"mrr4_0.happen", ELEM_OUTPUT_INT, {0x9D9}, {0x1}}, \ - {"shake_count.count", ELEM_OUTPUT_INT, {0x9DA}, {0x1}}, \ - {"shake_count.happen", ELEM_OUTPUT_INT, {0x9DB}, {0x1}}, \ - {"sfc_record0", ELEM_OUTPUT_INT, {0x9DC}, {0x1}}, \ - {"sfc_record1", ELEM_OUTPUT_INT, {0x9DD}, {0x1}}, \ - {"sfc_mr5", ELEM_OUTPUT_INT, {0x9DE}, {0x1}}, \ -} - -#define DATA_MODEL_HDR_RUN_TEE MODEL_VECTOR(HDR_RUN_TEE) = { \ - {"magic", ELEM_OUTPUT_INT, {0x0}, {0x4}}, \ - {"version", ELEM_OUTPUT_INT, {0x4}, {0x4}}, \ - {"module id", ELEM_OUTPUT_INT, {0x8}, {0x4}}, \ - {"if", ELEM_CTRL_COMPARE, {0xC}, {0x4}}, \ - {"is used", ELEM_CTRL_CMP_JUMP_NE, {0x1}, {0xFF}}, \ - {"err code", ELEM_OUTPUT_INT, {0x10}, {0x4}}, \ - {"reason", ELEM_OUTPUT_INT, {0x14}, {0x4}}, \ - {"hot reset index", ELEM_OUTPUT_INT, {0x18}, {0x4}}, \ - {"[RUN FATAL INFO SIZE]", ELEM_OUTPUT_INT, {0x1C}, {0x4}}, \ - {"[RUN FATAL INFO]", ELEM_OUTPUT_STR_NL, {0x20}, {0x7E0}}, \ -} - -#define DATA_MODEL_HDR_RUN_ATF MODEL_VECTOR(HDR_RUN_ATF) = {\ - {"magic", ELEM_OUTPUT_INT, {0x0}, {0x4}}, \ - {"version", ELEM_OUTPUT_INT, {0x4}, {0x4}}, \ - {"module id", ELEM_OUTPUT_INT, {0x8}, {0x4}}, \ - {"if", ELEM_CTRL_COMPARE, {0xC}, {0x4}}, \ - {"is used", ELEM_CTRL_CMP_JUMP_NE, {0x1}, {0xFF}}, \ - {"err code", ELEM_OUTPUT_INT, {0x10}, {0x4}}, \ - {"reason", ELEM_OUTPUT_INT, {0x14}, {0x4}}, \ - {"hot reset index", ELEM_OUTPUT_INT, {0x18}, {0x4}}, \ - {"[ATF info]", ELEM_OUTPUT_STR_NL, {0x1C}, {0x7E4}}, \ -} - -#define DATA_MODEL_HDR_RUN_AREA MODEL_VECTOR(HDR_RUN_AREA) = { \ - {"TEE INFO", ELEM_OUTPUT_DIVIDE, {0x0}, {0x2D}}, \ - {"HDR_RUN_TEE", ELEM_CTRL_TABLE_GOTO, {0x0}, {0x800}}, \ - {"table_index", ELEM_CTRL_TABLE_RANGE, {PLAINTEXT_TABLE_HDR_RUN_TEE}, {0x1}}, \ - {"NL", ELEM_OUTPUT_NL, {0x0}, {0x0}}, \ - {"ATF INFO", ELEM_OUTPUT_DIVIDE, {0x0}, {0x2D}}, \ - {"HDR_RUN_ATF", ELEM_CTRL_TABLE_GOTO, {0x800}, {0x800}}, \ - {"table_index", ELEM_CTRL_TABLE_RANGE, {PLAINTEXT_TABLE_HDR_RUN_ATF}, {0x1}}, \ - {"NL", ELEM_OUTPUT_NL, {0x0}, {0x0}}, \ - {"LPM INFO", ELEM_OUTPUT_DIVIDE, {0x0}, {0x2D}}, \ - {"HDR_RUN_LPM", ELEM_CTRL_TABLE_GOTO, {0x1000}, {0x1000}}, \ - {"table_index", ELEM_CTRL_TABLE_RANGE, {PLAINTEXT_TABLE_HDR_RUN_LPM}, {0x1}}, \ - {"NL", ELEM_OUTPUT_NL, {0x0}, {0x0}}, \ - {"OS INFO", ELEM_OUTPUT_DIVIDE, {0x0}, {0x2D}}, \ - {"HDR_RUN_OS", ELEM_CTRL_TABLE_GOTO, {0x2000}, {0x1000}}, \ - {"table_index", ELEM_CTRL_TABLE_RANGE, {PLAINTEXT_TABLE_HDR_RUN_OS}, {0x1}}, \ - {"NL", ELEM_OUTPUT_NL, {0x0}, {0x0}}, \ -} - -#define DATA_MODEL_HDR_BOOT MODEL_VECTOR(HDR_BOOT) = { \ - {"area 0", ELEM_OUTPUT_DIVIDE, {0x0}, {0x3D}}, \ - {"HDR_BOOT_AREA", ELEM_CTRL_TABLE_GOTO, {0x0}, {0x7800}}, \ - {"table_index", ELEM_CTRL_TABLE_RANGE, {PLAINTEXT_TABLE_HDR_BOOT_AREA}, {0x1}}, \ - {"NL", ELEM_OUTPUT_NL, {0x0}, {0x0}}, \ - {"area 1", ELEM_OUTPUT_DIVIDE, {0x0}, {0x3D}}, \ - {"HDR_BOOT_AREA", ELEM_CTRL_TABLE_GOTO, {0x7800}, {0x7800}}, \ - {"table_index", ELEM_CTRL_TABLE_RANGE, {PLAINTEXT_TABLE_HDR_BOOT_AREA}, {0x1}}, \ - {"NL", ELEM_OUTPUT_NL, {0x0}, {0x0}}, \ - {"area 2", ELEM_OUTPUT_DIVIDE, {0x0}, {0x3D}}, \ - {"HDR_BOOT_AREA", ELEM_CTRL_TABLE_GOTO, {0xF000}, {0x7800}}, \ - {"table_index", ELEM_CTRL_TABLE_RANGE, {PLAINTEXT_TABLE_HDR_BOOT_AREA}, {0x1}}, \ - {"NL", ELEM_OUTPUT_NL, {0x0}, {0x0}}, \ - {"area 3", ELEM_OUTPUT_DIVIDE, {0x0}, {0x3D}}, \ - {"HDR_BOOT_AREA", ELEM_CTRL_TABLE_GOTO, {0x16800}, {0x7800}}, \ - {"table_index", ELEM_CTRL_TABLE_RANGE, {PLAINTEXT_TABLE_HDR_BOOT_AREA}, {0x1}}, \ - {"NL", ELEM_OUTPUT_NL, {0x0}, {0x0}}, \ - {"area 4", ELEM_OUTPUT_DIVIDE, {0x0}, {0x3D}}, \ - {"HDR_BOOT_AREA", ELEM_CTRL_TABLE_GOTO, {0x1E000}, {0x7800}}, \ - {"table_index", ELEM_CTRL_TABLE_RANGE, {PLAINTEXT_TABLE_HDR_BOOT_AREA}, {0x1}}, \ - {"NL", ELEM_OUTPUT_NL, {0x0}, {0x0}}, \ - {"area 5", ELEM_OUTPUT_DIVIDE, {0x0}, {0x3D}}, \ - {"HDR_BOOT_AREA", ELEM_CTRL_TABLE_GOTO, {0x25800}, {0x7800}}, \ - {"table_index", ELEM_CTRL_TABLE_RANGE, {PLAINTEXT_TABLE_HDR_BOOT_AREA}, {0x1}}, \ - {"NL", ELEM_OUTPUT_NL, {0x0}, {0x0}}, \ - {"area 6", ELEM_OUTPUT_DIVIDE, {0x0}, {0x3D}}, \ - {"HDR_BOOT_AREA", ELEM_CTRL_TABLE_GOTO, {0x2D000}, {0x7800}}, \ - {"table_index", ELEM_CTRL_TABLE_RANGE, {PLAINTEXT_TABLE_HDR_BOOT_AREA}, {0x1}}, \ -} - -#define DATA_MODEL_HDR_RUN MODEL_VECTOR(HDR_RUN) = { \ - {"area 0", ELEM_OUTPUT_DIVIDE, {0x0}, {0x3D}}, \ - {"HDR_RUN_AREA", ELEM_CTRL_TABLE_GOTO, {0x0}, {0x3C00}}, \ - {"table_index", ELEM_CTRL_TABLE_RANGE, {PLAINTEXT_TABLE_HDR_RUN_AREA}, {0x1}}, \ - {"NL", ELEM_OUTPUT_NL, {0x0}, {0x0}}, \ - {"area 1", ELEM_OUTPUT_DIVIDE, {0x0}, {0x3D}}, \ - {"HDR_RUN_AREA", ELEM_CTRL_TABLE_GOTO, {0x3C00}, {0x3C00}}, \ - {"table_index", ELEM_CTRL_TABLE_RANGE, {PLAINTEXT_TABLE_HDR_RUN_AREA}, {0x1}}, \ - {"NL", ELEM_OUTPUT_NL, {0x0}, {0x0}}, \ - {"area 2", ELEM_OUTPUT_DIVIDE, {0x0}, {0x3D}}, \ - {"HDR_RUN_AREA", ELEM_CTRL_TABLE_GOTO, {0x7800}, {0x3C00}}, \ - {"table_index", ELEM_CTRL_TABLE_RANGE, {PLAINTEXT_TABLE_HDR_RUN_AREA}, {0x1}}, \ - {"NL", ELEM_OUTPUT_NL, {0x0}, {0x0}}, \ - {"area 3", ELEM_OUTPUT_DIVIDE, {0x0}, {0x3D}}, \ - {"HDR_RUN_AREA", ELEM_CTRL_TABLE_GOTO, {0xB400}, {0x3C00}}, \ - {"table_index", ELEM_CTRL_TABLE_RANGE, {PLAINTEXT_TABLE_HDR_RUN_AREA}, {0x1}}, \ - {"NL", ELEM_OUTPUT_NL, {0x0}, {0x0}}, \ - {"area 4", ELEM_OUTPUT_DIVIDE, {0x0}, {0x3D}}, \ - {"HDR_RUN_AREA", ELEM_CTRL_TABLE_GOTO, {0xF000}, {0x3C00}}, \ - {"table_index", ELEM_CTRL_TABLE_RANGE, {PLAINTEXT_TABLE_HDR_RUN_AREA}, {0x1}}, \ - {"NL", ELEM_OUTPUT_NL, {0x0}, {0x0}}, \ - {"area 5", ELEM_OUTPUT_DIVIDE, {0x0}, {0x3D}}, \ - {"HDR_RUN_AREA", ELEM_CTRL_TABLE_GOTO, {0x12C00}, {0x3C00}}, \ - {"table_index", ELEM_CTRL_TABLE_RANGE, {PLAINTEXT_TABLE_HDR_RUN_AREA}, {0x1}}, \ - {"NL", ELEM_OUTPUT_NL, {0x0}, {0x0}}, \ - {"area 6", ELEM_OUTPUT_DIVIDE, {0x0}, {0x3D}}, \ - {"HDR_RUN_AREA", ELEM_CTRL_TABLE_GOTO, {0x16800}, {0x3C00}}, \ - {"table_index", ELEM_CTRL_TABLE_RANGE, {PLAINTEXT_TABLE_HDR_RUN_AREA}, {0x1}}, \ -} - -#define DATA_MODEL_HDR_BOOT_INFO MODEL_VECTOR(HDR_BOOT_INFO) = { \ - {"region offset", ELEM_OUTPUT_INT, {0x0}, {0x4}}, \ - {"region size", ELEM_OUTPUT_INT, {0x4}, {0x4}}, \ - {"NL", ELEM_OUTPUT_NL, {0x0}, {0x0}}, \ - {"region config", ELEM_OUTPUT_DIVIDE, {0x0}, {0x2D}}, \ - {"total area", ELEM_OUTPUT_INT, {0x8}, {0x4}}, \ - {"history area", ELEM_OUTPUT_INT, {0xC}, {0x4}}, \ - {"error area", ELEM_OUTPUT_INT, {0x10}, {0x4}}, \ - {"area config:", ELEM_OUTPUT_STR_CONST, {0x0}, {0x0}}, \ - {" used module count", ELEM_OUTPUT_INT, {0x14}, {0x4}}, \ - {"NL", ELEM_OUTPUT_NL, {0x0}, {0x0}}, \ - {"module config:", ELEM_OUTPUT_STR_CONST, {0x0}, {0x0}}, \ - {" module 0 offset", ELEM_OUTPUT_INT, {0x1C}, {0x4}}, \ - {" module 0 size", ELEM_OUTPUT_INT, {0x20}, {0x4}}, \ - {"NL", ELEM_OUTPUT_NL, {0x0}, {0x0}}, \ - {" module 1 offset", ELEM_OUTPUT_INT, {0x24}, {0x4}}, \ - {" module 1 size", ELEM_OUTPUT_INT, {0x28}, {0x4}}, \ - {"NL", ELEM_OUTPUT_NL, {0x0}, {0x0}}, \ - {" module 2 offset", ELEM_OUTPUT_INT, {0x2C}, {0x4}}, \ - {" module 2 size", ELEM_OUTPUT_INT, {0x30}, {0x4}}, \ - {"NL", ELEM_OUTPUT_NL, {0x0}, {0x0}}, \ - {" module 3 offset", ELEM_OUTPUT_INT, {0x34}, {0x4}}, \ - {" module 3 size", ELEM_OUTPUT_INT, {0x38}, {0x4}}, \ - {"NL", ELEM_OUTPUT_NL, {0x0}, {0x0}}, \ - {"region control", ELEM_OUTPUT_DIVIDE, {0x0}, {0x2D}}, \ - {"area index", ELEM_OUTPUT_INT, {0x6C}, {0x4}}, \ - {"error area count", ELEM_OUTPUT_INT, {0x70}, {0x4}}, \ - {"NL", ELEM_OUTPUT_NL, {0x0}, {0x0}}, \ - {"[area 0 control info]", ELEM_OUTPUT_STR_CONST, {0x0}, {0x0}}, \ - {" flag", ELEM_OUTPUT_INT, {0x74}, {0x4}}, \ - {" tag", ELEM_OUTPUT_INT, {0x78}, {0x4}}, \ - {" exception type", ELEM_OUTPUT_INT, {0x7C}, {0x4}}, \ - {" module id", ELEM_OUTPUT_INT, {0x80}, {0x4}}, \ - {" exception id", ELEM_OUTPUT_INT, {0x84}, {0x4}}, \ - {" reset number", ELEM_OUTPUT_INT, {0x88}, {0x4}}, \ - {"NL", ELEM_OUTPUT_NL, {0x0}, {0x0}}, \ - {"[area 1 control info]", ELEM_OUTPUT_STR_CONST, {0x0}, {0x0}}, \ - {" flag", ELEM_OUTPUT_INT, {0x8C}, {0x4}}, \ - {" tag", ELEM_OUTPUT_INT, {0x90}, {0x4}}, \ - {" exception type", ELEM_OUTPUT_INT, {0x94}, {0x4}}, \ - {" module id", ELEM_OUTPUT_INT, {0x98}, {0x4}}, \ - {" exception id", ELEM_OUTPUT_INT, {0x9C}, {0x4}}, \ - {" reset number", ELEM_OUTPUT_INT, {0xA0}, {0x4}}, \ - {"NL", ELEM_OUTPUT_NL, {0x0}, {0x0}}, \ - {"[area 2 control info]", ELEM_OUTPUT_STR_CONST, {0x0}, {0x0}}, \ - {" flag", ELEM_OUTPUT_INT, {0xA4}, {0x4}}, \ - {" tag", ELEM_OUTPUT_INT, {0xA8}, {0x4}}, \ - {" exception type", ELEM_OUTPUT_INT, {0xAC}, {0x4}}, \ - {" module id", ELEM_OUTPUT_INT, {0xB0}, {0x4}}, \ - {" exception id", ELEM_OUTPUT_INT, {0xB4}, {0x4}}, \ - {" reset number", ELEM_OUTPUT_INT, {0xB8}, {0x4}}, \ - {"NL", ELEM_OUTPUT_NL, {0x0}, {0x0}}, \ - {"[area 3 control info]", ELEM_OUTPUT_STR_CONST, {0x0}, {0x0}}, \ - {" flag", ELEM_OUTPUT_INT, {0xBC}, {0x4}}, \ - {" tag", ELEM_OUTPUT_INT, {0xC0}, {0x4}}, \ - {" exception type", ELEM_OUTPUT_INT, {0xC4}, {0x4}}, \ - {" module id", ELEM_OUTPUT_INT, {0xC8}, {0x4}}, \ - {" exception id", ELEM_OUTPUT_INT, {0xCC}, {0x4}}, \ - {" reset number", ELEM_OUTPUT_INT, {0xD0}, {0x4}}, \ - {"NL", ELEM_OUTPUT_NL, {0x0}, {0x0}}, \ - {"[area 4 control info]", ELEM_OUTPUT_STR_CONST, {0x0}, {0x0}}, \ - {" flag", ELEM_OUTPUT_INT, {0xD4}, {0x4}}, \ - {" tag", ELEM_OUTPUT_INT, {0xD8}, {0x4}}, \ - {" exception type", ELEM_OUTPUT_INT, {0xDC}, {0x4}}, \ - {" module id", ELEM_OUTPUT_INT, {0xE0}, {0x4}}, \ - {" exception id", ELEM_OUTPUT_INT, {0xE4}, {0x4}}, \ - {" reset number", ELEM_OUTPUT_INT, {0xE8}, {0x4}}, \ - {"NL", ELEM_OUTPUT_NL, {0x0}, {0x0}}, \ - {"[area 5 control info]", ELEM_OUTPUT_STR_CONST, {0x0}, {0x0}}, \ - {" flag", ELEM_OUTPUT_INT, {0xEC}, {0x4}}, \ - {" tag", ELEM_OUTPUT_INT, {0xF0}, {0x4}}, \ - {" exception type", ELEM_OUTPUT_INT, {0xF4}, {0x4}}, \ - {" module id", ELEM_OUTPUT_INT, {0xF8}, {0x4}}, \ - {" exception id", ELEM_OUTPUT_INT, {0xFC}, {0x4}}, \ - {" reset number", ELEM_OUTPUT_INT, {0x100}, {0x4}}, \ - {"NL", ELEM_OUTPUT_NL, {0x0}, {0x0}}, \ - {"[area 6 control info]", ELEM_OUTPUT_STR_CONST, {0x0}, {0x0}}, \ - {" flag", ELEM_OUTPUT_INT, {0x104}, {0x4}}, \ - {" tag", ELEM_OUTPUT_INT, {0x108}, {0x4}}, \ - {" exception type", ELEM_OUTPUT_INT, {0x10C}, {0x4}}, \ - {" module id", ELEM_OUTPUT_INT, {0x110}, {0x4}}, \ - {" exception id", ELEM_OUTPUT_INT, {0x114}, {0x4}}, \ - {" reset number", ELEM_OUTPUT_INT, {0x118}, {0x4}}, \ -} - -#define DATA_MODEL_HDR_RUN_INFO MODEL_VECTOR(HDR_RUN_INFO) = { \ - {"region offset", ELEM_OUTPUT_INT, {0x0}, {0x4}}, \ - {"region size", ELEM_OUTPUT_INT, {0x4}, {0x4}}, \ - {"NL", ELEM_OUTPUT_NL, {0x0}, {0x0}}, \ - {"region config", ELEM_OUTPUT_DIVIDE, {0x0}, {0x2D}}, \ - {"total area", ELEM_OUTPUT_INT, {0x8}, {0x4}}, \ - {"history area", ELEM_OUTPUT_INT, {0xC}, {0x4}}, \ - {"error area", ELEM_OUTPUT_INT, {0x10}, {0x4}}, \ - {"area config:", ELEM_OUTPUT_STR_CONST, {0x0}, {0x0}}, \ - {" used module count", ELEM_OUTPUT_INT, {0x14}, {0x4}}, \ - {"NL", ELEM_OUTPUT_NL, {0x0}, {0x0}}, \ - {"module config:", ELEM_OUTPUT_STR_CONST, {0x0}, {0x0}}, \ - {" module 0 offset", ELEM_OUTPUT_INT, {0x1C}, {0x4}}, \ - {" module 0 size", ELEM_OUTPUT_INT, {0x20}, {0x4}}, \ - {"NL", ELEM_OUTPUT_NL, {0x0}, {0x0}}, \ - {" module 1 offset", ELEM_OUTPUT_INT, {0x24}, {0x4}}, \ - {" module 1 size", ELEM_OUTPUT_INT, {0x28}, {0x4}}, \ - {"NL", ELEM_OUTPUT_NL, {0x0}, {0x0}}, \ - {" module 2 offset", ELEM_OUTPUT_INT, {0x2C}, {0x4}}, \ - {" module 2 size", ELEM_OUTPUT_INT, {0x30}, {0x4}}, \ - {"NL", ELEM_OUTPUT_NL, {0x0}, {0x0}}, \ - {" module 3 offset", ELEM_OUTPUT_INT, {0x34}, {0x4}}, \ - {" module 3 size", ELEM_OUTPUT_INT, {0x38}, {0x4}}, \ - {"NL", ELEM_OUTPUT_NL, {0x0}, {0x0}}, \ - {"region control", ELEM_OUTPUT_DIVIDE, {0x0}, {0x2D}}, \ - {"area index", ELEM_OUTPUT_INT, {0x6C}, {0x4}}, \ - {"error area count", ELEM_OUTPUT_INT, {0x70}, {0x4}}, \ - {"NL", ELEM_OUTPUT_NL, {0x0}, {0x0}}, \ - {"[area 0 control info]", ELEM_OUTPUT_STR_CONST, {0x0}, {0x0}}, \ - {" flag", ELEM_OUTPUT_INT, {0x74}, {0x4}}, \ - {" tag", ELEM_OUTPUT_INT, {0x78}, {0x4}}, \ - {" exception type", ELEM_OUTPUT_INT, {0x7C}, {0x4}}, \ - {" reset number", ELEM_OUTPUT_INT, {0x88}, {0x4}}, \ - {"NL", ELEM_OUTPUT_NL, {0x0}, {0x0}}, \ - {"[area 1 control info]", ELEM_OUTPUT_STR_CONST, {0x0}, {0x0}}, \ - {" flag", ELEM_OUTPUT_INT, {0x8C}, {0x4}}, \ - {" tag", ELEM_OUTPUT_INT, {0x90}, {0x4}}, \ - {" exception type", ELEM_OUTPUT_INT, {0x94}, {0x4}}, \ - {" reset number", ELEM_OUTPUT_INT, {0xA0}, {0x4}}, \ - {"NL", ELEM_OUTPUT_NL, {0x0}, {0x0}}, \ - {"[area 2 control info]", ELEM_OUTPUT_STR_CONST, {0x0}, {0x0}}, \ - {" flag", ELEM_OUTPUT_INT, {0xA4}, {0x4}}, \ - {" tag", ELEM_OUTPUT_INT, {0xA8}, {0x4}}, \ - {" exception type", ELEM_OUTPUT_INT, {0xAC}, {0x4}}, \ - {" reset number", ELEM_OUTPUT_INT, {0xB8}, {0x4}}, \ - {"NL", ELEM_OUTPUT_NL, {0x0}, {0x0}}, \ - {"[area 3 control info]", ELEM_OUTPUT_STR_CONST, {0x0}, {0x0}}, \ - {" flag", ELEM_OUTPUT_INT, {0xBC}, {0x4}}, \ - {" tag", ELEM_OUTPUT_INT, {0xC0}, {0x4}}, \ - {" exception type", ELEM_OUTPUT_INT, {0xC4}, {0x4}}, \ - {" reset number", ELEM_OUTPUT_INT, {0xD0}, {0x4}}, \ - {"NL", ELEM_OUTPUT_NL, {0x0}, {0x0}}, \ - {"[area 4 control info]", ELEM_OUTPUT_STR_CONST, {0x0}, {0x0}}, \ - {" flag", ELEM_OUTPUT_INT, {0xD4}, {0x4}}, \ - {" tag", ELEM_OUTPUT_INT, {0xD8}, {0x4}}, \ - {" exception type", ELEM_OUTPUT_INT, {0xDC}, {0x4}}, \ - {" reset number", ELEM_OUTPUT_INT, {0xE8}, {0x4}}, \ - {"NL", ELEM_OUTPUT_NL, {0x0}, {0x0}}, \ - {"[area 5 control info]", ELEM_OUTPUT_STR_CONST, {0x0}, {0x0}}, \ - {" flag", ELEM_OUTPUT_INT, {0xEC}, {0x4}}, \ - {" tag", ELEM_OUTPUT_INT, {0xF0}, {0x4}}, \ - {" exception type", ELEM_OUTPUT_INT, {0xF4}, {0x4}}, \ - {" reset number", ELEM_OUTPUT_INT, {0x100}, {0x4}}, \ - {"NL", ELEM_OUTPUT_NL, {0x0}, {0x0}}, \ - {"[area 6 control info]", ELEM_OUTPUT_STR_CONST, {0x0}, {0x0}}, \ - {" flag", ELEM_OUTPUT_INT, {0x104}, {0x4}}, \ - {" tag", ELEM_OUTPUT_INT, {0x108}, {0x4}}, \ - {" exception type", ELEM_OUTPUT_INT, {0x10C}, {0x4}}, \ - {" reset number", ELEM_OUTPUT_INT, {0x118}, {0x4}}, \ -} - -#define DATA_MODEL_HDR MODEL_VECTOR(HDR) = { \ - {"head info", ELEM_OUTPUT_DIVIDE, {0x0}, {0x3D}}, \ - {"magic", ELEM_OUTPUT_INT, {0x0}, {0x4}}, \ - {"version", ELEM_OUTPUT_INT, {0x4}, {0x4}}, \ - {"reset count", ELEM_OUTPUT_INT, {0x8}, {0x4}}, \ - {"NL", ELEM_OUTPUT_NL, {0x0}, {0x0}}, \ - {"boot region", ELEM_OUTPUT_DIVIDE, {0x0}, {0x3D}}, \ - {"HDR_BOOT_INFO", ELEM_CTRL_TABLE_GOTO, {0XC}, {0x168}}, \ - {"table_index", ELEM_CTRL_TABLE_RANGE, {PLAINTEXT_TABLE_HDR_BOOT_INFO}, {0x1}}, \ - {"NL", ELEM_OUTPUT_NL, {0x0}, {0x0}}, \ - {"HDR_BOOT", ELEM_CTRL_TABLE_GOTO, {0x400}, {0xA000}}, \ - {"table_index", ELEM_CTRL_TABLE_RANGE, {PLAINTEXT_TABLE_HDR_BOOT}, {0x1}}, \ - {"NL", ELEM_OUTPUT_NL, {0x0}, {0x0}}, \ - {"run region", ELEM_OUTPUT_DIVIDE, {0x0}, {0x3D}}, \ - {"HDR_RUN_INFO", ELEM_CTRL_TABLE_GOTO, {0x170}, {0x164}}, \ - {"table_index", ELEM_CTRL_TABLE_RANGE, {PLAINTEXT_TABLE_HDR_RUN_INFO}, {0x1}}, \ - {"NL", ELEM_OUTPUT_NL, {0x0}, {0x0}}, \ - {"HDR_RUN", ELEM_CTRL_TABLE_GOTO, {0x4B400}, {0xA000}}, \ - {"table_index", ELEM_CTRL_TABLE_RANGE, {PLAINTEXT_TABLE_HDR_RUN}, {0x1}}, \ -} - -#endif // BBOX_DDR_DATA_MINI_H diff --git a/inc/toolchain/bbox/bbox_proxy.h b/inc/toolchain/bbox/bbox_proxy.h deleted file mode 100644 index 5b88b64fb..000000000 --- a/inc/toolchain/bbox/bbox_proxy.h +++ /dev/null @@ -1,57 +0,0 @@ -/** - * Copyright 2019-2020 Huawei Technologies Co., Ltd - * - * 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 BBOX_PROXY_H -#define BBOX_PROXY_H - -#include "bbox_proxy_config.h" - -typedef struct proxy_excep_time_t { - unsigned long long tv_sec; - unsigned long long tv_usec; -} proxy_excep_time; - -enum BBOX_PROXY_DUMP_STATUS { - PROXY_STATUS_INIT = 0, - PROXY_STATUS_DOING = 1, - PROXY_STATUS_DONE = 2, -}; - -struct bbox_proxy_exception_ctrl { - proxy_excep_time e_clock; // 模块触发异常时间 - unsigned int e_main_excepid; // 模块触发的异常id - unsigned int e_sub_excepid; // 模块触发的异常id - unsigned int e_info_offset; // 模块全部异常信息偏移值,基于模块预留内存首地址,从magic开始 - unsigned int e_info_len; // 模块全部异常信息长度 - unsigned short e_dump_status; // 模块将异常信息存预留内存的控制状态 - unsigned short e_save_status; // 代理将异常信息从预留内存导出的控制状态 - unsigned int e_reserved; // 结构对齐预留 -}; - -// 通过共享内存交互 -#define BBOX_PROXY_MAGIC 0x56312e31 -#define BBOX_PROXY_CTRL_RESERV 192 - -struct bbox_proxy_module_ctrl { - unsigned int magic; // 使用宏BBOX_PROXY_MAGIC - struct bbox_proxy_ctrl_info config; // ctrl块配置 - struct bbox_proxy_exception_ctrl block[BBOX_PROXY_CTRL_NUM]; // 模块dump信息控制状态 - unsigned char reserved[BBOX_PROXY_CTRL_RESERV]; // 预留空间,用于后续扩展 -}; - -#define BBOX_PROXY_CTRL_BLOCK_SIZE sizeof(struct bbox_proxy_module_ctrl) // total 512 byte - -#endif // BBOX_PROXY_H diff --git a/inc/toolchain/bbox/bbox_proxy_config.h b/inc/toolchain/bbox/bbox_proxy_config.h deleted file mode 100644 index a9d66c3c3..000000000 --- a/inc/toolchain/bbox/bbox_proxy_config.h +++ /dev/null @@ -1,95 +0,0 @@ -/** - * Copyright 2019-2020 Huawei Technologies Co., Ltd - * - * 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 BBOX_PROXY_CONFIG_H -#define BBOX_PROXY_CONFIG_H - -#define BBOX_EXCEPTIONDESC_MAXLEN 48 - -struct bbox_proxy_exception_info { - unsigned int e_excepid; // 异常id - unsigned char e_process_priority; // 异常处理级别 - unsigned char e_reboot_priority; // 异常重启级别 - unsigned char e_excep_type; // 异常类型 - unsigned char e_reentrant; // 异常是否可重入 - unsigned long long e_notify_core_mask; // 异常联动掩码 - unsigned long long e_reset_core_mask; // 异常联动掩码 - unsigned char e_desc[BBOX_EXCEPTIONDESC_MAXLEN]; // 异常描述 -}; - -enum BBOX_PROXY_CAPACITY { - BBOX_PROXY_CAPACITY_REGISTER = 1 << 0, - BBOX_PROXY_CAPACITY_DUMP_DDR = 1 << 1, - BBOX_PROXY_CAPACITY_DUMP_LOG = 1 << 2, - BBOX_PROXY_CAPACITY_TRANS_ID = 1 << 3, -}; - -struct bbox_proxy_module_info { - unsigned char coreid; // 模块id - unsigned long long flag; // dump能力标记位,BBOX_PROXY_CAPACITY - const char *name; // 模块名 - unsigned long long log_addr; // 模块dump起始地址 - unsigned int log_len; // 模块dump长度 - unsigned int wait_timeout; // dump等待超时时间,单位ms - unsigned int e_count; // 异常信息注册数量 -}; - -enum BBOX_PROXY_BLOCK_TYPE { - BLOCK_TYPE_NORMAL = 1 << 0, // 普通数据 - BLOCK_TYPE_STARTUP = 1 << 1, // 启动异常数据 -}; - -enum BBOX_PROXY_CHECK_FLAG { - CHECK_NONE = 0, - CHECK_STARTUP_EXCEPID = 1 << 0, - CHECK_STARTUP_TMSTMP = 1 << 1, - CHECK_RUNTIME_EXCEPID = 1 << 2, - CHECK_RUNTIME_TMSTMP = 1 << 3, - CHECK_HEARTBEAT_EXCEPID = 1 << 4, - CHECK_HEARTBEAT_TMSTMP = 1 << 5, -}; - -struct bbox_proxy_block_info { - unsigned int ctrl_type : 16; - unsigned int ctrl_flag : 16; - unsigned int info_offset; - unsigned int info_block_len; -}; - -#define BBOX_PROXY_CTRL_NUM 6 -#define BBOX_PROXY_CTRL_PAD 3 - -struct bbox_proxy_ctrl_info { - unsigned char e_block_num; // 需要使用的控制块个数,最多BBOX_PROXY_CTRL_NUM - unsigned char padding[BBOX_PROXY_CTRL_PAD]; // padding - struct bbox_proxy_block_info block_info[BBOX_PROXY_CTRL_NUM]; // 控制块配置 -}; - -#define BBOX_PROXY_EXCEPTION_NUM 256 - -struct bbox_proxy_info { - struct bbox_proxy_module_info module; - struct bbox_proxy_exception_info exception[BBOX_PROXY_EXCEPTION_NUM]; - struct bbox_proxy_ctrl_info ctrl; -}; - -#define BBOX_PROXY_INITIALIZER(name) { \ - .module = BBOX_PROXY_MODULE_##name, \ - .exception = BBOX_PROXY_EXCEPTION_##name, \ - .ctrl = BBOX_PROXY_CTRL_##name, \ -} - -#endif // BBOX_PROXY_CONFIG_H diff --git a/inc/toolchain/bbox/bbox_proxy_config_dc.h b/inc/toolchain/bbox/bbox_proxy_config_dc.h deleted file mode 100644 index 3cce48cbf..000000000 --- a/inc/toolchain/bbox/bbox_proxy_config_dc.h +++ /dev/null @@ -1,268 +0,0 @@ -/** - * Copyright 2019-2020 Huawei Technologies Co., Ltd - * - * 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 BBOX_PROXY_CONFIG_DC -#define BBOX_PROXY_CONFIG_DC - -#include "bbox_proxy_config.h" -#include "device/bbox_pub.h" - -/* - * 说明:模块代理及异常注册 - * 各模块通过模板宏初始化 struct bbox_proxy_info 结构体,黑匣子引用该头文件并将初始化结构体实例化 - * - * 示例: - * 各模块通过BBOX_PROXY_MODULE_XXX宏定义初始化 struct bbox_proxy_module_info 结构体 - * #define BBOX_PROXY_MODULE_LPM { \ - * .coreid = BBOX_LPM, \ - * .flag = BBOX_PROXY_CAPACITY_REGISTER | BBOX_PROXY_CAPACITY_DUMP | BBOX_PROXY_CAPACITY_LOG, \ - * .name = "lpm", \ - * .log_addr = 0xA00000, \ - * .log_len = 0x400000, \ - * .wait_timeout = 20000, \ // wait timeout will be restricted <= 20s - * .e_count = 3, \ - * } - * 各模块通过BBOX_PROXY_EXCEPTION_XXX宏定义初始化 struct bbox_proxy_exception_info 结构体 - * #define BBOX_PROXY_EXCEPTION_LPM { \ - * {0xA819320F, BBOX_DEAD, BBOX_REBOOT_WAIT, LPM_EXCEPTION, BBOX_REENTRANT_DISALLOW, - * BBOX_COREID_MASK(BBOX_LPM), BBOX_COREID_MASK(BBOX_LPM), "tsensor error"}, \ - * {0xA619FFFF, BBOX_ERR, BBOX_REBOOT_WAIT, LPM_EXCEPTION, BBOX_REENTRANT_DISALLOW, - * BBOX_COREID_MASK(BBOX_LPM), BBOX_COREID_MASK(BBOX_LPM), "lpm heartbeat lost"}, \ - * {0xA819FFFF, BBOX_DEAD, BBOX_REBOOT_WAIT, LPM_EXCEPTION, BBOX_REENTRANT_DISALLOW, - * BBOX_COREID_MASK(BBOX_LPM), BBOX_COREID_MASK(BBOX_LPM), "lpm startup error"}, \ - * } - * 各模块通过BBOX_PROXY_CTRL_XXX宏定义初始化 struct bbox_proxy_ctrl_info 结构体 - * #define BBOX_PROXY_CTRL_LPM { \ - * .e_block_num = 2, \ - * .block_info = { \ - * {BLOCK_TYPE_STARTUP, CHECK_NONE, 0, 0x200000}, \ - * {BLOCK_TYPE_NORMAL, CHECK_RUNTIME_EXCEPID | CHECK_RUNTIME_TMSTMP | CHECK_HEARTBEAT_EXCEPID, \ - * 0x200000, 0x200000}, \ - * } \ - * } - * 各模块通过修改DEFINE_BBOX_PROXY(x)宏定义增加自身模块在黑匣子代码中实例化 struct bbox_proxy_info 结构体 - * #define BBOX_PROXY_INITIALIZER(name) { \ - * .module = BBOX_PROXY_MODULE_##name, \ - * .exception = BBOX_PROXY_EXCEPTION_##name, \ - * .ctrl = BBOX_PROXY_CTRL_##name, \ - * } - * DEFINE_BBOX_PROXY(x) struct bbox_proxy_info x[] = { \ - * BBOX_PROXY_INITIALIZER(TS), \ - * BBOX_PROXY_INITIALIZER(LPM), \ - * } - */ -#define BBOX_PROXY_MODULE_TS { \ - .coreid = BBOX_TS, \ - .flag = BBOX_PROXY_CAPACITY_REGISTER | BBOX_PROXY_CAPACITY_DUMP_DDR | BBOX_PROXY_CAPACITY_TRANS_ID, \ - .name = "ts", \ - .log_addr = 0, \ - .log_len = 0, \ - .wait_timeout = 10000, \ - .e_count = 21, \ -} - -#define BBOX_PROXY_EXCEPTION_TS { \ - {0xA6060FFF, BBOX_MAJOR, BBOX_REBOOT_WAIT, HEARTBEAT_EXCEPTION, BBOX_REENTRANT_DISALLOW, \ - BBOX_COREID_MASK(BBOX_TS), BBOX_COREID_MASK(BBOX_TS), "ts heartbeat lost"}, \ - {0xA8060FFF, BBOX_CRITICAL, BBOX_REBOOT_WAIT, STARTUP_EXCEPTION, BBOX_REENTRANT_DISALLOW, \ - BBOX_COREID_MASK(BBOX_TS), BBOX_COREID_MASK(BBOX_TS), "ts startup error"}, \ - {0xA6060000, BBOX_MAJOR, BBOX_REBOOT_WAIT, TS_EXCEPTION, BBOX_REENTRANT_DISALLOW, \ - BBOX_COREID_MASK(BBOX_TS), BBOX_COREID_MASK(BBOX_TS), "data abort"}, \ - {0xA6060001, BBOX_MAJOR, BBOX_REBOOT_WAIT, TS_EXCEPTION, BBOX_REENTRANT_DISALLOW, \ - BBOX_COREID_MASK(BBOX_TS), BBOX_COREID_MASK(BBOX_TS), "instr abort"}, \ - {0xA6060002, BBOX_MAJOR, BBOX_REBOOT_WAIT, TS_EXCEPTION, BBOX_REENTRANT_DISALLOW, \ - BBOX_COREID_MASK(BBOX_TS), BBOX_COREID_MASK(BBOX_TS), "pc align fault"}, \ - {0xA6060003, BBOX_MAJOR, BBOX_REBOOT_WAIT, TS_EXCEPTION, BBOX_REENTRANT_DISALLOW, \ - BBOX_COREID_MASK(BBOX_TS), BBOX_COREID_MASK(BBOX_TS), "sp align fault"}, \ - {0xA6060004, BBOX_MAJOR, BBOX_REBOOT_WAIT, TS_EXCEPTION, BBOX_REENTRANT_DISALLOW, \ - BBOX_COREID_MASK(BBOX_TS), BBOX_COREID_MASK(BBOX_TS), "infinite loop"}, \ - {0xA6060005, BBOX_MAJOR, BBOX_REBOOT_WAIT, TS_EXCEPTION, BBOX_REENTRANT_DISALLOW, \ - BBOX_COREID_MASK(BBOX_TS), BBOX_COREID_MASK(BBOX_TS), "unknow exception"}, \ - {0xB4060006, BBOX_MINOR, BBOX_REBOOT_NO, TS_EXCEPTION, BBOX_REENTRANT_DISALLOW, \ - BBOX_COREID_MASK(BBOX_TS), BBOX_COREID_MASK(BBOX_TS), "aicore exception"}, \ - {0xB4060007, BBOX_MINOR, BBOX_REBOOT_NO, TS_EXCEPTION, BBOX_REENTRANT_DISALLOW, \ - BBOX_COREID_MASK(BBOX_TS), BBOX_COREID_MASK(BBOX_TS), "aicore timeout"}, \ - {0xB6060008, BBOX_MAJOR, BBOX_REBOOT_NO, TS_EXCEPTION, BBOX_REENTRANT_DISALLOW, \ - BBOX_COREID_MASK(BBOX_TS), BBOX_COREID_MASK(BBOX_TS), "sdma init fault"}, \ - {0xB4060009, BBOX_MINOR, BBOX_REBOOT_NO, TS_EXCEPTION, BBOX_REENTRANT_DISALLOW, \ - BBOX_COREID_MASK(BBOX_TS), BBOX_COREID_MASK(BBOX_TS), "sdma timeout"}, \ - {0xA606000A, BBOX_MAJOR, BBOX_REBOOT_WAIT, TS_EXCEPTION, BBOX_REENTRANT_DISALLOW, \ - BBOX_COREID_MASK(BBOX_TS), BBOX_COREID_MASK(BBOX_TS), "hwts bus error"}, \ - {0xA606000B, BBOX_MAJOR, BBOX_REBOOT_WAIT, TS_EXCEPTION, BBOX_REENTRANT_DISALLOW, \ - BBOX_COREID_MASK(BBOX_TS), BBOX_COREID_MASK(BBOX_TS), "hwts sqe error"}, \ - {0xA606000C, BBOX_MAJOR, BBOX_REBOOT_WAIT, TS_EXCEPTION, BBOX_REENTRANT_DISALLOW, \ - BBOX_COREID_MASK(BBOX_TS), BBOX_COREID_MASK(BBOX_TS), "hwts ecc error"}, \ - {0xA406000D, BBOX_MINOR, BBOX_REBOOT_WAIT, TS_EXCEPTION, BBOX_REENTRANT_DISALLOW, \ - BBOX_COREID_MASK(BBOX_TS), BBOX_COREID_MASK(BBOX_TS), "ts aicpu exception"}, \ - {0xA406000E, BBOX_MINOR, BBOX_REBOOT_WAIT, TS_EXCEPTION, BBOX_REENTRANT_DISALLOW, \ - BBOX_COREID_MASK(BBOX_TS), BBOX_COREID_MASK(BBOX_TS), "ts npu exception"}, \ - {0xA606000F, BBOX_MAJOR, BBOX_REBOOT_WAIT, TS_EXCEPTION, BBOX_REENTRANT_DISALLOW, \ - BBOX_COREID_MASK(BBOX_TS), BBOX_COREID_MASK(BBOX_TS), "aicore reset timeout"}, \ - {0xA4060010, BBOX_MINOR, BBOX_REBOOT_WAIT, TS_EXCEPTION, BBOX_REENTRANT_DISALLOW, \ - BBOX_COREID_MASK(BBOX_TS), BBOX_COREID_MASK(BBOX_TS), "ts aiv exception"}, \ - {0xA4060011, BBOX_MINOR, BBOX_REBOOT_WAIT, TS_EXCEPTION, BBOX_REENTRANT_DISALLOW, \ - BBOX_COREID_MASK(BBOX_TS), BBOX_COREID_MASK(BBOX_TS), "ts aiv timeout"}, \ - {0xA4060014, BBOX_MINOR, BBOX_REBOOT_WAIT, TS_EXCEPTION, BBOX_REENTRANT_DISALLOW, \ - BBOX_COREID_MASK(BBOX_TS), BBOX_COREID_MASK(BBOX_TS), "ts aicpu timeout"}, \ -} - -#define BBOX_PROXY_CTRL_TS { \ - .e_block_num = 2, \ - .padding = {0}, \ - .block_info = { \ - {BLOCK_TYPE_STARTUP, CHECK_NONE, \ - 0x200, 0x19000}, \ - {BLOCK_TYPE_NORMAL, CHECK_RUNTIME_EXCEPID | CHECK_RUNTIME_TMSTMP | CHECK_HEARTBEAT_EXCEPID, \ - 0x19200, 0x1E6E00}, \ - } \ -} - -#define BBOX_PROXY_MODULE_LPM { \ - .coreid = BBOX_LPM, \ - .flag = BBOX_PROXY_CAPACITY_REGISTER | BBOX_PROXY_CAPACITY_DUMP_DDR | BBOX_PROXY_CAPACITY_DUMP_LOG, \ - .name = "lpm", \ - .log_addr = 0xA00000, \ - .log_len = 0x20000, \ - .wait_timeout = 10000, \ - .e_count = 24, \ -} - -#define BBOX_PROXY_EXCEPTION_LPM { \ - {0xa819320f, BBOX_CRITICAL, BBOX_REBOOT_NO, LPM_EXCEPTION, BBOX_REENTRANT_ALLOW, \ - BBOX_COREID_MASK(BBOX_LPM), BBOX_COREID_MASK(BBOX_LPM), "tsensor error"}, \ - {0xa6192d15, BBOX_MAJOR, BBOX_REBOOT_WAIT, HEARTBEAT_EXCEPTION, BBOX_REENTRANT_DISALLOW, \ - BBOX_COREID_MASK(BBOX_LPM), BBOX_COREID_MASK(BBOX_LPM), "lpm heart error"}, \ - {0xa6193206, BBOX_MAJOR, BBOX_REBOOT_WAIT, LPM_EXCEPTION, BBOX_REENTRANT_ALLOW, \ - BBOX_COREID_MASK(BBOX_LPM), BBOX_COREID_MASK(BBOX_LPM), "headfault error"}, \ - {0xa4193216, BBOX_MINOR, BBOX_REBOOT_NO, LPM_EXCEPTION, BBOX_REENTRANT_DISALLOW, \ - BBOX_COREID_MASK(BBOX_LPM), BBOX_COREID_MASK(BBOX_LPM), "edp error"}, \ - {0xa4193217, BBOX_MINOR, BBOX_REBOOT_WAIT, LPM_EXCEPTION, BBOX_REENTRANT_DISALLOW, \ - BBOX_COREID_MASK(BBOX_LPM), BBOX_COREID_MASK(BBOX_LPM), "ipc timeout error"}, \ - {0xa4193218, BBOX_MINOR, BBOX_REBOOT_WAIT, LPM_EXCEPTION, BBOX_REENTRANT_DISALLOW, \ - BBOX_COREID_MASK(BBOX_LPM), BBOX_COREID_MASK(BBOX_LPM), "ipc queue error"}, \ - {0xa6193215, BBOX_MAJOR, BBOX_REBOOT_WAIT, LPM_EXCEPTION, BBOX_REENTRANT_DISALLOW, \ - BBOX_COREID_MASK(BBOX_LPM), BBOX_COREID_MASK(BBOX_LPM), "os heart error"}, \ - {0xa8193234,BBOX_CRITICAL, BBOX_REBOOT_WAIT, LPM_EXCEPTION, BBOX_REENTRANT_DISALLOW, \ - BBOX_COREID_MASK(BBOX_LPM), BBOX_COREID_MASK(BBOX_LPM), "ddr tmon low error"}, \ - {0xa8193235, BBOX_CRITICAL, BBOX_REBOOT_WAIT, LPM_EXCEPTION, BBOX_REENTRANT_DISALLOW, \ - BBOX_COREID_MASK(BBOX_LPM), BBOX_COREID_MASK(BBOX_LPM), "ddr tmon high error"}, \ - {0xa6193236, BBOX_MAJOR, BBOX_REBOOT_WAIT, LPM_EXCEPTION, BBOX_REENTRANT_DISALLOW, \ - BBOX_COREID_MASK(BBOX_LPM), BBOX_COREID_MASK(BBOX_LPM), "ddr gate error"}, \ - {0xa619323f, BBOX_MAJOR, BBOX_REBOOT_WAIT, LPM_EXCEPTION, BBOX_REENTRANT_DISALLOW, \ - BBOX_COREID_MASK(BBOX_LPM), BBOX_COREID_MASK(BBOX_LPM), "ddr aref error"}, \ - {0xa6193240, BBOX_MAJOR, BBOX_REBOOT_WAIT, LPM_EXCEPTION, BBOX_REENTRANT_DISALLOW, \ - BBOX_COREID_MASK(BBOX_LPM), BBOX_COREID_MASK(BBOX_LPM), "ddr rdtimeout error"}, \ - {0xa6193241, BBOX_MAJOR, BBOX_REBOOT_WAIT, LPM_EXCEPTION, BBOX_REENTRANT_DISALLOW, \ - BBOX_COREID_MASK(BBOX_LPM), BBOX_COREID_MASK(BBOX_LPM), "ddr pll unlock error"}, \ - {0xa6193242, BBOX_MAJOR, BBOX_REBOOT_WAIT, LPM_EXCEPTION, BBOX_REENTRANT_DISALLOW, \ - BBOX_COREID_MASK(BBOX_LPM), BBOX_COREID_MASK(BBOX_LPM), "ddr retrain error"}, \ - {0xa6193243, BBOX_MAJOR, BBOX_REBOOT_WAIT, LPM_EXCEPTION, BBOX_REENTRANT_DISALLOW, \ - BBOX_COREID_MASK(BBOX_LPM), BBOX_COREID_MASK(BBOX_LPM), "ddr tmon error"}, \ - {0xa6193244, BBOX_MAJOR, BBOX_REBOOT_WAIT, LPM_EXCEPTION, BBOX_REENTRANT_DISALLOW, \ - BBOX_COREID_MASK(BBOX_LPM), BBOX_COREID_MASK(BBOX_LPM), "ddr dfs error"}, \ - {0xa6193245, BBOX_MAJOR, BBOX_REBOOT_WAIT, LPM_EXCEPTION, BBOX_REENTRANT_DISALLOW, \ - BBOX_COREID_MASK(BBOX_LPM), BBOX_COREID_MASK(BBOX_LPM), "ddr dvalid error"}, \ - {0xa6193246, BBOX_MAJOR, BBOX_REBOOT_WAIT, LPM_EXCEPTION, BBOX_REENTRANT_DISALLOW, \ - BBOX_COREID_MASK(BBOX_LPM), BBOX_COREID_MASK(BBOX_LPM), "ddr dfi sel error"}, \ - {0xa6193247, BBOX_MAJOR, BBOX_REBOOT_WAIT, LPM_EXCEPTION, BBOX_REENTRANT_DISALLOW, \ - BBOX_COREID_MASK(BBOX_LPM), BBOX_COREID_MASK(BBOX_LPM), "ddr pll unlock lp error"}, \ - {0xa6193248, BBOX_MAJOR, BBOX_REBOOT_NO, LPM_EXCEPTION, BBOX_REENTRANT_ALLOW, \ - BBOX_COREID_MASK(BBOX_LPM), BBOX_COREID_MASK(BBOX_LPM), "ddr iecc uerr error"}, \ - {0xa419324a, BBOX_MAJOR, BBOX_REBOOT_WAIT, LPM_EXCEPTION, BBOX_REENTRANT_DISALLOW, \ - BBOX_COREID_MASK(BBOX_LPM), BBOX_COREID_MASK(BBOX_LPM), "ddr unkonwn error"}, \ - {0xa4193250, BBOX_MINOR, BBOX_REBOOT_NO, LPM_EXCEPTION, BBOX_REENTRANT_ALLOW, \ - BBOX_COREID_MASK(BBOX_LPM), BBOX_COREID_MASK(BBOX_LPM), "ddr iecc cerr error"}, \ - {0xa4192c1a, BBOX_MINOR, BBOX_REBOOT_WAIT, STARTUP_EXCEPTION, BBOX_REENTRANT_ALLOW, \ - BBOX_COREID_MASK(BBOX_LPM), BBOX_COREID_MASK(BBOX_LPM), "lp startup error"}, \ - {0xa419321b, BBOX_MINOR, BBOX_REBOOT_NO, LPM_EXCEPTION, BBOX_REENTRANT_DISALLOW, \ - BBOX_COREID_MASK(BBOX_LPM), BBOX_COREID_MASK(BBOX_LPM), "lp tmonitor error"}, \ -} - -#define BBOX_PROXY_CTRL_LPM { \ - .e_block_num = 6, \ - .padding = {0}, \ - .block_info = { \ - {BLOCK_TYPE_STARTUP, CHECK_NONE, 0x0400, 0x12C00}, \ - {BLOCK_TYPE_NORMAL, CHECK_RUNTIME_EXCEPID | CHECK_RUNTIME_TMSTMP | CHECK_HEARTBEAT_EXCEPID, 0x13000, 0x19000}, \ - {BLOCK_TYPE_NORMAL, CHECK_RUNTIME_EXCEPID | CHECK_RUNTIME_TMSTMP | CHECK_HEARTBEAT_EXCEPID, 0x2C000, 0x19000}, \ - {BLOCK_TYPE_NORMAL, CHECK_RUNTIME_EXCEPID | CHECK_RUNTIME_TMSTMP | CHECK_HEARTBEAT_EXCEPID, 0x45000, 0x19000}, \ - {BLOCK_TYPE_NORMAL, CHECK_RUNTIME_EXCEPID | CHECK_RUNTIME_TMSTMP | CHECK_HEARTBEAT_EXCEPID, 0x5E000, 0x19000}, \ - {BLOCK_TYPE_NORMAL, CHECK_RUNTIME_EXCEPID | CHECK_RUNTIME_TMSTMP | CHECK_HEARTBEAT_EXCEPID, 0x77000, 0x19000}, \ - } \ -} - -#define BBOX_PROXY_MODULE_HSM { \ - .coreid = BBOX_HSM, \ - .flag = BBOX_PROXY_CAPACITY_REGISTER | BBOX_PROXY_CAPACITY_DUMP_DDR | BBOX_PROXY_CAPACITY_DUMP_LOG, \ - .name = "hsm", \ - .log_addr = 0x3E00000, \ - .log_len = 0x100000, \ - .wait_timeout = 10000, \ - .e_count = 3, \ -} - -#define BBOX_PROXY_EXCEPTION_HSM { \ - {0xa6360000, BBOX_MAJOR, BBOX_REBOOT_WAIT, STARTUP_EXCEPTION, BBOX_REENTRANT_DISALLOW, \ - BBOX_COREID_MASK(BBOX_HSM), BBOX_COREID_MASK(BBOX_HSM), "HSM startup exception"}, \ - {0xa6361000, BBOX_MAJOR, BBOX_REBOOT_WAIT, HEARTBEAT_EXCEPTION, BBOX_REENTRANT_DISALLOW, \ - BBOX_COREID_MASK(BBOX_HSM), BBOX_COREID_MASK(BBOX_HSM), "HSM heartbeat exception"}, \ - {0xa6362000, BBOX_MAJOR, BBOX_REBOOT_NO, HSM_EXCEPTION, BBOX_REENTRANT_ALLOW, \ - BBOX_COREID_MASK(BBOX_HSM), BBOX_COREID_MASK(BBOX_HSM), "HSM resource shortage exception"}, \ -} - -#define BBOX_PROXY_CTRL_HSM { \ - .e_block_num = 5, \ - .padding = {0}, \ - .block_info = { \ - {BLOCK_TYPE_STARTUP, CHECK_NONE, 0x200, 0x1000}, \ - {BLOCK_TYPE_NORMAL, CHECK_RUNTIME_EXCEPID | CHECK_RUNTIME_TMSTMP | CHECK_HEARTBEAT_EXCEPID, 0x1200, 0x1000}, \ - {BLOCK_TYPE_NORMAL, CHECK_RUNTIME_EXCEPID | CHECK_RUNTIME_TMSTMP | CHECK_HEARTBEAT_EXCEPID, 0x2200, 0x1000}, \ - {BLOCK_TYPE_NORMAL, CHECK_RUNTIME_EXCEPID | CHECK_RUNTIME_TMSTMP | CHECK_HEARTBEAT_EXCEPID, 0x3200, 0x1000}, \ - {BLOCK_TYPE_NORMAL, CHECK_RUNTIME_EXCEPID | CHECK_RUNTIME_TMSTMP | CHECK_HEARTBEAT_EXCEPID, 0x4200, 0x1000}, \ - } \ -} - -#define BBOX_PROXY_MODULE_ATF { \ - .coreid = BBOX_TF, \ - .flag = BBOX_PROXY_CAPACITY_REGISTER, \ - .name = "atf", \ - .log_addr = 0x0, \ - .log_len = 0x0, \ - .wait_timeout = 10000, \ - .e_count = 1, \ -} - -#define BBOX_PROXY_EXCEPTION_ATF { \ - {0xA8340000, BBOX_CRITICAL, BBOX_REBOOT_WAIT, ATF_EXCEPTION, BBOX_REENTRANT_DISALLOW, \ - BBOX_COREID_MASK(BBOX_TF), BBOX_COREID_MASK(BBOX_TF), "atf panic exception"}, \ -} - -#define BBOX_PROXY_CTRL_ATF { \ - .e_block_num = 1, \ - .padding = {0}, \ - .block_info = { \ - {BLOCK_TYPE_STARTUP, CHECK_NONE, 0x400, 0xF800}, \ - } \ -} - -#define DEFINE_BBOX_PROXY(x) struct bbox_proxy_info x[] = { \ - BBOX_PROXY_INITIALIZER(TS), \ - BBOX_PROXY_INITIALIZER(LPM), \ - BBOX_PROXY_INITIALIZER(HSM), \ - BBOX_PROXY_INITIALIZER(ATF), \ -} - -#endif // BBOX_PROXY_CONFIG_DC diff --git a/inc/toolchain/bbox/bbox_proxy_config_mdc.h b/inc/toolchain/bbox/bbox_proxy_config_mdc.h deleted file mode 100644 index dad0ea813..000000000 --- a/inc/toolchain/bbox/bbox_proxy_config_mdc.h +++ /dev/null @@ -1,400 +0,0 @@ -/** - * Copyright 2019-2020 Huawei Technologies Co., Ltd - * - * 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 BBOX_PROXY_CONFIG_MDC -#define BBOX_PROXY_CONFIG_MDC - -#include "bbox_proxy_config.h" -#include "device/bbox_pub.h" - -/* - * 说明:模块代理及异常注册 - * 各模块通过模板宏初始化 struct bbox_proxy_info 结构体,黑匣子引用该头文件并将初始化结构体实例化 - * - * 示例: - * 各模块通过BBOX_PROXY_MODULE_XXX宏定义初始化 struct bbox_proxy_module_info 结构体 - * #define BBOX_PROXY_MODULE_LPM { \ - * .coreid = BBOX_LPM, \ - * .flag = BBOX_PROXY_CAPACITY_REGISTER | BBOX_PROXY_CAPACITY_DUMP | BBOX_PROXY_CAPACITY_LOG, \ - * .name = "lpm", \ - * .log_addr = 0xA00000, \ - * .log_len = 0x400000, \ - * .wait_timeout = 20000, \ // wait timeout will be restricted <= 20s - * .e_count = 3, \ - * } - * 各模块通过BBOX_PROXY_EXCEPTION_XXX宏定义初始化 struct bbox_proxy_exception_info 结构体 - * #define BBOX_PROXY_EXCEPTION_LPM { \ - * {0xA819320F, BBOX_DEAD, BBOX_REBOOT_WAIT, LPM_EXCEPTION, BBOX_REENTRANT_DISALLOW, - * BBOX_COREID_MASK(BBOX_LPM), BBOX_COREID_MASK(BBOX_LPM), "tsensor error"}, \ - * {0xA619FFFF, BBOX_ERR, BBOX_REBOOT_WAIT, LPM_EXCEPTION, BBOX_REENTRANT_DISALLOW, - * BBOX_COREID_MASK(BBOX_LPM), BBOX_COREID_MASK(BBOX_LPM), "lpm heartbeat lost"}, \ - * {0xA819FFFF, BBOX_DEAD, BBOX_REBOOT_WAIT, LPM_EXCEPTION, BBOX_REENTRANT_DISALLOW, - * BBOX_COREID_MASK(BBOX_LPM), BBOX_COREID_MASK(BBOX_LPM), "lpm startup error"}, \ - * } - * 各模块通过BBOX_PROXY_CTRL_XXX宏定义初始化 struct bbox_proxy_ctrl_info 结构体 - * #define BBOX_PROXY_CTRL_LPM { \ - * .e_block_num = 2, \ - * .block_info = { \ - * {BLOCK_TYPE_STARTUP, CHECK_NONE, 0, 0x200000}, \ - * {BLOCK_TYPE_NORMAL, CHECK_RUNTIME_EXCEPID | CHECK_RUNTIME_TMSTMP | CHECK_HEARTBEAT_EXCEPID, \ - * 0x200000, 0x200000}, \ - * } \ - * } - * 各模块通过修改DEFINE_BBOX_PROXY(x)宏定义增加自身模块在黑匣子代码中实例化 struct bbox_proxy_info 结构体 - * #define BBOX_PROXY_INITIALIZER(name) { \ - * .module = BBOX_PROXY_MODULE_##name, \ - * .exception = BBOX_PROXY_EXCEPTION_##name, \ - * .ctrl = BBOX_PROXY_CTRL_##name, \ - * } - * DEFINE_BBOX_PROXY(x) struct bbox_proxy_info x[] = { \ - * BBOX_PROXY_INITIALIZER(TS), \ - * BBOX_PROXY_INITIALIZER(LPM), \ - * } - */ -#define BBOX_PROXY_MODULE_TS { \ - .coreid = BBOX_TS, \ - .flag = BBOX_PROXY_CAPACITY_REGISTER | BBOX_PROXY_CAPACITY_DUMP_DDR | BBOX_PROXY_CAPACITY_TRANS_ID, \ - .name = "ts", \ - .log_addr = 0, \ - .log_len = 0, \ - .wait_timeout = 10000, \ - .e_count = 42, \ -} - -#define BBOX_PROXY_EXCEPTION_TS { \ - {0xA6060FFF, BBOX_MAJOR, BBOX_REBOOT_WAIT, HEARTBEAT_EXCEPTION, BBOX_REENTRANT_DISALLOW, \ - BBOX_COREID_MASK(BBOX_TS), BBOX_COREID_MASK(BBOX_TS), "ts0 heartbeat lost"}, \ - {0xA8060FFF, BBOX_CRITICAL, BBOX_REBOOT_WAIT, STARTUP_EXCEPTION, BBOX_REENTRANT_DISALLOW, \ - BBOX_COREID_MASK(BBOX_TS), BBOX_COREID_MASK(BBOX_TS), "ts0 startup error"}, \ - {0xA6060000, BBOX_MAJOR, BBOX_REBOOT_WAIT, TS_EXCEPTION, BBOX_REENTRANT_DISALLOW, \ - BBOX_COREID_MASK(BBOX_TS), BBOX_COREID_MASK(BBOX_TS), "ts0 data abort"}, \ - {0xA6060001, BBOX_MAJOR, BBOX_REBOOT_WAIT, TS_EXCEPTION, BBOX_REENTRANT_DISALLOW, \ - BBOX_COREID_MASK(BBOX_TS), BBOX_COREID_MASK(BBOX_TS), "ts0 instr abort"}, \ - {0xA6060002, BBOX_MAJOR, BBOX_REBOOT_WAIT, TS_EXCEPTION, BBOX_REENTRANT_DISALLOW, \ - BBOX_COREID_MASK(BBOX_TS), BBOX_COREID_MASK(BBOX_TS), "ts0 pc align fault"}, \ - {0xA6060003, BBOX_MAJOR, BBOX_REBOOT_WAIT, TS_EXCEPTION, BBOX_REENTRANT_DISALLOW, \ - BBOX_COREID_MASK(BBOX_TS), BBOX_COREID_MASK(BBOX_TS), "ts0 sp align fault"}, \ - {0xA6060004, BBOX_MAJOR, BBOX_REBOOT_WAIT, TS_EXCEPTION, BBOX_REENTRANT_DISALLOW, \ - BBOX_COREID_MASK(BBOX_TS), BBOX_COREID_MASK(BBOX_TS), "ts0 infinite loop"}, \ - {0xA6060005, BBOX_MAJOR, BBOX_REBOOT_WAIT, TS_EXCEPTION, BBOX_REENTRANT_DISALLOW, \ - BBOX_COREID_MASK(BBOX_TS), BBOX_COREID_MASK(BBOX_TS), "ts0 unknow exception"}, \ - {0xB4060006, BBOX_MINOR, BBOX_REBOOT_NO, TS_EXCEPTION, BBOX_REENTRANT_DISALLOW, \ - BBOX_COREID_MASK(BBOX_TS), BBOX_COREID_MASK(BBOX_TS), "ts0 aicore exception"}, \ - {0xB4060007, BBOX_MINOR, BBOX_REBOOT_NO, TS_EXCEPTION, BBOX_REENTRANT_DISALLOW, \ - BBOX_COREID_MASK(BBOX_TS), BBOX_COREID_MASK(BBOX_TS), "ts0 aicore timeout"}, \ - {0xB6060008, BBOX_MAJOR, BBOX_REBOOT_NO, TS_EXCEPTION, BBOX_REENTRANT_DISALLOW, \ - BBOX_COREID_MASK(BBOX_TS), BBOX_COREID_MASK(BBOX_TS), "ts0 sdma init fault"}, \ - {0xB4060009, BBOX_MINOR, BBOX_REBOOT_NO, TS_EXCEPTION, BBOX_REENTRANT_DISALLOW, \ - BBOX_COREID_MASK(BBOX_TS), BBOX_COREID_MASK(BBOX_TS), "ts0 sdma timeout"}, \ - {0xA606000A, BBOX_MAJOR, BBOX_REBOOT_WAIT, TS_EXCEPTION, BBOX_REENTRANT_DISALLOW, \ - BBOX_COREID_MASK(BBOX_TS), BBOX_COREID_MASK(BBOX_TS), "ts0 hwts bus error"}, \ - {0xA606000B, BBOX_MAJOR, BBOX_REBOOT_WAIT, TS_EXCEPTION, BBOX_REENTRANT_DISALLOW, \ - BBOX_COREID_MASK(BBOX_TS), BBOX_COREID_MASK(BBOX_TS), "ts0 hwts sqe error"}, \ - {0xA606000C, BBOX_MAJOR, BBOX_REBOOT_WAIT, TS_EXCEPTION, BBOX_REENTRANT_DISALLOW, \ - BBOX_COREID_MASK(BBOX_TS), BBOX_COREID_MASK(BBOX_TS), "ts0 hwts ecc error"}, \ - {0xA406000D, BBOX_MINOR, BBOX_REBOOT_WAIT, TS_EXCEPTION, BBOX_REENTRANT_DISALLOW, \ - BBOX_COREID_MASK(BBOX_TS), BBOX_COREID_MASK(BBOX_TS), "ts0 aicpu exception"}, \ - {0xA406000E, BBOX_MINOR, BBOX_REBOOT_WAIT, TS_EXCEPTION, BBOX_REENTRANT_DISALLOW, \ - BBOX_COREID_MASK(BBOX_TS), BBOX_COREID_MASK(BBOX_TS), "ts0 npu exception"}, \ - {0xA606000F, BBOX_MAJOR, BBOX_REBOOT_WAIT, TS_EXCEPTION, BBOX_REENTRANT_DISALLOW, \ - BBOX_COREID_MASK(BBOX_TS), BBOX_COREID_MASK(BBOX_TS), "ts0 aicore reset timeout"}, \ - {0xA4060010, BBOX_MINOR, BBOX_REBOOT_WAIT, TS_EXCEPTION, BBOX_REENTRANT_DISALLOW, \ - BBOX_COREID_MASK(BBOX_TS), BBOX_COREID_MASK(BBOX_TS), "ts0 aiv exception"}, \ - {0xA4060011, BBOX_MINOR, BBOX_REBOOT_WAIT, TS_EXCEPTION, BBOX_REENTRANT_DISALLOW, \ - BBOX_COREID_MASK(BBOX_TS), BBOX_COREID_MASK(BBOX_TS), "ts0 aiv timeout"}, \ - {0xA4060014, BBOX_MINOR, BBOX_REBOOT_WAIT, TS_EXCEPTION, BBOX_REENTRANT_DISALLOW, \ - BBOX_COREID_MASK(BBOX_TS), BBOX_COREID_MASK(BBOX_TS), "ts0 aicpu timeout"}, \ - {0xA6061FFF, BBOX_MAJOR, BBOX_REBOOT_WAIT, HEARTBEAT_EXCEPTION, BBOX_REENTRANT_DISALLOW, \ - BBOX_COREID_MASK(BBOX_TS), BBOX_COREID_MASK(BBOX_TS), "ts1 heartbeat lost"}, \ - {0xA8061FFF, BBOX_CRITICAL, BBOX_REBOOT_WAIT, STARTUP_EXCEPTION, BBOX_REENTRANT_DISALLOW, \ - BBOX_COREID_MASK(BBOX_TS), BBOX_COREID_MASK(BBOX_TS), "ts1 startup error"}, \ - {0xA6061000, BBOX_MAJOR, BBOX_REBOOT_WAIT, TS_EXCEPTION, BBOX_REENTRANT_DISALLOW, \ - BBOX_COREID_MASK(BBOX_TS), BBOX_COREID_MASK(BBOX_TS), "ts1 data abort"}, \ - {0xA6061001, BBOX_MAJOR, BBOX_REBOOT_WAIT, TS_EXCEPTION, BBOX_REENTRANT_DISALLOW, \ - BBOX_COREID_MASK(BBOX_TS), BBOX_COREID_MASK(BBOX_TS), "ts1 instr abort"}, \ - {0xA6061002, BBOX_MAJOR, BBOX_REBOOT_WAIT, TS_EXCEPTION, BBOX_REENTRANT_DISALLOW, \ - BBOX_COREID_MASK(BBOX_TS), BBOX_COREID_MASK(BBOX_TS), "ts1 pc align fault"}, \ - {0xA6061003, BBOX_MAJOR, BBOX_REBOOT_WAIT, TS_EXCEPTION, BBOX_REENTRANT_DISALLOW, \ - BBOX_COREID_MASK(BBOX_TS), BBOX_COREID_MASK(BBOX_TS), "ts1 sp align fault"}, \ - {0xA6061004, BBOX_MAJOR, BBOX_REBOOT_WAIT, TS_EXCEPTION, BBOX_REENTRANT_DISALLOW, \ - BBOX_COREID_MASK(BBOX_TS), BBOX_COREID_MASK(BBOX_TS), "ts1 infinite loop"}, \ - {0xA6061005, BBOX_MAJOR, BBOX_REBOOT_WAIT, TS_EXCEPTION, BBOX_REENTRANT_DISALLOW, \ - BBOX_COREID_MASK(BBOX_TS), BBOX_COREID_MASK(BBOX_TS), "ts1 unknow exception"}, \ - {0xB4061006, BBOX_MINOR, BBOX_REBOOT_NO, TS_EXCEPTION, BBOX_REENTRANT_DISALLOW, \ - BBOX_COREID_MASK(BBOX_TS), BBOX_COREID_MASK(BBOX_TS), "ts1 aicore exception"}, \ - {0xB4061007, BBOX_MINOR, BBOX_REBOOT_NO, TS_EXCEPTION, BBOX_REENTRANT_DISALLOW, \ - BBOX_COREID_MASK(BBOX_TS), BBOX_COREID_MASK(BBOX_TS), "ts1 aicore timeout"}, \ - {0xB6061008, BBOX_MAJOR, BBOX_REBOOT_NO, TS_EXCEPTION, BBOX_REENTRANT_DISALLOW, \ - BBOX_COREID_MASK(BBOX_TS), BBOX_COREID_MASK(BBOX_TS), "ts1 sdma init fault"}, \ - {0xB4061009, BBOX_MINOR, BBOX_REBOOT_NO, TS_EXCEPTION, BBOX_REENTRANT_DISALLOW, \ - BBOX_COREID_MASK(BBOX_TS), BBOX_COREID_MASK(BBOX_TS), "ts1 sdma timeout"}, \ - {0xA606100A, BBOX_MAJOR, BBOX_REBOOT_WAIT, TS_EXCEPTION, BBOX_REENTRANT_DISALLOW, \ - BBOX_COREID_MASK(BBOX_TS), BBOX_COREID_MASK(BBOX_TS), "ts1 hwts bus error"}, \ - {0xA606100B, BBOX_MAJOR, BBOX_REBOOT_WAIT, TS_EXCEPTION, BBOX_REENTRANT_DISALLOW, \ - BBOX_COREID_MASK(BBOX_TS), BBOX_COREID_MASK(BBOX_TS), "ts1 hwts sqe error"}, \ - {0xA606100C, BBOX_MAJOR, BBOX_REBOOT_WAIT, TS_EXCEPTION, BBOX_REENTRANT_DISALLOW, \ - BBOX_COREID_MASK(BBOX_TS), BBOX_COREID_MASK(BBOX_TS), "ts1 hwts ecc error"}, \ - {0xA406100D, BBOX_MINOR, BBOX_REBOOT_WAIT, TS_EXCEPTION, BBOX_REENTRANT_DISALLOW, \ - BBOX_COREID_MASK(BBOX_TS), BBOX_COREID_MASK(BBOX_TS), "ts1 aicpu exception"}, \ - {0xA406100E, BBOX_MINOR, BBOX_REBOOT_WAIT, TS_EXCEPTION, BBOX_REENTRANT_DISALLOW, \ - BBOX_COREID_MASK(BBOX_TS), BBOX_COREID_MASK(BBOX_TS), "ts1 npu exception"}, \ - {0xA606100F, BBOX_MAJOR, BBOX_REBOOT_WAIT, TS_EXCEPTION, BBOX_REENTRANT_DISALLOW, \ - BBOX_COREID_MASK(BBOX_TS), BBOX_COREID_MASK(BBOX_TS), "ts1 aicore reset timeout"}, \ - {0xA4061010, BBOX_MINOR, BBOX_REBOOT_WAIT, TS_EXCEPTION, BBOX_REENTRANT_DISALLOW, \ - BBOX_COREID_MASK(BBOX_TS), BBOX_COREID_MASK(BBOX_TS), "ts1 aiv exception"}, \ - {0xA4061011, BBOX_MINOR, BBOX_REBOOT_WAIT, TS_EXCEPTION, BBOX_REENTRANT_DISALLOW, \ - BBOX_COREID_MASK(BBOX_TS), BBOX_COREID_MASK(BBOX_TS), "ts1 aiv timeout"}, \ - {0xA4061014, BBOX_MINOR, BBOX_REBOOT_WAIT, TS_EXCEPTION, BBOX_REENTRANT_DISALLOW, \ - BBOX_COREID_MASK(BBOX_TS), BBOX_COREID_MASK(BBOX_TS), "ts1 aicpu timeout"}, \ -} - -#define BBOX_PROXY_CTRL_TS { \ - .e_block_num = 3, \ - .padding = {0}, \ - .block_info = { \ - {BLOCK_TYPE_STARTUP, CHECK_NONE, \ - 0x0200, 0x32000}, \ - {BLOCK_TYPE_NORMAL, CHECK_RUNTIME_EXCEPID | CHECK_RUNTIME_TMSTMP | CHECK_HEARTBEAT_EXCEPID, \ - 0x32200, 0xE6F00}, \ - {BLOCK_TYPE_NORMAL, CHECK_RUNTIME_EXCEPID | CHECK_RUNTIME_TMSTMP | CHECK_HEARTBEAT_EXCEPID, \ - 0x119100, 0xE6F00}, \ - } \ -} - -#define BBOX_PROXY_MODULE_LPM { \ - .coreid = BBOX_LPM, \ - .flag = BBOX_PROXY_CAPACITY_REGISTER | BBOX_PROXY_CAPACITY_DUMP_DDR | BBOX_PROXY_CAPACITY_DUMP_LOG, \ - .name = "lpm", \ - .log_addr = 0xA00000, \ - .log_len = 0x20000, \ - .wait_timeout = 10000, \ - .e_count = 24, \ -} - -#define BBOX_PROXY_EXCEPTION_LPM { \ - {0xa819320f, BBOX_CRITICAL, BBOX_REBOOT_NO, LPM_EXCEPTION, BBOX_REENTRANT_ALLOW, \ - BBOX_COREID_MASK(BBOX_LPM), BBOX_COREID_MASK(BBOX_LPM), "tsensor error"}, \ - {0xa6192d15, BBOX_MAJOR, BBOX_REBOOT_WAIT, HEARTBEAT_EXCEPTION, BBOX_REENTRANT_DISALLOW, \ - BBOX_COREID_MASK(BBOX_LPM), BBOX_COREID_MASK(BBOX_LPM), "lpm heart error"}, \ - {0xa6193206, BBOX_MAJOR, BBOX_REBOOT_WAIT, LPM_EXCEPTION, BBOX_REENTRANT_ALLOW, \ - BBOX_COREID_MASK(BBOX_LPM), BBOX_COREID_MASK(BBOX_LPM), "headfault error"}, \ - {0xa4193216, BBOX_MINOR, BBOX_REBOOT_NO, LPM_EXCEPTION, BBOX_REENTRANT_DISALLOW, \ - BBOX_COREID_MASK(BBOX_LPM), BBOX_COREID_MASK(BBOX_LPM), "edp error"}, \ - {0xa4193217, BBOX_MINOR, BBOX_REBOOT_WAIT, LPM_EXCEPTION, BBOX_REENTRANT_DISALLOW, \ - BBOX_COREID_MASK(BBOX_LPM), BBOX_COREID_MASK(BBOX_LPM), "ipc timeout error"}, \ - {0xa4193218, BBOX_MINOR, BBOX_REBOOT_WAIT, LPM_EXCEPTION, BBOX_REENTRANT_DISALLOW, \ - BBOX_COREID_MASK(BBOX_LPM), BBOX_COREID_MASK(BBOX_LPM), "ipc queue error"}, \ - {0xa6193215, BBOX_MAJOR, BBOX_REBOOT_WAIT, LPM_EXCEPTION, BBOX_REENTRANT_DISALLOW, \ - BBOX_COREID_MASK(BBOX_LPM), BBOX_COREID_MASK(BBOX_LPM), "os heart error"}, \ - {0xa8193234,BBOX_CRITICAL, BBOX_REBOOT_WAIT, LPM_EXCEPTION, BBOX_REENTRANT_DISALLOW, \ - BBOX_COREID_MASK(BBOX_LPM), BBOX_COREID_MASK(BBOX_LPM), "ddr tmon low error"}, \ - {0xa8193235, BBOX_CRITICAL, BBOX_REBOOT_WAIT, LPM_EXCEPTION, BBOX_REENTRANT_DISALLOW, \ - BBOX_COREID_MASK(BBOX_LPM), BBOX_COREID_MASK(BBOX_LPM), "ddr tmon high error"}, \ - {0xa6193236, BBOX_MAJOR, BBOX_REBOOT_WAIT, LPM_EXCEPTION, BBOX_REENTRANT_DISALLOW, \ - BBOX_COREID_MASK(BBOX_LPM), BBOX_COREID_MASK(BBOX_LPM), "ddr gate error"}, \ - {0xa619323f, BBOX_MAJOR, BBOX_REBOOT_WAIT, LPM_EXCEPTION, BBOX_REENTRANT_DISALLOW, \ - BBOX_COREID_MASK(BBOX_LPM), BBOX_COREID_MASK(BBOX_LPM), "ddr aref error"}, \ - {0xa6193240, BBOX_MAJOR, BBOX_REBOOT_WAIT, LPM_EXCEPTION, BBOX_REENTRANT_DISALLOW, \ - BBOX_COREID_MASK(BBOX_LPM), BBOX_COREID_MASK(BBOX_LPM), "ddr rdtimeout error"}, \ - {0xa6193241, BBOX_MAJOR, BBOX_REBOOT_WAIT, LPM_EXCEPTION, BBOX_REENTRANT_DISALLOW, \ - BBOX_COREID_MASK(BBOX_LPM), BBOX_COREID_MASK(BBOX_LPM), "ddr pll unlock error"}, \ - {0xa6193242, BBOX_MAJOR, BBOX_REBOOT_WAIT, LPM_EXCEPTION, BBOX_REENTRANT_DISALLOW, \ - BBOX_COREID_MASK(BBOX_LPM), BBOX_COREID_MASK(BBOX_LPM), "ddr retrain error"}, \ - {0xa6193243, BBOX_MAJOR, BBOX_REBOOT_WAIT, LPM_EXCEPTION, BBOX_REENTRANT_DISALLOW, \ - BBOX_COREID_MASK(BBOX_LPM), BBOX_COREID_MASK(BBOX_LPM), "ddr tmon error"}, \ - {0xa6193244, BBOX_MAJOR, BBOX_REBOOT_WAIT, LPM_EXCEPTION, BBOX_REENTRANT_DISALLOW, \ - BBOX_COREID_MASK(BBOX_LPM), BBOX_COREID_MASK(BBOX_LPM), "ddr dfs error"}, \ - {0xa6193245, BBOX_MAJOR, BBOX_REBOOT_WAIT, LPM_EXCEPTION, BBOX_REENTRANT_DISALLOW, \ - BBOX_COREID_MASK(BBOX_LPM), BBOX_COREID_MASK(BBOX_LPM), "ddr dvalid error"}, \ - {0xa6193246, BBOX_MAJOR, BBOX_REBOOT_WAIT, LPM_EXCEPTION, BBOX_REENTRANT_DISALLOW, \ - BBOX_COREID_MASK(BBOX_LPM), BBOX_COREID_MASK(BBOX_LPM), "ddr dfi sel error"}, \ - {0xa6193247, BBOX_MAJOR, BBOX_REBOOT_WAIT, LPM_EXCEPTION, BBOX_REENTRANT_DISALLOW, \ - BBOX_COREID_MASK(BBOX_LPM), BBOX_COREID_MASK(BBOX_LPM), "ddr pll unlock lp error"}, \ - {0xa6193248, BBOX_MAJOR, BBOX_REBOOT_NO, LPM_EXCEPTION, BBOX_REENTRANT_ALLOW, \ - BBOX_COREID_MASK(BBOX_LPM), BBOX_COREID_MASK(BBOX_LPM), "ddr iecc uerr error"}, \ - {0xa419324a, BBOX_MAJOR, BBOX_REBOOT_WAIT, LPM_EXCEPTION, BBOX_REENTRANT_DISALLOW, \ - BBOX_COREID_MASK(BBOX_LPM), BBOX_COREID_MASK(BBOX_LPM), "ddr unkonwn error"}, \ - {0xa4193250, BBOX_MINOR, BBOX_REBOOT_NO, LPM_EXCEPTION, BBOX_REENTRANT_ALLOW, \ - BBOX_COREID_MASK(BBOX_LPM), BBOX_COREID_MASK(BBOX_LPM), "ddr iecc cerr error"}, \ - {0xa4192c1a, BBOX_MINOR, BBOX_REBOOT_WAIT, STARTUP_EXCEPTION, BBOX_REENTRANT_ALLOW, \ - BBOX_COREID_MASK(BBOX_LPM), BBOX_COREID_MASK(BBOX_LPM), "lp startup error"}, \ - {0xa419321b, BBOX_MINOR, BBOX_REBOOT_NO, LPM_EXCEPTION, BBOX_REENTRANT_DISALLOW, \ - BBOX_COREID_MASK(BBOX_LPM), BBOX_COREID_MASK(BBOX_LPM), "lp tmonitor error"}, \ -} - -#define BBOX_PROXY_CTRL_LPM { \ - .e_block_num = 6, \ - .padding = {0}, \ - .block_info = { \ - {BLOCK_TYPE_STARTUP, CHECK_NONE, 0x0400, 0x12C00}, \ - {BLOCK_TYPE_NORMAL, CHECK_RUNTIME_EXCEPID | CHECK_RUNTIME_TMSTMP | CHECK_HEARTBEAT_EXCEPID, 0x13000, 0x19000}, \ - {BLOCK_TYPE_NORMAL, CHECK_RUNTIME_EXCEPID | CHECK_RUNTIME_TMSTMP | CHECK_HEARTBEAT_EXCEPID, 0x2C000, 0x19000}, \ - {BLOCK_TYPE_NORMAL, CHECK_RUNTIME_EXCEPID | CHECK_RUNTIME_TMSTMP | CHECK_HEARTBEAT_EXCEPID, 0x45000, 0x19000}, \ - {BLOCK_TYPE_NORMAL, CHECK_RUNTIME_EXCEPID | CHECK_RUNTIME_TMSTMP | CHECK_HEARTBEAT_EXCEPID, 0x5E000, 0x19000}, \ - {BLOCK_TYPE_NORMAL, CHECK_RUNTIME_EXCEPID | CHECK_RUNTIME_TMSTMP | CHECK_HEARTBEAT_EXCEPID, 0x77000, 0x19000}, \ - } \ -} - -#define BBOX_PROXY_MODULE_HSM { \ - .coreid = BBOX_HSM, \ - .flag = BBOX_PROXY_CAPACITY_REGISTER | BBOX_PROXY_CAPACITY_DUMP_DDR | BBOX_PROXY_CAPACITY_DUMP_LOG, \ - .name = "hsm", \ - .log_addr = 0x3E00000, \ - .log_len = 0x100000, \ - .wait_timeout = 10000, \ - .e_count = 3, \ -} - -#define BBOX_PROXY_EXCEPTION_HSM { \ - {0xa6360000, BBOX_MAJOR, BBOX_REBOOT_WAIT, STARTUP_EXCEPTION, BBOX_REENTRANT_DISALLOW, \ - BBOX_COREID_MASK(BBOX_HSM), BBOX_COREID_MASK(BBOX_HSM), "HSM startup exception"}, \ - {0xa6361000, BBOX_MAJOR, BBOX_REBOOT_WAIT, HEARTBEAT_EXCEPTION, BBOX_REENTRANT_DISALLOW, \ - BBOX_COREID_MASK(BBOX_HSM), BBOX_COREID_MASK(BBOX_HSM), "HSM heartbeat exception"}, \ - {0xa6362000, BBOX_MAJOR, BBOX_REBOOT_NO, HSM_EXCEPTION, BBOX_REENTRANT_ALLOW, \ - BBOX_COREID_MASK(BBOX_HSM), BBOX_COREID_MASK(BBOX_HSM), "HSM resource shortage exception"}, \ -} - -#define BBOX_PROXY_CTRL_HSM { \ - .e_block_num = 5, \ - .padding = {0}, \ - .block_info = { \ - {BLOCK_TYPE_STARTUP, CHECK_NONE, 0x200, 0x1000}, \ - {BLOCK_TYPE_NORMAL, CHECK_RUNTIME_EXCEPID | CHECK_RUNTIME_TMSTMP | CHECK_HEARTBEAT_EXCEPID, 0x1200, 0x1000}, \ - {BLOCK_TYPE_NORMAL, CHECK_RUNTIME_EXCEPID | CHECK_RUNTIME_TMSTMP | CHECK_HEARTBEAT_EXCEPID, 0x2200, 0x1000}, \ - {BLOCK_TYPE_NORMAL, CHECK_RUNTIME_EXCEPID | CHECK_RUNTIME_TMSTMP | CHECK_HEARTBEAT_EXCEPID, 0x3200, 0x1000}, \ - {BLOCK_TYPE_NORMAL, CHECK_RUNTIME_EXCEPID | CHECK_RUNTIME_TMSTMP | CHECK_HEARTBEAT_EXCEPID, 0x4200, 0x1000}, \ - } \ -} - -#define BBOX_PROXY_MODULE_ISP { \ - .coreid = BBOX_ISP, \ - .flag = BBOX_PROXY_CAPACITY_REGISTER | BBOX_PROXY_CAPACITY_DUMP_DDR, \ - .name = "isp", \ - .log_addr = 0, \ - .log_len = 0, \ - .wait_timeout = 10000, \ - .e_count = 8, \ -} - -/* startup error dump log only, heartbeat and running error dump both bbox and log */ -#define BBOX_PROXY_EXCEPTION_ISP { \ - {0xa8380000, BBOX_CRITICAL, BBOX_REBOOT_WAIT, STARTUP_EXCEPTION, BBOX_REENTRANT_DISALLOW, \ - BBOX_COREID_MASK(BBOX_ISP), BBOX_COREID_MASK(BBOX_ISP), "ISP0 startup exception"}, \ - {0xa8380001, BBOX_CRITICAL, BBOX_REBOOT_WAIT, STARTUP_EXCEPTION, BBOX_REENTRANT_DISALLOW, \ - BBOX_COREID_MASK(BBOX_ISP), BBOX_COREID_MASK(BBOX_ISP), "ISP1 startup exception"}, \ - {0xa8380002, BBOX_CRITICAL, BBOX_REBOOT_WAIT, STARTUP_EXCEPTION, BBOX_REENTRANT_DISALLOW, \ - BBOX_COREID_MASK(BBOX_ISP), BBOX_COREID_MASK(BBOX_ISP), "ISP2 startup exception"}, \ - {0xa8380003, BBOX_CRITICAL, BBOX_REBOOT_WAIT, STARTUP_EXCEPTION, BBOX_REENTRANT_DISALLOW, \ - BBOX_COREID_MASK(BBOX_ISP), BBOX_COREID_MASK(BBOX_ISP), "ISP3 startup exception"}, \ - {0xa8381000, BBOX_CRITICAL, BBOX_REBOOT_WAIT, ISP_EXCEPTION, BBOX_REENTRANT_DISALLOW, \ - BBOX_COREID_MASK(BBOX_ISP), BBOX_COREID_MASK(BBOX_ISP), "ISP0 running exception"}, \ - {0xa8381001, BBOX_CRITICAL, BBOX_REBOOT_WAIT, ISP_EXCEPTION, BBOX_REENTRANT_DISALLOW, \ - BBOX_COREID_MASK(BBOX_ISP), BBOX_COREID_MASK(BBOX_ISP), "ISP1 running exception"}, \ - {0xa8381002, BBOX_CRITICAL, BBOX_REBOOT_WAIT, ISP_EXCEPTION, BBOX_REENTRANT_DISALLOW, \ - BBOX_COREID_MASK(BBOX_ISP), BBOX_COREID_MASK(BBOX_ISP), "ISP2 running exception"}, \ - {0xa8381003, BBOX_CRITICAL, BBOX_REBOOT_WAIT, ISP_EXCEPTION, BBOX_REENTRANT_DISALLOW, \ - BBOX_COREID_MASK(BBOX_ISP), BBOX_COREID_MASK(BBOX_ISP), "ISP3 running exception"}, \ -} - -#define BBOX_PROXY_CTRL_ISP { \ - .e_block_num = 4, \ - .padding = {0}, \ - .block_info = { \ - {BLOCK_TYPE_NORMAL | BLOCK_TYPE_STARTUP, \ - CHECK_STARTUP_EXCEPID | CHECK_RUNTIME_EXCEPID | CHECK_RUNTIME_TMSTMP | CHECK_HEARTBEAT_EXCEPID, \ - 0x200, 0x7FE00}, \ - {BLOCK_TYPE_NORMAL | BLOCK_TYPE_STARTUP, \ - CHECK_STARTUP_EXCEPID | CHECK_RUNTIME_EXCEPID | CHECK_RUNTIME_TMSTMP | CHECK_HEARTBEAT_EXCEPID, \ - 0x80000, 0x80000}, \ - {BLOCK_TYPE_NORMAL | BLOCK_TYPE_STARTUP, \ - CHECK_STARTUP_EXCEPID | CHECK_RUNTIME_EXCEPID | CHECK_RUNTIME_TMSTMP | CHECK_HEARTBEAT_EXCEPID, \ - 0x100000, 0x80000}, \ - {BLOCK_TYPE_NORMAL | BLOCK_TYPE_STARTUP, \ - CHECK_STARTUP_EXCEPID | CHECK_RUNTIME_EXCEPID | CHECK_RUNTIME_TMSTMP | CHECK_HEARTBEAT_EXCEPID, \ - 0x180000, 0x80000}, \ - } \ -} - -#define BBOX_PROXY_MODULE_SAFETYISLAND { \ - .coreid = BBOX_SAFETYISLAND, \ - .flag = BBOX_PROXY_CAPACITY_REGISTER | BBOX_PROXY_CAPACITY_DUMP_DDR, \ - .name = "sil", \ - .log_addr = 0, \ - .log_len = 0, \ - .wait_timeout = 10000, \ - .e_count = 5, \ -} - -#define BBOX_PROXY_EXCEPTION_SAFETYISLAND { \ - {0xA63A0001, BBOX_CRITICAL, BBOX_REBOOT_NO, SAFETYISLAND_EXCEPTION, BBOX_REENTRANT_DISALLOW, \ - BBOX_COREID_MASK(BBOX_SAFETYISLAND), BBOX_COREID_MASK(BBOX_SAFETYISLAND), "sil os panic"}, \ - {0xA63A1001, BBOX_MAJOR, BBOX_REBOOT_NO, SAFETYISLAND_EXCEPTION, BBOX_REENTRANT_DISALLOW, \ - BBOX_COREID_MASK(BBOX_SAFETYISLAND), BBOX_COREID_MASK(BBOX_SAFETYISLAND), "sil lpm err"}, \ - {0xA43A2001, BBOX_MINOR, BBOX_REBOOT_WAIT, SAFETYISLAND_EXCEPTION, BBOX_REENTRANT_DISALLOW, \ - BBOX_COREID_MASK(BBOX_SAFETYISLAND), BBOX_COREID_MASK(BBOX_SAFETYISLAND), "sil ipc or hb err"}, \ - {0xA63A3001, BBOX_MAJOR, BBOX_REBOOT_WAIT, SAFETYISLAND_EXCEPTION, BBOX_REENTRANT_DISALLOW, \ - BBOX_COREID_MASK(BBOX_SAFETYISLAND), BBOX_COREID_MASK(BBOX_SAFETYISLAND), "sil heartbeat err"}, \ - {0xA63A4001, BBOX_MAJOR, BBOX_REBOOT_WAIT, SAFETYISLAND_EXCEPTION, BBOX_REENTRANT_DISALLOW, \ - BBOX_COREID_MASK(BBOX_SAFETYISLAND), BBOX_COREID_MASK(BBOX_SAFETYISLAND), "sil excep tbl full"}, \ -} - -#define BBOX_PROXY_CTRL_SAFETYISLAND { \ - .e_block_num = 6, \ - .padding = {0}, \ - .block_info = { \ - {BLOCK_TYPE_NORMAL, CHECK_RUNTIME_EXCEPID | CHECK_RUNTIME_TMSTMP | CHECK_HEARTBEAT_EXCEPID, 0x400, 0xC800}, \ - {BLOCK_TYPE_NORMAL, CHECK_RUNTIME_EXCEPID | CHECK_RUNTIME_TMSTMP | CHECK_HEARTBEAT_EXCEPID, 0xD000, 0xC800}, \ - {BLOCK_TYPE_NORMAL, CHECK_RUNTIME_EXCEPID | CHECK_RUNTIME_TMSTMP | CHECK_HEARTBEAT_EXCEPID, 0x19C00, 0xC800}, \ - {BLOCK_TYPE_NORMAL, CHECK_RUNTIME_EXCEPID | CHECK_RUNTIME_TMSTMP | CHECK_HEARTBEAT_EXCEPID, 0x26800, 0xC800}, \ - {BLOCK_TYPE_NORMAL, CHECK_RUNTIME_EXCEPID | CHECK_RUNTIME_TMSTMP | CHECK_HEARTBEAT_EXCEPID, 0x33400, 0xC800}, \ - {BLOCK_TYPE_NORMAL, CHECK_RUNTIME_EXCEPID | CHECK_RUNTIME_TMSTMP | CHECK_HEARTBEAT_EXCEPID, 0x40000, 0xC800}, \ - } \ -} - -#define BBOX_PROXY_MODULE_ATF { \ - .coreid = BBOX_TF, \ - .flag = BBOX_PROXY_CAPACITY_REGISTER, \ - .name = "atf", \ - .log_addr = 0x0, \ - .log_len = 0x0, \ - .wait_timeout = 10000, \ - .e_count = 1, \ -} - -#define BBOX_PROXY_EXCEPTION_ATF { \ - {0xA8340000, BBOX_CRITICAL, BBOX_REBOOT_WAIT, ATF_EXCEPTION, BBOX_REENTRANT_DISALLOW, \ - BBOX_COREID_MASK(BBOX_TF), BBOX_COREID_MASK(BBOX_TF), "atf panic exception"}, \ -} - -#define BBOX_PROXY_CTRL_ATF { \ - .e_block_num = 1, \ - .padding = {0}, \ - .block_info = { \ - {BLOCK_TYPE_STARTUP, CHECK_NONE, 0x90400, 0xF800}, \ - } \ -} - - -#define DEFINE_BBOX_PROXY(x) struct bbox_proxy_info x[] = { \ - BBOX_PROXY_INITIALIZER(TS), \ - BBOX_PROXY_INITIALIZER(LPM), \ - BBOX_PROXY_INITIALIZER(HSM), \ - BBOX_PROXY_INITIALIZER(ISP), \ - BBOX_PROXY_INITIALIZER(SAFETYISLAND), \ - BBOX_PROXY_INITIALIZER(ATF), \ -} - -#endif // BBOX_PROXY_CONFIG_MDC diff --git a/inc/toolchain/bbox/device/bbox_pub.h b/inc/toolchain/bbox/device/bbox_pub.h deleted file mode 100644 index a75f51957..000000000 --- a/inc/toolchain/bbox/device/bbox_pub.h +++ /dev/null @@ -1,320 +0,0 @@ -/** - * Copyright 2019-2020 Huawei Technologies Co., Ltd - * - * 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 BBOX_PUB_H -#define BBOX_PUB_H - -#include "bbox_types.h" - -/********************************************************** - * basic type definitions * - **********************************************************/ -// 模块id列表 -enum BBOX_COREID_LIST { - BBOX_UNDEF = 0x0, - BBOX_DRIVER = 0x1, - BBOX_OS = 0x2, - BBOX_TS = 0x3, - BBOX_RUNTIME = 0x4, - BBOX_AICPU = 0x5, - BBOX_CCE = 0x6, - BBOX_TVM = 0x7, - BBOX_FRAMEWORK = 0x8, - BBOX_HIAI = 0x9, - BBOX_DVPP = 0xa, - BBOX_AIPP = 0xb, - BBOX_LPM = 0xc, - BBOX_MDC = 0xd, - BBOX_COMPILER = 0xe, - BBOX_TOOLCHAIN = 0xf, - BBOX_ALGORITHM = 0x10, - BBOX_PROFILING = 0x11, - BBOX_HCCL = 0x12, - BBOX_EMULATE = 0x13, - BBOX_BIOS = 0x14, - BBOX_TEEOS = 0x15, - BBOX_TINY = 0x16, - BBOX_LPFW = 0x17, - BBOX_NETWORK = 0x18, - BBOX_ZIP = 0x19, - BBOX_TF = 0x1A, - BBOX_HSM = 0x1B, - BBOX_ISP = 0x1C, - BBOX_SAFETYISLAND = 0x1D, - BBOX_CLUSTER = 0x1E, - BBOX_COMISOLATOR = 0x1F, - BBOX_SD = 0x20, - BBOX_DP = 0x21, - BBOX_CORE_MAX = 0x22, -}; - -// 异常类型 -enum BBOX_REBOOT_REASON { - BBOX_REBOOT_REASON_LABEL0 = 0x0, // label0:重启相关 - DEVICE_COLDBOOT = BBOX_REBOOT_REASON_LABEL0, // 冷启动,如关机后第一次开机;掉电后第一次开机 - BIOS_EXCEPTION = 0x1, // bios异常重启,前一次启动bios异常 - DEVICE_HOTBOOT = 0x2, // 热复位,如按键复位,芯片硬复位等 - BBOX_REBOOT_REASON_LABEL1 = 0x10, // label1:硬件原因复位 - ABNORMAL_EXCEPTION = BBOX_REBOOT_REASON_LABEL1, // 未检测到的异常 - TSENSOR_EXCEPTION = 0x1f, // soc温保复位 - PMU_EXCEPTION = 0x20, // 过流、欠压、PMU过温引起的硬件复位 - DDR_FATAL_EXCEPTION = 0X22, // ddr fatal异常复位,如:ddr颗粒超温复位 - BBOX_REBOOT_REASON_LABEL2 = 0x24, // label2:os软件原因复位 - OS_PANIC = BBOX_REBOOT_REASON_LABEL2, // os panic,如访问非法地址 - OS_SOFT_LOCKUP = 0x26, // soft lockup - OS_OOM = 0x2a, // OOM 异常 - OS_HDC = 0x2b, // HDC 断连 - BBOX_REBOOT_REASON_LABEL3 = 0x2c, // label3:其他模块复位 - STARTUP_EXCEPTION = 0x2c, // 模块启动异常 - HEARTBEAT_EXCEPTION = 0x2d, // 模块心跳异常 - RUN_EXCEPTION = 0x2e, // 模块运行异常 - LPM_EXCEPTION = 0x32, // LPM子系统检测到的各种异常 - TS_EXCEPTION = 0x33, // TS子系统检测到的各种异常 - DVPP_EXCEPTION = 0x35, // DVPP异常 - DRIVER_EXCEPTION = 0x36, // DRIVER异常 - ZIP_EXCEPTION = 0x37, // ZIP异常 - TEE_EXCEPTION = 0x38, // teeos异常 - LPFW_EXCEPTION = 0x39, // LPFW异常 - NETWORK_EXCEPTION = 0x3A, // NETWORK异常 - HSM_EXCEPTION = 0x3B, // HSM异常 - ATF_EXCEPTION = 0x3C, // ATF异常 - ISP_EXCEPTION = 0x3D, // ISP异常 - SAFETYISLAND_EXCEPTION = 0x3E, // SAFETYISLAND异常 - TOOLCHAIN_EXCEPTION = 0x3F, // TOOLCHAIN异常 - CLUSTER_EXCEPTION = 0x40, // CLUSTER异常 - COMISOLATOR_EXCEPTION = 0x41, // COMISOLATOR异常 - SD_EXCEPTION = 0x42, // SD异常 - DP_EXCEPTION = 0x43, // DP异常 - BBOX_REBOOT_REASON_LABEL4 = 0x50, // label4: - BBOX_REBOOT_REASON_LABEL5 = 0x65, // label5:电源异常 - BBOX_REBOOT_REASON_LABEL6 = 0x6A, // label6:xloader异常 - BBOX_REBOOT_REASON_LABEL7 = 0x74, // label7:fastboot异常 - BBOX_REBOOT_REASON_LABEL8 = 0x89, // label8: host侧异常 - DEVICE_LTO_EXCEPTION = 0x8A, // 设备启动超时: load timeout - DEVICE_HBL_EXCEPTION = 0x8B, // 设备心跳丢失: heart beat lost - DEVICE_USER_RESET = 0x8C, // 用户复位 - DEVICE_AER_EXCEPTION = 0x8D, // 设备AER错误: advanced err report - BBOX_REBOOT_REASON_LABEL9 = 0x90, // label9: - BBOX_REBOOT_REASON_LABEL10 = 0xB0, // label10: - BBOX_EXCEPTION_REASON_INVALID = 0xFF, -}; - -enum BBOX_PROCESS_PRI { - BBOX_OTHER = 0x0, // 不确定 - BBOX_NOTICE = 0x1, // 提示 - BBOX_MINOR = 0x2, // 次要 - BBOX_MAJOR = 0x3, // 重要 - BBOX_CRITICAL = 0x4, // 紧急 - BBOX_PPRI_MAX -}; - -enum BBOX_REBOOT_PRI { - BBOX_REBOOT_NOW = 0x01, // 立即重启 - BBOX_REBOOT_WAIT, // 等待重启 - BBOX_REBOOT_NO, // 不重启 - BBOX_REBOOT_MAX -}; - -enum BBOX_REENTRANT { - BBOX_REENTRANT_ALLOW = 0x01, // 可重复触发的异常 - BBOX_REENTRANT_DISALLOW // 不可重复触发的异常 -}; - -#define BBOX_COREID_VALID(coreid) ((((coreid) == BBOX_UNDEF) || ((coreid) >= BBOX_CORE_MAX)) ? BBOX_FALSE : BBOX_TRUE) -#define BBOX_COREID_MASK(coreid) (u64)((BBOX_COREID_VALID(coreid) == BBOX_TRUE) ? (1ull << (u8)((coreid) - 1)) : BBOX_UNDEF) - - -/********************************************************** - * module exception register definitions * - **********************************************************/ -#define BBOX_MODULE_CTRL_NUM 6 - -struct bbox_module_exception_ctrl { - excep_time e_clock; // 模块触发异常时间 - u32 e_excepid; // 模块触发的异常id - u32 e_block_offset; // 模块异常信息划分块起始偏移值,基于模块预留内存首地址,从magic开始 - u32 e_block_len; // 模块异常信息划分块长度 - u32 e_info_len; // 模块异常信息实际长度 -}; - -#define BBOX_MODULE_MAGIC 0x56312e32 -#define BBOX_MODULE_CTRL_PAD 3 -#define BBOX_MODULE_CTRL_NUM 6 -#define BBOX_MODULE_CTRL_RESERV 312 - -struct bbox_module_ctrl { - u32 magic; // 使用宏BBOX_MAGIC - u8 e_block_num; // 需要使用的控制块个数,最多BBOX_PROXY_CTRL_NUM - u8 padding[BBOX_MODULE_CTRL_PAD]; // padding - struct bbox_module_exception_ctrl block[BBOX_MODULE_CTRL_NUM]; // 模块dump信息控制状态 - u8 reserved[BBOX_MODULE_CTRL_RESERV]; // 预留空间,用于后续扩展 -}; - -#define BBOX_MODULE_CTRL_BLOCK_SIZE sizeof(struct bbox_module_ctrl) // total 512 byte - - -/********************************************************** - * bbox interfaces definitions * - **********************************************************/ -#ifndef BBOX_COMMON_STRUCT -#define BBOX_COMMON_STRUCT -typedef void (*bbox_e_callback)(u32, void*); - -typedef struct bbox_exception_info { - u32 e_excepid; // exception id; - u32 e_excepid_end; // can register exception id region. [excepid~excepid_end] - u64 e_notify_core_mask; // need notify other core mask - u64 e_reset_core_mask; // need reset other core mask - u8 e_exce_type; // the type of exception - u8 e_from_core; // the core of happen exception - u8 e_process_priority; // exception process priority - u8 e_reboot_priority; // exception reboot priority, just recommended host operation - u8 e_reentrant; // whether to allow exception reentrant - u8 e_from_module[BBOX_MODULE_NAME_LEN]; // the module of happen excption - u8 e_desc[BBOX_EXCEPTIONDESC_MAXLEN]; // the desc of happen excption - bbox_e_callback e_callback; // will be called when excption has processed. -} bbox_exception_info_s; -#endif - -struct bbox_report_info { - u32 devid; // device chip id, may NOT same with device slot id - u32 excepid; // exception id - excep_time time; // exception time - u32 arg; // arg -}; - -struct bbox_dump_done_ops_info { - u32 devid; // device chip id, may NOT same with device slot id - u32 excepid; // exception id - u8 coreid; // which core done - u8 etype; // exception type - excep_time time; // exception time -}; - -/* - * @brief : callback function, tell bbox dump done - * @param [in] : struct bbox_dump_done_ops_info *info dump done info - * @return : NA - */ -typedef void (*bbox_dump_done_ops)(const struct bbox_dump_done_ops_info *info); - -struct bbox_dump_ops_info { - u32 devid; // device chip id, may NOT same with device slot id - u32 excepid; // exception id - u8 coreid; // exception core id - u8 etype; // exception type - excep_time time; // exception time - u32 arg; // arg from exception report -}; - -/* - * @brief : module dump operate, the function over, need call fndone to mark dump over - * @param [in] : struct bbox_dump_ops_info *info module dump info - * @param [in] : bbox_dump_done_ops done dump done function pointer - * @return : NA - */ -typedef void (*bbox_dump_ops)(const struct bbox_dump_ops_info *info, bbox_dump_done_ops done); - -struct bbox_reset_ops_info { - u32 devid; // device chip id, may NOT same with device slot id - u32 excepid; // exception id - u8 coreid; // exception core id - u8 etype; // exception type -}; - -/* - * @brief : module reset operate - * @param [in] : struct bbox_reset_ops_info *info module reset info - * @return : NA - */ -typedef void (*bbox_reset_ops)(const struct bbox_reset_ops_info *info); - -struct bbox_module_info { - u8 coreid; // core id - bbox_dump_ops ops_dump; // dump operate pointer - bbox_reset_ops ops_reset; // reset operate pointer -}; - -struct bbox_module_result { - u64 log_addr; // reserved physical address - u32 log_len; // reserved physical length -}; - -/* - * @brief : register module - * @param [in] : struct bbox_module_info *info module info - * @param [in] : struct bbox_module_result *result register result - * @return : <0 failure; ==0 success - */ -int bbox_register_module(const struct bbox_module_info *info, struct bbox_module_result *result); - -/* - * @brief : unregister module - * @param [in] : u8 core_id core id - * @return : <0 failure; ==0 success - */ -int bbox_unregister_module(u8 coreid); - -/* - * @brief : report exception - * @param [in] : struct bbox_report_ops_info *info report info - * @return : =1: disallow reentrant - * =0: success - * <0: failure - */ -int bbox_exception_report(const struct bbox_report_info *info); - -#ifndef BBOX_COMMON_INTERFACE -#define BBOX_COMMON_INTERFACE -/* - * @brief : register exception - * @param [in] : struct bbox_exception_info *e exception info - * @return : e_excepid - * == 0 fail; >0 success - */ -u32 bbox_register_exception(const struct bbox_exception_info *e); - -/* - * func name: bbox_unregister_exception - * func args: u32 excepid, exception id; - * return : < 0 fail - * >=0 success - */ -int bbox_unregister_exception(u32 excepid); - -/* - * @brief : get device error code - * @param [in] : dev_id device chip id, may NOT same with device slot id - * @param [out] : u32 *e_code exception code array; - * @param [in] : u32 e_capacity array num, max value is 128 - * @return : >0: error of num; - * =0: none of error; - * <0: failure; - */ -int bbox_get_device_errorcode(u32 dev_id, u32 *e_code, u32 e_capacity); - -/* - * @brief : get the exception description - * @param [in] : u32 ecode exception id - * @param [out] : u8 *desc string array, exception description - * @param [in] : u32 length string array length - * @return : <0 failure; ==0 success - */ -int bbox_get_device_ecode_info(u32 ecode, u8 *desc, u32 length); -#endif - -#endif - diff --git a/inc/toolchain/bbox/device/bbox_pub_cloud.h b/inc/toolchain/bbox/device/bbox_pub_cloud.h deleted file mode 100644 index 61af75a09..000000000 --- a/inc/toolchain/bbox/device/bbox_pub_cloud.h +++ /dev/null @@ -1,288 +0,0 @@ -/** - * Copyright 2019-2020 Huawei Technologies Co., Ltd - * - * 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 BB_PUB_CLOUD_H -#define BB_PUB_CLOUD_H - -#include "bbox_types.h" - -#ifndef RDR_BASIC_TYPE -#define RDR_BASIC_TYPE -/* 模块id列表 */ -typedef enum CORE_LIST { - RDR_UNDEF = 0x0, - RDR_DRIVER = 0x1, - RDR_AP = 0x2, - RDR_TS = 0x3, - RDR_DVPP = 0xa, - RDR_BIOS = 0x14, - RDR_TEEOS = 0x15, - RDR_LPFW = 0x17, - RDR_NETWORK = 0x18, - RDR_TF = 0x1A, - RDR_CORE_MAX = 0x1B, -} rdr_coreid; - -#define RDR_COREID_VALID(coreid) ((((coreid) == 0) || ((coreid) >= RDR_CORE_MAX)) ? BBOX_FALSE : BBOX_TRUE) -#define RDR_COREID_MASK(coreid) (u64)(unsigned)(1 << ((coreid) - 1)) - -/* 异常类型 */ -typedef enum { - REBOOT_REASON_LABEL0 = 0x0, /* label0:重启相关 */ - AP_S_COLDBOOT = REBOOT_REASON_LABEL0, /* 冷启动,如关机后第一次开机;掉电后第一次开机 */ - BIOS_S_EXCEPTION = 0x1, /* bios异常重启,前一次启动bios异常 */ - AP_S_HOTBOOT = 0x2, /* 热复位,如按键复位,芯片硬复位等 */ - REBOOT_REASON_LABEL1 = 0x10, /* label1:硬件原因复位 */ - AP_S_ABNORMAL = REBOOT_REASON_LABEL1, /* 未检测到的异常 */ - AP_S_TSENSOR = 0x1f, /* soc温保复位 */ - AP_S_PMU = 0x20, /* 过流、欠压、PMU过温引起的硬件复位 */ - AP_S_DDR_FATAL = 0X22, /* ddr fatal异常复位,如:ddr颗粒超温复位 */ - REBOOT_REASON_LABEL2 = 0x24, /* label2:ap软件原因复位 */ - AP_S_PANIC = REBOOT_REASON_LABEL2, /* A核panic,如访问非法地址 */ - AP_S_OOM = 0x2a, /* OOM 异常 */ - AP_S_HDC = 0x2b, /* HDC 断连 */ - REBOOT_REASON_LABEL3 = 0x2c, /* label3:其他模块复位 */ - STARTUP_S_EXCEPTION = 0x2c, /* 模块启动异常 */ - HEARTBEAT_S_EXCEPTION = 0x2d, /* 模块心跳异常 */ - TS_S_EXCEPTION = 0x33, /* TS子系统检测到的各种异常 */ - DVPP_S_EXCEPTION = 0x35, /* DVPP异常 */ - DRIVER_S_EXCEPTION = 0x36, /* DRIVER异常 */ - TEE_S_EXCEPTION = 0x38, /* teeos异常 */ - LPFW_S_EXCEPTION = 0x39, /* LPFW异常 */ - NETWORK_S_EXCEPTION = 0x3A, /* NETWORK异常 */ - REBOOT_REASON_LABEL4 = 0x40, /* label4: */ - REBOOT_REASON_LABEL5 = 0x65, /* label5:电源异常 */ - REBOOT_REASON_LABEL6 = 0x6A, /* label6:xloader异常 */ - REBOOT_REASON_LABEL7 = 0x74, /* label7:fastboot异常 */ - REBOOT_REASON_LABEL8 = 0x89, /* label8: host侧异常 */ - DEVICE_LOAD_TIMEOUT = 0x8A, /* 设备启动超时 */ - DEVICE_HEAT_BEAT_LOST = 0x8B, /* 设备心跳丢失 */ - DEVICE_RESET_INFORM = 0x8C, /* 用户复位 */ - DEVICE_ADVANCED_ERR_REPORT = 0x8D, /* 设备AER错误 */ - REBOOT_REASON_LABEL9 = 0x90, /* label9: */ - REBOOT_REASON_LABEL10 = 0xB0, /* label10: */ - RDR_EXCEPTION_REASON_INVALID = 0xFF, -} EXCH_SOURCE; - -enum PROCESS_PRI { - RDR_OTHER = 0x0, /* 不确定 */ - RDR_NOTICE = 0x1, /* 提示 */ - RDR_MINOR = 0x2, /* 次要 */ - RDR_WARN = RDR_MINOR, - RDR_MAJOR = 0x3, /* 重要 */ - RDR_ERR = RDR_MAJOR, - RDR_CRITICAL = 0x4, /* 紧急 */ - RDR_DEAD = RDR_CRITICAL, - RDR_PPRI_MAX -}; - -enum REBOOT_PRI { - RDR_REBOOT_NOW = 0x01, /* 立即重启 */ - RDR_REBOOT_WAIT, /* 等待重启 */ - RDR_REBOOT_NO, /* 不重启 */ - RDR_REBOOT_MAX -}; - -enum REENTRANT { - RDR_REENTRANT_ALLOW = 0x01, /* 可重复触发的异常 */ - RDR_REENTRANT_DISALLOW /* 不可重复触发的异常 */ -}; - -#define MODULE_MAGIC 0xbaba0514 -#define MODULE_VALID 1 -#define MODULE_EXCEPTION_REGISTER_MAXNUM 512 - -struct exc_description_s { - u32 e_excepid; /* 异常id */ - u8 e_process_level; /* 异常处理级别:BBOX_PROCESS_PRI */ - u8 e_reboot_priority; /* 异常重启级别:BBOX_REBOOT_PRI */ - u8 e_excep_type; /* 异常类型 */ - u8 e_reentrant; /* 异常是否可重入 */ - u64 e_notify_core_mask; /* 异常联动掩码 */ - u8 e_desc[BBOX_EXCEPTIONDESC_MAXLEN]; /* 异常描述 */ -}; - -struct exc_info_s { - excep_time e_clock; /* 模块触发异常时间 */ - u32 e_excepid; /* 模块触发的异常id */ - u16 e_dump_status; /* 模块将异常信息存预留内存的控制状态 */ - u16 e_save_status; /* 代理将异常信息从预留内存导出的控制状态 */ -}; - -/* 通过共享内存注册异常 */ -struct exc_module_info_s { - u32 magic; /* 使用宏MODULE_MAGIC */ - u16 e_excep_valid; /* 模块写完注册的异常,则设置MODULE_VALID */ - u16 e_excep_num; /* 模块注册异常个数 */ - u8 e_from_module[BBOX_MODULE_NAME_LEN]; /* 模块名 */ - struct exc_info_s cur_info; /* 模块dump信息控制状态 */ - u32 e_mini_offset; /* 模块最小集异常信息偏移值,基于模块预留内存首地址,从magic开始 */ - u32 e_mini_len; /* 模块最小集异常信息长度 */ - u32 e_info_offset; /* 模块全部异常信息偏移值,基于模块预留内存首地址,从magic开始 */ - u32 e_info_len; /* 模块全部异常信息长度 */ - struct exc_description_s e_description[1]; /* 模块异常注册信息 */ -}; - -/* 通过注册函数注册异常 */ -struct rdr_ddr_module_info_s { - u32 magic; /* 使用宏MODULE_MAGIC */ - u32 e_mini_offset; /* 模块最小集异常信息偏移值,基于模块预留内存首地址,从magic开始 */ - u32 e_mini_len; /* 模块最小集异常信息长度 */ - u32 e_info_offset; /* 模块全部异常信息偏移值,基于模块预留内存首地址,从magic开始 */ - u32 e_info_len; /* 模块全部异常信息长度 */ -}; - -enum MODULE_DUMP_STATUS { - STATUS_INIT = 0, - STATUS_DOING = 1, - STATUS_DONE = 2, -}; -#endif - -#ifndef BBOX_COMMON_STRUCT -#define BBOX_COMMON_STRUCT -typedef void (*bbox_e_callback)(u32, void*); - -typedef struct bbox_exception_info { - u32 e_excepid; // exception id; - u32 e_excepid_end; // can register exception id region. [excepid~excepid_end] - u64 e_notify_core_mask; // need notify other core mask - u64 e_reset_core_mask; // need reset other core mask - u8 e_exce_type; // the type of exception - u8 e_from_core; // the core of happen exception - u8 e_process_priority; // exception process priority - u8 e_reboot_priority; // exception reboot priority, just recommended host operation - u8 e_reentrant; // whether to allow exception reentrant - u8 e_from_module[BBOX_MODULE_NAME_LEN]; // the module of happen excption - u8 e_desc[BBOX_EXCEPTIONDESC_MAXLEN]; // the desc of happen excption - bbox_e_callback e_callback; // will be called when excption has processed. -} bbox_exception_info_s; -#endif - -/* - * @brief : bbox dump done - * @param [in] : u32 dev_id device chip id, may NOT same with device slot id - * @param [in] : u8 core_id exception core - * @param [in] : u32 excep_id exception id - * @param [in] : u8 etype exception type - * @param [in] : excep_time *time exception time - * @param [in] : bbox_cb_dump_done fndone callback function - * @return : NA - */ -typedef void (*bbox_cb_dump_done)(u32 dev_id, u8 core_id, u32 excep_id, u8 etype, const excep_time *time); - -/* - * @brief : bbox dump, the function over, need call fndone to mark dump over - * @param [in] : u32 dev_id device chip id, may NOT same with device slot id - * @param [in] : u8 core_id exception core - * @param [in] : u32 excep_id exception id - * @param [in] : u8 etype exception type - * @param [in] : excep_time *time exception time - * @param [in] : u32 arg arg - * @param [in] : bbox_cb_dump_done fndone callback function - * @return : NA - */ -typedef void (*bbox_dump)(u32 dev_id, u8 core_id, u32 excep_id, u8 etype, - const excep_time *time, u32 arg, bbox_cb_dump_done fndone); - -/* - * @brief : bbox reset - * @param [in] : u32 dev_id device chip id, may NOT same with device slot id - * @param [in] : u8 core_id exception core - * @param [in] : u32 excep_id exception id - * @param [in] : u8 etype exception type - * @return : NA - */ -typedef void (*bbox_reset)(u32 dev_id, u8 core_id, u32 excep_id, u8 etype); - -struct bbox_module_ops { - bbox_dump ops_dump; - bbox_reset ops_reset; -}; - -struct bbox_register_module_result { - u64 log_addr; // reserved physical address - u32 log_len; // reserved physical length -}; - -/* - * @brief : register module - * @param [in] : u8 core_id core id - * @param [in] : struct bbox_module_ops* ops module ops - * @param [in] : struct bbox_register_module_result *retinfo register result info - * @return : <0 failure; ==0 success - */ -int bbox_register_module_ops(u8 core_id, const struct bbox_module_ops *ops, - struct bbox_register_module_result *retinfo); - -/* - * @brief : unregister module - * @param [in] : u8 core_id core id - * @return : <0 failure; ==0 success - */ -int bbox_unregister_module_ops(u8 core_id); - -/* - * @brief : unregister module - * @param [in] : dev_id device chip id, may NOT same with device slot id - * @param [in] : u32 excep_id exception id - * @param [in] : excep_time *timestamp exception time - * @param [in] : u32 arg arg - * @return : NA - */ -void bbox_system_error(u32 dev_id, u32 excep_id, const excep_time *timestamp, u32 arg); - -#ifndef BBOX_COMMON_INTERFACE -#define BBOX_COMMON_INTERFACE -/* - * @brief : register exception - * @param [in] : struct bbox_exception_info *e exception info - * @return : e_excepid - * == 0 fail; >0 success - */ -u32 bbox_register_exception(const struct bbox_exception_info *e); - -/* - * func name: bbox_unregister_exception - * func args: u32 excepid, exception id; - * return : < 0 fail - * >=0 success - */ -int bbox_unregister_exception(u32 excepid); - -/* - * @brief : get device error code - * @param [in] : dev_id device chip id, may NOT same with device slot id - * @param [out] : u32 *e_code exception code array; - * @param [in] : u32 e_capacity array num, max value is 128 - * @return : >0: error of num; - * =0: none of error; - * <0: failure; - */ -int bbox_get_device_errorcode(u32 dev_id, u32 *e_code, u32 e_capacity); - -/* - * @brief : get the exception description - * @param [in] : u32 ecode exception id - * @param [out] : u8 *desc string array, exception description - * @param [in] : u32 length string array length - * @return : <0 failure; ==0 success - */ -int bbox_get_device_ecode_info(u32 ecode, u8 *desc, u32 length); -#endif - -#endif // BB_PUB_CLOUD_H - diff --git a/inc/toolchain/bbox/device/bbox_pub_mini.h b/inc/toolchain/bbox/device/bbox_pub_mini.h deleted file mode 100644 index 03e9fa3a8..000000000 --- a/inc/toolchain/bbox/device/bbox_pub_mini.h +++ /dev/null @@ -1,288 +0,0 @@ -/** - * Copyright 2019-2020 Huawei Technologies Co., Ltd - * - * 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 BB_PUB_MINI_H -#define BB_PUB_MINI_H - -#include "bbox_types.h" - -#ifndef RDR_BASIC_TYPE -#define RDR_BASIC_TYPE -/* 模块id列表 */ -typedef enum CORE_LIST { - RDR_UNDEF = 0x0, - RDR_DRIVER = 0x1, - RDR_AP = 0x2, - RDR_TS = 0x3, - RDR_AICPU = 0x5, - RDR_DVPP = 0xa, - RDR_LPM3 = 0xc, - RDR_BIOS = 0x14, - RDR_TEEOS = 0x15, - RDR_TF = 0x1A, - RDR_CORE_MAX = 0x1B, -} rdr_coreid; - -#define RDR_COREID_VALID(coreid) ((((coreid) == 0) || ((coreid) >= RDR_CORE_MAX)) ? BBOX_FALSE : BBOX_TRUE) -#define RDR_COREID_MASK(coreid) (u64)(unsigned)(1 << ((coreid) - 1)) - -/* 异常类型 */ -typedef enum { - REBOOT_REASON_LABEL0 = 0x0, /* label0:重启相关 */ - AP_S_COLDBOOT = REBOOT_REASON_LABEL0, /* 冷启动,如关机后第一次开机;掉电后第一次开机 */ - BIOS_S_EXCEPTION = 0x1, /* bios异常重启,前一次启动bios异常 */ - AP_S_HOTBOOT = 0x2, /* 热复位,如按键复位,芯片硬复位等 */ - REBOOT_REASON_LABEL1 = 0x10, /* label1:硬件原因复位 */ - AP_S_ABNORMAL = REBOOT_REASON_LABEL1, /* 未检测到的异常 */ - AP_S_TSENSOR = 0x1f, /* soc温保复位 */ - AP_S_PMU = 0x20, /* 过流、欠压、PMU过温引起的硬件复位 */ - AP_S_DDR_FATAL = 0X22, /* ddr fatal异常复位,如:ddr颗粒超温复位 */ - REBOOT_REASON_LABEL2 = 0x24, /* label2:ap软件原因复位 */ - AP_S_PANIC = REBOOT_REASON_LABEL2, /* A核panic,如访问非法地址 */ - AP_S_OOM = 0x2a, /* OOM 异常 */ - AP_S_HDC = 0x2b, /* HDC 断连 */ - REBOOT_REASON_LABEL3 = 0x2c, /* label3:其他模块复位 */ - STARTUP_S_EXCEPTION = 0x2c, /* 模块启动异常 */ - HEARTBEAT_S_EXCEPTION = 0x2d, /* 模块心跳异常 */ - LPM3_S_EXCEPTION = 0x32, /* LPM3子系统检测到的各种异常 */ - TS_S_EXCEPTION = 0x33, /* TS子系统检测到的各种异常 */ - DVPP_S_EXCEPTION = 0x35, /* DVPP异常 */ - DRIVER_S_EXCEPTION = 0x36, /* DRIVER异常 */ - TEE_S_EXCEPTION = 0x38, /* teeos异常 */ - REBOOT_REASON_LABEL4 = 0x40, /* label4: */ - REBOOT_REASON_LABEL5 = 0x65, /* label5:电源异常 */ - REBOOT_REASON_LABEL6 = 0x6A, /* label6:xloader异常 */ - REBOOT_REASON_LABEL7 = 0x74, /* label7:fastboot异常 */ - REBOOT_REASON_LABEL8 = 0x89, /* label8: host侧异常 */ - DEVICE_LOAD_TIMEOUT = 0x8A, /* 设备启动超时 */ - DEVICE_HEAT_BEAT_LOST = 0x8B, /* 设备心跳丢失 */ - DEVICE_RESET_INFORM = 0x8C, /* 用户复位 */ - DEVICE_ADVANCED_ERR_REPORT = 0x8D, /* 设备AER错误 */ - REBOOT_REASON_LABEL9 = 0x90, /* label9: */ - REBOOT_REASON_LABEL10 = 0xB0, /* label10: */ - RDR_EXCEPTION_REASON_INVALID = 0xFF, -} EXCH_SOURCE; - -enum PROCESS_PRI { - RDR_OTHER = 0x0, /* 不确定 */ - RDR_NOTICE = 0x1, /* 提示 */ - RDR_MINOR = 0x2, /* 次要 */ - RDR_WARN = RDR_MINOR, - RDR_MAJOR = 0x3, /* 重要 */ - RDR_ERR = RDR_MAJOR, - RDR_CRITICAL = 0x4, /* 紧急 */ - RDR_DEAD = RDR_CRITICAL, - RDR_PPRI_MAX -}; - -enum REBOOT_PRI { - RDR_REBOOT_NOW = 0x01, /* 立即重启 */ - RDR_REBOOT_WAIT, /* 等待重启 */ - RDR_REBOOT_NO, /* 不重启 */ - RDR_REBOOT_MAX -}; - -enum REENTRANT { - RDR_REENTRANT_ALLOW = 0x01, /* 可重复触发的异常 */ - RDR_REENTRANT_DISALLOW /* 不可重复触发的异常 */ -}; - -#define MODULE_MAGIC 0xbaba0514 -#define MODULE_VALID 1 -#define MODULE_EXCEPTION_REGISTER_MAXNUM 512 - -struct exc_description_s { - u32 e_excepid; /* 异常id */ - u8 e_process_level; /* 异常处理级别:BBOX_PROCESS_PRI */ - u8 e_reboot_priority; /* 异常重启级别:BBOX_REBOOT_PRI */ - u8 e_excep_type; /* 异常类型 */ - u8 e_reentrant; /* 异常是否可重入 */ - u64 e_notify_core_mask; /* 异常联动掩码 */ - u8 e_desc[BBOX_EXCEPTIONDESC_MAXLEN]; /* 异常描述 */ -}; - -struct exc_info_s { - excep_time e_clock; /* 模块触发异常时间 */ - u32 e_excepid; /* 模块触发的异常id */ - u16 e_dump_status; /* 模块将异常信息存预留内存的控制状态 */ - u16 e_save_status; /* 代理将异常信息从预留内存导出的控制状态 */ -}; - -/* 通过共享内存注册异常 */ -struct exc_module_info_s { - u32 magic; /* 使用宏MODULE_MAGIC */ - u16 e_excep_valid; /* 模块写完注册的异常,则设置MODULE_VALID */ - u16 e_excep_num; /* 模块注册异常个数 */ - u8 e_from_module[BBOX_MODULE_NAME_LEN]; /* 模块名 */ - struct exc_info_s cur_info; /* 模块dump信息控制状态 */ - u32 e_mini_offset; /* 模块最小集异常信息偏移值,基于模块预留内存首地址,从magic开始 */ - u32 e_mini_len; /* 模块最小集异常信息长度 */ - u32 e_info_offset; /* 模块全部异常信息偏移值,基于模块预留内存首地址,从magic开始 */ - u32 e_info_len; /* 模块全部异常信息长度 */ - struct exc_description_s e_description[1]; /* 模块异常注册信息 */ -}; - -/* 通过注册函数注册异常 */ -struct rdr_ddr_module_info_s { - u32 magic; /* 使用宏MODULE_MAGIC */ - u32 e_mini_offset; /* 模块最小集异常信息偏移值,基于模块预留内存首地址,从magic开始 */ - u32 e_mini_len; /* 模块最小集异常信息长度 */ - u32 e_info_offset; /* 模块全部异常信息偏移值,基于模块预留内存首地址,从magic开始 */ - u32 e_info_len; /* 模块全部异常信息长度 */ -}; - -enum MODULE_DUMP_STATUS { - STATUS_INIT = 0, - STATUS_DOING = 1, - STATUS_DONE = 2, -}; -#endif - -#define RDR_MODULE_NAME_LEN 16 -#define RDR_EXCEPTIONDESC_MAXLEN 48 - -typedef void (*rdr_e_callback)(u32, void*); - -/* - * struct list_head e_list; - * u32 excepid, exception id; - * if excepid equal 0, will auto generation excepid, and return it. - * u32 excepid_end, can register exception id region. [excepid~excepid_end]; - need excepid_end >= excepid, - * if excepid_end equal 0, will be register excepid only, - but excepid & excepid_end cant equal 0 at the same time. - * u64 notify_core_mask, need notify other core mask - * u64 reset_core_mask, need reset other core mask - * u8 exce_type, the type of exception - * u8 from_core, the core of happen exception - * u8 process_priority, exception process priority - * u8 reboot_priority, exception reboot priority - * u8 reentrant, whether to allow exception reentrant - * char* from_module, the module of happen excption - * char* desc, the desc of happen excption - * rdr_e_callback callback, will be called when excption has processed. - */ -struct rdr_exception_info_s { - struct list_head e_list; - u32 e_excepid; - u32 e_excepid_end; - u64 e_notify_core_mask; - u64 e_reset_core_mask; - u8 e_exce_type; - u8 e_from_core; - u8 e_process_priority; - u8 e_reboot_priority; - u8 e_reentrant; - u8 e_from_module[RDR_MODULE_NAME_LEN]; - u8 e_desc[RDR_EXCEPTIONDESC_MAXLEN]; - rdr_e_callback e_callback; -}; - -/* - * @brief : module dump done, callback it, tell bbox dump done - * @param [in] : u32 excep_id exception id - * @param [in] : u8 core_id which core done - * @param [in] : u8 etype exception type - * @param [in] : excep_time *time exception time - * @return : NA - */ -typedef void (*pfn_cb_dump_done)(u32 excepid, u8 coreid, u8 etype, excep_time time); - -/* - * @brief : call module dump exception info - * the function over, need call fndone to mark dump over - * @param [in] : u32 excepid exception id - * @param [in] : u8 coreid exception core - * @param [in] : u8 etype exception type - * @param [in] : excep_time time exception time - * @param [in] : char* logpath exception log path - * @param [in] : pfn_cb_dump_done fndone - * @return : NA - */ -typedef void (*pfn_dump)(u32 excepid, u8 etype, u8 coreid, excep_time time, - char* logpath, pfn_cb_dump_done fndone); - -/* - * @brief : call module reset - * @param [in] : u32 excepid exception id - * @param [in] : u8 core_id exception core - * @param [in] : u8 etype exception type - * @return : NA - */ -typedef void (*pfn_reset)(u32 excepid, u8 etype, u8 coreid); - -struct rdr_module_ops { - pfn_dump ops_dump; - pfn_reset ops_reset; -}; - -struct rdr_register_module_result { - u64 log_vaddr; // reserved physical address - u32 log_len; // reserved physical address length -}; - -/* - * @brief : register exception - * @param [in] : struct rdr_exception_info_s* e exception info - * @return : excepid - * == 0 error; > 0 success - */ -u32 rdr_register_exception(struct rdr_exception_info_s *e); - -/* - * @brief : unregister exception - * @param [in] : u32 excep_id, exception id; - * @return : < 0 fail; >=0 success - */ -int rdr_unregister_exception(u32 excepid); - -/* - * @brief : register module - * @param [in] : u8 core_id core id - * @param [in] : struct rdr_module_ops* ops ops info - * @param [out] : struct rdr_register_module_result* retinfo return info - * @return : < 0 error; >=0 success - */ -int rdr_register_module_ops(u8 coreid, const struct rdr_module_ops* ops, struct rdr_register_module_result* retinfo); - -/* - * @brief : unregister module - * @param [in] :u8 core_id core id - * @return : < 0 fail; >=0 success - */ -int rdr_unregister_module_ops(u8 coreid); - -/* - * @brief : report exception - * @param [in] : u32 excep_id exception id - * @param [in] : excep_time timestamp exception time - * @param [in] : u32 arg arg - * @return : NA - */ -void mntn_system_error(u32 excep_id, excep_time timestamp, u32 arg); - -/* - * @brief : get arg value - * @param [in] : u32 excepid exception id - * @param [in] : u8 coreid exception core id - * @param [in] : excep_time timestamp exception time - * @param [out] : u32 *arg return arg value - * @return : NA - */ -int rdr_module_dump_get_arg(u32 excepid, u8 coreid, excep_time time, u32 *arg); - -#endif // BB_PUB_MINI_H - diff --git a/inc/toolchain/bbox/device/bbox_types.h b/inc/toolchain/bbox/device/bbox_types.h deleted file mode 100644 index b7d862f45..000000000 --- a/inc/toolchain/bbox/device/bbox_types.h +++ /dev/null @@ -1,66 +0,0 @@ -/** - * Copyright 2019-2020 Huawei Technologies Co., Ltd - * - * 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 RDR_TYPES_H -#define RDR_TYPES_H -#include - -typedef signed char s8; -typedef unsigned char u8; - -typedef signed short s16; -typedef unsigned short u16; - -typedef signed int s32; -typedef unsigned int u32; - -typedef signed long long s64; -typedef unsigned long long u64; - -typedef struct excep_time_t { - u64 tv_sec; - u64 tv_usec; -} excep_time; - -#define BBOX_TRUE 1 -#define BBOX_FALSE 0 - -#define BBOX_SUCCESS 0 -#define BBOX_FAILURE (-1) -#define BBOX_COMM_INVAL (-2) // communication failure -#define BBOX_COMM_TIMEOUT (-3) // communication timeout -#define BBOX_MSG_INVAL (-4) // message invalid -#define BBOX_MSG_NONE (-5) // no have data -#define BBOX_NO_SUPPORT (-10) // not support - -#define BBOX_DISALLOW_REETRANT 1 // return value - -#define BBOX_EOK 0 -#define BBOX_ENXIO (-6) // No such device or address -#define BBOX_ENODEV (-19) // No such device -#define BBOX_EINVAL (-22) // Invalid argument -#define BBOX_ENOSPC (-28) // No space left on device - -#define BBOX_NOTIFY_DONE (NOTIFY_DONE) -#define BBOX_NOTIFY_OK (NOTIFY_OK) - -#define BBOX_UCHAR_INVALID 0xFF -#define BBOX_UINT_INVALID 0xFFFFFFFF -#define BBOX_MODULE_NAME_LEN 16 -#define BBOX_EXCEPTIONDESC_MAXLEN 48 - -#endif // RDR_TYPES_H - diff --git a/inc/toolchain/ide_daemon_api.h b/inc/toolchain/ide_daemon_api.h deleted file mode 100644 index 929f5f782..000000000 --- a/inc/toolchain/ide_daemon_api.h +++ /dev/null @@ -1,177 +0,0 @@ -/** - * Copyright 2019-2020 Huawei Technologies Co., Ltd - * - * 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. - */ - -/** @defgroup dump dump接口 */ -#ifndef IDE_DAEMON_API_H -#define IDE_DAEMON_API_H - -#ifdef __cplusplus -extern "C" { -#endif - -/** - * @ingroup dump。 - * - * dump ip信息缓冲区长度 - */ -typedef void *IDE_SESSION; - -/** - * @ingroup dump。 - * - * dump ip信息缓冲区长度 - */ -#ifndef uint32_t -typedef unsigned int uint32_t; -#endif - -/** - * @ingroup dump。 - * - * dump ip信息缓冲区长度 - */ -#define IDE_DAEMON_IP_LEN (16) - -/** - * @ingroup dump。 - * - * dump 连接信息 - */ -typedef struct tagConnInfo { - char ip[IDE_DAEMON_IP_LEN]; /**< IP地址 */ - int port; /**< 端口号 */ - int deviceID; /**< 设备ID号 */ -} connInfo_t; - -/** - * @ingroup dump。 - * - * dump 错误信息 - */ -typedef enum tagIdeError { - IDE_DAEMON_NONE_ERROR = 0, /**< 无错误 */ - IDE_DAEMON_UNKNOW_ERROR = 1, /**< 未知错误 */ - IDE_DAEMON_WRITE_ERROR = 2, /**< 写入失败 */ - IDE_DAEMON_NO_SPACE_ERROR = 3, /**< 磁盘已满 */ - IDE_DAEMON_INVALID_PATH_ERROR = 4, /**< 无效路径 */ - IDE_DAEMON_INVALID_PARAM_ERROR = 5, /**< 无效参数 */ - IDE_DAEMON_TCP_CONNECT_ERROR = 6, /**< TCP连接失败 */ - IDE_DAEMON_TCP_CHANNEL_ERROR = 7, /**< TCP通道异常 */ - IDE_DAEMON_MALLOC_ERROR = 8, /**< 申请堆内存失败 */ - IDE_DAEMON_HDC_CHANNEL_ERROR = 9, /**< HDC通路异常 */ - IDE_DAEMON_CHANNEL_ERROR = 10, /**< 通路异常 */ - IDE_DAEMON_MKDIR_ERROR = 11, /**< 创建目录失败 */ - IDE_DAEMON_MEMCPY_ERROR = 12, /**< 内存拷贝失败 */ - IDE_DAEMON_MEMSET_ERROR = 13, /**< 内存清零失败 */ - IDE_DAEMON_INVALID_IP_ERROR = 14, /**< 无效的IP地址 */ - IDE_DAEMON_INTERGER_REVERSED_ERROR = 15, /**< 整形溢出 */ - IDE_DAEMON_DUMP_QUEUE_FULL = 16, /**< dump队列已满 */ - NR_IDE_DAEMON_ERROR, /**< 枚举最大值 */ -}ideError_t; - -/** - * @ingroup dump。 - * - * dump 错误信息 - */ -typedef ideError_t IdeErrorT; - -/** - * @ingroup dump。 - * - * dump回传数据块标识信息 - */ -enum IdeDumpFlag { - IDE_DUMP_NONE_FLAG = 0, /**< 无标志位 */ -}; - -/** - * @ingroup dump。 - * - * dump回传数据块 - */ -struct IdeDumpChunk { - char *fileName; /**< 文件名,绝对路径 */ - unsigned char *dataBuf; /**< 写入的数据Buffer */ - unsigned int bufLen; /**< 写入的数据Buffer长度 */ - unsigned int isLastChunk; /**< 是否最后一块数据 0:非最后一块数据;1:最后一块数据 */ - long long offset; /**< 文件写入的偏移位 -1为追加形式写入 */ - enum IdeDumpFlag flag; /**< 标志位 */ -}; - -/** - * @ingroup dump - * @par 描述: 创建Dump通路。 - * - * @attention 无 - * @param privInfo [IN] 启动Dump通路数据(格式host:port;device_id(HDC), local;device_id(Local)) - * @retval #非空 创建会话成功 - * @retval #NULL 创建会话失败 - * @par 依赖: - * @li ide_daemon_api.cpp:该接口所属的开发包。 - * @li ide_daemon_api.h:该接口声明所在的头文件。 - * @see 无 - * @since - */ -extern IDE_SESSION IdeDumpStart(const char *privInfo); - -/** - * @ingroup dump - * @par 描述: 进行数据Dump,Dump完成数据落盘后返回。 - * - * @attention 无 - * @param session [IN] 会话句柄 - * @param dumpChunk [IN] Dump的数据结构体 - * @retval #IDE_DAEMON_NONE_ERROR 写数据成功 - * @retval #IDE_DAEMON_INVALID_PARAM_ERROR 非法参数 - * @retval #IDE_DAEMON_UNKNOW_ERROR 写数据失败 - * @par 依赖: - * @li ide_daemon_api.cpp:该接口所属的开发包。 - * @li ide_daemon_api.h:该接口声明所在的头文件。 - * @see 无 - * @since - */ -extern IdeErrorT IdeDumpData(IDE_SESSION session, const struct IdeDumpChunk *dumpChunk); - -/** - * @ingroup dump - * @par 描述: 关闭Dump通路。 - * - * @attention 无 - * @param session [IN] 会话句柄 - * @retval #IDE_DAEMON_NONE_ERROR 关闭会话成功 - * @retval #IDE_DAEMON_INVALID_PARAM_ERROR 非法参数 - * @retval #IDE_DAEMON_UNKNOW_ERROR 关闭会话失败 - * @par 依赖: - * @li ide_daemon_api.cpp:该接口所属的开发包。 - * @li ide_daemon_api.h:该接口声明所在的头文件。 - * @see 无 - * @since - */ -extern IdeErrorT IdeDumpEnd(IDE_SESSION session); - -#ifdef __cplusplus -} -#endif - -#endif -/* - * History: \n - * 2018-10-10, huawei, 初始化该文件。 \n - * 2020-02-10, huawei, 更改API规范化。 \n - * - * vi: set expandtab ts=4 sw=4 tw=120: - */ diff --git a/inc/toolchain/ide_tlv.h b/inc/toolchain/ide_tlv.h deleted file mode 100644 index 044adcb50..000000000 --- a/inc/toolchain/ide_tlv.h +++ /dev/null @@ -1,79 +0,0 @@ -/** - * Copyright 2019-2020 Huawei Technologies Co., Ltd - * - * 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. - */ - -/** @defgroup adx ADX */ -#ifndef IDE_TLV_H -#define IDE_TLV_H - -/** - * @ingroup adx - * - * adx 命令请求列表 - */ -enum cmd_class { - IDE_EXEC_COMMAND_REQ = 0, /**< 执行device命令请求\n */ - IDE_SEND_FILE_REQ, /**< 发送文件到device命令请求\n */ - IDE_DEBUG_REQ, /**< Debug命令请求\n */ - IDE_BBOX_REQ, /**< Bbox命令请求\n */ - IDE_LOG_REQ, /**< Log命令请求\n */ - IDE_PROFILING_REQ, /**< Profiling命令请求\n */ - IDE_OME_DUMP_REQ, /**< Ome dump命令请求\n */ - IDE_FILE_SYNC_REQ, /**< 发送文件到AiHost 命令请求\n */ - IDE_EXEC_API_REQ, /**< 执行AiHost Api命令请求\n */ - IDE_EXEC_HOSTCMD_REQ, /**< 执行AiHost 命令命令请求\n */ - IDE_DETECT_REQ, /**< 执行AiHost 通路命令请求\n */ - IDE_FILE_GET_REQ, /**< 获取AiHost侧文件命令请求\n */ - IDE_NV_REQ, /**< 执行AiHost Nv命令请求\n */ - IDE_DUMP_REQ, /**< Dump命令请求\n */ - IDE_FILE_GETD_REQ, /**< 获取Device侧文件命令请求\n */ - IDE_INVALID_REQ, /**< 无效命令请求\n */ - NR_IDE_CMD_CLASS, /**< 标识命令请求最大值\n */ -}; - -/** - * @ingroup adx - * - * adx 命令请求列表 - */ -typedef enum cmd_class CmdClassT; - -/** - * @ingroup adx - * - * adx 数据交互格式 - */ -struct tlv_req { - enum cmd_class type; /**< 数据包命令类型 */ - int dev_id; /**< 设备 ID */ - int len; /**< 数据包数据长度 */ - char value[0]; /**< 数据包数据 */ -}; - -/** - * @ingroup adx - * - * adx 数据交互格式 - */ -typedef struct tlv_req TlvReqT; - -#endif -/* - * History: \n - * 2018-10-10, huawei, 初始化该文件。 \n - * 2020-02-10, huawei, 更改API规范化。 \n - * - * vi: set expandtab ts=4 sw=4 tw=120: - */ diff --git a/inc/toolchain/prof_acl_api.h b/inc/toolchain/prof_acl_api.h deleted file mode 100644 index 74f660650..000000000 --- a/inc/toolchain/prof_acl_api.h +++ /dev/null @@ -1,51 +0,0 @@ -/** - * Copyright 2019-2020 Huawei Technologies Co., Ltd - * - * 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 MSPROF_ENGINE_PROF_ACL_API_H_ -#define MSPROF_ENGINE_PROF_ACL_API_H_ - -#define MSVP_PROF_API __attribute__((visibility("default"))) - -#include -#include - -/** - * @name ProrErrorCode - * @brief error code of prof_acl_apis - */ -enum ProfErrorCode { - PROF_ERROR_NONE = 0, // ok - PROF_ERROR_PARAM_INVALID, // param invalid, for example nullptr - PROF_ERROR_REPEAT_INIT, // profiling has already been inited - PROF_ERROR_CONFIG_INVALID, // config invalid, for example invalid json string - PROF_ERROR_DIR_NO_ACCESS, // dir is not accessable - PROF_ERROR_FAILURE, // failed to init or start profiling - PROF_ERROR_NOT_INITED, // profiling has not been inited - PROF_ERROR_DEVICE_INVALID, // device id invalid - PROF_ERROR_UNSUPPORTED, // unsupported data type or ai core metrics - PROF_ERROR_REPEAT_START, // profiilng has already been started - PROF_ERROR_NOT_STARTED, // profiling has not been started -}; - -/** - * @brief transfer profiling config in acl.json to sample config - * @param aclCfg [IN] profiling json string from acl.json as {"switch":"on", "result_path":"/home",...} - * @param sampleCfg [OUT] json string for GE as {"startCfg":[{"deviceID":"all","jobID":"1234",...}]} - * @return ProfErrorCode - */ -MSVP_PROF_API int32_t ProfAclCfgToSampleCfg(const std::string &aclCfg, std::string &sampleCfg); - -#endif // MSPROF_ENGINE_PROF_ACL_API_H_ diff --git a/inc/toolchain/profiler_client.h b/inc/toolchain/profiler_client.h deleted file mode 100644 index 0176b10e6..000000000 --- a/inc/toolchain/profiler_client.h +++ /dev/null @@ -1,102 +0,0 @@ -/** - * Copyright 2019-2020 Huawei Technologies Co., Ltd - * - * 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 PROFILER_CLIENT_H_INCLUDED -#define PROFILER_CLIENT_H_INCLUDED - -#ifdef __cplusplus -extern "C" { -#endif // __cplusplus - -#ifdef WIN32 -#ifdef PROFILERCLIENT_EXPORTS -#define MSVP_PROF_CLN_API __declspec(dllexport) -#else -#define MSVP_PROF_CLN_API __declspec(dllimport) -#endif -#else -#define MSVP_PROF_CLN_API -#endif -/** - * the data structure to write - */ -struct data_chunk { - char* relative_file_name;// from subpath begin; For example: subA/subB/example.txt; Note: the begin don't has '/'; - unsigned char* data_buf;// the pointer to the data - unsigned int buf_len;// the len of data_buf - unsigned int is_last_chunk;// = 1, the last chunk of the file; != 1, not the last chunk of the file - long long offset;// the begin location of the file to write; if the offset is -1, directly append data. -}; - -struct collect_dev_info_s { - int dev_id; -}; - -/** \brief use it to connect the server. - * - * \param const unsigned char* target: The engine gets it from ENV. Don't need care about it. - * \param const unsigned char* engine_name: For example OME;CCE; Runtime;Matrix... - * \return the return value void* point the client handle - * - */ - -MSVP_PROF_CLN_API extern void* create_collect_client(const char* target, const char* engine_name); - -/** \brief notify profiling the device list - * - * \param void* handle: the return value of the create_collect_client function - * \param const char* job_ctx: identifies profiling job - * \param const collect_dev_info_s* dev_list: pointer to the device list - * \param int dev_num: the device number - * \return 0 on success - */ -MSVP_PROF_CLN_API extern int collect_host_sync_dev_list(void* handle, const char* job_ctx, const collect_dev_info_s* dev_list, int dev_num); - -/** \brief write data by this function to transfer - * - * \param void* handle: the return value of the create_collect_client function - * \param struct data_chunk* data: record the value to restore the sampling data - * \param const unsigned char* job_ctx: The engine gets it from ENV. Don't need care about it. Represent the context about profiling job. - * \return On success, the number of bytes written is returned(zero indicates nothing was written); On error, <0 is returned, and the value is set appropriately. - * - */ - -MSVP_PROF_CLN_API extern int collect_write(void* handle, const char* job_ctx, struct data_chunk* data); - -/** \brief release the handle - * - * \param void* handle: the return value of the create_collect_client function - * \return - * - */ - -MSVP_PROF_CLN_API extern void release_collect_client(void* handle); - -/** \brief update job ctx for specific device, colllect_update_job_ctx uses malloc() to allocate a buffer to hold the - * new job_ctx and return a pointer to the buffer. The caller should deallocate this buffer using free() - * - * \param const char* job_ctx: pointer to current job_ctx - * \param collect_ctx_info* info: update job_ctx with the info - * \return pointer to buffer which holds the new job_ctx - */ -MSVP_PROF_CLN_API extern char* collect_dev_update_job_ctx(const char* job_ctx, const collect_dev_info_s * info); -#ifdef __cplusplus -} -#endif // __cplusplus - -#endif // PROFILER_CLIENT_H_INCLUDED - - -- Gitee