Overview
OpTilingParseContextBuilder is used to build TilingParseContext. The constructed Context serves as an input parameter during operator TilingParse computation for retrieving required input and output data of the operator. After the Parser computation completes, the results are written back into the context.
The following figure shows the inheritance relationship of OpTilingParseContextBuilder.
The procedure is as follows:
- Construct ContextHolder.
Call the OpTilingParseContextBuilder API to transfer the corresponding input data, such as the input InputTensorDesc and CompiledJson; and finally call the Build() API to build a ContextHolder<TilingParseContext> object.
- Obtain TilingParseContext.
Call the GetContext API through ContextHolder to obtain TilingParseContext.
- Call the operator TilingParser function TilingParserKernelFunc, use TilingParseContext as the function input parameter, complete TilingParser computation, and write the computation output result.
- Use the TilingParseContext API to obtain CompiledInfo.
- Release ContextHolder as required. After the release is complete, the data pointers in TilingParseContext built using Build are invalid.
This class is inherited from the OpContextBuilderBase class. Before the ContextHolder object construction, it is necessary to call OpType, OpName, and IONum (or IOInstanceNum) of OpContextBuilderBase to respectively set the operator type, name, and numbers of inputs and outputs, and to call the AppendAttr API to set operator attributes.
Header File to Be Included
1 | #include "base/context_builder/op_tiling_parse_context_builder.h" |
Public Member Functions
OpTilingParseContextBuilder()
~OpTilingParseContextBuilder() override
OpTilingParseContextBuilder &InputTensorDesc(size_t index, ge::DataType dtype, ge::Format origin_format,
ge::Format storage_format,
const gert::ExpandDimsType &expand_dims_type = {})
OpTilingParseContextBuilder &OutputTensorDesc(size_t index, ge::DataType dtype, ge::Format origin_format,
ge::Format storage_format,
const gert::ExpandDimsType &expand_dims_type = {})
OpTilingParseContextBuilder &CompiledJson(const ge::char_t *compiled_json)
OpTilingParseContextBuilder &CompiledInfo(const void *compile_info)
OpTilingParseContextBuilder &PlatformInfo(const void *platform_info)
ContextHolder<TilingParseContext> Build()