Overview

This class manages the context for implementing function execution for operators on the host. The constructed context stores only pointers. To facilitate lifecycle and ownership management, the ContextHolder class is provided for resource management.

Necessary input and output data can be obtained through the context when function execution is implemented for operators on the host. Operator implementation on the host includes Tiling, InferShape, InferShapeRange, InferDataType, and InferFormat. Each implementation function requires a type of context as the input parameter. For example, the input parameter of the Tiling implementation function is TilingContext, and that of the InferShape implementation function is InferShapeContext.

To facilitate context construction for the operator implementation on the host, we provide various context construction methods, which are called the OpxxxContextBuilder class. It can be used to shield the complexity of underlying data structures and simplify the construction process. For example, the OpTilingContextBuilder class is provided to construct TilingContext.

The OpxxxContextBuilder APIs are as follows:

OpxxxContextBuilder is used to create ContextHolder, which manages the memory resources indicated by the pointer in the context. You can obtain the corresponding context through ContextHolder.

Header Files to Be Included

1
#include "base/context_builder/context_holder.h"

Public Member Functions

template<typename ContextTypeT>
ContextTypeT *GetContext()