Browse Source

rm macro

tags/v1.2.0
chenyemeng 3 years ago
parent
commit
739849bc74
17 changed files with 460 additions and 203 deletions
  1. +1
    -1
      metadef
  2. +1
    -1
      parser
  3. +60
    -60
      third_party/fwkacllib/inc/aicpu/aicpu_schedule/aicpu_op_type_list.h
  4. +26
    -102
      third_party/fwkacllib/inc/hccl/hcom.h
  5. +2
    -1
      third_party/fwkacllib/inc/mmpa/sub_inc/mmpa_linux.h
  6. +1
    -0
      third_party/fwkacllib/inc/mmpa/sub_inc/mmpa_win.h
  7. +49
    -0
      third_party/fwkacllib/inc/register/op_kernel_registry.h
  8. +96
    -0
      third_party/fwkacllib/inc/register/op_registry.h
  9. +8
    -17
      third_party/fwkacllib/inc/runtime/base.h
  10. +5
    -1
      third_party/fwkacllib/inc/runtime/config.h
  11. +1
    -1
      third_party/fwkacllib/inc/runtime/context.h
  12. +1
    -1
      third_party/fwkacllib/inc/runtime/dev.h
  13. +1
    -1
      third_party/fwkacllib/inc/runtime/kernel.h
  14. +17
    -17
      third_party/fwkacllib/inc/runtime/mem.h
  15. +1
    -0
      third_party/fwkacllib/inc/runtime/stream.h
  16. +52
    -0
      third_party/fwkacllib/inc/soft_dp/ExternalSoftDp.h
  17. +138
    -0
      third_party/fwkacllib/inc/toolchain/slog.h

+ 1
- 1
metadef

@@ -1 +1 @@
Subproject commit fe37bc343ea52c76d35e9e9ec83cea0151bfa900
Subproject commit f08320a6d699f5b537bf66da572bf225b9cd330e

+ 1
- 1
parser

@@ -1 +1 @@
Subproject commit 336cd3107253d3fe41cfb9fec2db62b5f3d8a33b
Subproject commit b2df31dc5810283e2e483df5ba9517e2ece132a0

+ 60
- 60
third_party/fwkacllib/inc/aicpu/aicpu_schedule/aicpu_op_type_list.h View File

@@ -1,60 +1,60 @@
/**
* 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_OP_TYPE_LIST_H_
#define AICPU_OP_TYPE_LIST_H_
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 OpParamInfo {
uint64_t num;
uint64_t dtypeList;
uint64_t formatList;
};
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_
/**
* 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_OP_TYPE_LIST_H_
#define AICPU_OP_TYPE_LIST_H_
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 OpParamInfo {
uint64_t num;
uint64_t dtypeList;
uint64_t formatList;
};
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_

+ 26
- 102
third_party/fwkacllib/inc/hccl/hcom.h View File

@@ -33,15 +33,6 @@ extern "C" {



/**
* @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
*/
HcclResult hcom_get_rank_size(const char *group, u32 *rankSize);

/**
* @brief Get the rank number in the group.
*
@@ -51,15 +42,6 @@ HcclResult hcom_get_rank_size(const char *group, u32 *rankSize);
*/
HcclResult HcomGetRankSize(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
*/
HcclResult hcom_get_local_rank_size(const char *group, u32 *localRankSize);

/**
* @brief Get the rank number of this rank's server within the group.
*
@@ -69,15 +51,6 @@ HcclResult hcom_get_local_rank_size(const char *group, u32 *localRankSize);
*/
HcclResult HcomGetLocalRankSize(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
*/
HcclResult hcom_get_rank_id(const char *group, u32 *rankId);

/**
* @brief Get the rank id of this rank.
*
@@ -87,15 +60,6 @@ HcclResult hcom_get_rank_id(const char *group, u32 *rankId);
*/
HcclResult HcomGetRankId(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
*/
HcclResult hcom_get_local_rank_id(const char *group, u32 *localRankId);

/**
* @brief Get the local rank id of this rank's server within the group.
*
@@ -105,16 +69,6 @@ HcclResult hcom_get_local_rank_id(const char *group, u32 *localRankId);
*/
HcclResult HcomGetLocalRankId(const char *group, u32 *localRankId);

/**
* @brief Get the world rank id according to the group rank id.
*
* @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
*/
HcclResult hcom_get_world_rank_from_group_rank(const char *group, u32 groupRank, u32 *worldRank);

/**
* @brief Get the world rank id according to the group rank id.
*
@@ -125,16 +79,6 @@ HcclResult hcom_get_world_rank_from_group_rank(const char *group, u32 groupRank,
*/
HcclResult HcomGetWorldRankFromGroupRank(const char *group, u32 groupRank, u32 *worldRank);

/**
* @brief Get the group rank id according to the world rank id.
*
* @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
*/
HcclResult hcom_get_group_rank_from_world_rank(u32 worldRank, const char *group, u32 *groupRank);

/**
* @brief Get the group rank id according to the world rank id.
*
@@ -145,16 +89,6 @@ HcclResult hcom_get_group_rank_from_world_rank(u32 worldRank, const char *group,
*/
HcclResult HcomGetGroupRankFromWorldRank(u32 worldRank, const char *group, u32 *groupRank);

/**
* @brief Create group.
*
* @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
*/
HcclResult hcom_create_group(const char *group, u32 rankNum, u32 *rankIds);

/**
* @brief Create group.
*
@@ -165,14 +99,6 @@ HcclResult hcom_create_group(const char *group, u32 rankNum, u32 *rankIds);
*/
HcclResult HcomCreateGroup(const char *group, u32 rankNum, u32 *rankIds);

/**
* @brief Destroy group
*
* @param group A string identifying the group name.
* @return HcclResult
*/
HcclResult hcom_destroy_group(const char *group);

/**
* @brief Destroy group
*
@@ -189,46 +115,54 @@ HcclResult HcomDestroyGroup(const char *group);
* @param IdxList A list identifying the index of end gradient in each segment.
* @return HcclResult
*/
extern HcclResult hcom_set_split_strategy_by_index(const char *group, u32 segmentNum, const u32 *IdxList);
extern HcclResult HcomSetGradFusionByIndex(const char *group, u32 segmentNum, const u32 *IdxList);

/**
* @brief Set the gradient split strategy with in the group, according to gradient index.
* @brief Set the gradient split strategy with in the group, according to gradient data size.
*
* @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.
* @param sizeList A list identifying the percent of each segment.
* @return HcclResult
*/
extern HcclResult HcomSetGradFusionByIndex(const char *group, u32 segmentNum, const u32 *IdxList);
extern HcclResult HcomSetGradFusionBySize(const char *group, u32 segmentNum, const float *sizeList);

/**
* @brief Set the gradient split strategy with in the group, according to gradient data size.
* @brief Initialize hcom executor.
*
* @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.
* @param void
* @return HcclResult
*/
extern HcclResult hcom_set_split_strategy_by_size(const char *group, u32 segmentNum, const float *sizeList);
HcclResult HcomExecInitialize();

/**
* @brief Set the gradient split strategy with in the group, according to gradient data size.
* @brief Finalize hcom executor.
*
* @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.
* @param void
* @return HcclResult
*/
extern HcclResult HcomSetGradFusionBySize(const char *group, u32 segmentNum, const float *sizeList);
HcclResult HcomExecFinalize();

/**
* @brief Register memories and init resources for remote access.
* @brief Put collective communication operation into hcom executor.
*
* @param addrList memory addresses for remote access.
* @param count number of remote memory addresses.
* @param opInfo information about collective communication operation.
* @param callback callback after collective communication operation.
* @return HcclResult
*/
extern HcclResult hcom_remote_access_mem_register(const MemRegisterAddr* addrList, u32 count);
HcclResult HcomExecEnqueueOperation(HcomOperation opInfo, std::function<void(HcclResult status)> callback);

/**
* @brief Put remote access operation into hcom executor.
*
* @param remoteAccessType operation type (read or write).
* @param addrInfos address information about collective communication operation.
* @param callback callback after collective communication operation.
* @return HcclResult
*/
HcclResult HcomExecEnqueueRemoteAccess(const std::string& remoteAccessType,
const std::vector<HcomRemoteAccessAddrInfo>& addrInfos,
std::function<void(HcclResult status)> callback);

/**
* @brief Register memories and init resources for remote access.
@@ -239,16 +173,6 @@ extern HcclResult hcom_remote_access_mem_register(const MemRegisterAddr* addrLis
*/
extern HcclResult HcomRegRemoteAccessMem(const MemRegisterAddr* addrList, u32 count);

HcclResult HcomExecInitialize();

HcclResult HcomExecFinalize();

HcclResult HcomExecEnqueueOperation(HcomOperation opInfo, std::function<void(HcclResult status)> callback);

HcclResult HcomExecEnqueueRemoteAccess(const std::string& remoteAccessType,
const std::vector<HcomRemoteAccessAddrInfo>& addrInfos,
std::function<void(HcclResult status)> callback);

#ifdef __cplusplus
}
#endif // __cplusplus


+ 2
- 1
third_party/fwkacllib/inc/mmpa/sub_inc/mmpa_linux.h View File

@@ -279,8 +279,9 @@ typedef struct {
#define M_NAME_MAX MAX_FNAME

#define M_F_OK F_OK
#define M_R_OK R_OK
#define M_X_OK X_OK
#define M_W_OK W_OK
#define M_R_OK R_OK

#define MM_DT_DIR DT_DIR
#define MM_DT_REG DT_REG


+ 1
- 0
third_party/fwkacllib/inc/mmpa/sub_inc/mmpa_win.h View File

@@ -322,6 +322,7 @@ typedef VOID (*mmPf)(VOID);
#define M_NAME_MAX _MAX_FNAME

#define M_F_OK 0
#define M_X_OK 1
#define M_W_OK 2
#define M_R_OK 4



+ 49
- 0
third_party/fwkacllib/inc/register/op_kernel_registry.h View File

@@ -0,0 +1,49 @@
/**
* 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_REGISTER_OP_KERNEL_REGISTRY_H_
#define INC_REGISTER_OP_KERNEL_REGISTRY_H_
#include <memory>
#include <string>
#include "register/register_types.h"
#include "register.h"

namespace ge {
class FMK_FUNC_HOST_VISIBILITY FMK_FUNC_DEV_VISIBILITY OpKernelRegistry {
public:
using CreateFn = HostCpuOp* (*)();
~OpKernelRegistry();

static OpKernelRegistry& GetInstance() {
static OpKernelRegistry instance;
return instance;
}

bool IsRegistered(const std::string &op_type);

void RegisterHostCpuOp(const std::string &op_type, CreateFn create_fn);

std::unique_ptr<HostCpuOp> CreateHostCpuOp(const std::string &op_type);

private:
OpKernelRegistry();
class OpKernelRegistryImpl;
/*lint -e148*/
std::unique_ptr<OpKernelRegistryImpl> impl_;
};
} // namespace ge

#endif // INC_REGISTER_OP_KERNEL_REGISTRY_H_

+ 96
- 0
third_party/fwkacllib/inc/register/op_registry.h View File

@@ -0,0 +1,96 @@
/**
* 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_REGISTER_OP_REGISTRY_H_
#define INC_REGISTER_OP_REGISTRY_H_

#include <limits.h>
#include <set>
#include <string>
#include <unordered_map>
#include <vector>

#include "register/register.h"

namespace domi {
enum RemoveInputType {
OMG_MOVE_TYPE_DTYPE = 0,
OMG_MOVE_TYPE_VALUE,
OMG_MOVE_TYPE_SHAPE,
OMG_MOVE_TYPE_FORMAT,
OMG_MOVE_TYPE_AXIS,
OMG_MOVE_TYPE_SCALAR_VALUE,
OMG_REMOVE_TYPE_WITH_COND = 1000,
OMG_REMOVE_INPUT_WITH_ORIGINAL_TYPE,
OMG_INPUT_REORDER,
};

struct RemoveInputConfigure {
int inputIdx = INT_MAX;
std::string attrName;
RemoveInputType moveType;
bool attrValue = false;
std::string originalType;
std::vector<int> input_order;
};

class FMK_FUNC_HOST_VISIBILITY FMK_FUNC_DEV_VISIBILITY OpRegistry {
public:
static OpRegistry *Instance();

std::vector<OpRegistrationData> registrationDatas;

bool Register(const OpRegistrationData &reg_data);

domi::ImplyType GetImplyType(const std::string &op_type);

void GetOpTypeByImplyType(std::vector<std::string> &vec_op_type, const domi::ImplyType &imply_type);

domi::ParseParamFunc GetParseParamFunc(const std::string &op_type, const std::string &ori_type);

domi::ParseParamByOpFunc GetParseParamByOperatorFunc(const std::string &ori_type);

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);

Status GetParseSubgraphPostFunc(const std::string &op_type, domi::ParseSubgraphFuncV2 &parse_subgraph_func);

domi::ImplyType GetImplyTypeByOriOpType(const std::string &ori_optype);

const std::vector<RemoveInputConfigure> &GetRemoveInputConfigure(const std::string &ori_optype) const;

bool GetOmTypeByOriOpType(const std::string &ori_optype, std::string &om_type);

ParseOpToGraphFunc GetParseOpToGraphFunc(const std::string &op_type, const std::string &ori_type);

private:
std::unordered_map<std::string, domi::ImplyType> op_run_mode_map_;
std::unordered_map<std::string, ParseParamFunc> op_parse_params_fn_map_;
std::unordered_map<std::string, ParseParamByOpFunc> parse_params_by_op_func_map_;
std::unordered_map<std::string, FusionParseParamFunc> fusion_op_parse_params_fn_map_;
std::unordered_map<std::string, FusionParseParamByOpFunc> fusion_parse_params_by_op_fn_map_;
std::unordered_map<std::string, ParseSubgraphFunc> op_types_to_parse_subgraph_post_func_;
std::unordered_map<std::string, std::vector<RemoveInputConfigure>> remove_input_configure_map_;
std::unordered_map<std::string, std::string> origin_type_to_om_type_;
std::unordered_map<std::string, ParseOpToGraphFunc> parse_op_to_graph_fn_map_;
std::unordered_map<std::string, ParseSubgraphFuncV2> op_types_to_parse_subgraph_post_func_v2_;
};
} // namespace domi
#endif // INC_REGISTER_OP_REGISTRY_H_

+ 8
- 17
third_party/fwkacllib/inc/runtime/base.h View File

@@ -81,26 +81,17 @@ typedef enum tagRtLimitType {
} rtLimitType_t;

typedef struct rtExceptionInfo {
uint32_t taskid;
uint32_t streamid;
uint32_t tid;
uint32_t deviceid;
uint32_t taskid;
uint32_t streamid;
uint32_t tid;
uint32_t deviceid;
uint32_t retcode;
} rtExceptionInfo;

typedef struct rtTaskFailInfo {
uint32_t taskid;
uint32_t streamid;
uint32_t tid;
uint32_t deviceid;
uint32_t retcode;
} rtTaskFailInfo;

typedef void (*rtErrorCallback)(rtExceptionType);

typedef void (*rtTaskFailCallback)(rtExceptionInfo *exceptionInfo);

typedef void (*rtTaskFailCallbackByModule)(rtTaskFailInfo *exceptionInfo);

typedef void (*rtDeviceStateCallback)(uint32_t devId, bool isOpen);

/**
@@ -143,13 +134,13 @@ 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);
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);
RTS_API rtError_t rtProfilerStop(uint64_t profConfig, int32_t numsDev, uint32_t *deviceList);

/**
* @ingroup profiling_base
@@ -209,7 +200,7 @@ RTS_API rtError_t rtRegDeviceStateCallback(const char *regName, rtDeviceStateCal
* @param [out] NA
* @return RT_ERROR_NONE for ok
*/
RTS_API rtError_t rtRegTaskFailCallbackByModule(const char *moduleName, rtTaskFailCallbackByModule callback);
RTS_API rtError_t rtRegTaskFailCallbackByModule(const char *moduleName, rtTaskFailCallback callback);

/**
* @ingroup dvrt_base


+ 5
- 1
third_party/fwkacllib/inc/runtime/config.h View File

@@ -42,6 +42,7 @@ typedef enum tagRtChipType {
CHIP_MDC,
CHIP_LHISI,
CHIP_DC,
CHIP_CLOUD_V2,
CHIP_END,
} rtChipType_t;

@@ -62,6 +63,7 @@ typedef enum tagRtPlatformType {
PLATFORM_LHISI_ES,
PLATFORM_LHISI_CS,
PLATFORM_DC,
PLATFORM_CLOUD_V2,
PLATFORM_END,
} rtPlatformType_t;

@@ -119,7 +121,9 @@ typedef struct tagRtMemoryConfig {
uint32_t compilerSize;
} rtMemoryConfig_t;

typedef struct tagRtPlatformConfig { uint32_t platformConfig; } rtPlatformConfig_t;
typedef struct tagRtPlatformConfig {
uint32_t platformConfig;
} rtPlatformConfig_t;

/**
* @ingroup


+ 1
- 1
third_party/fwkacllib/inc/runtime/context.h View File

@@ -47,7 +47,7 @@ typedef struct tagRtGroupInfo {
uint32_t aivectorNum;
uint32_t sdmaNum;
uint32_t activeStreamNum;
void* extrPtr;
void *extrPtr;
} rtGroupInfo_t;

/**


+ 1
- 1
third_party/fwkacllib/inc/runtime/dev.h View File

@@ -185,7 +185,7 @@ RTS_API rtError_t rtDisableP2P(uint32_t devIdDes, uint32_t phyIdSrc);
* @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);
RTS_API rtError_t rtDeviceCanAccessPeer(int32_t *canAccessPeer, uint32_t device, uint32_t peerDevice);

/**
* @ingroup dvrt_dev


+ 1
- 1
third_party/fwkacllib/inc/runtime/kernel.h View File

@@ -387,7 +387,7 @@ typedef void *rtModel_t;
* @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);
RTS_API rtError_t rtDumpAddrSet(rtModel_t model, void *addr, uint32_t dumpSize, uint32_t flag);

/**
* @ingroup rt_kernel


+ 17
- 17
third_party/fwkacllib/inc/runtime/mem.h View File

@@ -159,11 +159,11 @@ typedef struct rtAiCoreMemorySize {
* @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
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;

/**
@@ -179,23 +179,23 @@ typedef struct tagRtPointerAttributes {


typedef struct rtMallocHostSharedMemoryIn {
const char* name;
const uint64_t size;
uint32_t flag;
const char *name;
const uint64_t size;
uint32_t flag;
} rtMallocHostSharedMemoryIn;

typedef struct rtMallocHostSharedMemoryOut {
int fd;
void* ptr;
void* devPtr;
int fd;
void *ptr;
void *devPtr;
} rtMallocHostSharedMemoryOut;

typedef struct rtFreeHostSharedMemoryIn {
const char* name;
const uint64_t size;
int fd;
void* ptr;
void* devPtr;
const char *name;
const uint64_t size;
int fd;
void *ptr;
void *devPtr;
} rtFreeHostSharedMemoryIn;


@@ -267,7 +267,7 @@ RTS_API rtError_t rtFreeHost(void *hostPtr);
*/

RTS_API rtError_t rtMallocHostSharedMemory(rtMallocHostSharedMemoryIn *in,
rtMallocHostSharedMemoryOut *out);
rtMallocHostSharedMemoryOut *out);

/**
* @ingroup dvrt_mem


+ 1
- 0
third_party/fwkacllib/inc/runtime/stream.h View File

@@ -36,6 +36,7 @@ extern "C" {
#define RT_STREAM_FORBIDDEN_DEFAULT (0x10)
#define RT_STREAM_HEAD (0x20)
#define RT_STREAM_PRIMARY_DEFAULT (0x40)
#define RT_STREAM_PRIMARY_FIRST_DEFAULT (0x80)

/**
* @ingroup stream_type


+ 52
- 0
third_party/fwkacllib/inc/soft_dp/ExternalSoftDp.h View File

@@ -0,0 +1,52 @@
/**
* @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

#include <stdint.h>

extern "C" {
struct SoftDpProcsessInfo {
uint8_t* inputBuffer;
uint32_t inputBufferSize;

uint8_t* outputBuffer;
uint32_t outputBufferSize;

uint32_t outputWidth;
uint32_t outputHeight;

uint32_t reserved;
};

struct DpCropInfo {
uint32_t left;
uint32_t right;
uint32_t up;
uint32_t down;
};

/*
* @brief decode and resize interface
* @param [in] SoftDpProcsessInfo& softDpProcsessInfo : soft dp struct
* @return success: return 0, fail: return error number
*/
uint32_t DecodeAndResizeJpeg(SoftDpProcsessInfo& softDpProcsessInfo);

/*
* @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& softDpProcsessInfo, const DpCropInfo& cropInfo);
}
#endif // EXTERNALSOFTDP_H

+ 138
- 0
third_party/fwkacllib/inc/toolchain/slog.h View File

@@ -18,7 +18,9 @@
#define D_SYSLOG_H_

#ifdef __cplusplus
#ifndef LOG_CPP
extern "C" {
#endif
#endif // __cplusplus

#ifndef LINUX
@@ -105,6 +107,7 @@ extern "C" {
#define SECURITY_LOG_MASK (0x00100000)
#define RUN_LOG_MASK (0x01000000)
#define OPERATION_LOG_MASK (0x10000000)
#define RESERVERD_LENGTH 52

typedef struct tagDCODE {
const char *cName;
@@ -116,6 +119,18 @@ typedef struct tagKV {
char *value;
} KeyValue;

typedef enum {
APPLICATION = 0,
SYSTEM
} ProcessType;

typedef struct {
ProcessType type;
unsigned int pid;
unsigned int deviceId;
char reserved[RESERVERD_LENGTH];
} LogAttr;

/**
* @ingroup slog
*
@@ -228,6 +243,14 @@ DLL_EXPORT int dlog_setlevel(int moduleId, int level, int enableEvent);
*/
DLL_EXPORT int CheckLogLevel(int moduleId, int logLevel);

/**
* @ingroup slog
* @brief DlogSetAttr: set log attr, default pid is 0, default device id is 0, default process type is APPLICATION
* @param [in]logAttr: attr info, include pid(must be larger than 0), process type and device id(chip ID)
* @return: 0: SUCCEED, others: FAILED
*/
DLL_EXPORT int DlogSetAttr(LogAttr logAttr);

/**
* @ingroup slog
* @brief dlog_error: print error log
@@ -367,6 +390,121 @@ void DlogInner(int moduleId, int level, const char *fmt, ...);
void DlogWithKVInner(int moduleId, int level, KeyValue *pstKVArray, int kvNum, const char *fmt, ...);

#ifdef __cplusplus
#ifndef LOG_CPP
}
#endif // LOG_CPP
#endif // __cplusplus

#ifdef LOG_CPP
#ifdef __cplusplus
extern "C" {
#endif
/**
* @ingroup slog
* @brief DlogGetlevelForC: get module loglevel and enableEvent
*
* @param [in]moduleId: moudule id(see slog.h, eg: CCE), others: invalid
* @param [out]enableEvent: 1: enable; 0: disable
* @return: module level(0: debug, 1: info, 2: warning, 3: error, 4: null output)
*/
DLL_EXPORT int DlogGetlevelForC(int moduleId, int *enableEvent);

/**
* @ingroup slog
* @brief DlogSetlevelForC: set module loglevel and enableEvent
*
* @param [in]moduleId: moudule id(see slog.h, eg: CCE), -1: all modules, others: invalid
* @param [in]level: log level(0: debug, 1: info, 2: warning, 3: error, 4: null output)
* @param [in]enableEvent: 1: enable; 0: disable, others:invalid
* @return: 0: SUCCEED, others: FAILED
*/
DLL_EXPORT int DlogSetlevelForC(int moduleId, int level, int enableEvent);

/**
* @ingroup slog
* @brief CheckLogLevelForC: check module level enable or not
* users no need to call it because all dlog interface(include inner interface) has already called
*
* @param [in]moduleId: module id, eg: CCE
* @param [in]logLevel: eg: DLOG_EVENT/DLOG_ERROR/DLOG_WARN/DLOG_INFO/DLOG_DEBUG
* @return: 1:enable, 0:disable
*/
DLL_EXPORT int CheckLogLevelForC(int moduleId, int logLevel);

/**
* @ingroup slog
* @brief DlogSetAttrForC: set log attr, default pid is 0, default device id is 0, default process type is APPLICATION
* @param [in]logAttr: attr info, include pid(must be larger than 0), process type and device id(chip ID)
* @return: 0: SUCCEED, others: FAILED
*/
DLL_EXPORT int DlogSetAttrForC(LogAttr logAttr);

/**
* @ingroup slog
* @brief DlogForC: print log, need caller to specify level
* call CheckLogLevelForC in advance to optimize performance, call interface with fmt input take time
*
* @param [in]moduleId: module id, eg: CCE
* @param [in]level(0: debug, 1: info, 2: warning, 3: error, 5: trace, 6: oplog, 16: event)
* @param [in]fmt: log content
*/
#define DlogForC(moduleId, level, fmt, ...) \
do { \
if(CheckLogLevelForC(moduleId, level) == 1) { \
DlogInnerForC(moduleId, level, "[%s:%d]" fmt, __FILE__, __LINE__, ##__VA_ARGS__); \
} \
} while (0)

/**
* @ingroup slog
* @brief DlogSubForC: print log, need caller to specify level and submodule
* call CheckLogLevelForC in advance to optimize performance, call interface with fmt input take time
*
* @param [in]moduleId: module id, eg: CCE
* @param [in]submodule: eg: engine
* @param [in]level(0: debug, 1: info, 2: warning, 3: error, 5: trace, 6: oplog, 16: event)
* @param [in]fmt: log content
*/
#define DlogSubForC(moduleId, submodule, level, fmt, ...) \
do { \
if(CheckLogLevelForC(moduleId, level) == 1) { \
DlogInnerForC(moduleId, level, "[%s:%d][%s]" fmt, __FILE__, __LINE__, submodule, ##__VA_ARGS__); \
} \
} while (0)

/**
* @ingroup slog
* @brief DlogWithKVForC: print log, need caller to specify level and other paramters
* call CheckLogLevelForC in advance to optimize performance, call interface with fmt input take time
*
* @param [in]moduleId: module id, eg: CCE
* @param [in]level(0: debug, 1: info, 2: warning, 3: error, 5: trace, 6: oplog, 16: event)
* @param [in]pstKVArray: key-value array
* @param [in]kvNum: key-value element num in array
* @param [in]fmt: log content
*/
#define DlogWithKVForC(moduleId, level, pstKVArray, kvNum, fmt, ...) \
do { \
if(CheckLogLevelForC(moduleId, level) == 1) { \
DlogWithKVInnerForC(moduleId, level, pstKVArray, kvNum, "[%s:%d]" fmt, __FILE__, __LINE__, ##__VA_ARGS__); \
} \
} while (0)

/**
* @ingroup slog
* @brief DlogFlushForC: flush log buffer to file
*/
DLL_EXPORT void DlogFlushForC(void);

/**
* @ingroup slog
* @brief Internal log interface, other modules are not allowed to call this interface
*/
void DlogInnerForC(int moduleId, int level, const char *fmt, ...);
void DlogWithKVInnerForC(int moduleId, int level, KeyValue *pstKVArray, int kvNum, const char *fmt, ...);

#ifdef __cplusplus
}
#endif
#endif // LOG_CPP
#endif // D_SYSLOG_H_

Loading…
Cancel
Save