DUMP_GRAPH_FORMAT
Description
Controls the type of the dump file to be generated.
Available values:
- onnx: model description structure based on ONNX. You can open this file using visualizer software such as Netron. The generated file name is ge_onnx*.pbtxt.
- ge_proto: text file stored in Protobuf format. The generated file name is ge_proto*.txt.
- readable: highly readable text file in Dynamo FX graph style. The generated file name is ge_readable*.txt. For details about the file content, see Readable File Parsing.
How to use:
The configuration is a character string separated by vertical bars (|). The type is in lowercase. Combined configuration is supported, for example, ge_proto|onnx|readable indicates that all types of files are dumped. Separate configuration is also supported, for example, ge_proto indicates that only ge_proto*.txt files of the ge_proto type are dumped.
DUMP_GRAPH_FORMAT takes effect only when DUMP_GE_GRAPH is enabled. The default value is ge_proto|onnx.
Example
export DUMP_GRAPH_FORMAT="ge_proto|onnx"
Restrictions
- If this environment variable is set to an invalid value, undefined behavior may occur.
- If the operator dump data collection function is enabled, see ge.exec.enableDump in Graph Development.
The subgraph ge_proto_xxxx_Build.txt is dumped even if the value of DUMP_GRAPH_FORMAT does not contain ge_proto.
Readable File Parsing
- The following is a complete ge_readable*.txt file:
graph("MakeTransformerSubGraph"): %input_0 : [#users=1] = Node[type=Data] (attrs = {index: 0}) %input_1 : [#users=1] = Node[type=Data] (attrs = {index: 1}) %input_2 : [#users=1] = Node[type=Data] (attrs = {index: 2}) %Const_0 : [#users=1] = Node[type=Const] (attrs = {value: [-1 7168]}) %Reshape_1 : [#users=1] = Node[type=Reshape] (inputs = (x=%input_0, shape=%Const_0), attrs = {axis: 0, num_axes: -1}) %Cast_2 : [#users=1] = Node[type=Cast] (inputs = (x=%Reshape_1), attrs = {dst_type: 0}) %Cast_3 : [#users=1] = Node[type=Cast] (inputs = (x=%input_1), attrs = {dst_type: 0}) %Const_4 : [#users=1] = Node[type=Const] (attrs = {value: [1 0]}) %Transpose_5 : [#users=1] = Node[type=Transpose] (inputs = (x=%Cast_3, perm=%Const_4)) %MatMul_6 : [#users=1] = Node[type=MatMul] (inputs = (x1=%Cast_2, x2=%Transpose_5), attrs = {transpose_x1: false, transpose_x2: false}) %Sigmoid_7 : [#users=1] = Node[type=Sigmoid] (inputs = (x=%MatMul_6)) %Const_8 : [#users=1] = Node[type=Const] (attrs = {value: [-1 256]}) %Reshape_9 : [#users=1] = Node[type=Reshape] (inputs = (x=%Sigmoid_7, shape=%Const_8), attrs = {axis: 0, num_axes: -1}) %Unsqueeze_10 : [#users=1] = Node[type=Unsqueeze] (inputs = (x=%input_2), attrs = {axes: {0}}) %Cast_11 : [#users=1] = Node[type=Cast] (inputs = (x=%Unsqueeze_10), attrs = {dst_type: 0}) %Add_12 : [#users=1] = Node[type=Add] (inputs = (x1=%Reshape_9, x2=%Cast_11)) %Const_13 : [#users=1] = Node[type=Const] (attrs = {value: [2]}) %TopKV2_14 : [#users=2] = Node[type=TopKV2] (inputs = (x=%Add_12, k=%Const_13), attrs = {sorted: true, dim: -1, largest: true, indices_dtype: 3}) %ret : [users=1] = get_element[node=%TopKV2_14](0) %ret_1 : [users=0] = get_element[node=%TopKV2_14](1) %Const_15 : [#users=1] = Node[type=Const] (attrs = {value: [-1]}) %ReduceSum_16 : [#users=1] = Node[type=ReduceSum] (inputs = (x=%ret, axes=%Const_15), attrs = {keep_dims: false, noop_with_empty_axes: true}) %Const_17 : [#users=1] = Node[type=Const] (attrs = {value: [4]}) %TopKV2_18 : [#users=2] = Node[type=TopKV2] (inputs = (x=%ReduceSum_16, k=%Const_17), attrs = {sorted: false, dim: -1, largest: true, indices_dtype: 3}) %ret_2 : [users=0] = get_element[node=%TopKV2_18](0) %ret_3 : [users=1] = get_element[node=%TopKV2_18](1) %Cast_19 : [#users=1] = Node[type=Cast] (inputs = (x=%ret_3), attrs = {dst_type: 9}) %ZerosLike_20 : [#users=1] = Node[type=ZerosLike] (inputs = (x=%ReduceSum_16)) %Shape_21 : [#users=1] = Node[type=Shape] (inputs = (x=%Cast_19), attrs = {dtype: 3}) %Const_22 : [#users=1] = Node[type=Const] (attrs = {value: [1.000000]}) %Cast_23 : [#users=1] = Node[type=Cast] (inputs = (x=%Const_22), attrs = {dst_type: 0}) %Fill_24 : [#users=1] = Node[type=Fill] (inputs = (dims=%Shape_21, value=%Cast_23)) %ScatterElements_25 : [#users=1] = Node[type=ScatterElements] (inputs = (data=%ZerosLike_20, indices=%Cast_19, updates=%Fill_24), attrs = {axis: 0, reduction: "none"}) %Unsqueeze_26 : [#users=1] = Node[type=Unsqueeze] (inputs = (x=%ScatterElements_25), attrs = {axes: {-1}}) %Const_27 : [#users=1] = Node[type=Const] (attrs = {value: [256 256]}) %BroadcastTo_28 : [#users=1] = Node[type=BroadcastTo] (inputs = (x=%Unsqueeze_26, shape=%Const_27)) %Identity_29 : [#users=1] = Node[type=Identity] (inputs = (x=%BroadcastTo_28)) %Const_30 : [#users=1] = Node[type=Const] (attrs = {value: [256 256]}) %Reshape_31 : [#users=1] = Node[type=Reshape] (inputs = (x=%Identity_29, shape=%Const_30), attrs = {axis: 0, num_axes: -1}) %Cast_32 : [#users=1] = Node[type=Cast] (inputs = (x=%Reshape_31), attrs = {dst_type: 12}) %LogicalNot_33 : [#users=1] = Node[type=LogicalNot] (inputs = (x=%Cast_32)) %Const_34 : [#users=1] = Node[type=Const] (attrs = {value: [0.000000]}) %MaskedFill_35 : [#users=1] = Node[type=MaskedFill] (inputs = (x=%Add_12, mask=%LogicalNot_33, value=%Const_34)) %Const_36 : [#users=1] = Node[type=Const] (attrs = {value: [4]}) %TopKV2_37 : [#users=2] = Node[type=TopKV2] (inputs = (x=%MaskedFill_35, k=%Const_36), attrs = {sorted: false, dim: -1, largest: true, indices_dtype: 3}) %ret_4 : [users=0] = get_element[node=%TopKV2_37](0) %ret_5 : [users=1] = get_element[node=%TopKV2_37](1) %Cast_38 : [#users=1] = Node[type=Cast] (inputs = (x=%ret_5), attrs = {dst_type: 9}) %GatherElements_39 : [#users=1] = Node[type=GatherElements] (inputs = (x=%Sigmoid_7, index=%Cast_38), attrs = {dim: 1}) %Const_40 : [#users=1] = Node[type=Const] (attrs = {value: [0.000001]}) %RealDiv_41 : [#users=1] = Node[type=RealDiv] (inputs = (x1=%GatherElements_39, x2=%Const_40)) %Const_42 : [#users=1] = Node[type=Const] (attrs = {value: [2.500000]}) %Mul_43 : [#users=1] = Node[type=Mul] (inputs = (x1=%RealDiv_41, x2=%Const_42)) %Cast_44 : [#users=1] = Node[type=Cast] (inputs = (x=%Mul_43), attrs = {dst_type: 0}) return (output_0=%Cast_38, output_1=%Cast_44) - The following is an example of a file that contains subgraphs:
graph("TransformerBlockSubgraph"): %input_0 : [#users=1] = Node[type=Data] (attrs = {index: 0}) %pred_1 : [#users=1] = Node[type=Data] (attrs = {index: 1}) %If_0 : [#users=1] = Node[type=If] (inputs = (cond=%pred_1, input_0=%input_0), attrs = {then_branch: %If_then, else_branch: %If_else}) %Const_1 : [#users=1] = Node[type=Const] (attrs = {value: [0]}) %Const_2 : [#users=1] = Node[type=Const] (attrs = {value: [4]}) %Const_3 : [#users=1] = Node[type=Const] (attrs = {value: [1]}) %For_6 : [#users=2] = Node[type=For] (inputs = (start=%Const_1, limit=%Const_2, delta=%Const_3, input_1=%If_0), attrs = {body: %For_body}) %ret : [users=1] = get_element[node=%For_6](0) %ret_1 : [users=1] = get_element[node=%For_6](1) return (output_0=%ret, output_1=%ret_1) graph("If_then"): %input_0 : [#users=1] = Node[type=Data] (attrs = {index: 0}) %Const_0 : [#users=1] = Node[type=Const] (attrs = {value: [0.900000]}) %Mul_1 : [#users=1] = Node[type=Mul] (inputs = (x1=%input_0, x2=%Const_0)) return (%Mul_1) graph("If_else"): %input_0 : [#users=1] = Node[type=Data] (attrs = {index: 0}) %Identity_0 : [#users=1] = Node[type=Identity] (inputs = (x=%input_0)) return (%Identity_0) graph("For_body"): %iter : [#users=1] = Node[type=Data] (attrs = {index: 0}) %hidden : [#users=1] = Node[type=Data] (attrs = {index: 1}) %Const_0 : [#users=1] = Node[type=Const] (attrs = {value: [1]}) %Add_0 : [#users=1] = Node[type=Add] (inputs = (x1=%iter, x2=%Const_0)) %Const_1 : [#users=1] = Node[type=Const] (attrs = {value: [0.500000]}) %Mul_1 : [#users=1] = Node[type=Mul] (inputs = (x1=%hidden, x2=%Const_1)) %Add_2 : [#users=1] = Node[type=Add] (inputs = (x1=%hidden, x2=%Mul_1)) return (output_0=%Add_0, output_1=%Add_2)
The following describes each field:
- Graph name: graph("<Graph name>")
- Node instance: %<Node instance name> : [#users=<Out-degree>] = Node[type=<Node type>](inputs = (<Input name 1>=%<Input instance 1>, ...), attrs = {<Attribute name 1>: <Attribute value 1>, ...})
- <Node instance name>: name of a node instance
- #users=<Out-degree>: number of node outputs
- Node[type=<Node type>]: operator type corresponding to the node. For example, the MatMul node is displayed as Node[type=MatMul].
- inputs = (<Input name 1>=%<Input instance 1>, ...): The node input is displayed in the format of Parameter name=Instance name. If the parameter name fails to be parsed, the input is rolled back to the _input_N sequence. The default value is used when the node has no input.
Dynamic input: The dynamic input parameters are numbered in the format of Input name_#cnt (Input name_0, Input name_1, ...).
- attrs = {<Attribute name 1>: <Attribute value 1>, ...}: node attribute set, including subgraph attribute items and common attribute items. The default values are used when there are no attributes.
- Output reference of a multi-output node: %ret/ret_#cnt : [#users=<Number of consumers>] = get_element[node=%<Node instance name>](<Output index>).
- %ret/ret_#cnt: Each output of a multi-output node is named in this format: ret, ret_1, ret_2, ...
- [#users=<Number of consumers>]: number of consumers of the output
- get_element[node=%<Node instance name>](<Output index>): Indicates that the <Output index>th output is extracted from the multi-output node.
- Graph output: return (<Output list>)
- Graph output, corresponding to the input of the NetOutput node.
- Single output: return (%<Output instance>)
- Multi-output: return (output_0=%<Output instance 0>, output_1=%<Output instance 1>, ...) Outputs are numbered in the format of output_#cnt (output_0, output_1, ...).
- Subgraph representation: Nodes that contain subgraphs are represented as follows:
- Subgraph declaration: Declare in the attrs of the parent node in this format: attrs = {<Subgraph attribute name>: %<Subgraph instance name>, ... }; If the subgraph attribute name fails to be parsed, rollback is performed to the _graph_N sequence.
- Input mapping: The input_#cnt (or args_#cnt) of the parent node corresponds to the Data node whose index value is cnt in the subgraph. For example, input_0 of the parent node corresponds to Data(attrs = {index: 0}) of the subgraph.
- Output mapping:
- Single output: The return value of the subgraph is directly used as the output of the parent node.
- Multiple outputs: The output_#cnt of the subgraph corresponds to the cntth output of the parent node. The parent node extracts the corresponding output through get_element[node=%<Parent node>](cnt).
- Subgraph display position: The subgraph content is displayed separately after the main output of the parent graph is complete. Each subgraph starts with graph("<Subgraph instance name>").
Applicability
Atlas 350 Accelerator Card