Fill
产 品 支 持 情 况
功 能 说 明
将 特 定TPosition的LocalTensor初 始 化 为 某 一 具 体 数 值。
函 数 原 型
template <typename T, typename U = PrimT<T>, typename Std::enable_if<Std::is_same<PrimT<T>, U>::value, bool>::type = true>
__aicore__ inline void Fill(const LocalTensor<T>& dst, const InitConstValueParams<U>& initConstValueParams)
参 数 说 明
表 1 模 板 参 数 说 明
Ascend 950PR/Ascend 950DT,支 持 的 数 据 类 型 为:half/int16_t/uint16_t/bfloat16_t/float/int32_t/uint32_t | |
|
表 2 参 数 说 明
目 的 操 作 数,结 果 矩 阵,类 型 为LocalTensor。 Ascend 950PR/Ascend 950DT, 支 持 的TPosition为A1/B1。 Kirin X90,支 持 的TPosition为A1/A2/B1/B2。 Kirin 9030,支 持 的TPosition为A1/A2/B1/B2。 如 果TPosition为A1/B1,起 始 地 址 需 要 满 足32B对 齐;如 果TPosition为A2/B2,起 始 地 址 需 要 满 足512B对 齐。 | ||
初 始 化 相 关 参 数,类 型 为InitConstValueParams。 具 体 定 义 请 参 考${INSTALL_DIR}/include/ascendc/basic_api/interface/kernel_struct_mm.h,${INSTALL_DIR}请 替 换 为CANN软 件 安 装 后 文 件 存 储 路 径。 参 数 说 明 请 参 考表3。 Ascend 950PR/Ascend 950DT,支 持 配 置 所 有 参 数。
|
表 3 InitConstValueParams结 构 体 参 数 说 明
约 束 说 明
- 操 作 数 地 址 对 齐 要 求 请 参 见通 用 地 址 对 齐 约 束。
调 用 示 例
完 整 使 用 样 例 请 参 见基 础API Fill样 例。
uint32 mLength = 16;
uint32 kLength = 16;
Fill(leftMatrix, {1, static_cast<uint16_t>(mLength * kLength * sizeof(float) / 32), 0, 1}); // 给leftMatrix填 充 mLength * kLength长 度 的 数 据 为1, 按32B的 颗 粒 进 行 填 充