Browse Source

!1904 header file update

Merge pull request !1904 from 陈叶朦/master
tags/v1.5.1
i-robot Gitee 3 years ago
parent
commit
4e4ef802b8
11 changed files with 332 additions and 128 deletions
  1. +7
    -0
      third_party/fwkacllib/inc/external/runtime/rt_error_codes.h
  2. +4
    -4
      third_party/fwkacllib/inc/runtime/base.h
  3. +43
    -0
      third_party/fwkacllib/inc/runtime/config.h
  4. +5
    -0
      third_party/fwkacllib/inc/runtime/dev.h
  5. +35
    -2
      third_party/fwkacllib/inc/runtime/event.h
  6. +66
    -17
      third_party/fwkacllib/inc/runtime/kernel.h
  7. +11
    -0
      third_party/fwkacllib/inc/runtime/mem.h
  8. +11
    -2
      third_party/fwkacllib/inc/runtime/rt_model.h
  9. +30
    -1
      third_party/fwkacllib/inc/toolchain/prof_callback.h
  10. +32
    -30
      third_party/fwkacllib/inc/toolchain/slog.h
  11. +88
    -72
      third_party/fwkacllib/inc/toolchain/tuning_tool/tune_api.h

+ 7
- 0
third_party/fwkacllib/inc/external/runtime/rt_error_codes.h View File

@@ -38,6 +38,7 @@ static const int32_t ACL_ERROR_RT_STREAM_NO_CB_REG = 107015; // callba
static const int32_t ACL_ERROR_RT_INVALID_MEMORY_TYPE = 107016; // invalid memory type static const int32_t ACL_ERROR_RT_INVALID_MEMORY_TYPE = 107016; // invalid memory type
static const int32_t ACL_ERROR_RT_INVALID_HANDLE = 107017; // invalid handle static const int32_t ACL_ERROR_RT_INVALID_HANDLE = 107017; // invalid handle
static const int32_t ACL_ERROR_RT_INVALID_MALLOC_TYPE = 107018; // invalid malloc type static const int32_t ACL_ERROR_RT_INVALID_MALLOC_TYPE = 107018; // invalid malloc type
static const int32_t ACL_ERROR_RT_WAIT_TIMEOUT = 107019; // wait timeout
static const int32_t ACL_ERROR_RT_FEATURE_NOT_SUPPORT = 207000; // feature not support static const int32_t ACL_ERROR_RT_FEATURE_NOT_SUPPORT = 207000; // feature not support
static const int32_t ACL_ERROR_RT_MEMORY_ALLOCATION = 207001; // memory allocation error static const int32_t ACL_ERROR_RT_MEMORY_ALLOCATION = 207001; // memory allocation error
@@ -50,6 +51,7 @@ static const int32_t ACL_ERROR_RT_NO_EVENT_RESOURCE = 207007; // no eve
static const int32_t ACL_ERROR_RT_NO_STREAM_RESOURCE = 207008; // no stream resource static const int32_t ACL_ERROR_RT_NO_STREAM_RESOURCE = 207008; // no stream resource
static const int32_t ACL_ERROR_RT_NO_NOTIFY_RESOURCE = 207009; // no notify resource static const int32_t ACL_ERROR_RT_NO_NOTIFY_RESOURCE = 207009; // no notify resource
static const int32_t ACL_ERROR_RT_NO_MODEL_RESOURCE = 207010; // no model resource static const int32_t ACL_ERROR_RT_NO_MODEL_RESOURCE = 207010; // no model resource
static const int32_t ACL_ERROR_RT_NO_CDQ_RESOURCE = 207011; // no cdq resource
static const int32_t ACL_ERROR_RT_INTERNAL_ERROR = 507000; // runtime internal error static const int32_t ACL_ERROR_RT_INTERNAL_ERROR = 507000; // runtime internal error
static const int32_t ACL_ERROR_RT_TS_ERROR = 507001; // ts internel error static const int32_t ACL_ERROR_RT_TS_ERROR = 507001; // ts internel error
@@ -85,9 +87,14 @@ static const int32_t ACL_ERROR_RT_DEBUG_UNREGISTER_FAIL = 507030; // debug
static const int32_t ACL_ERROR_RT_LABEL_CONTEXT = 507031; // label not in current context static const int32_t ACL_ERROR_RT_LABEL_CONTEXT = 507031; // label not in current context
static const int32_t ACL_ERROR_RT_PROGRAM_USE_OUT = 507032; // program register num use out static const int32_t ACL_ERROR_RT_PROGRAM_USE_OUT = 507032; // program register num use out
static const int32_t ACL_ERROR_RT_DEV_SETUP_ERROR = 507033; // device setup error static const int32_t ACL_ERROR_RT_DEV_SETUP_ERROR = 507033; // device setup error
static const int32_t ACL_ERROR_RT_VECTOR_CORE_TIMEOUT = 507034; // vector core timeout
static const int32_t ACL_ERROR_RT_VECTOR_CORE_EXCEPTION = 507035; // vector core exception
static const int32_t ACL_ERROR_RT_VECTOR_CORE_TRAP_EXCEPTION = 507036; // vector core trap exception
static const int32_t ACL_ERROR_RT_CDQ_BATCH_ABNORMAL = 507037; // cdq alloc batch abnormal
static const int32_t ACL_ERROR_RT_DRV_INTERNAL_ERROR = 507899; // drv internal error static const int32_t ACL_ERROR_RT_DRV_INTERNAL_ERROR = 507899; // drv internal error
static const int32_t ACL_ERROR_RT_AICPU_INTERNAL_ERROR = 507900; // aicpu internal error static const int32_t ACL_ERROR_RT_AICPU_INTERNAL_ERROR = 507900; // aicpu internal error
static const int32_t ACL_ERROR_RT_SOCKET_CLOSE = 507901; // hdc disconnect
#ifdef __cplusplus #ifdef __cplusplus
} }


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

@@ -156,7 +156,7 @@ RTS_API rtError_t rtProfilerTrace(uint64_t id, bool notify, uint32_t flags, rtSt


/** /**
* @ingroup profiling_base * @ingroup profiling_base
* @brief ts send keypoint for step info.
* @brief ts send keypoint profiler log.
*/ */
RTS_API rtError_t rtProfilerTraceEx(uint64_t id, uint64_t modelId, uint16_t tagId, rtStream_t stream); RTS_API rtError_t rtProfilerTraceEx(uint64_t id, uint64_t modelId, uint16_t tagId, rtStream_t stream);


@@ -206,7 +206,7 @@ RTS_API rtError_t rtRegDeviceStateCallback(const char *regName, rtDeviceStateCal


/** /**
* @ingroup dvrt_base * @ingroup dvrt_base
* @brief register callback for fail task
* @brief register callback for fail task
* @param [in] uniName unique register name, can't be null * @param [in] uniName unique register name, can't be null
* @param [in] callback fail task callback function * @param [in] callback fail task callback function
* @param [out] NA * @param [out] NA
@@ -345,11 +345,11 @@ RTS_API rtError_t rtLabelCreateEx(rtLabel_t *label, rtStream_t stream);
* @return RT_ERROR_NONE for ok * @return RT_ERROR_NONE for ok
* @return RT_ERROR_INVALID_VALUE for error input * @return RT_ERROR_INVALID_VALUE for error input
*/ */
rtError_t rtLabelCreateExV2(rtLabel_t *label, rtModel_t model, rtStream_t stream);
RTS_API rtError_t rtLabelCreateExV2(rtLabel_t *label, rtModel_t model, rtStream_t stream);


/** /**
* @ingroup dvrt_base * @ingroup dvrt_base
* @brief get current thread last stream id and task id
* @brief get current thread last stream id and task id
* @param [out] stream id and task id * @param [out] stream id and task id
* @param [in] null * @param [in] null
* @return RT_ERROR_NONE for ok * @return RT_ERROR_NONE for ok


+ 43
- 0
third_party/fwkacllib/inc/runtime/config.h View File

@@ -46,6 +46,12 @@ typedef enum tagRtChipType {
CHIP_END, CHIP_END,
} rtChipType_t; } rtChipType_t;


typedef enum tagRtAicpuScheType {
SCHEDULE_SOFTWARE = 0, /* Software Schedule */
SCHEDULE_SOFTWARE_OPT,
SCHEDULE_HARDWARE, /* HWTS Schedule */
} rtAicpuScheType;

typedef enum tagRtVersion { typedef enum tagRtVersion {
VER_BEGIN = 0, VER_BEGIN = 0,
VER_NA = VER_BEGIN, VER_NA = VER_BEGIN,
@@ -65,6 +71,7 @@ typedef enum tagRtPlatformType {
PLATFORM_LHISI_CS, PLATFORM_LHISI_CS,
PLATFORM_DC, PLATFORM_DC,
PLATFORM_CLOUD_V2, PLATFORM_CLOUD_V2,
PLATFORM_LHISI_SD3403,
PLATFORM_END, PLATFORM_END,
} rtPlatformType_t; } rtPlatformType_t;


@@ -126,6 +133,11 @@ typedef struct tagRtPlatformConfig {
uint32_t platformConfig; uint32_t platformConfig;
} rtPlatformConfig_t; } rtPlatformConfig_t;


typedef enum tagRTTaskTimeoutType {
RT_TIMEOUT_TYPE_OP_WAIT = 0,
RT_TIMEOUT_TYPE_OP_EXECUTE,
} rtTaskTimeoutType_t;

/** /**
* @ingroup * @ingroup
* @brief get AI core count * @brief get AI core count
@@ -184,6 +196,37 @@ RTS_API rtError_t rtMemGetL2Info(rtStream_t stream, void **ptr, uint32_t *size);
*/ */
RTS_API rtError_t rtGetRuntimeVersion(uint32_t *runtimeVersion); RTS_API rtError_t rtGetRuntimeVersion(uint32_t *runtimeVersion);



/**
* @ingroup
* @brief get device feature ability by device id, such as task schedule ability.
* @param [in] deviceId
* @param [in] moduleType
* @param [in] featureType
* @param [out] value
* @return RT_ERROR_NONE for ok
* @return RT_ERROR_INVALID_VALUE for error input
*/
RTS_API rtError_t rtGetDeviceCapability(int32_t deviceId, int32_t moduleType, int32_t featureType, int32_t *value);

/**
* @ingroup
* @brief set event wait task timeout time.
* @param [in] timeout
* @return RT_ERROR_NONE for ok
* @return RT_ERROR_INVALID_VALUE for error input
*/
RTS_API rtError_t rtSetOpWaitTimeOut(uint32_t timeout);

/**
* @ingroup
* @brief set op execute task timeout time.
* @param [in] timeout
* @return RT_ERROR_NONE for ok
* @return RT_ERROR_INVALID_VALUE for error input
*/
RTS_API rtError_t rtSetOpExecuteTimeOut(uint32_t timeout);

#if defined(__cplusplus) && !defined(COMPILE_OMG_PACKAGE) #if defined(__cplusplus) && !defined(COMPILE_OMG_PACKAGE)
} }
#endif #endif


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

@@ -63,6 +63,11 @@ typedef enum tagRtFeatureType {
FEATURE_TYPE_RSV FEATURE_TYPE_RSV
} rtFeatureType_t; } rtFeatureType_t;


typedef enum tagRtDeviceFeatureType {
FEATURE_TYPE_SCHE,
FEATURE_TYPE_END,
} rtDeviceFeatureType_t;

typedef enum tagMemcpyInfo { typedef enum tagMemcpyInfo {
MEMCPY_INFO_SUPPORT_ZEROCOPY = 0, MEMCPY_INFO_SUPPORT_ZEROCOPY = 0,
MEMCPY_INFO_RSV MEMCPY_INFO_RSV


+ 35
- 2
third_party/fwkacllib/inc/runtime/event.h View File

@@ -23,12 +23,23 @@
extern "C" { extern "C" {
#endif #endif


typedef enum rtEventWaitStatus {
EVENT_STATUS_COMPLETE = 0,
EVENT_STATUS_NOT_READY = 1,
EVENT_STATUS_MAX = 2,
} rtEventWaitStatus_t;

/** /**
* @ingroup event_flags * @ingroup event_flags
* @brief event op bit flags * @brief event op bit flags
*/ */
#define RT_EVENT_DEFAULT (0x00)
#define RT_EVENT_WITH_FLAG (0x01)
#define RT_EVENT_DEFAULT (0x0E)
#define RT_EVENT_WITH_FLAG (0x0B)

#define RT_EVENT_DDSYNC_NS 0x01U
#define RT_EVENT_STREAM_MARK 0x02U
#define RT_EVENT_DDSYNC 0x04U
#define RT_EVENT_TIME_LINE 0x08U


/** /**
* @ingroup dvrt_event * @ingroup dvrt_event
@@ -104,6 +115,16 @@ RTS_API rtError_t rtEventSynchronize(rtEvent_t event);
*/ */
RTS_API rtError_t rtEventQuery(rtEvent_t event); RTS_API rtError_t rtEventQuery(rtEvent_t event);


/**
* @ingroup dvrt_event
* @brief Queries an event's wait status
* @param [in] event event to query
* @param [in out] EVENT_WAIT_STATUS status
* @return EVENT_STATUS_COMPLETE for complete
* @return EVENT_STATUS_NOT_READY for not complete
*/
RTS_API rtError_t rtEventQueryWaitStatus(rtEvent_t event, rtEventWaitStatus_t *status);

/** /**
* @ingroup dvrt_event * @ingroup dvrt_event
* @brief computes the elapsed time between events. * @brief computes the elapsed time between events.
@@ -176,6 +197,18 @@ RTS_API rtError_t rtNotifyRecord(rtNotify_t notify, rtStream_t stream);
*/ */
RTS_API rtError_t rtNotifyWait(rtNotify_t notify, rtStream_t stream); RTS_API rtError_t rtNotifyWait(rtNotify_t notify, rtStream_t stream);


/**
* @ingroup dvrt_event
* @brief Wait for a notify with time out
* @param [in] notify_ notify to be wait
* @param [in] stream_ input stream
* @param [in] timeOut input timeOut
* @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 rtNotifyWaitWithTimeOut(rtNotify_t notify_, rtStream_t stream_, uint32_t timeOut);

/** /**
* @ingroup dvrt_event * @ingroup dvrt_event
* @brief Name a notify * @brief Name a notify


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

@@ -111,6 +111,16 @@ typedef struct rtKernelInfo {
uint32_t module_size; uint32_t module_size;
} *rtKernelInfo_t; } *rtKernelInfo_t;


/**
* @ingroup rt_kernel
* @brief op name
*/
typedef struct rtKernelLaunchNames {
const char *soName; // defined for so name
const char *kernelName; // defined for kernel type name
const char *opName; // defined for operator name
} rtKernelLaunchNames_t;

/** /**
* @ingroup rt_KernelConfigDump * @ingroup rt_KernelConfigDump
* @brief device dump type * @brief device dump type
@@ -173,13 +183,7 @@ typedef void (*rtCallback_t)(void *fnData);
* @ingroup rt_kernel * @ingroup rt_kernel
* @brief magic number of elf binary for aicube * @brief magic number of elf binary for aicube
*/ */
#define RT_DEV_BINARY_MAGIC_ELF_AICUBE 0x41415247

/**
* @ingroup rt_kernel
* @brief magic number of elf binary for aivector
*/
#define RT_DEV_BINARY_MAGIC_ELF_AIVECTOR 0x41415248
#define RT_DEV_BINARY_MAGIC_ELF_AICUBE 0x41494343


/** /**
* @ingroup rt_kernel_flags * @ingroup rt_kernel_flags
@@ -192,14 +196,14 @@ typedef void (*rtCallback_t)(void *fnData);
#define RT_KERNEL_CUSTOM_AICPU (0x08) #define RT_KERNEL_CUSTOM_AICPU (0x08)


// STARS topic scheduler sqe : topic_type // STARS topic scheduler sqe : topic_type
#define RT_KERNEL_DEVICE_FIRST (0X10)
#define RT_KERNEL_HOST_ONLY (0X20)
#define RT_KERNEL_HOST_FIRST (0X30)
#define RT_KERNEL_DEVICE_FIRST (0x10)
#define RT_KERNEL_HOST_ONLY (0x20)
#define RT_KERNEL_HOST_FIRST (0x40)


/** /**
* @ingroup rt_kernel * @ingroup rt_kernel
* @brief kernel mode * @brief kernel mode
*/
**/
#define RT_DEFAULT_KERNEL_MODE (0x00) #define RT_DEFAULT_KERNEL_MODE (0x00)
#define RT_NORMAL_KERNEL_MODE (0x01) #define RT_NORMAL_KERNEL_MODE (0x01)
#define RT_ALL_KERNEL_MODE (0x02) #define RT_ALL_KERNEL_MODE (0x02)
@@ -222,7 +226,7 @@ RTS_API rtError_t rtDevBinaryRegister(const rtDevBinary_t *bin, void **handle);


/** /**
* @ingroup rt_kernel * @ingroup rt_kernel
* @brief register device binary
* @brief register device binary with all kernel
* @param [in] bin device binary description * @param [in] bin device binary description
* @param [out] handle device binary handle * @param [out] handle device binary handle
* @return RT_ERROR_NONE for ok * @return RT_ERROR_NONE for ok
@@ -341,7 +345,7 @@ RTS_API rtError_t rtKernelLaunch(const void *stubFunc, uint32_t blockDim, void *
* @ingroup rt_kernel * @ingroup rt_kernel
* @brief launch kernel with handle to device * @brief launch kernel with handle to device
* @param [in] handle program * @param [in] handle program
* @param [in] devFunc device function description
* @param [in] devFunc device function description.
* @param [in] blockDim block dimentions * @param [in] blockDim block dimentions
* @param [in] args argments address for kernel function * @param [in] args argments address for kernel function
* @param [in] argsSize argements size * @param [in] argsSize argements size
@@ -352,7 +356,7 @@ RTS_API rtError_t rtKernelLaunch(const void *stubFunc, uint32_t blockDim, void *
* @return RT_ERROR_INVALID_VALUE for error input * @return RT_ERROR_INVALID_VALUE for error input
*/ */
RTS_API rtError_t rtKernelLaunchWithHandle(void *handle, const void *devFunc, uint32_t blockDim, void *args, uint32_t argsSize, RTS_API rtError_t rtKernelLaunchWithHandle(void *handle, const void *devFunc, uint32_t blockDim, void *args, uint32_t argsSize,
rtSmDesc_t *smDesc, rtStream_t stream, const void *kernelInfo);
rtSmDesc_t *smDesc, rtStream_t stream_, const void *kernelInfo);


/** /**
* @ingroup rt_kernel * @ingroup rt_kernel
@@ -371,7 +375,7 @@ RTS_API rtError_t rtKernelLaunchWithFlag(const void *stubFunc, uint32_t blockDim
rtSmDesc_t *smDesc, rtStream_t stream, uint32_t flags); rtSmDesc_t *smDesc, rtStream_t stream, uint32_t flags);


/** /**
* @ingroup rt_kernel
* @ingroup rt_kernel(abandoned)
* @brief launch kernel to device * @brief launch kernel to device
* @param [in] args argments address for kernel function * @param [in] args argments address for kernel function
* @param [in] argsSize argements size * @param [in] argsSize argements size
@@ -383,7 +387,21 @@ RTS_API rtError_t rtKernelLaunchWithFlag(const void *stubFunc, uint32_t blockDim
RTS_API rtError_t rtKernelLaunchEx(void *args, uint32_t argsSize, uint32_t flags, rtStream_t stream); RTS_API rtError_t rtKernelLaunchEx(void *args, uint32_t argsSize, uint32_t flags, rtStream_t stream);


/** /**
* @ingroup rt_kernel
* @ingroup rt_kernel(in use)
* @brief launch kernel to device
* @param [in] opName opkernel name
* @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 rtKernelLaunchFwk(const char *opName, void *args, uint32_t argsSize, uint32_t flags,
rtStream_t rtStream);

/**
* @ingroup rt_kernel(abandoned)
* @brief launch cpu kernel to device * @brief launch cpu kernel to device
* @param [in] soName so name * @param [in] soName so name
* @param [in] kernelName kernel name * @param [in] kernelName kernel name
@@ -399,7 +417,22 @@ RTS_API rtError_t rtCpuKernelLaunch(const void *soName, const void *kernelName,
uint32_t argsSize, rtSmDesc_t *smDesc, rtStream_t stream); uint32_t argsSize, rtSmDesc_t *smDesc, rtStream_t stream);


/** /**
* @ingroup rt_kernel
* @ingroup rt_kernel(in use)
* @brief launch cpu kernel to device
* @param [in] launchNames names for kernel launch
* @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 rtAicpuKernelLaunch(const rtKernelLaunchNames_t *launchNames,
uint32_t blockDim, const void *args, uint32_t argsSize, rtSmDesc_t *smDesc, rtStream_t stream);

/**
* @ingroup rt_kernel(abandoned)
* @brief launch cpu kernel to device with dump identifier * @brief launch cpu kernel to device with dump identifier
* @param [in] soName so name * @param [in] soName so name
* @param [in] kernelName kernel name * @param [in] kernelName kernel name
@@ -416,6 +449,22 @@ RTS_API rtError_t rtCpuKernelLaunchWithFlag(const void *soName, const void *kern
const void *args, uint32_t argsSize, rtSmDesc_t *smDesc, rtStream_t stream, const void *args, uint32_t argsSize, rtSmDesc_t *smDesc, rtStream_t stream,
uint32_t flags); uint32_t flags);


/**
* @ingroup rt_kernel(in use)
* @brief launch cpu kernel to device with dump identifier
* @param [in] launchNames names for kernel launch
* @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 rtAicpuKernelLaunchWithFlag(const rtKernelLaunchNames_t *launchNames, uint32_t blockDim,
const void *args, uint32_t argsSize, rtSmDesc_t *smDesc, rtStream_t stream, uint32_t flags);

/** /**
* @ingroup rt_kernel * @ingroup rt_kernel
* @brief L1 fusion dump addr transfered to device * @brief L1 fusion dump addr transfered to device


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

@@ -116,6 +116,9 @@ typedef enum tagRtMemInfoType {


typedef enum tagRtRecudeKind { typedef enum tagRtRecudeKind {
RT_MEMCPY_SDMA_AUTOMATIC_ADD = 10, // D2D, SDMA inline reduce, include 1P, and P2P RT_MEMCPY_SDMA_AUTOMATIC_ADD = 10, // D2D, SDMA inline reduce, include 1P, and P2P
RT_MEMCPY_SDMA_AUTOMATIC_MAX = 11,
RT_MEMCPY_SDMA_AUTOMATIC_MIN = 12,
RT_MEMCPY_SDMA_AUTOMATIC_EQUAL = 13,
RT_RECUDE_KIND_END RT_RECUDE_KIND_END
} rtRecudeKind_t; } rtRecudeKind_t;


@@ -123,6 +126,14 @@ typedef enum tagRtDataType {
RT_DATA_TYPE_FP32 = 0, // fp32 RT_DATA_TYPE_FP32 = 0, // fp32
RT_DATA_TYPE_FP16 = 1, // fp16 RT_DATA_TYPE_FP16 = 1, // fp16
RT_DATA_TYPE_INT16 = 2, // int16 RT_DATA_TYPE_INT16 = 2, // int16
RT_DATA_TYPE_INT4 = 3, // int4
RT_DATA_TYPE_INT8 = 4, // int8
RT_DATA_TYPE_INT32 = 5, // int32
RT_DATA_TYPE_BFP16 = 6, // bfp16
RT_DATA_TYPE_BFP32 = 7, // bfp32
RT_DATA_TYPE_UINT8 = 8, // uint8
RT_DATA_TYPE_UINT16= 9, // uint16
RT_DATA_TYPE_UINT32= 10,// uint32
RT_DATA_TYPE_END RT_DATA_TYPE_END
} rtDataType_t; } rtDataType_t;




+ 11
- 2
third_party/fwkacllib/inc/runtime/rt_model.h View File

@@ -135,12 +135,13 @@ typedef struct tagAllKernelTaskInfo {
uint16_t argsCount; uint16_t argsCount;
uint16_t argsSize; uint16_t argsSize;
uint16_t reserved; uint16_t reserved;
const void *dev_func;
void *devfunc;
void *handle; void *handle;
uint8_t *smDesc; uint8_t *smDesc;
uint8_t *args; uint8_t *args;
uint16_t *argsOffset; uint16_t *argsOffset;
} rtAllKernelTaskInfo_t; } rtAllKernelTaskInfo_t;

typedef struct tagKernelTaskInfoEx { typedef struct tagKernelTaskInfoEx {
uint32_t flags; uint32_t flags;
uint32_t argsSize; uint32_t argsSize;
@@ -198,6 +199,13 @@ typedef struct tagProfilerTraceTaskInfo {
uint32_t reserved[6]; uint32_t reserved[6];
} rtProfilerTrace_t; } rtProfilerTrace_t;


typedef struct tagProfilerTraceExTaskInfo {
uint64_t profilerTraceId;
uint64_t modelId;
uint16_t tagId;
uint8_t reserved[22];
} rtProfilerTraceEx_t;

typedef struct tagrtMemcpyAsyncTaskInfo { typedef struct tagrtMemcpyAsyncTaskInfo {
void *dst; void *dst;
uint64_t destMax; uint64_t destMax;
@@ -265,7 +273,7 @@ typedef struct tagTaskInfo {
union { union {
rtKernelTaskInfoEx_t kernelTaskEx; rtKernelTaskInfoEx_t kernelTaskEx;
rtKernelTaskInfo_t kernelTask; rtKernelTaskInfo_t kernelTask;
rtAllKernelTaskInfo_t allkernelTask;
rtAllKernelTaskInfo_t allKernelTask;
rtEventTaskInfo_t eventTask; rtEventTaskInfo_t eventTask;
rtStreamSwitchTaskInfo_t streamSwitchTask; rtStreamSwitchTaskInfo_t streamSwitchTask;
rtStreamActiveTaskInfo_t streamActiveTask; rtStreamActiveTaskInfo_t streamActiveTask;
@@ -273,6 +281,7 @@ typedef struct tagTaskInfo {
rtLabelSwitchTaskInfo_t labelSwitchTask; rtLabelSwitchTaskInfo_t labelSwitchTask;
rtLabelGotoTaskInfo_t labelGotoTask; rtLabelGotoTaskInfo_t labelGotoTask;
rtProfilerTrace_t profilertraceTask; rtProfilerTrace_t profilertraceTask;
rtProfilerTraceEx_t profilertraceExTask;
rtMemcpyAsyncTaskInfo_t memcpyAsyncTask; rtMemcpyAsyncTaskInfo_t memcpyAsyncTask;
rtNotifyTaskInfo_t notifyTask; rtNotifyTaskInfo_t notifyTask;
rtReduceAsyncTaskInfo_t reduceAsyncTask; rtReduceAsyncTaskInfo_t reduceAsyncTask;


+ 30
- 1
third_party/fwkacllib/inc/toolchain/prof_callback.h View File

@@ -108,7 +108,19 @@ enum MsprofCtrlCallbackType {
MSPROF_CTRL_INIT_ACL_ENV = 0, // start profiling with acl env MSPROF_CTRL_INIT_ACL_ENV = 0, // start profiling with acl env
MSPROF_CTRL_INIT_ACL_JSON, // start profiling with acl.json MSPROF_CTRL_INIT_ACL_JSON, // start profiling with acl.json
MSPROF_CTRL_INIT_GE_OPTIONS, // start profiling with ge env and options MSPROF_CTRL_INIT_GE_OPTIONS, // start profiling with ge env and options
MSPROF_CTRL_FINALIZE // stop profiling
MSPROF_CTRL_FINALIZE, // stop profiling
MSPROF_CTRL_REPORT_FUN_P, // for report callback
MSPROF_CTRL_PROF_SWITCH_ON, // for prof switch on
MSPROF_CTRL_PROF_SWITCH_OFF // for prof switch off
};

#define MSPROF_MAX_DEV_NUM (64)

struct MsprofCommandHandle {
uint64_t profSwitch;
uint32_t devNums; // length of device id list
uint32_t devIdList[MSPROF_MAX_DEV_NUM];
uint32_t modelId;
}; };


/** /**
@@ -129,6 +141,23 @@ typedef int32_t (*MsprofCtrlCallback)(uint32_t type, void *data, uint32_t len);
*/ */
typedef void (*MsprofSetDeviceCallback)(uint32_t devId, bool isOpenDevice); typedef void (*MsprofSetDeviceCallback)(uint32_t devId, bool isOpenDevice);


/*
* @name MsprofInit
* @brief Profiling module init
* @param [in] dataType: profiling type: ACL Env/ACL Json/GE Option
* @param [in] data: profiling switch data
* @param [in] dataLen: Length of data
* @return 0:SUCCESS, >0:FAILED
*/
int32_t MsprofInit(uint32_t dataType, void *data, uint32_t dataLen);

/*
* @name AscendCL
* @brief Finishing Profiling
* @param NULL
* @return 0:SUCCESS, >0:FAILED
*/
int32_t MsprofFinalize();
#ifdef __cplusplus #ifdef __cplusplus
} }
#endif #endif


+ 32
- 30
third_party/fwkacllib/inc/toolchain/slog.h View File

@@ -17,6 +17,8 @@
#ifndef D_SYSLOG_H_ #ifndef D_SYSLOG_H_
#define D_SYSLOG_H_ #define D_SYSLOG_H_


static const int TMP_LOG = 0;

#ifdef __cplusplus #ifdef __cplusplus
#ifndef LOG_CPP #ifndef LOG_CPP
extern "C" { extern "C" {
@@ -120,15 +122,15 @@ typedef struct tagKV {
} KeyValue; } KeyValue;


typedef enum { typedef enum {
APPLICATION = 0,
SYSTEM
APPLICATION = 0,
SYSTEM
} ProcessType; } ProcessType;


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


/** /**
@@ -141,7 +143,7 @@ enum {
IDEDD, /**< IDE daemon device */ IDEDD, /**< IDE daemon device */
IDEDH, /**< IDE daemon host */ IDEDH, /**< IDE daemon host */
HCCL, /**< HCCL */ HCCL, /**< HCCL */
FMK, /**< Framework */
FMK, /**< Adapter */
HIAIENGINE, /**< Matrix */ HIAIENGINE, /**< Matrix */
DVPP, /**< DVPP */ DVPP, /**< DVPP */
RUNTIME, /**< Runtime */ RUNTIME, /**< Runtime */
@@ -162,11 +164,11 @@ enum {
MDCDEFAULT, /**< MDC undefine */ MDCDEFAULT, /**< MDC undefine */
MDCSC, /**< MDC spatial cognition */ MDCSC, /**< MDC spatial cognition */
MDCPNC, MDCPNC,
MLL,
MLL, /**< abandon */
DEVMM, /**< Dlog memory managent */ DEVMM, /**< Dlog memory managent */
KERNEL, /**< Kernel */ KERNEL, /**< Kernel */
LIBMEDIA, /**< Libmedia */ LIBMEDIA, /**< Libmedia */
CCECPU, /**< ai cpu */
CCECPU, /**< aicpu shedule */
ASCENDDK, /**< AscendDK */ ASCENDDK, /**< AscendDK */
ROS, /**< ROS */ ROS, /**< ROS */
HCCP, HCCP,
@@ -179,7 +181,7 @@ enum {
TSDUMP, /**< TSDUMP module */ TSDUMP, /**< TSDUMP module */
AICPU, /**< AICPU module */ AICPU, /**< AICPU module */
LP, /**< LP module */ LP, /**< LP module */
TDT,
TDT, /**< tsdaemon or aicpu shedule */
FE, FE,
MD, MD,
MB, MB,
@@ -261,7 +263,7 @@ DLL_EXPORT int DlogSetAttr(LogAttr logAttr);
#define dlog_error(moduleId, fmt, ...) \ #define dlog_error(moduleId, fmt, ...) \
do { \ do { \
DlogErrorInner(moduleId, "[%s:%d]" fmt, __FILE__, __LINE__, ##__VA_ARGS__); \ DlogErrorInner(moduleId, "[%s:%d]" fmt, __FILE__, __LINE__, ##__VA_ARGS__); \
} while (0)
} while (TMP_LOG != 0)


/** /**
* @ingroup slog * @ingroup slog
@@ -276,7 +278,7 @@ DLL_EXPORT int DlogSetAttr(LogAttr logAttr);
if(CheckLogLevel(moduleId, DLOG_WARN) == 1) { \ if(CheckLogLevel(moduleId, DLOG_WARN) == 1) { \
DlogWarnInner(moduleId, "[%s:%d]" fmt, __FILE__, __LINE__, ##__VA_ARGS__); \ DlogWarnInner(moduleId, "[%s:%d]" fmt, __FILE__, __LINE__, ##__VA_ARGS__); \
} \ } \
} while (0)
} while (TMP_LOG != 0)


/** /**
* @ingroup slog * @ingroup slog
@@ -291,7 +293,7 @@ DLL_EXPORT int DlogSetAttr(LogAttr logAttr);
if(CheckLogLevel(moduleId, DLOG_INFO) == 1) { \ if(CheckLogLevel(moduleId, DLOG_INFO) == 1) { \
DlogInfoInner(moduleId, "[%s:%d]" fmt, __FILE__, __LINE__, ##__VA_ARGS__); \ DlogInfoInner(moduleId, "[%s:%d]" fmt, __FILE__, __LINE__, ##__VA_ARGS__); \
} \ } \
} while (0)
} while (TMP_LOG != 0)


/** /**
* @ingroup slog * @ingroup slog
@@ -306,7 +308,7 @@ DLL_EXPORT int DlogSetAttr(LogAttr logAttr);
if(CheckLogLevel(moduleId, DLOG_DEBUG) == 1) { \ if(CheckLogLevel(moduleId, DLOG_DEBUG) == 1) { \
DlogDebugInner(moduleId, "[%s:%d]" fmt, __FILE__, __LINE__, ##__VA_ARGS__); \ DlogDebugInner(moduleId, "[%s:%d]" fmt, __FILE__, __LINE__, ##__VA_ARGS__); \
} \ } \
} while (0)
} while (TMP_LOG != 0)


/** /**
* @ingroup slog * @ingroup slog
@@ -318,7 +320,7 @@ DLL_EXPORT int DlogSetAttr(LogAttr logAttr);
#define dlog_event(moduleId, fmt, ...) \ #define dlog_event(moduleId, fmt, ...) \
do { \ do { \
DlogEventInner(moduleId, "[%s:%d]" fmt, __FILE__, __LINE__, ##__VA_ARGS__); \ DlogEventInner(moduleId, "[%s:%d]" fmt, __FILE__, __LINE__, ##__VA_ARGS__); \
} while (0)
} while (TMP_LOG != 0)


/** /**
* @ingroup slog * @ingroup slog
@@ -334,7 +336,7 @@ DLL_EXPORT int DlogSetAttr(LogAttr logAttr);
if(CheckLogLevel(moduleId, level) == 1) { \ if(CheckLogLevel(moduleId, level) == 1) { \
DlogInner(moduleId, level, "[%s:%d]" fmt, __FILE__, __LINE__, ##__VA_ARGS__); \ DlogInner(moduleId, level, "[%s:%d]" fmt, __FILE__, __LINE__, ##__VA_ARGS__); \
} \ } \
} while (0)
} while (TMP_LOG != 0)


/** /**
* @ingroup slog * @ingroup slog
@@ -351,7 +353,7 @@ DLL_EXPORT int DlogSetAttr(LogAttr logAttr);
if(CheckLogLevel(moduleId, level) == 1) { \ if(CheckLogLevel(moduleId, level) == 1) { \
DlogInner(moduleId, level, "[%s:%d][%s]" fmt, __FILE__, __LINE__, submodule, ##__VA_ARGS__); \ DlogInner(moduleId, level, "[%s:%d][%s]" fmt, __FILE__, __LINE__, submodule, ##__VA_ARGS__); \
} \ } \
} while (0)
} while (TMP_LOG != 0)


/** /**
* @ingroup slog * @ingroup slog
@@ -369,7 +371,7 @@ DLL_EXPORT int DlogSetAttr(LogAttr logAttr);
if(CheckLogLevel(moduleId, level) == 1) { \ if(CheckLogLevel(moduleId, level) == 1) { \
DlogWithKVInner(moduleId, level, pstKVArray, kvNum, "[%s:%d]" fmt, __FILE__, __LINE__, ##__VA_ARGS__); \ DlogWithKVInner(moduleId, level, pstKVArray, kvNum, "[%s:%d]" fmt, __FILE__, __LINE__, ##__VA_ARGS__); \
} \ } \
} while (0)
} while (TMP_LOG != 0)


/** /**
* @ingroup slog * @ingroup slog
@@ -381,13 +383,13 @@ DLL_EXPORT void DlogFlush(void);
* @ingroup slog * @ingroup slog
* @brief Internal log interface, other modules are not allowed to call this interface * @brief Internal log interface, other modules are not allowed to call this interface
*/ */
void DlogErrorInner(int moduleId, const char *fmt, ...) __attribute__((format(printf, 2, 3)));
void DlogWarnInner(int moduleId, const char *fmt, ...) __attribute__((format(printf, 2, 3)));
void DlogInfoInner(int moduleId, const char *fmt, ...) __attribute__((format(printf, 2, 3)));
void DlogDebugInner(int moduleId, const char *fmt, ...) __attribute__((format(printf, 2, 3)));
void DlogEventInner(int moduleId, const char *fmt, ...) __attribute__((format(printf, 2, 3)));
void DlogInner(int moduleId, int level, const char *fmt, ...) __attribute__((format(printf, 3, 4)));
void DlogWithKVInner(int moduleId, int level, KeyValue *pstKVArray, int kvNum, const char *fmt, ...) __attribute__((format(printf, 5, 6)));
void DlogErrorInner(int moduleId, const char *fmt, ...);
void DlogWarnInner(int moduleId, const char *fmt, ...);
void DlogInfoInner(int moduleId, const char *fmt, ...);
void DlogDebugInner(int moduleId, const char *fmt, ...);
void DlogEventInner(int moduleId, const char *fmt, ...);
void DlogInner(int moduleId, int level, const char *fmt, ...);
void DlogWithKVInner(int moduleId, int level, KeyValue *pstKVArray, int kvNum, const char *fmt, ...);


#ifdef __cplusplus #ifdef __cplusplus
#ifndef LOG_CPP #ifndef LOG_CPP
@@ -453,7 +455,7 @@ DLL_EXPORT int DlogSetAttrForC(LogAttr logAttr);
if(CheckLogLevelForC(moduleId, level) == 1) { \ if(CheckLogLevelForC(moduleId, level) == 1) { \
DlogInnerForC(moduleId, level, "[%s:%d]" fmt, __FILE__, __LINE__, ##__VA_ARGS__); \ DlogInnerForC(moduleId, level, "[%s:%d]" fmt, __FILE__, __LINE__, ##__VA_ARGS__); \
} \ } \
} while (0)
} while (TMP_LOG != 0)


/** /**
* @ingroup slog * @ingroup slog
@@ -470,7 +472,7 @@ DLL_EXPORT int DlogSetAttrForC(LogAttr logAttr);
if(CheckLogLevelForC(moduleId, level) == 1) { \ if(CheckLogLevelForC(moduleId, level) == 1) { \
DlogInnerForC(moduleId, level, "[%s:%d][%s]" fmt, __FILE__, __LINE__, submodule, ##__VA_ARGS__); \ DlogInnerForC(moduleId, level, "[%s:%d][%s]" fmt, __FILE__, __LINE__, submodule, ##__VA_ARGS__); \
} \ } \
} while (0)
} while (TMP_LOG != 0)


/** /**
* @ingroup slog * @ingroup slog
@@ -488,7 +490,7 @@ DLL_EXPORT int DlogSetAttrForC(LogAttr logAttr);
if(CheckLogLevelForC(moduleId, level) == 1) { \ if(CheckLogLevelForC(moduleId, level) == 1) { \
DlogWithKVInnerForC(moduleId, level, pstKVArray, kvNum, "[%s:%d]" fmt, __FILE__, __LINE__, ##__VA_ARGS__); \ DlogWithKVInnerForC(moduleId, level, pstKVArray, kvNum, "[%s:%d]" fmt, __FILE__, __LINE__, ##__VA_ARGS__); \
} \ } \
} while (0)
} while (TMP_LOG != 0)


/** /**
* @ingroup slog * @ingroup slog
@@ -500,8 +502,8 @@ DLL_EXPORT void DlogFlushForC(void);
* @ingroup slog * @ingroup slog
* @brief Internal log interface, other modules are not allowed to call this interface * @brief Internal log interface, other modules are not allowed to call this interface
*/ */
void DlogInnerForC(int moduleId, int level, const char *fmt, ...) __attribute__((format(printf, 3, 4)));
void DlogWithKVInnerForC(int moduleId, int level, KeyValue *pstKVArray, int kvNum, const char *fmt, ...) __attribute__((format(printf, 5, 6)));
void DlogInnerForC(int moduleId, int level, const char *fmt, ...);
void DlogWithKVInnerForC(int moduleId, int level, KeyValue *pstKVArray, int kvNum, const char *fmt, ...);


#ifdef __cplusplus #ifdef __cplusplus
} }


+ 88
- 72
third_party/fwkacllib/inc/toolchain/tuning_tool/tune_api.h View File

@@ -1,72 +1,88 @@
/**
* @file tune_api.h
*
* Copyright (c) Huawei Technologies Co., Ltd. 2020-2020. All rights reserved.\n
*
* 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.\n
* 描述:mstune调优接口头文件
*/
/** @defgroup mstune mstune调优接口 */
#ifndef TUNE_API_H
#define TUNE_API_H
#include <vector>
#include <map>
#include <string>
#include "graph/graph.h"
#include "ge/ge_api.h"
/**
* @ingroup mstune
*
* mstune status
*/
enum MsTuneStatus {
MSTUNE_SUCCESS, /** tune success */
MSTUNE_FAILED, /** tune failed */
};
// Option key: for train options sets
const std::string MSTUNE_SELF_KEY = "mstune";
const std::string MSTUNE_GEINIT_KEY = "initialize";
const std::string MSTUNE_GESESS_KEY = "session";
/**
* @ingroup mstune
* @par 描述: 命令行调优
*
* @attention 无
* @param option [IN] 调优参数
* @param msg [OUT] 调优异常下返回信息
* @retval #MSTUNE_SUCCESS 执行成功
* @retval #MSTUNE_FAILED 执行失败
* @par 依赖:
* @li tune_api.cpp:该接口所属的开发包。
* @li tune_api.h:该接口声明所在的头文件。
* @see 无
* @since
*/
MsTuneStatus MsTuning(const std::map<std::string, std::string> &option, std::string &msg);
/**
* @ingroup mstune
* @par 描述: 梯度调优
*
* @attention 无
* @param tuningGraph [IN] 调优图
* @param dependGraph [IN] 调优依赖图
* @param session [IN] ge连接会话
* @param option [IN] 参数集. 包含调优参数及ge参数
* @retval #MSTUNE_SUCCESS 执行成功
* @retval #MSTUNE_FAILED 执行失败
* @par 依赖:
* @li tune_api.cpp:该接口所属的开发包。
* @li tune_api.h:该接口声明所在的头文件。
* @see 无
* @since
*/
extern "C" MsTuneStatus MsTrainTuning(ge::Graph &tuningGraph, std::vector<ge::Graph> &dependGraph,
ge::Session *session, const std::map<std::string, std::map<std::string, std::string>> &option);
#endif
/**
* @file tune_api.h
*
* Copyright (c) Huawei Technologies Co., Ltd. 2020-2021. All rights reserved.\n
*
* 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.\n
* 描述:aoe调优接口头文件
*/
/** @defgroup aoe aoe调优接口 */
#ifndef TUNE_API_H
#define TUNE_API_H
#include <map>
#include <string>
#include "ge/ge_api.h"
#include "aoe_types.h"

/**
* @ingroup aoe
* @par 描述: 命令行调优
*
* @attention 无
* @param option [IN] 调优参数
* @param msg [OUT] 调优异常下返回信息
* @retval #AOE_SUCCESS 执行成功
* @retval #AOE_FAILURE 执行失败
* @par 依赖:
* @li tune_api.cpp:该接口所属的开发包。
* @li tune_api.h:该接口声明所在的头文件。
* @see 无
* @since
*/
AoeStatus AoeOfflineTuning(const std::map<std::string, std::string> &option, std::string &msg);

/**
* @ingroup aoe
* @par 描述: 调优初始化
*
* @attention 无
* @param session [IN] ge连接会话
* @param option [IN] 参数集. 包含调优参数及ge参数
* @retval #AOE_SUCCESS 执行成功
* @retval #AOE_FAILURE 执行失败
* @par 依赖:
* @li tune_api.cpp:该接口所属的开发包。
* @li tune_api.h:该接口声明所在的头文件。
* @see 无
* @since
*/
extern "C" AoeStatus AoeOnlineInitialize(ge::Session *session, const std::map<std::string, std::string> &option);

/**
* @ingroup aoe
* @par 描述: 调优去初始化
*
* @attention 无
* @param 无
* @retval #AOE_SUCCESS 执行成功
* @retval #AOE_FAILURE 执行失败
* @par 依赖:
* @li tune_api.cpp:该接口所属的开发包。
* @li tune_api.h:该接口声明所在的头文件。
* @see 无
* @since
*/
extern "C" AoeStatus AoeOnlineFinalize();

/**
* @ingroup aoe
* @par 描述: 调优处理
*
* @attention 无
* @param tuningGraph [IN] 调优图
* @param dependGraph [IN] 调优依赖图
* @param session [IN] ge连接会话
* @param option [IN] 参数集. 包含调优参数及ge参数
* @retval #AOE_SUCCESS 执行成功
* @retval #AOE_FAILURE 执行失败
* @par 依赖:
* @li tune_api.cpp:该接口所属的开发包。
* @li tune_api.h:该接口声明所在的头文件。
* @see 无
* @since
*/
extern "C" AoeStatus AoeOnlineTuning(ge::Graph &tuningGraph, std::vector<ge::Graph> &dependGraph,
ge::Session *session, const std::map<std::string, std::string> &option);
#endif

Loading…
Cancel
Save