GetTilingFunc

Function

Obtains the corresponding tiling function based on the operator type.

Prototype

1
TilingFunc GetTilingFunc(const char *opType) const

Parameters

Parameter

Input/Output

Description

opType

Input

Operator type, which must be the same as the operator type defined in the prototype.

Returns

If the operation is successful, the pointer to the corresponding tiling function is returned. If the operation fails, a null pointer is returned. The tiling function pointer is defined as follows:

1
using TilingFunc = uint32_t(*)(gert::TilingContext*)

Restrictions

None

Example

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
context_ascendc::OpTilingRegistry tmpIns;
bool flag = tmpIns.LoadTilingLibrary("/your/path/to/so_path/liboptiling.so");
if (flag == false) {
    std::cout << "Load tiling so failed" << std::endl;
    return -1;        
}
context_ascendc::TilingFunc tilingFunc = tmpIns.GetTilingFunc("AddCustom");
if (tilingFunc != nullptr) {
    //  use tiling func
    ...
} else {
    std::cout << "get tiling func failed." << std::endl;
    return -1;
}
// ...