Skip to content
版 本

DEVICE_IMPL_OP_OPTILING

功 能 说 明

Tiling下 沉场 景 中,该 宏 定 义 用 于 生 成Tiling下 沉 的 注 册 类,再 通 过 调 用 注 册 类 的 成 员 函 数 来 注 册 需 要 下 沉 的Tiling函 数。

函 数 原 型

Text
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参 数 说 明

参 数

输 入/输 出

说 明

optype

输 入

需 要 注 册Tiling函 数 的OpType(算 子 类 型)。

表 2 Tiling成 员 函 数 参 数 说 明

参 数

输 入/输 出

说 明

func

输 入

需 要 注 册 的Tiling函 数,该 函 数 接 受 一 个 作 为 输 入,以 为 返 回 值。

返 回 值 说 明

约 束 说 明

调 用 示 例

Text
DEVICE_IMPL_OP_OPTILING(TestOptype).Tiling(TestTilingFunc); // 将Tiling函 数 以 及 其OpType注 册 到Tiling下 沉

免 责 声 明:本 站 内 容 由 asc-devkit 仓 master 分 支 自 动 编 译 生 成,属 于 持 续 开 发 版 本,可 能 存 在 缺 陷,仅 供 预 览 与 参 考。如 需 稳 定 及 商 用 资 料,请 查 阅 官 方 昇 腾 社 区