Browse Source

Add __attribute__((unused)) for global const-variable

pull/1080/head
zhangxiaokun 5 years ago
parent
commit
2f0cb667b6
24 changed files with 500 additions and 331 deletions
  1. +0
    -1
      ge/common/base64.h
  2. +11
    -3
      ge/common/formats/utils/formats_definitions.h
  3. +53
    -45
      ge/common/fp16_t.h
  4. +9
    -1
      ge/common/kernel_store.h
  5. +25
    -18
      ge/common/profiling/profiling_manager.h
  6. +3
    -3
      ge/graph/build/memory/graph_mem_assigner.cc
  7. +9
    -1
      ge/graph/build/memory/mem_assigner.h
  8. +16
    -8
      ge/graph/load/model_manager/aipp_utils.h
  9. +2
    -2
      ge/graph/load/model_manager/davinci_model.h
  10. +22
    -14
      ge/graph/manager/graph_caching_allocator.h
  11. +9
    -1
      ge/graph/manager/graph_manager_utils.h
  12. +17
    -9
      ge/graph/manager/graph_var_manager.h
  13. +10
    -2
      ge/hybrid/node_executor/node_executor.h
  14. +176
    -168
      inc/external/ge/ge_api_types.h
  15. +20
    -10
      inc/external/ge/ge_ir_build.h
  16. +13
    -5
      inc/framework/common/ge_types.h
  17. +11
    -3
      inc/framework/common/l2_cache_optimize.h
  18. +9
    -1
      inc/framework/common/op_types.h
  19. +31
    -23
      inc/framework/common/types.h
  20. +10
    -2
      inc/framework/common/util.h
  21. +9
    -1
      inc/framework/memory/memory_assigner.h
  22. +10
    -2
      third_party/fwkacllib/inc/cce/fwk_adpt_struct.h
  23. +14
    -5
      third_party/fwkacllib/inc/hccl/base.h
  24. +11
    -3
      third_party/fwkacllib/inc/runtime/base.h

+ 0
- 1
ge/common/base64.h View File

@@ -33,7 +33,6 @@ const char kEqualSymbol = '=';
const size_t kBase64CharsNum = 64;
const size_t kThreeByteOneGroup = 3;
const size_t kFourByteOneGroup = 4;
const size_t kThreeByteOneGroupIndex0 = 0;
const size_t kThreeByteOneGroupIndex1 = 1;
const size_t kThreeByteOneGroupIndex2 = 2;
const size_t kFourByteOneGroupIndex0 = 0;


+ 11
- 3
ge/common/formats/utils/formats_definitions.h View File

@@ -17,11 +17,19 @@
#ifndef GE_COMMON_FORMATS_UTILS_FORMATS_DEFINITIONS_H_
#define GE_COMMON_FORMATS_UTILS_FORMATS_DEFINITIONS_H_

#ifndef GE_VAR_UNUSED
#ifdef __GNUC__
#define GE_VAR_UNUSED __attribute__((unused))
#else
#define GE_VAR_UNUSED
#endif
#endif

namespace ge {
namespace formats {
static const int kCubeSize = 16;
static const int kNiSize = 16;
static const int64_t kShapeItemNumMAX = 1024UL * 1024UL * 1024UL * 1024UL;
static const int kCubeSize GE_VAR_UNUSED = 16;
static const int kNiSize GE_VAR_UNUSED = 16;
static const int64_t kShapeItemNumMAX GE_VAR_UNUSED = 1024UL * 1024UL * 1024UL * 1024UL;


enum NchwDimIndex {


+ 53
- 45
ge/common/fp16_t.h View File

@@ -17,6 +17,14 @@
#ifndef GE_COMMON_FP16_T_H_
#define GE_COMMON_FP16_T_H_

#ifndef GE_VAR_UNUSED
#ifdef __GNUC__
#define GE_VAR_UNUSED __attribute__((unused))
#else
#define GE_VAR_UNUSED
#endif
#endif

#include <algorithm>
#include <cmath>
#include <cstdint>
@@ -90,50 +98,50 @@ using BitShift = enum {
};
/// @ingroup fp16 basic parameter
/// @brief fp16 exponent bias
constexpr uint16_t kFp16ExpBias = 15;
constexpr uint16_t kFp16ExpBias GE_VAR_UNUSED = 15;
/// @ingroup fp16 basic parameter
/// @brief the exponent bit length of fp16 is 5
constexpr uint16_t kFp16ExpLen = 5;
constexpr uint16_t kFp16ExpLen GE_VAR_UNUSED = 5;
/// @ingroup fp16 basic parameter
/// @brief the mantissa bit length of fp16 is 10
constexpr uint16_t kFp16ManLen = 10;
constexpr uint16_t kFp16ManLen GE_VAR_UNUSED = 10;
/// @ingroup fp16 basic parameter
/// @brief bit index of sign in fp16
constexpr uint16_t kFp16SignIndex = 15;
constexpr uint16_t kFp16SignIndex GE_VAR_UNUSED = 15;
/// @ingroup fp16 basic parameter
/// @brief sign mask of fp16 (1 00000 00000 00000)
constexpr uint16_t kFp16SignMask = 0x8000;
constexpr uint16_t kFp16SignMask GE_VAR_UNUSED = 0x8000;
/// @ingroup fp16 basic parameter
/// @brief exponent mask of fp16 ( 11111 00000 00000)
constexpr uint16_t kFp16ExpMask = 0x7C00;
constexpr uint16_t kFp16ExpMask GE_VAR_UNUSED = 0x7C00;
/// @ingroup fp16 basic parameter
/// @brief mantissa mask of fp16 ( 11111 11111)
constexpr uint16_t kFp16ManMask = 0x03FF;
constexpr uint16_t kFp16ManMask GE_VAR_UNUSED = 0x03FF;
/// @ingroup fp16 basic parameter
/// @brief hide bit of mantissa of fp16( 1 00000 00000)
constexpr uint16_t kFp16ManHideBit = 0x0400;
constexpr uint16_t kFp16ManHideBit GE_VAR_UNUSED = 0x0400;
/// @ingroup fp16 basic parameter
/// @brief maximum value (0111 1011 1111 1111)
constexpr uint16_t kFp16Max = 0x7BFF;
constexpr uint16_t kFp16Max GE_VAR_UNUSED = 0x7BFF;
/// @ingroup fp16 basic parameter
/// @brief minimum value (1111 1011 1111 1111)
constexpr uint16_t kFp16Min = 0xFBFF;
constexpr uint16_t kFp16Min GE_VAR_UNUSED = 0xFBFF;
/// @ingroup fp16 basic parameter
/// @brief absolute maximum value (0111 1111 1111 1111)
constexpr uint16_t kFp16AbsMax = 0x7FFF;
constexpr uint16_t kFp16AbsMax GE_VAR_UNUSED = 0x7FFF;
/// @ingroup fp16 basic parameter
/// @brief maximum exponent value of fp16 is 15(11111)
constexpr uint16_t kFp16MaxExp = 0x001F;
constexpr uint16_t kFp16MaxExp GE_VAR_UNUSED = 0x001F;
/// @ingroup fp16 basic parameter
/// @brief maximum valid exponent value of fp16 is 14(11110)
constexpr uint16_t kFp16MaxValidExp = 0x001E;
constexpr uint16_t kFp16MaxValidExp GE_VAR_UNUSED = 0x001E;
/// @ingroup fp16 basic parameter
/// @brief maximum mantissa value of fp16(11111 11111)
constexpr uint16_t kFp16MaxMan = 0x03FF;
constexpr uint16_t kFp16MaxMan GE_VAR_UNUSED = 0x03FF;
/// @ingroup fp16 basic parameter
/// @brief absolute minimum normal value of fp16
/// (E=1,M=0 D=2^(-14)=0.00006103515625)
constexpr uint16_t kFp16MinNormal = 1.0f / (2 << 14);
constexpr uint16_t kFp16MinNormal GE_VAR_UNUSED = 1.0f / (2 << 14);
/// @ingroup fp16 basic operator
/// @brief get sign of fp16
#define FP16_EXTRAC_SIGN(x) (((x) >> 15) & 1)
@@ -163,37 +171,37 @@ constexpr uint16_t kFp16MinNormal = 1.0f / (2 << 14);
#define FP16_IS_INVALID(x) ((x & kFp16ExpMask) == kFp16ExpMask)
/// @ingroup fp32 basic parameter
/// @brief fp32 exponent bias
constexpr uint16_t kFp32ExpBias = 127;
constexpr uint16_t kFp32ExpBias GE_VAR_UNUSED = 127;
/// @ingroup fp32 basic parameter
/// @brief the exponent bit length of float/fp32 is 8
constexpr uint16_t kFp32ExpLen = 8;
constexpr uint16_t kFp32ExpLen GE_VAR_UNUSED = 8;
/// @ingroup fp32 basic parameter
/// @brief the mantissa bit length of float/fp32 is 23
constexpr uint16_t kFp32ManLen = 23;
constexpr uint16_t kFp32ManLen GE_VAR_UNUSED = 23;
/// @ingroup fp32 basic parameter
/// @brief bit index of sign in float/fp32
constexpr uint16_t kFp32SignIndex = 31;
constexpr uint16_t kFp32SignIndex GE_VAR_UNUSED = 31;
/// @ingroup fp32 basic parameter
/// @brief sign mask of fp32 (1 0000 0000 0000 0000 0000 0000 000)
constexpr uint32_t kFp32SignMask = 0x80000000u;
constexpr uint32_t kFp32SignMask GE_VAR_UNUSED = 0x80000000u;
/// @ingroup fp32 basic parameter
/// @brief exponent mask of fp32 ( 1111 1111 0000 0000 0000 0000 000)
constexpr uint32_t kFp32ExpMask = 0x7F800000u;
constexpr uint32_t kFp32ExpMask GE_VAR_UNUSED = 0x7F800000u;
/// @ingroup fp32 basic parameter
/// @brief mantissa mask of fp32 ( 1111 1111 1111 1111 111)
constexpr uint32_t kFp32ManMask = 0x007FFFFFu;
constexpr uint32_t kFp32ManMask GE_VAR_UNUSED = 0x007FFFFFu;
/// @ingroup fp32 basic parameter
/// @brief hide bit of mantissa of fp32 ( 1 0000 0000 0000 0000 000)
constexpr uint32_t kFp32ManHideBit = 0x00800000u;
constexpr uint32_t kFp32ManHideBit GE_VAR_UNUSED = 0x00800000u;
/// @ingroup fp32 basic parameter
/// @brief absolute maximum value (0 1111 1111 1111 1111 1111 1111 111)
constexpr uint32_t kFp32AbsMax = 0x7FFFFFFFu;
constexpr uint32_t kFp32AbsMax GE_VAR_UNUSED = 0x7FFFFFFFu;
/// @ingroup fp32 basic parameter
/// @brief maximum exponent value of fp32 is 255(1111 1111)
constexpr uint32_t kFp32MaxExp = 0xFF;
constexpr uint32_t kFp32MaxExp GE_VAR_UNUSED = 0xFF;
/// @ingroup fp32 basic parameter
/// @brief maximum mantissa value of fp32 (1111 1111 1111 1111 1111 111)
constexpr uint32_t kFp32MaxMan = 0x7FFFFF;
constexpr uint32_t kFp32MaxMan GE_VAR_UNUSED = 0x7FFFFF;
/// @ingroup fp32 special value judgment
/// @brief whether a fp32 is NaN
#define FP32_IS_NAN(x) (((x & kFp32ExpMask) == kFp32ExpMask) && (x & kFp32ManMask))
@@ -217,37 +225,37 @@ constexpr uint32_t kFp32MaxMan = 0x7FFFFF;
#define FP32_CONSTRUCTOR(s, e, m) (((s) << kFp32SignIndex) | ((e) << kFp32ManLen) | ((m)&kFp32MaxMan))
/// @ingroup fp64 basic parameter
/// @brief fp64 exponent bias
constexpr uint16_t kFp64ExpBias = 1023;
constexpr uint16_t kFp64ExpBias GE_VAR_UNUSED = 1023;
/// @ingroup fp64 basic parameter
/// @brief the exponent bit length of double/fp64 is 11
constexpr uint16_t kFp64ExpLen = 11;
constexpr uint16_t kFp64ExpLen GE_VAR_UNUSED = 11;
/// @ingroup fp64 basic parameter
/// @brief the mantissa bit length of double/fp64 is 52
constexpr uint16_t kFp64ManLen = 52;
constexpr uint16_t kFp64ManLen GE_VAR_UNUSED = 52;
/// @ingroup fp64 basic parameter
/// @brief bit index of sign in double/fp64 is 63
constexpr uint16_t kFp64SignIndex = 63;
constexpr uint16_t kFp64SignIndex GE_VAR_UNUSED = 63;
/// @ingroup fp64 basic parameter
/// @brief sign mask of fp64 (1 000 (total 63bits 0))
constexpr uint64_t kFp64SignMask = 0x8000000000000000LLu;
constexpr uint64_t kFp64SignMask GE_VAR_UNUSED = 0x8000000000000000LLu;
/// @ingroup fp64 basic parameter
/// @brief exponent mask of fp64 (0 1 11111 11111 0000?-?-(total 52bits 0))
constexpr uint64_t kFp64ExpMask = 0x7FF0000000000000LLu;
constexpr uint64_t kFp64ExpMask GE_VAR_UNUSED = 0x7FF0000000000000LLu;
/// @ingroup fp64 basic parameter
/// @brief mantissa mask of fp64 ( 1111?-?-(total 52bits 1))
constexpr uint64_t kFp64ManMask = 0x000FFFFFFFFFFFFFLLu;
constexpr uint64_t kFp64ManMask GE_VAR_UNUSED = 0x000FFFFFFFFFFFFFLLu;
/// @ingroup fp64 basic parameter
/// @brief hide bit of mantissa of fp64 ( 1 0000?-?-(total 52bits 0))
constexpr uint64_t kFp64ManHideBit = 0x0010000000000000LLu;
constexpr uint64_t kFp64ManHideBit GE_VAR_UNUSED = 0x0010000000000000LLu;
/// @ingroup fp64 basic parameter
/// @brief absolute maximum value (0 111?-?-(total 63bits 1))
constexpr uint64_t kFp64AbsMax = 0x7FFFFFFFFFFFFFFFLLu;
constexpr uint64_t kFp64AbsMax GE_VAR_UNUSED = 0x7FFFFFFFFFFFFFFFLLu;
/// @ingroup fp64 basic parameter
/// @brief maximum exponent value of fp64 is 2047(1 11111 11111)
constexpr uint64_t kFp64MaxExp = 0x07FF;
constexpr uint64_t kFp64MaxExp GE_VAR_UNUSED = 0x07FF;
/// @ingroup fp64 basic parameter
/// @brief maximum mantissa value of fp64 (111?-?-(total 52bits 1))
constexpr uint64_t kFp64MaxMan = 0xFFFFFFFFFFFLLu;
constexpr uint64_t kFp64MaxMan GE_VAR_UNUSED = 0xFFFFFFFFFFFLLu;
/// @ingroup fp64 special value judgment
/// @brief whether a fp64 is NaN
#define FP64_IS_NAN(x) (((x & kFp64ExpMask) == kFp64ExpMask) && (x & kFp64ManMask))
@@ -256,30 +264,30 @@ constexpr uint64_t kFp64MaxMan = 0xFFFFFFFFFFFLLu;
#define FP64_IS_INF(x) (((x & kFp64ExpMask) == kFp64ExpMask) && (!(x & kFp64ManMask)))
/// @ingroup integer special value judgment
/// @brief maximum positive value of int8_t (0111 1111)
constexpr int8_t kInt8Max = 0x7F;
constexpr int8_t kInt8Max GE_VAR_UNUSED = 0x7F;
/// @ingroup integer special value judgment
/// @brief maximum value of a data with 8 bits length (1111 111)
constexpr uint8_t kBitLen8Max = 0xFF;
constexpr uint8_t kBitLen8Max GE_VAR_UNUSED = 0xFF;
/// @ingroup integer special value judgment
/// @brief maximum positive value of int16_t (0111 1111 1111 1111)
constexpr int16_t kInt16Max = 0x7FFF;
constexpr int16_t kInt16Max GE_VAR_UNUSED = 0x7FFF;
/// @ingroup integer special value judgment
/// @brief maximum value of a data with 16 bits length (1111 1111 1111 1111)
constexpr uint16_t kBitLen16Max = 0xFFFF;
constexpr uint16_t kBitLen16Max GE_VAR_UNUSED = 0xFFFF;
/// @ingroup integer special value judgment
/// @brief maximum positive value of int32_t (0111 1111 1111 1111 1111 1111 1111 1111)
constexpr int32_t kInt32Max = 0x7FFFFFFFu;
constexpr int32_t kInt32Max GE_VAR_UNUSED = 0x7FFFFFFFu;
/// @ingroup integer special value judgment
/// @brief maximum value of a data with 32 bits length (1111 1111 1111 1111 1111 1111 1111 1111)
constexpr uint32_t kBitLen32Max = 0xFFFFFFFFu;
constexpr uint32_t kBitLen32Max GE_VAR_UNUSED = 0xFFFFFFFFu;
/// @ingroup integer special value judgment
/// @brief maximum positive value of int64_t
/// (0111 1111 1111 1111 1111 1111 1111 1111 1111 1111 1111 1111 1111 1111 1111 1111)
constexpr int64_t kInt64Max = 0x7FFFFFFFFFFFFFFFu;
constexpr int64_t kInt64Max GE_VAR_UNUSED = 0x7FFFFFFFFFFFFFFFu;
/// @ingroup integer special value judgment
/// @brief maximum value of a data with 64 bits length
/// (1111 1111 1111 1111 1111 1111 1111 1111 1111 1111 1111 1111 1111 1111 1111 1111)
constexpr uint64_t kBitLen64Max = 0xFFFFFFFFFFFFFFFFu;
constexpr uint64_t kBitLen64Max GE_VAR_UNUSED = 0xFFFFFFFFFFFFFFFFu;

/// @ingroup fp16_t enum
/// @brief round mode of last valid digital


+ 9
- 1
ge/common/kernel_store.h View File

@@ -17,6 +17,14 @@
#ifndef GE_COMMON_KERNEL_STORE_H_
#define GE_COMMON_KERNEL_STORE_H_

#ifndef GE_VAR_UNUSED
#ifdef __GNUC__
#define GE_VAR_UNUSED __attribute__((unused))
#else
#define GE_VAR_UNUSED
#endif
#endif

#include <cstdint>
#include <memory>
#include <string>
@@ -40,7 +48,7 @@ using CustAICPUKernelPtr = std::shared_ptr<ge::OpKernelBin>;
using TBEKernel = ge::OpKernelBin;
using TBEKernelPtr = std::shared_ptr<ge::OpKernelBin>;

const uint32_t kKernelItemMagic = 0x5d776efd;
const uint32_t kKernelItemMagic GE_VAR_UNUSED = 0x5d776efd;

struct KernelStoreItemHead {
uint32_t magic;


+ 25
- 18
ge/common/profiling/profiling_manager.h View File

@@ -17,6 +17,14 @@
#ifndef GE_COMMON_PROFILING_PROFILING_MANAGER_H_
#define GE_COMMON_PROFILING_PROFILING_MANAGER_H_

#ifndef GE_VAR_UNUSED
#ifdef __GNUC__
#define GE_VAR_UNUSED __attribute__((unused))
#else
#define GE_VAR_UNUSED
#endif
#endif

#include <nlohmann/json.hpp>
#include <mutex>
#include <map>
@@ -34,24 +42,23 @@ using std::vector;
using Json = nlohmann::json;

namespace {
const std::string GE_PROFILING_MODULE = "Framework";
// DataTypeConfig MASK
const uint64_t PROF_ACL_API_MASK = 0x0001;
const uint64_t PROF_TASK_TIME_MASK = 0x0002;
const uint64_t PROF_AICORE_METRICS_MASK = 0x0004;
const uint64_t PROF_AICPU_TRACE_MASK = 0x0008;
const uint64_t PROF_MODEL_EXECUTE_MASK = 0x0010;
const uint64_t PROF_RUNTIME_API_MASK = 0x0020;
const uint64_t PROF_RUNTIME_TRACE_MASK = 0x0040;
const uint64_t PROF_SCHEDULE_TIMELINE_MASK = 0x0080;
const uint64_t PROF_SCHEDULE_TRACE_MASK = 0x0100;
const uint64_t PROF_AIVECTORCORE_METRICS_MASK = 0x0200;
const uint64_t PROF_SUBTASK_TIME_MASK = 0x0400;
const uint64_t PROF_TRAINING_TRACE_MASK = 0x0800;
const uint64_t PROF_HCCL_TRACE_MASK = 0x1000;
const uint64_t PROF_DATA_PROCESS_MASK = 0x2000;
const uint64_t PROF_MODEL_LOAD_MASK = 0x8000000000000000;

const std::string GE_PROFILING_MODULE GE_VAR_UNUSED = "Framework";
// DataTypeConfig MASK
const uint64_t PROF_ACL_API_MASK GE_VAR_UNUSED = 0x0001;
const uint64_t PROF_TASK_TIME_MASK GE_VAR_UNUSED = 0x0002;
const uint64_t PROF_AICORE_METRICS_MASK GE_VAR_UNUSED = 0x0004;
const uint64_t PROF_AICPU_TRACE_MASK GE_VAR_UNUSED = 0x0008;
const uint64_t PROF_MODEL_EXECUTE_MASK GE_VAR_UNUSED = 0x0010;
const uint64_t PROF_RUNTIME_API_MASK GE_VAR_UNUSED = 0x0020;
const uint64_t PROF_RUNTIME_TRACE_MASK GE_VAR_UNUSED = 0x0040;
const uint64_t PROF_SCHEDULE_TIMELINE_MASK GE_VAR_UNUSED = 0x0080;
const uint64_t PROF_SCHEDULE_TRACE_MASK GE_VAR_UNUSED = 0x0100;
const uint64_t PROF_AIVECTORCORE_METRICS_MASK GE_VAR_UNUSED = 0x0200;
const uint64_t PROF_SUBTASK_TIME_MASK GE_VAR_UNUSED = 0x0400;
const uint64_t PROF_TRAINING_TRACE_MASK GE_VAR_UNUSED = 0x0800;
const uint64_t PROF_HCCL_TRACE_MASK GE_VAR_UNUSED = 0x1000;
const uint64_t PROF_DATA_PROCESS_MASK GE_VAR_UNUSED = 0x2000;
const uint64_t PROF_MODEL_LOAD_MASK GE_VAR_UNUSED = 0x8000000000000000;
} // namespace
namespace ge {
struct DeviceSubsInfo {


+ 3
- 3
ge/graph/build/memory/graph_mem_assigner.cc View File

@@ -948,7 +948,7 @@ Status GraphMemoryAssigner::AssignAtomicOutputMemory(const ge::NodePtr &node, ve
output_list[output_index] = iter->second.mem_offset_;
std::string batch_label;
(void)ge::AttrUtils::GetStr(op_desc, ATTR_NAME_BATCH_LABEL, batch_label);
GELOGI("[IMAS]Atomic output : Set %s name[%s] optype[%s] output[%ld] offset to [%zu] stream_id[%ld] memtype[%ld] "
GELOGI("[IMAS]Atomic output : Set %s name[%s] optype[%s] output[%ld] offset to [%zu] stream_id[%ld] memtype[%u] "
"size[%ld] real_size[%ld] batch[%s].", compute_graph_->GetName().c_str(), op_desc->GetName().c_str(),
node->GetType().c_str(), output_index, iter->second.mem_offset_, op_desc->GetStreamId(), RT_MEMORY_HBM,
size, size, batch_label.c_str());
@@ -1028,7 +1028,7 @@ Status GraphMemoryAssigner::AssignOrdinaryAtomicWorkspaceMemory(const ge::OpDesc
(void)ge::AttrUtils::GetStr(op_desc, ATTR_NAME_BATCH_LABEL, batch_label);
GELOGI(
"[IMAS]Atomic ordinary workspace : Set %s name[%s] optype[%s] workspace[%lu] offset to [%zu] stream_id[%ld] "
"memtype[%ld] size[%ld] real_size[%ld] batch[%s].",
"memtype[%u] size[%ld] real_size[%ld] batch[%s].",
compute_graph_->GetName().c_str(), op_desc->GetName().c_str(), op_desc->GetType().c_str(), workspace_index,
mem_type_iter->second.mem_offset_, op_desc->GetStreamId(), RT_MEMORY_HBM, workspace_size, workspace_size,
batch_label.c_str());
@@ -1069,7 +1069,7 @@ Status GraphMemoryAssigner::AssignFusionAtomicWorkspaceMemory(const ge::OpDescPt
(void)ge::AttrUtils::GetStr(op_desc, ATTR_NAME_BATCH_LABEL, batch_label);
GELOGI(
"[IMAS]Atomic fusion workspace : Set %s name[%s] optype[%s] workspace[%lu] offset to [%zu] stream_id[%ld] "
"memtype[%ld] ssize[%ld] real_size[%ld] batch[%s].", compute_graph_->GetName().c_str(),
"memtype[%u] ssize[%ld] real_size[%ld] batch[%s].", compute_graph_->GetName().c_str(),
op_desc->GetName().c_str(), op_desc->GetType().c_str(), workspace_index, mem_type_iter->second.mem_offset_,
op_desc->GetStreamId(), RT_MEMORY_HBM, workspace_size, workspace_size, batch_label.c_str());



+ 9
- 1
ge/graph/build/memory/mem_assigner.h View File

@@ -17,10 +17,18 @@
#ifndef GE_GRAPH_BUILD_MEMORY_MEM_ASSIGNER_H_
#define GE_GRAPH_BUILD_MEMORY_MEM_ASSIGNER_H_

#ifndef GE_VAR_UNUSED
#ifdef __GNUC__
#define GE_VAR_UNUSED __attribute__((unused))
#else
#define GE_VAR_UNUSED
#endif
#endif

#include "common/ge_inner_error_codes.h"
#include "memory/memory_assigner.h"
namespace ge {
static const int64_t kInvalidOffset = -1;
static const int64_t kInvalidOffset GE_VAR_UNUSED = -1;

class MemAssigner {
public:


+ 16
- 8
ge/graph/load/model_manager/aipp_utils.h View File

@@ -17,6 +17,14 @@
#ifndef GE_GRAPH_LOAD_NEW_MODEL_MANAGER_AIPP_UTILS_H_
#define GE_GRAPH_LOAD_NEW_MODEL_MANAGER_AIPP_UTILS_H_

#ifndef GE_VAR_UNUSED
#ifdef __GNUC__
#define GE_VAR_UNUSED __attribute__((unused))
#else
#define GE_VAR_UNUSED
#endif
#endif

#include <vector>

#include "common/ge_inner_error_codes.h"
@@ -27,14 +35,14 @@
using std::vector;

namespace ge {
const uint32_t kAippOriginInputIndex = 0;
const uint32_t kAippInfoNum = 6;
const uint32_t kAippInfoFormat = 0;
const uint32_t kAippInfoDataType = 1;
const uint32_t kAippInfoTensorName = 2;
const uint32_t kAippInfoTensorSize = 3;
const uint32_t kAippInfoDimNum = 4;
const uint32_t kAippInfoShape = 5;
const uint32_t kAippOriginInputIndex GE_VAR_UNUSED = 0;
const uint32_t kAippInfoNum GE_VAR_UNUSED = 6;
const uint32_t kAippInfoFormat GE_VAR_UNUSED = 0;
const uint32_t kAippInfoDataType GE_VAR_UNUSED = 1;
const uint32_t kAippInfoTensorName GE_VAR_UNUSED = 2;
const uint32_t kAippInfoTensorSize GE_VAR_UNUSED = 3;
const uint32_t kAippInfoDimNum GE_VAR_UNUSED = 4;
const uint32_t kAippInfoShape GE_VAR_UNUSED = 5;

class AippUtils {
public:


+ 2
- 2
ge/graph/load/model_manager/davinci_model.h View File

@@ -55,8 +55,8 @@ using std::multimap;

namespace ge {
// op debug need 2048 bits buffer
const size_t kOpDebugMemorySize = 2048UL;
const size_t kDebugP2pSize = 8UL;
const size_t kOpDebugMemorySize GE_VAR_UNUSED = 2048UL;
const size_t kDebugP2pSize GE_VAR_UNUSED = 8UL;

typedef enum tagModelProcStage {
MODEL_LOAD_START = 1,


+ 22
- 14
ge/graph/manager/graph_caching_allocator.h View File

@@ -17,6 +17,14 @@
#ifndef GE_GRAPH_MANAGER_GRAPH_CACHING_ALLOCATOR_H_
#define GE_GRAPH_MANAGER_GRAPH_CACHING_ALLOCATOR_H_

#ifndef GE_VAR_UNUSED
#ifdef __GNUC__
#define GE_VAR_UNUSED __attribute__((unused))
#else
#define GE_VAR_UNUSED
#endif
#endif

#include <iostream>
#include <map>
#include <memory>
@@ -33,20 +41,20 @@
#include "runtime/mem.h"

namespace ge {
constexpr size_t kRoundBlockSize = 512; // all block sizes are rounded to at least 512 bytes
constexpr size_t kBinSizeUnit4 = 4;
constexpr size_t kBinSizeUnit8 = 8;
constexpr size_t kBinSizeUnit16 = 16;
constexpr size_t kBinSizeUnit26 = 26;
constexpr size_t kBinSizeUnit32 = 32;
constexpr size_t kBinSizeUnit128 = 128;
constexpr double kSplitThreshold = 0.75; // split when malloc size <= small block size * kSpliThreshold
constexpr size_t kKByteSize = 1024;
constexpr size_t kMByteSize = 1048576; // 1024 * 1024
constexpr size_t kGByteSize = 1073741824; // 1024 * 1024 * 1024
static const uint32_t kNumBins = 8;
constexpr size_t kRoundBlockSize GE_VAR_UNUSED = 512; // all block sizes are rounded to at least 512 bytes
constexpr size_t kBinSizeUnit4 GE_VAR_UNUSED = 4;
constexpr size_t kBinSizeUnit8 GE_VAR_UNUSED = 8;
constexpr size_t kBinSizeUnit16 GE_VAR_UNUSED = 16;
constexpr size_t kBinSizeUnit26 GE_VAR_UNUSED = 26;
constexpr size_t kBinSizeUnit32 GE_VAR_UNUSED = 32;
constexpr size_t kBinSizeUnit128 GE_VAR_UNUSED = 128;
constexpr double kSplitThreshold GE_VAR_UNUSED = 0.75; // split when malloc size <= small block size * kSpliThreshold
constexpr size_t kKByteSize GE_VAR_UNUSED = 1024;
constexpr size_t kMByteSize GE_VAR_UNUSED = 1048576; // 1024 * 1024
constexpr size_t kGByteSize GE_VAR_UNUSED = 1073741824; // 1024 * 1024 * 1024
static const uint32_t kNumBins GE_VAR_UNUSED = 8;

class MemoryAllocator;



+ 9
- 1
ge/graph/manager/graph_manager_utils.h View File

@@ -17,6 +17,14 @@
#ifndef GE_GRAPH_MANAGER_GRAPH_MANAGER_UTILS_H_
#define GE_GRAPH_MANAGER_GRAPH_MANAGER_UTILS_H_

#ifndef GE_VAR_UNUSED
#ifdef __GNUC__
#define GE_VAR_UNUSED __attribute__((unused))
#else
#define GE_VAR_UNUSED
#endif
#endif

#include <condition_variable>
#include <map>
#include <memory>
@@ -54,7 +62,7 @@ using GeModelPtr = std::shared_ptr<ge::GeModel>;
using ConstGraphPtr = std::shared_ptr<const ge::Graph>;
using GraphPtr = std::shared_ptr<ge::Graph>;

const uint64_t INVALID_SESSION_ID = 0xffffffffffffffffULL;
const uint64_t INVALID_SESSION_ID GE_VAR_UNUSED = 0xffffffffffffffffULL;

struct ModelIdInfo {
uint32_t model_id{INVALID_MODEL_ID};


+ 17
- 9
ge/graph/manager/graph_var_manager.h View File

@@ -17,6 +17,14 @@
#ifndef GE_GRAPH_MANAGER_GRAPH_VAR_MANAGER_H_
#define GE_GRAPH_MANAGER_GRAPH_VAR_MANAGER_H_

#ifndef GE_VAR_UNUSED
#ifdef __GNUC__
#define GE_VAR_UNUSED __attribute__((unused))
#else
#define GE_VAR_UNUSED
#endif
#endif

#include <atomic>
#include <map>
#include <memory>
@@ -34,15 +42,15 @@
#include "runtime/mem.h"

namespace ge {
const size_t kGraphMemoryManagerMallocMaxSize = 26UL * 1024UL * 1024UL * 1024UL;
const size_t kMemoryVarManagerMallocSize = 5UL * 1024UL * 1024UL * 1024UL;
const size_t kMemoryVarLogicBase = 32UL * 1024UL * 1024UL * 1024UL;
const size_t kUseMaxMemorySize = kGraphMemoryManagerMallocMaxSize + kMemoryVarManagerMallocSize;
const size_t kGraphMemoryBuffer = 4UL * 1024UL * 1024UL * 1024UL;
const size_t kMaxMemorySize = 256UL * 1024UL * 1024UL * 1024UL;
const char kEnvGeuseStaticMemory[] = "GE_USE_STATIC_MEMORY";
const uint64_t kSessionMemAlignSize = 512;
const size_t kSessionMemAlignUnit = 2;
const size_t kGraphMemoryManagerMallocMaxSize GE_VAR_UNUSED = 26UL * 1024UL * 1024UL * 1024UL;
const size_t kMemoryVarManagerMallocSize GE_VAR_UNUSED = 5UL * 1024UL * 1024UL * 1024UL;
const size_t kMemoryVarLogicBase GE_VAR_UNUSED = 32UL * 1024UL * 1024UL * 1024UL;
const size_t kUseMaxMemorySize GE_VAR_UNUSED = kGraphMemoryManagerMallocMaxSize + kMemoryVarManagerMallocSize;
const size_t kGraphMemoryBuffer GE_VAR_UNUSED = 4UL * 1024UL * 1024UL * 1024UL;
const size_t kMaxMemorySize GE_VAR_UNUSED = 256UL * 1024UL * 1024UL * 1024UL;
const char kEnvGeuseStaticMemory[] GE_VAR_UNUSED = "GE_USE_STATIC_MEMORY";
const uint64_t kSessionMemAlignSize GE_VAR_UNUSED = 512;
const size_t kSessionMemAlignUnit GE_VAR_UNUSED = 2;

enum MemStatus {
NORMAL = 0,


+ 10
- 2
ge/hybrid/node_executor/node_executor.h View File

@@ -17,14 +17,22 @@
#ifndef GE_HYBRID_NODE_EXECUTOR_NODE_EXECUTOR_H_
#define GE_HYBRID_NODE_EXECUTOR_NODE_EXECUTOR_H_

#ifndef GE_VAR_UNUSED
#ifdef __GNUC__
#define GE_VAR_UNUSED __attribute__((unused))
#else
#define GE_VAR_UNUSED
#endif
#endif

#include "external/ge/ge_api_error_codes.h"
#include "common/opskernel/ops_kernel_builder.h"
#include "graph/node.h"
#include "task_context.h"

namespace ge {
const uint32_t MEMORY_ALIGN_RATIO = 2;
const uint32_t MEMORY_ALIGN_SIZE = 32;
const uint32_t MEMORY_ALIGN_RATIO GE_VAR_UNUSED = 2;
const uint32_t MEMORY_ALIGN_SIZE GE_VAR_UNUSED = 32;
namespace hybrid {
class HybridModel;
// Base class of Node Task


+ 176
- 168
inc/external/ge/ge_api_types.h View File

@@ -17,6 +17,14 @@
#ifndef INC_EXTERNAL_GE_GE_API_TYPES_H_
#define INC_EXTERNAL_GE_GE_API_TYPES_H_

#ifndef GE_VAR_UNUSED
#ifdef __GNUC__
#define GE_VAR_UNUSED __attribute__((unused))
#else
#define GE_VAR_UNUSED
#endif
#endif

#include <cstdint>
#include <string>
#include <vector>
@@ -26,287 +34,287 @@

namespace ge {
// Option key: graph run mode
const char *const OPTION_GRAPH_RUN_MODE = "ge.graphRunMode";
const char *const OPTION_GRAPH_RUN_MODE GE_VAR_UNUSED = "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_SESSION_ID GE_VAR_UNUSED = "ge.exec.sessionId";
const char *const OPTION_EXEC_DEVICE_ID GE_VAR_UNUSED = "ge.exec.deviceId";
const char *const OPTION_EXEC_JOB_ID GE_VAR_UNUSED = "ge.exec.jobId";
const char *const OPTION_EXEC_IS_USEHCOM GE_VAR_UNUSED = "ge.exec.isUseHcom";
const char *const OPTION_EXEC_IS_USEHVD GE_VAR_UNUSED = "ge.exec.isUseHvd";
const char *const OPTION_EXEC_RANK_ID GE_VAR_UNUSED = "ge.exec.rankId";
const char *const OPTION_EXEC_POD_NAME GE_VAR_UNUSED = "ge.exec.podName";
const char *const OPTION_EXEC_DEPLOY_MODE GE_VAR_UNUSED = "ge.exec.deployMode";
const char *const OPTION_EXEC_RANK_TABLE_FILE GE_VAR_UNUSED = "ge.exec.rankTableFile";
const char *const GE_AICPU_FLAG GE_VAR_UNUSED = "ge.aicpuFlag";
const char *const OPTION_EXEC_EXTERN_PLUGIN_PATH GE_VAR_UNUSED = "ge.soLoadPath";
// Dump flag and para
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_EXCEPTION_DUMP = "ge.exec.enable_exception_dump";
const char *const OPTION_EXEC_ENABLE_SCOPE_FUSION_PASSES = "ge.exec.enableScopeFusionPasses";
const char *const OPTION_EXEC_PROFILING_FPPONIT_OPTIONS = "ge.exec.profilingFpPointOptions";
const char *const OPTION_EXEC_PROFILING_BPPONIT_OPTIONS = "ge.exec.profilingBpPointOptions";
const char *const OPTION_EXEC_ENABLE_DUMP GE_VAR_UNUSED = "ge.exec.enableDump";
const char *const OPTION_EXEC_DUMP_PATH GE_VAR_UNUSED = "ge.exec.dumpPath";
const char *const OPTION_EXEC_DUMP_STEP GE_VAR_UNUSED = "ge.exec.dumpStep";
const char *const OPTION_EXEC_DUMP_MODE GE_VAR_UNUSED = "ge.exec.dumpMode";
const char *const OPTION_EXEC_ENABLE_DUMP_DEBUG GE_VAR_UNUSED = "ge.exec.enableDumpDebug";
const char *const OPTION_EXEC_DUMP_DEBUG_MODE GE_VAR_UNUSED = "ge.exec.dumpDebugMode";
const char *const OPTION_EXEC_ENABLE_INCRE_BUILD GE_VAR_UNUSED = "ge.exec.enableIncreBuild";
const char *const OPTION_EXEC_INCRE_BUILD_CACHE_PATH GE_VAR_UNUSED = "ge.exec.increBuildCachePath";
const char *const OPTION_EXEC_ENABLE_EXCEPTION_DUMP GE_VAR_UNUSED = "ge.exec.enable_exception_dump";
const char *const OPTION_EXEC_ENABLE_SCOPE_FUSION_PASSES GE_VAR_UNUSED = "ge.exec.enableScopeFusionPasses";
const char *const OPTION_EXEC_PROFILING_FPPONIT_OPTIONS GE_VAR_UNUSED = "ge.exec.profilingFpPointOptions";
const char *const OPTION_EXEC_PROFILING_BPPONIT_OPTIONS GE_VAR_UNUSED = "ge.exec.profilingBpPointOptions";
// profiling flag
const char *const OPTION_EXEC_PROFILING_MODE = "ge.exec.profilingMode";
const char *const OPTION_EXEC_PROFILING_OPTIONS = "ge.exec.profilingOptions";
const char *const OPTION_EXEC_PROFILING_MODE GE_VAR_UNUSED = "ge.exec.profilingMode";
const char *const OPTION_EXEC_PROFILING_OPTIONS GE_VAR_UNUSED = "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";
const char *const OPTION_EXEC_HCCL_FLAG GE_VAR_UNUSED = "ge.exec.hcclFlag";
const char *const OPTION_EXEC_ATOMIC_FLAG GE_VAR_UNUSED = "ge.exec.enable_atomic";
const char *const OPTION_EXEC_DISABLE_REUSED_MEMORY GE_VAR_UNUSED = "ge.exec.disableReuseMemory";
const char *const OPTION_EXEC_ENABLE_TAILING_OPTIMIZATION GE_VAR_UNUSED = "ge.exec.isTailingOptimization";
// Dynamic input flag. ge.exec.dynamicInput=1, means enable dynaimc input,
// ge.exec.dynamicGraphExecuteMode, dynamic_execute[default]
const char *const OPTION_EXEC_DYNAMIC_INPUT = "ge.exec.dynamicInput";
const char *const OPTION_EXEC_DYNAMIC_EXECUTE_MODE = "ge.exec.dynamicGraphExecuteMode";
const char *const OPTION_EXEC_DATA_INPUTS_SHAPE_RANGE = "ge.exec.dataInputsShapeRange";
const char *const OPTION_EXEC_DYNAMIC_INPUT GE_VAR_UNUSED = "ge.exec.dynamicInput";
const char *const OPTION_EXEC_DYNAMIC_EXECUTE_MODE GE_VAR_UNUSED = "ge.exec.dynamicGraphExecuteMode";
const char *const OPTION_EXEC_DATA_INPUTS_SHAPE_RANGE GE_VAR_UNUSED = "ge.exec.dataInputsShapeRange";

// Option key: memory init
const char *const GRAPH_MEMORY_MAX_SIZE = "ge.graphMemoryMaxSize";
const char *const VARIABLE_MEMORY_MAX_SIZE = "ge.variableMemoryMaxSize";
const char *const GRAPH_MEMORY_MAX_SIZE GE_VAR_UNUSED = "ge.graphMemoryMaxSize";
const char *const VARIABLE_MEMORY_MAX_SIZE GE_VAR_UNUSED = "ge.variableMemoryMaxSize";
namespace configure_option {
const char *const STREAM_NUM = "ge.streamNum";
const char *const HEAD_STREAM = "ge.headStream";
const char *const PERF_LEVEL = "ge.perfLevel";
const char *const ENCRYPT_MODE = "ge.encryptMode";
const char *const EK_FILE = "ge.ekFile";
const char *const CERT_FILE = "ge.certFile";
const char *const HW_KEY_FILE = "ge.hwKeyFile";
const char *const PRIVATE_KEY_FILE = "ge.privateKeyFile";
const char *const FRAMEWORK_TYPE = "ge.frameworkType";
const char *const CALIBRATION_CONF_FILE = "ge.calibrationConfFile";
const char *const INSERT_OP_FILE = "ge.insertOpFile";
const char *const OUTPUT_NODE_NAME = "ge.outputNodeName";
const char *const COMPRESS_FLAG = "ge.compressFlag";
const char *const PRECISION_MODE = "ge.exec.precision_mode";
const char *const SINGLE_OP_FLAG = "ge.exec.single_op";
const char *const TRAIN_FLAG = "ge.trainFlag";
const char *const RUN_FLAG = "ge.runFlag";
const char *const LOCAL_FMKOP_FLAG = "ge.enabledLocalFmkop";
const char *const TBE_PLUGIN_PATH_FLAG = "ge.TBE_plugin_path";
const char *const DDK_VERSION_FLAG = "ge.DDK_version";
const char *const GE_FE_FLAG = "ge.feFlag";
const char *const STREAM_MAX_PARALLEL_NUM = "ge.streamMaxParallelNum";
const char *const OUTPUT_DATATYPE = "ge.outputDatatype";
const char *const OP_SELECT_IMPL_MODE = "ge.opSelectImplmode";
const char *const OPTYPELIST_FOR_IMPLMODE = "ge.optypelistForImplmode";
const char *const HCOM_PARALLEL = "ge.hcomParallel";
const char *const AUTO_TUNE_MODE = "ge.autoTuneMode";
const char *const SOC_VERSION = "ge.socVersion";
const char *const CORE_TYPE = "ge.engineType";
const char *const AICORE_NUM = "ge.aicoreNum";
const char *const L1_FUSION = "ge.l1Fusion";
const char *const BUFFER_OPTIMIZE = "ge.bufferOptimize";
const char *const ENABLE_SMALL_CHANNEL = "ge.enableSmallChannel";
const char *const ENABLE_COMPRESS_WEIGHT = "ge.enableCompressWeight";
const char *const FUSION_SWITCH_FILE = "ge.fusionSwitchFile";
const char *const SAVE_ORIGINAL_MODEL = "ge.saveOriginalModel";
const char *const ORIGINAL_MODEL_FILE = "ge.originalModelFile";
const char *const INPUT_FP16_NODES = "ge.INPUT_NODES_SET_FP16";
const char *const OP_DEBUG_LEVEL = "ge.opDebugLevel";
const char *const STREAM_NUM GE_VAR_UNUSED = "ge.streamNum";
const char *const HEAD_STREAM GE_VAR_UNUSED = "ge.headStream";
const char *const PERF_LEVEL GE_VAR_UNUSED = "ge.perfLevel";
const char *const ENCRYPT_MODE GE_VAR_UNUSED = "ge.encryptMode";
const char *const EK_FILE GE_VAR_UNUSED = "ge.ekFile";
const char *const CERT_FILE GE_VAR_UNUSED = "ge.certFile";
const char *const HW_KEY_FILE GE_VAR_UNUSED = "ge.hwKeyFile";
const char *const PRIVATE_KEY_FILE GE_VAR_UNUSED = "ge.privateKeyFile";
const char *const FRAMEWORK_TYPE GE_VAR_UNUSED = "ge.frameworkType";
const char *const CALIBRATION_CONF_FILE GE_VAR_UNUSED = "ge.calibrationConfFile";
const char *const INSERT_OP_FILE GE_VAR_UNUSED = "ge.insertOpFile";
const char *const OUTPUT_NODE_NAME GE_VAR_UNUSED = "ge.outputNodeName";
const char *const COMPRESS_FLAG GE_VAR_UNUSED = "ge.compressFlag";
const char *const PRECISION_MODE GE_VAR_UNUSED = "ge.exec.precision_mode";
const char *const SINGLE_OP_FLAG GE_VAR_UNUSED = "ge.exec.single_op";
const char *const TRAIN_FLAG GE_VAR_UNUSED = "ge.trainFlag";
const char *const RUN_FLAG GE_VAR_UNUSED = "ge.runFlag";
const char *const LOCAL_FMKOP_FLAG GE_VAR_UNUSED = "ge.enabledLocalFmkop";
const char *const TBE_PLUGIN_PATH_FLAG GE_VAR_UNUSED = "ge.TBE_plugin_path";
const char *const DDK_VERSION_FLAG GE_VAR_UNUSED = "ge.DDK_version";
const char *const GE_FE_FLAG GE_VAR_UNUSED = "ge.feFlag";
const char *const STREAM_MAX_PARALLEL_NUM GE_VAR_UNUSED = "ge.streamMaxParallelNum";
const char *const OUTPUT_DATATYPE GE_VAR_UNUSED = "ge.outputDatatype";
const char *const OP_SELECT_IMPL_MODE GE_VAR_UNUSED = "ge.opSelectImplmode";
const char *const OPTYPELIST_FOR_IMPLMODE GE_VAR_UNUSED = "ge.optypelistForImplmode";
const char *const HCOM_PARALLEL GE_VAR_UNUSED = "ge.hcomParallel";
const char *const AUTO_TUNE_MODE GE_VAR_UNUSED = "ge.autoTuneMode";
const char *const SOC_VERSION GE_VAR_UNUSED = "ge.socVersion";
const char *const CORE_TYPE GE_VAR_UNUSED = "ge.engineType";
const char *const AICORE_NUM GE_VAR_UNUSED = "ge.aicoreNum";
const char *const L1_FUSION GE_VAR_UNUSED = "ge.l1Fusion";
const char *const BUFFER_OPTIMIZE GE_VAR_UNUSED = "ge.bufferOptimize";
const char *const ENABLE_SMALL_CHANNEL GE_VAR_UNUSED = "ge.enableSmallChannel";
const char *const ENABLE_COMPRESS_WEIGHT GE_VAR_UNUSED = "ge.enableCompressWeight";
const char *const FUSION_SWITCH_FILE GE_VAR_UNUSED = "ge.fusionSwitchFile";
const char *const SAVE_ORIGINAL_MODEL GE_VAR_UNUSED = "ge.saveOriginalModel";
const char *const ORIGINAL_MODEL_FILE GE_VAR_UNUSED = "ge.originalModelFile";
const char *const INPUT_FP16_NODES GE_VAR_UNUSED = "ge.INPUT_NODES_SET_FP16";
const char *const OP_DEBUG_LEVEL GE_VAR_UNUSED = "ge.opDebugLevel";
} // namespace configure_option
// 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";
const std::string STREAM_NUM GE_VAR_UNUSED = "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";
const std::string HEAD_STREAM GE_VAR_UNUSED = "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";
const std::string PERF_LEVEL GE_VAR_UNUSED = "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";
const std::string ENCRYPT_MODE GE_VAR_UNUSED = "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";
const std::string EK_FILE GE_VAR_UNUSED = "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";
const std::string CERT_FILE GE_VAR_UNUSED = "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";
const std::string HW_KEY_FILE GE_VAR_UNUSED = "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";
const std::string PRIVATE_KEY_FILE GE_VAR_UNUSED = "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";
const std::string FRAMEWORK_TYPE GE_VAR_UNUSED = "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";
const std::string CALIBRATION_CONF_FILE GE_VAR_UNUSED = "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";
const std::string INSERT_OP_FILE GE_VAR_UNUSED = "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";
const std::string OUTPUT_NODE_NAME GE_VAR_UNUSED = "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 COMPRESS_FLAG GE_VAR_UNUSED = "ge.compressFlag";

const std::string PRECISION_MODE = "ge.exec.precision_mode";
const std::string PRECISION_MODE GE_VAR_UNUSED = "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";
const std::string SINGLE_OP_FLAG GE_VAR_UNUSED = "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";
const std::string TRAIN_FLAG GE_VAR_UNUSED = "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";
const std::string RUN_FLAG GE_VAR_UNUSED = "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";
const std::string LOCAL_FMKOP_FLAG GE_VAR_UNUSED = "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";
const std::string TBE_PLUGIN_PATH_FLAG GE_VAR_UNUSED = "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";
const std::string DDK_VERSION_FLAG GE_VAR_UNUSED = "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";
const std::string GE_FE_FLAG GE_VAR_UNUSED = "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";
const std::string STREAM_MAX_PARALLEL_NUM GE_VAR_UNUSED = "ge.streamMaxParallelNum";

// congigure outputDatatype to setting net output type
const std::string OUTPUT_DATATYPE = "ge.outputDatatype";
const std::string OUTPUT_DATATYPE GE_VAR_UNUSED = "ge.outputDatatype";

// congigure opSelectImplmode to setting op select implmode
const std::string OP_SELECT_IMPL_MODE = "ge.opSelectImplmode";
const std::string OP_SELECT_IMPL_MODE GE_VAR_UNUSED = "ge.opSelectImplmode";

// congigure optypelist_for_implmode to setting which op use implmode
const std::string OPTYPELIST_FOR_IMPLMODE = "ge.optypelistForImplmode";
const std::string OPTYPELIST_FOR_IMPLMODE GE_VAR_UNUSED = "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";
const std::string HCOM_PARALLEL GE_VAR_UNUSED = "ge.hcomParallel";

// configure whether to use dynamic batch size
const char *const kDynamicBatchSize = "ge.dynamicBatchSize";
const char *const kDynamicBatchSize GE_VAR_UNUSED = "ge.dynamicBatchSize";

const std::string INPUT_SHAPE = "ge.inputShape";
const std::string INPUT_SHAPE GE_VAR_UNUSED = "ge.inputShape";

const std::string DYNAMIC_NODE_TYPE = "ge.dynamicNodeType";
const std::string DYNAMIC_NODE_TYPE GE_VAR_UNUSED = "ge.dynamicNodeType";
// configure whether to use dynamic image size
const char *const kDynamicImageSize = "ge.dynamicImageSize";
const char *const kDynamicImageSize GE_VAR_UNUSED = "ge.dynamicImageSize";

// Configure whether to use dynamic dims
const char *const kDynamicDims = "ge.dynamicDims";
const char *const kDynamicDims GE_VAR_UNUSED = "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";
const std::string AUTO_TUNE_MODE GE_VAR_UNUSED = "ge.autoTuneMode";

// Configure soc version , example: "Ascend310"
const std::string SOC_VERSION = "ge.socVersion";
const std::string SOC_VERSION GE_VAR_UNUSED = "ge.socVersion";

// Configure core type "VectorEngine", default value is "AIcoreEngine"
const std::string CORE_TYPE = "ge.engineType";
const std::string CORE_TYPE GE_VAR_UNUSED = "ge.engineType";

// Configure AICORE NUM
const std::string AICORE_NUM = "ge.aicoreNum";
const std::string AICORE_NUM GE_VAR_UNUSED = "ge.aicoreNum";

// Configure L1FUSION
const std::string L1_FUSION = "ge.l1Fusion";
const std::string L1_FUSION GE_VAR_UNUSED = "ge.l1Fusion";

// Configure l1,l2,and others optimize option
const std::string BUFFER_OPTIMIZE = "ge.bufferOptimize";
const std::string BUFFER_OPTIMIZE GE_VAR_UNUSED = "ge.bufferOptimize";

// Configure Small Channel flag
const std::string ENABLE_SMALL_CHANNEL = "ge.enableSmallChannel";
const std::string ENABLE_SMALL_CHANNEL GE_VAR_UNUSED = "ge.enableSmallChannel";

// Configure Compress Weight flag
const std::string ENABLE_COMPRESS_WEIGHT = "ge.enableCompressWeight";
const std::string ENABLE_COMPRESS_WEIGHT GE_VAR_UNUSED = "ge.enableCompressWeight";

// Configure fusion switch file path
const std::string FUSION_SWITCH_FILE = "ge.fusionSwitchFile";
const std::string FUSION_SWITCH_FILE GE_VAR_UNUSED = "ge.fusionSwitchFile";

// Save original model
const std::string SAVE_ORIGINAL_MODEL = "ge.saveOriginalModel";
const std::string SAVE_ORIGINAL_MODEL GE_VAR_UNUSED = "ge.saveOriginalModel";

// Save original model file name
const std::string ORIGINAL_MODEL_FILE = "ge.originalModelFile";
const std::string ORIGINAL_MODEL_FILE GE_VAR_UNUSED = "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";
const char *const OPTION_GE_MAX_DUMP_FILE_NUM GE_VAR_UNUSED = "ge.maxDumpFileNum";
const char *const OPTION_GE_MAX_DUMP_FILE_SIZE GE_VAR_UNUSED = "ge.maxDumpFileSize";
const char *const OPTION_GE_MAX_DUMP_OP_NUM GE_VAR_UNUSED = "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";
const char *const ENABLE_PRINT_OP_PASS GE_VAR_UNUSED = "ge.enablePrintOpPass";

// Configure operator compilation path
// Its value should be file path, default value is "./"
const char *const DEBUG_DIR = "ge.debugDir";
const char *const DEBUG_DIR GE_VAR_UNUSED = "ge.debugDir";

// Configure operator compiler cache path
// Its value should be file path, default value is "./"
const char *const OP_COMPILER_CACHE_DIR = "ge.op_compiler_cache_dir";
const char *const OP_COMPILER_CACHE_DIR GE_VAR_UNUSED = "ge.op_compiler_cache_dir";

// Configure operator compiler cache mode
// Its value should be "disable", "enable" or "force", default value is "disable"
const char *const OP_COMPILER_CACHE_MODE = "ge.op_compiler_cache_mode";
const char *const OP_COMPILER_CACHE_MODE GE_VAR_UNUSED = "ge.op_compiler_cache_mode";

// 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";
const char *const ENABLE_SINGLE_STREAM GE_VAR_UNUSED = "ge.enableSingleStream";

// Configure input fp16 nodes
const std::string INPUT_FP16_NODES = "ge.INPUT_NODES_SET_FP16";
const std::string INPUT_FP16_NODES GE_VAR_UNUSED = "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";
const std::string OP_DEBUG_LEVEL GE_VAR_UNUSED = "ge.opDebugLevel";

// Configure model bank path
const std::string MDL_BANK_PATH_FLAG = "ge.mdl_bank_path";
const std::string MDL_BANK_PATH_FLAG GE_VAR_UNUSED = "ge.mdl_bank_path";

// Configure display_model_info flag
const std::string DISPLAY_MODEL_INFO = "ge.display_model_info";
const std::string DISPLAY_MODEL_INFO GE_VAR_UNUSED = "ge.display_model_info";

// Configure op bank path
const std::string OP_BANK_PATH_FLAG = "ge.op_bank_path";
const std::string OP_BANK_UPDATE_FLAG = "ge.op_bank_update";
const std::string OP_BANK_PATH_FLAG GE_VAR_UNUSED = "ge.op_bank_path";
const std::string OP_BANK_UPDATE_FLAG GE_VAR_UNUSED = "ge.op_bank_update";

// Configure for fix hcombroadcast format.
// when config model multi, broadcast format should be fixed
// 0: data multi; 1: model multi;
const std::string HCOM_MULTI_MODE = "ge.hcomMultiMode";
const std::string HCOM_MULTI_MODE GE_VAR_UNUSED = "ge.hcomMultiMode";

// Graph run mode
enum GraphRunMode { PREDICTION = 0, TRAIN };
@@ -345,43 +353,43 @@ using Status = uint32_t;
using RunAsyncCallback = std::function<void(Status, std::vector<ge::OutputTensorInfo> &)>;
// 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 IS_DYNAMIC_INPUT = "is_dynamic_input";
static const char *const IS_INPUT_ADJUST_HW_LAYOUT = "is_input_adjust_hw_layout";
static const char *const IS_OUTPUT_ADJUST_HW_LAYOUT = "is_output_adjust_hw_layout";
static const char *const ENABLE_SCOPE_FUSION_PASSES = "enable_scope_fusion_passes";
static const char *const OUTPUT = "output";
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();
static const char *const DEBUG_DIR = ge::DEBUG_DIR;
static const char *const OP_COMPILER_CACHE_DIR = ge::OP_COMPILER_CACHE_DIR;
static const char *const OP_COMPILER_CACHE_MODE = ge::OP_COMPILER_CACHE_MODE;
static const char *const MDL_BANK_PATH = ge::MDL_BANK_PATH_FLAG.c_str();
static const char *const OP_BANK_PATH = ge::OP_BANK_PATH_FLAG.c_str();
static const char *const OP_BANK_UPDATE = ge::OP_BANK_UPDATE_FLAG.c_str();
static const char *const OP_DEBUG_LEVEL = ge::OP_DEBUG_LEVEL.c_str();
static const char *const INPUT_FORMAT GE_VAR_UNUSED = "input_format";
static const char *const INPUT_SHAPE GE_VAR_UNUSED = "input_shape";
static const char *const OP_NAME_MAP GE_VAR_UNUSED = "op_name_map";
static const char *const IS_DYNAMIC_INPUT GE_VAR_UNUSED = "is_dynamic_input";
static const char *const IS_INPUT_ADJUST_HW_LAYOUT GE_VAR_UNUSED = "is_input_adjust_hw_layout";
static const char *const IS_OUTPUT_ADJUST_HW_LAYOUT GE_VAR_UNUSED = "is_output_adjust_hw_layout";
static const char *const ENABLE_SCOPE_FUSION_PASSES GE_VAR_UNUSED = "enable_scope_fusion_passes";
static const char *const OUTPUT GE_VAR_UNUSED = "output";
static const char *const DYNAMIC_BATCH_SIZE GE_VAR_UNUSED = kDynamicBatchSize;
static const char *const DYNAMIC_IMAGE_SIZE GE_VAR_UNUSED = kDynamicImageSize;
static const char *const DYNAMIC_DIMS GE_VAR_UNUSED = kDynamicDims;
static const char *const INSERT_OP_FILE GE_VAR_UNUSED = ge::INSERT_OP_FILE.c_str();
static const char *const PRECISION_MODE GE_VAR_UNUSED = ge::PRECISION_MODE.c_str();
static const char *const EXEC_DISABLE_REUSED_MEMORY GE_VAR_UNUSED = ge::OPTION_EXEC_DISABLE_REUSED_MEMORY;
static const char *const AUTO_TUNE_MODE GE_VAR_UNUSED = ge::AUTO_TUNE_MODE.c_str();
static const char *const CORE_TYPE GE_VAR_UNUSED = ge::CORE_TYPE.c_str();
static const char *const SOC_VERSION GE_VAR_UNUSED = ge::SOC_VERSION.c_str();
static const char *const ENABLE_SINGLE_STREAM GE_VAR_UNUSED = ge::ENABLE_SINGLE_STREAM;
static const char *const AICORE_NUM GE_VAR_UNUSED = ge::AICORE_NUM.c_str();
static const char *const FUSION_SWITCH_FILE GE_VAR_UNUSED = ge::FUSION_SWITCH_FILE.c_str();
static const char *const ENABLE_SMALL_CHANNEL GE_VAR_UNUSED = ge::ENABLE_SMALL_CHANNEL.c_str();
static const char *const OP_SELECT_IMPL_MODE GE_VAR_UNUSED = ge::OP_SELECT_IMPL_MODE.c_str();
static const char *const OUTPUT_TYPE GE_VAR_UNUSED = ge::OUTPUT_DATATYPE.c_str();
static const char *const BUFFER_OPTIMIZE GE_VAR_UNUSED = ge::BUFFER_OPTIMIZE.c_str();
static const char *const ENABLE_COMPRESS_WEIGHT GE_VAR_UNUSED = ge::ENABLE_COMPRESS_WEIGHT.c_str();
static const char *const COMPRESS_WEIGHT_CONF GE_VAR_UNUSED = "compress_weight_conf";
static const char *const OUT_NODES GE_VAR_UNUSED = ge::OUTPUT_NODE_NAME.c_str();
static const char *const INPUT_FP16_NODES GE_VAR_UNUSED = ge::INPUT_FP16_NODES.c_str();
static const char *const LOG_LEVEL GE_VAR_UNUSED = "log";
static const char *const OPTYPELIST_FOR_IMPLMODE GE_VAR_UNUSED = ge::OPTYPELIST_FOR_IMPLMODE.c_str();
static const char *const DEBUG_DIR GE_VAR_UNUSED = ge::DEBUG_DIR;
static const char *const OP_COMPILER_CACHE_DIR GE_VAR_UNUSED = ge::OP_COMPILER_CACHE_DIR;
static const char *const OP_COMPILER_CACHE_MODE GE_VAR_UNUSED = ge::OP_COMPILER_CACHE_MODE;
static const char *const MDL_BANK_PATH GE_VAR_UNUSED = ge::MDL_BANK_PATH_FLAG.c_str();
static const char *const OP_BANK_PATH GE_VAR_UNUSED = ge::OP_BANK_PATH_FLAG.c_str();
static const char *const OP_BANK_UPDATE GE_VAR_UNUSED = ge::OP_BANK_UPDATE_FLAG.c_str();
static const char *const OP_DEBUG_LEVEL GE_VAR_UNUSED = ge::OP_DEBUG_LEVEL.c_str();

// for interface: aclgrphBuildModel
#ifdef __GNUC__


+ 20
- 10
inc/external/ge/ge_ir_build.h View File

@@ -30,6 +30,13 @@
#define GE_FUNC_VISIBILITY
#endif
#endif
#ifndef GE_VAR_UNUSED
#ifdef __GNUC__
#define GE_VAR_UNUSED __attribute__((unused))
#else
#define GE_VAR_UNUSED
#endif
#endif

#include <string>
#include <map>
@@ -38,9 +45,9 @@
#include "graph/ge_error_codes.h"

namespace {
const int IR_MAJOR_VERSION = 1;
const int IR_MINOR_VERSION = 0;
const int IR_PATCH_VERSION = 0;
const int IR_MAJOR_VERSION GE_VAR_UNUSED = 1;
const int IR_MINOR_VERSION GE_VAR_UNUSED = 0;
const int IR_PATCH_VERSION GE_VAR_UNUSED = 0;
} // namespace

namespace ge {
@@ -80,13 +87,16 @@ GE_FUNC_VISIBILITY void aclgrphBuildFinalize();
* @retval GRAPH_SUCCESS The function is successfully executed.
* @retval OtherValues Failure
*/
ATTRIBUTED_DEPRECATED(GE_FUNC_VISIBILITY graphStatus aclgrphBuildModel(const ge::Graph &, const std::map<AscendString, AscendString> &,
ModelBufferData &))
GE_FUNC_VISIBILITY graphStatus aclgrphBuildModel(const ge::Graph &graph, const std::map<std::string, std::string> &build_options,
ModelBufferData &model);
ATTRIBUTED_DEPRECATED(GE_FUNC_VISIBILITY graphStatus aclgrphBuildModel(const ge::Graph &,
const std::map<AscendString, AscendString> &,
ModelBufferData &))
GE_FUNC_VISIBILITY graphStatus aclgrphBuildModel(const ge::Graph &graph,
const std::map<std::string, std::string> &build_options,
ModelBufferData &model);

GE_FUNC_VISIBILITY graphStatus aclgrphBuildModel(const ge::Graph &graph, const std::map<AscendString, AscendString> &build_options,
ModelBufferData &model);
GE_FUNC_VISIBILITY graphStatus aclgrphBuildModel(const ge::Graph &graph,
const std::map<AscendString, AscendString> &build_options,
ModelBufferData &model);

/**
* @ingroup AscendCL
@@ -138,7 +148,7 @@ GE_FUNC_VISIBILITY graphStatus aclgrphDumpGraph(const ge::Graph &graph, const ch
* @retval OtherValues Failure
*/
GE_FUNC_VISIBILITY graphStatus aclgrphGenerateForOp(const AscendString &op_type, const std::vector<TensorDesc> &inputs,
const std::vector<TensorDesc> &outputs, Graph &graph);
const std::vector<TensorDesc> &outputs, Graph &graph);

}; // namespace ge
#endif // INC_EXTERNAL_GE_IR_BUILD_H_

+ 13
- 5
inc/framework/common/ge_types.h View File

@@ -17,6 +17,14 @@
#ifndef INC_FRAMEWORK_COMMON_GE_TYPES_H_
#define INC_FRAMEWORK_COMMON_GE_TYPES_H_

#ifndef GE_VAR_UNUSED
#ifdef __GNUC__
#define GE_VAR_UNUSED __attribute__((unused))
#else
#define GE_VAR_UNUSED
#endif
#endif

#include <stdint.h>

#include <string>
@@ -53,13 +61,13 @@ enum OpEngineType {

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";
const char *const GE_OPTION_EXEC_PLACEMENT = "ge.exec.placement";
const char *const GE_ENGINE_ATTR_MEM_TYPE_HBM GE_VAR_UNUSED = "HBM";
const char *const GE_OPTION_EXEC_PLACEMENT GE_VAR_UNUSED = "ge.exec.placement";

// profiling data
const uint32_t kTaskTypeAicore = 0;
const uint32_t kTaskTypeAicpu = 1;
const uint32_t kTaskTypeInvalid = 0xFFFF;
const uint32_t kTaskTypeAicore GE_VAR_UNUSED = 0;
const uint32_t kTaskTypeAicpu GE_VAR_UNUSED = 1;
const uint32_t kTaskTypeInvalid GE_VAR_UNUSED = 0xFFFF;

// Data cache, including data address and length
struct DataBuffer {


+ 11
- 3
inc/framework/common/l2_cache_optimize.h View File

@@ -17,6 +17,14 @@
#ifndef INC_FRAMEWORK_COMMON_L2_CACHE_OPTIMIZE_H_
#define INC_FRAMEWORK_COMMON_L2_CACHE_OPTIMIZE_H_

#ifndef GE_VAR_UNUSED
#ifdef __GNUC__
#define GE_VAR_UNUSED __attribute__((unused))
#else
#define GE_VAR_UNUSED
#endif
#endif

#include <stdint.h>

#include <algorithm>
@@ -32,10 +40,10 @@ using std::vector;

namespace ge {
// Size of RC memory alignment, 2M
constexpr size_t ALIGN_SIZE = 2097152;
constexpr size_t ALIGN_SIZE GE_VAR_UNUSED = 2097152;

constexpr uint32_t RC_VALUE_DEFAULT = 1;
constexpr uint32_t RC_VALUE_MAX = 32;
constexpr uint32_t RC_VALUE_DEFAULT GE_VAR_UNUSED = 1;
constexpr uint32_t RC_VALUE_MAX GE_VAR_UNUSED = 32;

// RC data type classification
enum RCType {


+ 9
- 1
inc/framework/common/op_types.h View File

@@ -17,6 +17,14 @@
#ifndef INC_FRAMEWORK_COMMON_OP_TYPES_H_
#define INC_FRAMEWORK_COMMON_OP_TYPES_H_

#ifndef GE_VAR_UNUSED
#ifdef __GNUC__
#define GE_VAR_UNUSED __attribute__((unused))
#else
#define GE_VAR_UNUSED
#endif
#endif

#include <set>
#include <string>

@@ -53,7 +61,7 @@ class GE_FUNC_VISIBILITY OpTypeRegistrar {
FMK_FUNC_HOST_VISIBILITY FMK_FUNC_DEV_VISIBILITY extern const char *var_name;

#define REGISTER_OPTYPE_DEFINE(var_name, str_name) \
const char *var_name = str_name; \
const char *var_name GE_VAR_UNUSED = str_name; \
const OpTypeRegistrar g_##var_name##_reg(str_name);

#define IS_OPTYPE_EXISTING(str_name) (OpTypeContainer::Instance()->IsExisting(str_name))


+ 31
- 23
inc/framework/common/types.h View File

@@ -17,6 +17,14 @@
#ifndef INC_FRAMEWORK_COMMON_TYPES_H_
#define INC_FRAMEWORK_COMMON_TYPES_H_

#ifndef GE_VAR_UNUSED
#ifdef __GNUC__
#define GE_VAR_UNUSED __attribute__((unused))
#else
#define GE_VAR_UNUSED
#endif
#endif

#include <limits.h>
#include <stdint.h>
#include <algorithm>
@@ -594,22 +602,22 @@ FMK_FUNC_HOST_VISIBILITY FMK_FUNC_DEV_VISIBILITY extern const uint32_t MODEL_FIL
///
/// @brief model name length
///
static constexpr uint32_t MODEL_NAME_LENGTH = 32;
static constexpr uint32_t MODEL_NAME_LENGTH GE_VAR_UNUSED = 32;

///
/// @brief length of user-defined information
///
static constexpr uint32_t USER_DEFINE_INFO_LENGTH = 32;
static constexpr uint32_t USER_DEFINE_INFO_LENGTH GE_VAR_UNUSED = 32;

///
/// @brief length of the model file signature
///
static constexpr uint32_t MODEL_FILE_CHECKSUM_LENGTH = 64;
static constexpr uint32_t MODEL_FILE_CHECKSUM_LENGTH GE_VAR_UNUSED = 64;

///
/// @brief length of the reserved field in the model file header
///
static constexpr uint32_t MODEL_FILE_RESERVED_LENGTH = 75;
static constexpr uint32_t MODEL_FILE_RESERVED_LENGTH GE_VAR_UNUSED = 75;

///
/// @ingroup domi_omg
@@ -712,15 +720,15 @@ FMK_FUNC_HOST_VISIBILITY FMK_FUNC_DEV_VISIBILITY extern const uint32_t DEFAULT_D
FMK_FUNC_HOST_VISIBILITY FMK_FUNC_DEV_VISIBILITY extern const uint32_t NUM_ONE;

// dim default size value
static const int32_t DIM_DEFAULT_SIZE = 4;
static const int32_t DIM_DEFAULT_SIZE GE_VAR_UNUSED = 4;

// the shape of c must be the mutiply of 16 for depthwise
static const uint32_t DEPTHWISE_DIM_C_BASE_NUM = 16;
static const uint32_t DEPTHWISE_DIM_C_BASE_NUM GE_VAR_UNUSED = 16;

// C1HWNCoC0 dim size
static const int32_t DIM_C1HWNCoC0_SIZE = 6;
static const int32_t DIM_C1HWNCoC0_SIZE GE_VAR_UNUSED = 6;
// C1HWNCoC0 C0 value
static const int C1HWCOC_C0_VALUE = 16;
static const int C1HWCOC_C0_VALUE GE_VAR_UNUSED = 16;
// spatial default dim size
FMK_FUNC_HOST_VISIBILITY FMK_FUNC_DEV_VISIBILITY extern const int32_t SPATIAL_DIM_DEFAULT_SIZE;

@@ -742,12 +750,12 @@ FMK_FUNC_HOST_VISIBILITY FMK_FUNC_DEV_VISIBILITY extern const uint32_t NCHW_DIM_
FMK_FUNC_HOST_VISIBILITY FMK_FUNC_DEV_VISIBILITY extern const uint32_t NCHW_DIM_W;

// default C1HWNCoC0 index
static const uint32_t C1HWNCoC0_DIM_C1 = 0;
static const uint32_t C1HWNCoC0_DIM_H = 1;
static const uint32_t C1HWNCoC0_DIM_W = 2;
static const uint32_t C1HWNCoC0_DIM_N = 3;
static const uint32_t C1HWNCoC0_DIM_Co = 4;
static const uint32_t C1HWNCoC0_DIM_C0 = 5;
static const uint32_t C1HWNCoC0_DIM_C1 GE_VAR_UNUSED = 0;
static const uint32_t C1HWNCoC0_DIM_H GE_VAR_UNUSED = 1;
static const uint32_t C1HWNCoC0_DIM_W GE_VAR_UNUSED = 2;
static const uint32_t C1HWNCoC0_DIM_N GE_VAR_UNUSED = 3;
static const uint32_t C1HWNCoC0_DIM_Co GE_VAR_UNUSED = 4;
static const uint32_t C1HWNCoC0_DIM_C0 GE_VAR_UNUSED = 5;

// default KCHW index
FMK_FUNC_HOST_VISIBILITY FMK_FUNC_DEV_VISIBILITY extern const uint32_t KCHW_DIM_K;
@@ -830,7 +838,7 @@ FMK_FUNC_HOST_VISIBILITY FMK_FUNC_DEV_VISIBILITY extern const uint32_t STREAM_SW
FMK_FUNC_HOST_VISIBILITY FMK_FUNC_DEV_VISIBILITY extern const std::string NODE_NAME_GLOBAL_STEP;
FMK_FUNC_HOST_VISIBILITY FMK_FUNC_DEV_VISIBILITY extern const std::string NODE_NAME_GLOBAL_STEP_ASSIGNADD;

static const int PLATFORM_VERSION_LEN = 20;
static const int PLATFORM_VERSION_LEN GE_VAR_UNUSED = 20;

// Definition of the file header of the model file
struct ModelFileHeader {
@@ -853,16 +861,16 @@ struct ModelFileHeader {
uint8_t reserved[MODEL_FILE_RESERVED_LENGTH] = {0}; // Reserved field 75
};

static constexpr uint8_t TARGET_TYPE_LTTE_8BIT = 0;
static constexpr uint8_t TARGET_TYPE_MINI_8BIT = 1;
static constexpr uint8_t TARGET_TYPE_TINY_8BIT = 2;
static constexpr uint8_t TARGET_TYPE_LTTE_8BIT GE_VAR_UNUSED = 0;
static constexpr uint8_t TARGET_TYPE_MINI_8BIT GE_VAR_UNUSED = 1;
static constexpr uint8_t TARGET_TYPE_TINY_8BIT GE_VAR_UNUSED = 2;

static constexpr int32_t PARTITION_TYPE_MODEL_DEF = 0;
static constexpr int32_t PARTITION_TYPE_WEIGHTS = 1;
static constexpr int32_t PARTITION_TYPE_TASK_INFO = 2;
static constexpr int32_t PARTITION_TYPE_MODEL_DEF GE_VAR_UNUSED = 0;
static constexpr int32_t PARTITION_TYPE_WEIGHTS GE_VAR_UNUSED = 1;
static constexpr int32_t PARTITION_TYPE_TASK_INFO GE_VAR_UNUSED = 2;

// number of partitions in the current model
static constexpr uint32_t PARTITION_SIZE = 5;
static constexpr uint32_t PARTITION_SIZE GE_VAR_UNUSED = 5;

enum ModelPartitionType { MODEL_DEF = 0, WEIGHTS_DATA, TASK_INFO, TBE_KERNELS, CUST_AICPU_KERNELS };

@@ -879,7 +887,7 @@ struct ModelPartitionTable {

#define SIZE_OF_MODEL_PARTITION_TABLE(table) (sizeof(ModelPartitionTable) + sizeof(ModelPartitionMemInfo) * (table).num)

static constexpr int32_t PTHREAD_CREAT_SUCCESS = 0; // pthread_creat success
static constexpr int32_t PTHREAD_CREAT_SUCCESS GE_VAR_UNUSED = 0; // pthread_creat success

// Filter format
typedef enum tagDomiFilterFormat {


+ 10
- 2
inc/framework/common/util.h View File

@@ -17,6 +17,14 @@
#ifndef INC_FRAMEWORK_COMMON_UTIL_H_
#define INC_FRAMEWORK_COMMON_UTIL_H_

#ifndef GE_VAR_UNUSED
#ifdef __GNUC__
#define GE_VAR_UNUSED __attribute__((unused))
#else
#define GE_VAR_UNUSED
#endif
#endif

#include <google/protobuf/text_format.h>
#include <limits.h>
#include <math.h>
@@ -213,7 +221,7 @@
* @ingroup domi_common
* @brief version of om.proto file
*/
static constexpr int32_t OM_PROTO_VERSION = 2;
static constexpr int32_t OM_PROTO_VERSION GE_VAR_UNUSED = 2;

/**
* Finding an Integer Ceiling Value Without Precision Loss
@@ -227,7 +235,7 @@ using google::protobuf::Message;
/// @ingroup domi_common
/// @brief Maximum file path length
///
const int32_t DOMI_MAX_PATH_LEN = 256;
const int32_t DOMI_MAX_PATH_LEN GE_VAR_UNUSED = 256;

///
/// @ingroup domi_common


+ 9
- 1
inc/framework/memory/memory_assigner.h View File

@@ -17,13 +17,21 @@
#ifndef INC_FRAMEWORK_MEMORY_MEMORY_ASSIGNER_H_
#define INC_FRAMEWORK_MEMORY_MEMORY_ASSIGNER_H_

#ifndef GE_VAR_UNUSED
#ifdef __GNUC__
#define GE_VAR_UNUSED __attribute__((unused))
#else
#define GE_VAR_UNUSED
#endif
#endif

#include <utility>

#include "common/ge_inner_error_codes.h"
#include "graph/node.h"

namespace ge {
const int64_t MEM_ALIGN_SIZE = 512;
const int64_t MEM_ALIGN_SIZE GE_VAR_UNUSED = 512;
class GE_FUNC_VISIBILITY MemoryAssigner {
public:
explicit MemoryAssigner(ge::ComputeGraphPtr compute_graph) : compute_graph_(std::move(compute_graph)) {}


+ 10
- 2
third_party/fwkacllib/inc/cce/fwk_adpt_struct.h View File

@@ -17,6 +17,14 @@
#ifndef FWK_ADPT_STRUCT_H__
#define FWK_ADPT_STRUCT_H__

#ifndef GE_VAR_UNUSED
#ifdef __GNUC__
#define GE_VAR_UNUSED __attribute__((unused))
#else
#define GE_VAR_UNUSED
#endif
#endif

#include <cstdint>

namespace aicpu {
@@ -97,7 +105,7 @@ struct StrFWKKernel {
typedef StrFWKKernel FWKOperateParam;

// Extent info ShapeAndType
const uint32_t kMaxShapeDims = 8;
const uint32_t kMaxShapeDims GE_VAR_UNUSED = 8;
#pragma pack(push, 1)
struct ShapeAndType {
int32_t type;
@@ -106,7 +114,7 @@ struct ShapeAndType {
#pragma pack(pop)

// Extend info structure for extInfoAddr
const uint32_t kExtInfoHeadSize = 8;
const uint32_t kExtInfoHeadSize GE_VAR_UNUSED = 8;

#pragma pack(push, 1)
struct ExtInfo {


+ 14
- 5
third_party/fwkacllib/inc/hccl/base.h View File

@@ -16,12 +16,21 @@

/**
* @file base.h
* @brief HCOM data type definition
*
* @brief HCOM data type definition
*
*/

#ifndef HCCL_BASE_H_
#define HCCL_BASE_H_

#ifndef GE_VAR_UNUSED
#ifdef __GNUC__
#define GE_VAR_UNUSED __attribute__((unused))
#else
#define GE_VAR_UNUSED
#endif
#endif

#include <hccl/hccl_types.h>
#include <string>
#ifdef __cplusplus
@@ -50,7 +59,7 @@ typedef enum {
HOROVOD_REDUCE_RESERVED /**< reserved */
} HorovodReduceOp;

const u32 HCCL_MAX_SEGMENT_NUM = 8; // The max number of gradient segments.
const u32 HCCL_MAX_SEGMENT_NUM GE_VAR_UNUSED = 8; // The max number of gradient segments.

/**
* @brief the feature of the model
@@ -72,7 +81,7 @@ struct MemRegisterAddr {
/*
* @brief The max number of memory register address for remote access.
*/
const u32 HCCL_MAX_MEM_REGISTER_NUM = 32;
const u32 HCCL_MAX_MEM_REGISTER_NUM GE_VAR_UNUSED = 32;

enum GradSplitForceMode {
FORCE_NONE, /**< no force */
@@ -120,7 +129,7 @@ struct HcomRemoteAccessAddrInfo {
u32 remotetRankID;
u64 remoteAddr; // host embedding table address
u64 localAddr; // device HBM address
u64 length; // Memory Length in Bytes
u64 length; // Memory Length in Bytes
};

#ifdef __cplusplus


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

@@ -17,6 +17,14 @@
#ifndef __CCE_RUNTIME_BASE_H__
#define __CCE_RUNTIME_BASE_H__

#ifndef GE_VAR_UNUSED
#ifdef __GNUC__
#define GE_VAR_UNUSED __attribute__((unused))
#else
#define GE_VAR_UNUSED
#endif
#endif

#include <stdint.h>
#include "toolchain/prof_callback.h"

@@ -34,7 +42,7 @@ extern "C" {
#endif

typedef int32_t rtError_t;
static const int32_t RT_ERROR_NONE = 0; // success
static const int32_t RT_ERROR_NONE GE_VAR_UNUSED = 0; // success

/**
* @ingroup dvrt_base
@@ -200,7 +208,7 @@ RTS_API rtError_t rtRegDeviceStateCallback(const char *regName, rtDeviceStateCal

/**
* @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] callback fail task callback function
* @param [out] NA
@@ -343,7 +351,7 @@ rtError_t rtLabelCreateExV2(rtLabel_t *label, rtModel_t model, rtStream_t stream

/**
* @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 [in] null
* @return RT_ERROR_NONE for ok


Loading…
Cancel
Save