已合并
feat(grad_minmax_bwd_cmp): adapt UpdateGradMinMax_hetero and BackwardSegmentCmp for Ascend NPU #23
lhp_lhp创建于 25 天前
feat(grad_minmax_bwd_cmp): adapt UpdateGradMinMax_hetero and BackwardSegmentCmp for Ascend NPU #23
已合并
Pull Request已成功合入, 合并人@knightgd
(感谢 lhp_lhp 的贡献)src/array/ascend/backward_segment_cmp.cc
已过期
@@ -0,0 +85,4 @@
85+template <typename DType>
86+void BackwardSegmentCmpAscendImpl(NDArray feat, NDArray arg, NDArray out) {
87+ DGLContext ctx = feat->ctx;
88+ ASCEND_CALL(aclrtSynchronizeDevice());
系统消息
7 天前 评论:
7 天前 评论:
changed this line on f7d7475c view diff detail
src/array/ascend/backward_segment_cmp.cc
已过期
@@ -0,0 +121,4 @@
121+
122+ // int64 arg -> int32 conversion.
123+ // Synchronize the device before D2H CopyTo to avoid stream race.
124+ ASCEND_CALL(aclrtSynchronizeDevice());
系统消息
7 天前 评论:
7 天前 评论:
changed this line on f7d7475c view diff detail
src/array/ascend/update_grad_minmax_hetero.cc
已过期
@@ -0,0 +104,4 @@
104+ }
105+
106+ DGLContext ctx = feat.front()->ctx;
107+ ASCEND_CALL(aclrtSynchronizeDevice());
系统消息
7 天前 评论:
7 天前 评论:
changed this line on f7d7475c view diff detail
src/array/ascend/update_grad_minmax_hetero.cc
已过期
@@ -0,0 +166,4 @@
166+ // Synchronize the device before D2H CopyTo to avoid stream race.
167+ DGLContext ctx = feat.front()->ctx;
168+ DGLContext cpu_ctx{kDGLCPU, 0};
169+ ASCEND_CALL(aclrtSynchronizeDevice());
系统消息
7 天前 评论:
7 天前 评论:
changed this line on f7d7475c view diff detail


Description
为 Ascend 910B3 (dav-2201) 适配 2 个 segment reduce 反向算子的 NPU 原生路径,替换 CPU 回退和 LOG(FATAL)。
适配算子
out[arg[i,k], k] = feat[i,k](arg>=0)if (type==idx_type[r,c]) out[idx[r,c], c] += feat[r,c]实现方案
支持的数据类型
Checklist
Changes
Test Results