71 lines
2.1 KiB
C
71 lines
2.1 KiB
C
|
|
#ifndef OPS_BUILT_IN_OP_TILING_ERROR_LOG_H_
|
||
|
|
#define OPS_BUILT_IN_OP_TILING_ERROR_LOG_H_
|
||
|
|
|
||
|
|
#include <string>
|
||
|
|
#include "toolchain/slog.h"
|
||
|
|
|
||
|
|
#define OP_LOGI(opname, ...)
|
||
|
|
#define OP_LOGW(opname, ...) \
|
||
|
|
do { \
|
||
|
|
printf("[WARN][%s] ", (opname), ##__VA_ARGS__); \
|
||
|
|
printf("\n"); \
|
||
|
|
} while (0)
|
||
|
|
|
||
|
|
#define OP_LOGE_WITHOUT_REPORT(opname, ...) \
|
||
|
|
do { \
|
||
|
|
printf("[ERRORx][%s] ", (opname), ##__VA_ARGS__); \
|
||
|
|
printf("\n"); \
|
||
|
|
} while (0)
|
||
|
|
|
||
|
|
#define OP_LOGE(opname, ...) \
|
||
|
|
do { \
|
||
|
|
printf("[ERROR][%s] ", (opname), ##__VA_ARGS__); \
|
||
|
|
printf("\n"); \
|
||
|
|
} while (0)
|
||
|
|
|
||
|
|
#define OP_LOGD(opname, ...)
|
||
|
|
|
||
|
|
namespace optiling {
|
||
|
|
|
||
|
|
#define VECTOR_INNER_ERR_REPORT_TILIING(op_name, err_msg, ...) \
|
||
|
|
do { \
|
||
|
|
OP_LOGE_WITHOUT_REPORT(op_name, err_msg, ##__VA_ARGS__); \
|
||
|
|
} while (0)
|
||
|
|
|
||
|
|
|
||
|
|
#define OP_CHECK_IF(cond, log_func, expr) \
|
||
|
|
do { \
|
||
|
|
if (cond) { \
|
||
|
|
log_func; \
|
||
|
|
expr; \
|
||
|
|
} \
|
||
|
|
} while (0)
|
||
|
|
|
||
|
|
|
||
|
|
|
||
|
|
#define OP_CHECK_NULL_WITH_CONTEXT(context, ptr) \
|
||
|
|
do { \
|
||
|
|
if ((ptr) == nullptr) { \
|
||
|
|
OP_LOGE(context->GetNodeType(), "%s is null", #ptr); \
|
||
|
|
return ge::GRAPH_FAILED; \
|
||
|
|
} \
|
||
|
|
} while (0)
|
||
|
|
|
||
|
|
} // namespace optiling
|
||
|
|
|
||
|
|
template <typename T>
|
||
|
|
T CeilAlign(T a, T b)
|
||
|
|
{
|
||
|
|
return (a + b - 1) / b * b;
|
||
|
|
}
|
||
|
|
|
||
|
|
template <typename T>
|
||
|
|
T CeilDiv(T a, T b)
|
||
|
|
{
|
||
|
|
if (b == 0) {
|
||
|
|
return a;
|
||
|
|
}
|
||
|
|
return (a + b - 1) / b;
|
||
|
|
}
|
||
|
|
|
||
|
|
#endif // OPS_BUILT_IN_OP_TILING_ERROR_LOG_H_
|