* Copyright (c) 2025 Huawei Technologies Co., Ltd.
* This program is free software, you can redistribute it and/or modify it under the terms and conditions of
* CANN Open Software License Agreement Version 2.0 (the "License").
* Please refer to the License for details. You may not use this file except in compliance with the License.
* THIS SOFTWARE IS PROVIDED ON AN "AS IS" BASIS, WITHOUT WARRANTIES OF ANY KIND, EITHER EXPRESS OR IMPLIED,
* INCLUDING BUT NOT LIMITED TO NON-INFRINGEMENT, MERCHANTABILITY, OR FITNESS FOR A PARTICULAR PURPOSE.
* See LICENSE in the root of the software repository for the full text of the License.
*/
syntax = "proto3";
package af.proto;
enum DataType
{
DT_UNDEFINED = 0;
DT_FLOAT = 1;
DT_FLOAT16 = 2;
DT_INT8 = 3;
DT_UINT8 = 4;
DT_INT16 = 5;
DT_UINT16 = 6;
DT_INT32 = 7;
DT_INT64 = 8;
DT_UINT32 = 9;
DT_UINT64 = 10;
DT_BOOL = 11;
DT_DOUBLE = 12;
DT_STRING = 13;
DT_DUAL_SUB_INT8 = 14;
DT_DUAL_SUB_UINT8 = 15;
DT_COMPLEX64 = 16;
DT_COMPLEX128 = 17;
DT_QINT8 = 18;
DT_QINT16 = 19;
DT_QINT32 = 20;
DT_QUINT8 = 21;
DT_QUINT16 = 22;
DT_RESOURCE = 23;
DT_STRING_REF = 24;
DT_DUAL = 25;
DT_VARIANT = 26;
DT_BF16 = 27;
DT_INT4 = 28;
DT_UINT1 = 29;
DT_INT2 = 30;
DT_UINT2 = 31;
DT_COMPLEX32 = 32;
DT_HIFLOAT8 = 33;
DT_FLOAT8_E5M2 = 34;
DT_FLOAT8_E4M3FN = 35;
DT_FLOAT8_E8M0 = 36;
DT_FLOAT6_E3M2 = 37;
DT_FLOAT6_E2M3 = 38;
DT_FLOAT4_E2M1 = 39;
DT_FLOAT4_E1M2 = 40;
DT_HIFLOAT4 = 41;
}
message AttrDef
{
message ListValue
{
enum ListValueType{
VT_LIST_NONE = 0;
VT_LIST_STRING = 1;
VT_LIST_INT = 2;
VT_LIST_FLOAT = 3;
VT_LIST_BOOL = 4;
VT_LIST_BYTES = 5;
VT_LIST_TENSOR_DESC = 6;
VT_LIST_TENSOR = 7;
VT_LIST_GRAPH = 8;
VT_LIST_NAMED_ATTRS = 9;
VT_LIST_DATA_TYPE = 10;
}
repeated bytes s = 2;
repeated int64 i = 3;
repeated float f = 4;
repeated bool b = 5;
repeated bytes bt = 7;
repeated TensorDescriptor td = 8;
repeated TensorDef t = 9;
repeated GraphDef g = 10;
repeated NamedAttrs na = 11;
repeated int64 dt = 12;
ListValueType val_type = 20;
}
message ListListInt{
message ListInt{
repeated int64 list_i = 1;
}
repeated ListInt list_list_i = 1;
}
message ListListFloat{
message ListFloat{
repeated float list_f = 1;
}
repeated ListFloat list_list_f = 1;
}
oneof value
{
bytes s = 2;
int64 i = 3;
float f = 4;
bool b = 5;
bytes bt = 7;
ListValue list = 1;
NamedAttrs func = 10;
TensorDescriptor td = 11;
TensorDef t = 12;
GraphDef g = 13;
ListListInt list_list_int = 14;
int64 dt = 15;
ListListFloat list_list_float = 16;
bytes expression = 17;
}
}
message AttributeDef
{
oneof value
{
bytes s = 1;
int64 i = 2;
float f = 3;
bool b = 4;
bytes bt = 5;
}
}
message OtherGroupDef {
map<string, AttributeDef> attr = 1;
}
message TensorDescAttrGroupsDef {
repeated string origin_symbol_shape = 1;
repeated string symbolic_value = 2;
}
message InputSourceDef {
int32 input_data_idx = 1;
int64 dim_idx = 2;
}
message ReplacementDef {
string replace_expr = 1;
int32 rank = 2;
}
message SymbolCheckInfoDef {
string expr = 1;
string file = 2;
int64 line = 3;
string dfx = 4;
}
message ShapeEnvSettingDef {
bool specialize_zero_one = 1;
int32 dynamic_mode = 2;
}
message SymbolInfoDef {
repeated string symbols = 1;
}
message ShapeEnvAttrGroupsDef {
map<string, int64> symbol_to_value = 1;
map<int64, SymbolInfoDef> value_to_symbol = 2;
map<string, InputSourceDef> symbol_to_source = 3;
map<string, ReplacementDef> replacements = 4;
repeated SymbolCheckInfoDef symbol_check_infos = 5;
repeated SymbolCheckInfoDef symbol_assert_infos = 6;
ShapeEnvSettingDef shape_setting = 7;
uint64 unique_sym_id = 8;
}
message SchedInfoDef {
int64 exec_order = 1;
repeated int64 axis = 2;
int64 loop_axis = 3;
int32 exec_condition = 4;
}
message ApiInfoDef {
int32 type = 1;
int32 compute_type = 2;
int32 unit = 3;
}
message MemAttrDef {
int64 tensor_id = 1;
int32 alloc_type = 2;
int32 position = 3;
int32 hardware = 4;
repeated int64 buf_ids = 5;
string name = 6;
int64 reuse_id = 7;
}
message MemQueueAttrDef {
int64 id = 1;
int64 depth = 2;
int64 buf_num = 3;
string name = 4;
}
message MemBufAttrDef {
int64 id = 1;
string name = 2;
}
message MemOptAttrDef {
int64 reuse_id = 1;
int64 ref_tensor = 2;
int64 merge_scope = 3;
}
message AxisDef {
int64 id = 1;
string name = 2;
int32 axis_type = 3;
bool bind_block = 4;
string size = 5;
string align = 6;
repeated int64 from = 7;
int64 split_pair_other_id = 8;
bool allow_oversize_axis = 9;
bool allow_unaligned_tail = 10;
}
message AscendCIROpAttrGroupsDef {
string name = 1;
string type = 2;
}
message AscTensorAttrGroupsDef {
int64 dtype = 1;
repeated int64 axis_ids = 2;
repeated string repeats = 3;
repeated string strides = 4;
repeated int64 vectorized_axis = 5;
repeated string vectorized_strides = 6;
MemAttrDef mem = 7;
MemQueueAttrDef que = 8;
MemBufAttrDef buf = 9;
MemOptAttrDef opt = 10;
}
message AscGraphAttrGroupsDef {
int64 tiling_key = 1;
repeated AxisDef axis = 2;
int64 type = 3;
repeated string size_var = 4;
}
message AscIrAttrDef {
map<string, AttrDef> attr = 1;
}
message TmpBufDescDef {
string size = 1;
int64 life_time_axis_id = 2;
}
message TmpBufferGroupDef {
TmpBufDescDef buf_desc = 1;
MemAttrDef mem = 2;
int64 id = 3;
}
message AscNodeAttrGroupsDef {
string name = 1;
string type = 2;
SchedInfoDef sched = 3;
ApiInfoDef api = 4;
AscIrAttrDef ir_attr_def = 5;
repeated TmpBufferGroupDef tmp_buffers = 6;
}
message AttrGroupDef {
oneof attr_group {
AscendCIROpAttrGroupsDef op_attr_group = 2;
TensorDescAttrGroupsDef tensor_attr_group = 3;
ShapeEnvAttrGroupsDef shape_env_attr_group = 4;
AscGraphAttrGroupsDef asc_graph_attr_group = 5;
AscNodeAttrGroupsDef asc_node_attr_group = 6;
AscTensorAttrGroupsDef asc_tensor_attr_group = 7;
}
}
message AttrGroups {
OtherGroupDef other_group_def = 1;
repeated AttrGroupDef attr_group_def = 2;
}
message NamedAttrs
{
string name = 1;
map<string, AttrDef> attr = 2;
}
message ShapeDef
{
repeated int64 dim = 1;
}
message TensorDescriptor
{
string name = 1;
DataType dtype = 2;
ShapeDef shape = 3;
string layout = 4;
bool has_out_attr = 9;
int64 size = 10;
int64 weight_size = 11;
bool reuse_input = 12;
bool output_tensor = 13;
string device_type = 14;
bool input_tensor =15;
int64 real_dim_cnt = 16;
int64 reuse_input_index = 17;
int64 data_offset = 18;
int64 cmps_size = 19;
string cmps_tab = 20;
int64 cmps_tab_offset = 21;
map<string, AttrDef> attr = 5;
AttrGroups attr_groups = 6;
}
message TensorDef
{
TensorDescriptor desc = 1;
bytes data = 2;
}
message OpDef
{
string name = 1;
string type = 2;
repeated string input = 5;
map<string, AttrDef> attr = 10;
AttrGroups attr_groups = 11;
bool has_out_attr = 20;
int64 id = 21;
int64 stream_id =22;
repeated string input_name = 23;
repeated string src_name = 24;
repeated int64 src_index = 25;
repeated string dst_name = 26;
repeated int64 dst_index = 27;
repeated int64 input_i = 28;
repeated int64 output_i = 29;
repeated int64 workspace = 30;
repeated int64 workspace_bytes = 31;
repeated bool is_input_const = 32;
repeated TensorDescriptor input_desc = 33;
repeated TensorDescriptor output_desc = 34;
repeated string subgraph_name = 35;
}
message GraphDef
{
string name = 1;
repeated string input = 4;
repeated string output = 5;
repeated OpDef op = 6;
map<string, AttrDef> attr = 11;
AttrGroups attr_groups = 12;
}
message ModelDef
{
string name = 1;
uint32 version = 2;
string custom_version = 3;
repeated GraphDef graph = 7;
map<string, AttrDef> attr = 11;
AttrGroups attr_groups = 12;
}