@@ -27,16 +27,16 @@ | |||||
#include "common/cust_aicpu_kernel_store.h" | #include "common/cust_aicpu_kernel_store.h" | ||||
#include "framework/common/debug/log.h" | #include "framework/common/debug/log.h" | ||||
#include "framework/common/fmk_error_codes.h" | #include "framework/common/fmk_error_codes.h" | ||||
#include "framework/common/ge_types.h" | |||||
#include "graph/buffer.h" | #include "graph/buffer.h" | ||||
#include "external/graph/graph.h" | #include "external/graph/graph.h" | ||||
#include "proto/task.pb.h" | #include "proto/task.pb.h" | ||||
namespace ge { | namespace ge { | ||||
const uint32_t INVALID_MODEL_ID = 0xFFFFFFFFUL; | |||||
class GeModel : public AttrHolder { | class GeModel : public AttrHolder { | ||||
public: | public: | ||||
GeModel(); | GeModel(); | ||||
~GeModel() = default; | |||||
~GeModel() override = default; | |||||
GeModel(const GeModel &other) = delete; | GeModel(const GeModel &other) = delete; | ||||
GeModel &operator=(const GeModel &other) = delete; | GeModel &operator=(const GeModel &other) = delete; | ||||
@@ -57,10 +57,13 @@ class GeModel : public AttrHolder { | |||||
void SetCustAICPUKernelStore(const CustAICPUKernelStore &cust_aicpu_kernal_store); | void SetCustAICPUKernelStore(const CustAICPUKernelStore &cust_aicpu_kernal_store); | ||||
void SetWeight(const Buffer &weights_buffer); | void SetWeight(const Buffer &weights_buffer); | ||||
bool LoadTBEKernelStore(const uint8_t *const data, const size_t len); | |||||
bool loadAICPUKernelStore(const uint8_t *const data, const size_t len); | |||||
void SetName(const std::string &name); | void SetName(const std::string &name); | ||||
void SetVersion(uint32_t version); | |||||
void SetVersion(const uint32_t version); | |||||
void SetPlatformVersion(const std::string &platform_version); | void SetPlatformVersion(const std::string &platform_version); | ||||
void SetPlatformType(uint8_t platform_type); | |||||
void SetPlatformType(const uint8_t platform_type); | |||||
void SetAttr(const ProtoAttrMap &attrs); | void SetAttr(const ProtoAttrMap &attrs); | ||||
@@ -70,13 +73,10 @@ class GeModel : public AttrHolder { | |||||
using AttrHolder::GetAllAttrs; | using AttrHolder::GetAllAttrs; | ||||
using AttrHolder::GetAllAttrNames; | using AttrHolder::GetAllAttrNames; | ||||
void SetModelId(uint32_t model_id) { model_id_ = model_id; } | |||||
void SetModelId(const uint32_t model_id) { model_id_ = model_id; } | |||||
uint32_t GetModelId() const { return model_id_; } | uint32_t GetModelId() const { return model_id_; } | ||||
Status GetSessionId(uint32_t model_id, uint64_t &session_id) const; | |||||
void InsertSessionMap(uint32_t model_id, uint64_t session_id) { | |||||
model_id_to_session_id_map_.insert({model_id, session_id}); | |||||
} | |||||
Status GetSessionId(const uint32_t model_id, uint64_t &session_id) const; | |||||
protected: | protected: | ||||
ConstProtoAttrMap &GetAttrMap() const override; | ConstProtoAttrMap &GetAttrMap() const override; | ||||
@@ -93,9 +93,9 @@ class GeModel : public AttrHolder { | |||||
Buffer weights_buffer_; /*lint !e148*/ | Buffer weights_buffer_; /*lint !e148*/ | ||||
std::string name_; | std::string name_; | ||||
uint32_t version_ = {0}; | |||||
uint32_t version_ = {0U}; | |||||
std::string platform_version_; | std::string platform_version_; | ||||
uint8_t platform_type_ = {0}; | |||||
uint8_t platform_type_ = {0U}; | |||||
uint32_t model_id_ = INVALID_MODEL_ID; | uint32_t model_id_ = INVALID_MODEL_ID; | ||||
std::map<uint32_t, uint64_t> model_id_to_session_id_map_; | std::map<uint32_t, uint64_t> model_id_to_session_id_map_; | ||||
}; | }; | ||||
@@ -1,50 +0,0 @@ | |||||
/** | |||||
* 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 | |||||
* | |||||
* 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 AICPU_OP_TYPE_LIST_H_ | |||||
#define AICPU_OP_TYPE_LIST_H_ | |||||
extern "C" { | |||||
enum OpKernelType { TF_KERNEL, CPU_KERNEL }; | |||||
enum ReturnCode { OP_TYPE_NOT_SUPPORT, FORMAT_NOT_SUPPORT, DTYPE_NOT_SUPPORT }; | |||||
#pragma pack(push, 1) | |||||
// One byte alignment | |||||
struct SysOpInfo { | |||||
uint64_t opLen; | |||||
uint64_t opType; | |||||
OpKernelType kernelsType; | |||||
}; | |||||
struct SysOpCheckInfo { | |||||
uint64_t opListNum; | |||||
uint64_t offSetLen; | |||||
uint64_t sysOpInfoList; | |||||
uint64_t opParamInfoList; | |||||
}; | |||||
struct SysOpCheckResp { | |||||
uint64_t opListNum; | |||||
bool isWithoutJson; | |||||
uint64_t returnCodeList; | |||||
uint64_t sysOpInfoList; | |||||
uint64_t opParamInfoList; | |||||
}; | |||||
#pragma pack(pop) | |||||
} | |||||
#endif // AICPU_OP_TYPE_LIST_H_ |
@@ -1,104 +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 AICPU_TASK_STRUCT_H | |||||
#define AICPU_TASK_STRUCT_H | |||||
#include <cstdint> | |||||
namespace aicpu { | |||||
using char_t = char; | |||||
#pragma pack(push, 1) | |||||
struct AicpuParamHead { | |||||
uint32_t length; // Total length: include cunstom message | |||||
uint32_t ioAddrNum; // Input and output address number | |||||
uint32_t extInfoLength; // extInfo struct Length | |||||
uint64_t extInfoAddr; // extInfo address | |||||
}; | |||||
enum class AicpuConfigMsgType { | |||||
AICPU_CONFIG_MSG_TYPE_BUF_FREE = 0, /* free buf */ | |||||
AICPU_CONFIG_MSG_TYPE_BUF_RESET = 1, /* reset buf */ | |||||
AICPU_CONFIG_MSG_TYPE_BUF_SET_ADDR = 2, /* set buf addr to aicpu */ | |||||
}; | |||||
enum class AicpuErrMsgType { | |||||
ERR_MSG_TYPE_NULL = 0, | |||||
ERR_MSG_TYPE_AICORE = 1, | |||||
ERR_MSG_TYPE_AICPU = 2, | |||||
}; | |||||
enum class AicpuExtInfoMsgType { | |||||
EXT_MODEL_ID_MSG_TYPE = 0, | |||||
}; | |||||
struct AicpuConfigMsg { | |||||
uint8_t msgType; | |||||
uint8_t reserved1; | |||||
uint16_t bufLen; | |||||
uint32_t offset; | |||||
uint64_t bufAddr; | |||||
uint32_t tsId; | |||||
uint32_t reserved2; | |||||
}; | |||||
struct AicpuModelIdInfo { | |||||
uint32_t modelId; | |||||
uint32_t extendModelId; | |||||
uint32_t extendInfo[13]; | |||||
}; | |||||
// 64 bytes | |||||
struct AicpuExtendInfo { | |||||
uint8_t msgType; | |||||
uint8_t version; | |||||
uint8_t reserved[2]; | |||||
union { | |||||
AicpuModelIdInfo modelIdMap; | |||||
}; | |||||
}; | |||||
struct AicoreErrMsgInfo { | |||||
uint8_t errType; | |||||
uint8_t version; | |||||
uint8_t reserved1[2]; /* reserved1, 4 byte alignment */ | |||||
uint32_t errorCode; | |||||
uint32_t modelId; | |||||
uint32_t taskId; | |||||
uint32_t streamId; | |||||
uint64_t transactionId; | |||||
uint8_t reserved2[228]; /* the total byte is 256, reserved2 len = 256 - other lens */ | |||||
}; | |||||
struct AicpuErrMsgInfo { | |||||
uint8_t errType; | |||||
uint8_t version; | |||||
uint8_t reserved1[2]; /* reserved1, 4 byte alignment */ | |||||
uint32_t errorCode; | |||||
uint32_t modelId; | |||||
uint32_t streamId; | |||||
uint64_t transactionId; | |||||
char_t opName[64]; /* op name str */ | |||||
char_t errDesc[128]; /* err msg desc info */ | |||||
uint8_t reserved2[40]; /* the total byte is 256, reserved2 len = 256 - other lens */ | |||||
}; | |||||
#pragma pack(pop) | |||||
} // namespace aicpu | |||||
#endif // AICPU_TASK_STRUCT_H |
@@ -1,48 +0,0 @@ | |||||
/** | |||||
* Copyright (c) Huawei Technologies Co., Ltd. 2021. 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. | |||||
* | |||||
* Description:interface. | |||||
* Create: 2021-12-21 | |||||
*/ | |||||
#ifndef AICPU_TYPE_DEF_H | |||||
#define AICPU_TYPE_DEF_H | |||||
#include <cstdint> | |||||
#include <cstddef> | |||||
#ifndef char_t | |||||
typedef char char_t; | |||||
#endif | |||||
#ifndef float32_t | |||||
typedef float float32_t; | |||||
#endif | |||||
#ifndef float64_t | |||||
typedef double float64_t; | |||||
#endif | |||||
inline uint64_t PtrToValue(const void *ptr) { | |||||
return static_cast<const uint64_t>(reinterpret_cast<const uintptr_t>(ptr)); | |||||
} | |||||
inline void *ValueToPtr(const uint64_t value) { | |||||
return reinterpret_cast<void *>(static_cast<const uintptr_t>(value)); | |||||
} | |||||
template <typename TI, typename TO> | |||||
inline TO *PtrToPtr(TI *ptr) { | |||||
return reinterpret_cast<TO *>(ptr); | |||||
} | |||||
template <typename T> | |||||
inline T *PtrAdd(T *const ptr, const size_t maxIdx, const size_t idx) { | |||||
if ((ptr != nullptr) && (idx < maxIdx)) { | |||||
return reinterpret_cast<T *>(ptr + idx); | |||||
} | |||||
return nullptr; | |||||
} | |||||
#endif // AICPU_TYPE_DEF_H |
@@ -1,29 +0,0 @@ | |||||
/** | |||||
* Copyright (c) Hisilicon Technologies Co., Ltd. 2019-2021. All rights reserved. | |||||
* | |||||
* Licensed under the Apache License, Version 2.0 (the "License"); | |||||
* you may not use this file except in compliance with the License. | |||||
* You may obtain a copy of the License at | |||||
* | |||||
* http://www.apache.org/licenses/LICENSE-2.0 | |||||
* | |||||
* Unless required by applicable law or agreed to in writing, software | |||||
* distributed under the License is distributed on an "AS IS" BASIS, | |||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. | |||||
* See the License for the specific language governing permissions and | |||||
* limitations under the License. | |||||
*/ | |||||
#ifndef INC_TDT_STATUS_H | |||||
#define INC_TDT_STATUS_H | |||||
#include "common/type_def.h" | |||||
namespace tsd { | |||||
#ifdef __cplusplus | |||||
using TSD_StatusT = uint32_t; | |||||
#else | |||||
typedef uint32_t TSD_StatusT; | |||||
#endif | |||||
// success code | |||||
constexpr TSD_StatusT TSD_OK = 0U; | |||||
} // namespace tsd | |||||
#endif // INC_TDT_STATUS_H |