aclGenGraphAndDumpForOp

Description

Builds a graph of a single-operator, dumps the graph, and generates a .txt file. The graph refers to the structure of the intermediate representation (IR) operator. During the build, the graph refreshes continuously due to fusion and partitioning in order to adapt the graph expressed by the user to Ascend AI Processor for higher performance.

Application scenarios:

In the operator tuning scenario, you can call this API to build a graph of a single-operator graph and dump the graph to a .txt file as one of the input data sources for operator tuning.

This API is not required in scenarios that do not involve graph building (for example, single-operator API execution).

Prototype

aclError aclGenGraphAndDumpForOp(const char *opType,

int numInputs,

const aclTensorDesc *const inputDesc[],

const aclDataBuffer *const inputs[],

int numOutputs,

const aclTensorDesc *const outputDesc[],

aclDataBuffer *const outputs[],

const aclopAttr *attr,

aclopEngineType engineType,

const char *graphDumpPath,

const aclGraphDumpOption *graphDumpOpt)

Parameters

Parameter

Input/Output

Description

opType

Input

Pointer to the operator type name.

numInputs

Input

Number of input tensors.

inputDesc

Input

Pointer array of the input tensor description.

Call aclCreateTensorDesc to create data of the aclTensorDesc type in advance.

The array length is consistent with numInputs. The elements in the inputs array match those in the inputDesc array with ordering preserved.

inputs

Input

Pointer array of the input tensors.

Call aclCreateDataBuffer to create data of the aclDataBuffer type in advance.

The array length is consistent with numInputs. The elements in the inputs array match those in the inputDesc array with ordering preserved.

numOutputs

Input

Number of output tensors.

outputDesc

Input

Pointer array of the output tensor description.

Call aclCreateTensorDesc to create data of the aclTensorDesc type in advance.

The array length is consistent with numOutputs. The elements in the outputs array match those in the outputDesc array with ordering preserved.

outputs

Input

Pointer array of the output tensors.

Call aclCreateDataBuffer to create data of the aclDataBuffer type in advance.

The array length is consistent with numOutputs. The elements in the outputs array match those in the outputDesc array with ordering preserved.

attr

Input

Pointer to the operator attributes.

Call aclopCreateAttr to create data of the aclopAttr type in advance.

engineType

Input

Operator execution engine.

graphDumpPath

Input

Pointer to the path for saving the dumped single-operator graph (.txt).

You need to create the path in advance. If you do not specify the file name in the path, the file name will be specified in AscendCL.

If you specify the same directory, including the file name, for multiple dump operations, the latest file overwrites the previous file.

graphDumpOpt

Input

Pointer to the dump option of the single-operator graph.

Reserved. You can only pass nullptr to this parameter.

Returns

The value 0 indicates success, and other values indicate failure. For details, see aclError.