DEVICE_IMPL_OP_OPTILING
功能说明
在Tiling下沉场景中,该宏定义用于生成Tiling下沉的注册类,再通过调用注册类的成员函数来注册需要下沉的Tiling函数。
函数原型
namespace optiling {
using SinkTilingFunc = std::function<ge::graphStatus(gert::TilingContext *context)>;
class DeviceOpImplRegisterImpl;
// 开发者仅关注Tiling成员函数
class DeviceOpImplRegister {
public:
DeviceOpImplRegister(const char *opType);
~DeviceOpImplRegister();
DeviceOpImplRegister(DeviceOpImplRegister &&other) noexcept;
DeviceOpImplRegister(const DeviceOpImplRegister &other);
DeviceOpImplRegister &operator=(const DeviceOpImplRegister &) = delete;
DeviceOpImplRegister &operator=(DeviceOpImplRegister &&) = delete;
DeviceOpImplRegister &Tiling(SinkTilingFunc func);
// ...
};
} // namespace optiling
#define DEVICE_IMPL_OP_OPTILING(optype) \
static optiling::DeviceOpImplRegister VAR_UNUSED g_deviceOpImplRegister##optype = \
optiling::DeviceOpImplRegister(#optype)
#endif
参数说明
表 1 DEVICE_IMPL_OP_OPTILING参数说明
表 2 Tiling成员函数参数说明
返回值说明
无
约束说明
无
调用示例
DEVICE_IMPL_OP_OPTILING(TestOptype).Tiling(TestTilingFunc); // 将Tiling函数以及其OpType注册到Tiling下沉