Thanks for sending an requirement! Please fill in the following template to help quickly solve your problem.
索引类算子在涉及处理多个重复索引时,由于atomicadd等导致的计算顺序不确定,可能出现多次执行结果不一致问题。针对该类算子提供一套统一解决方案,索引线性化+索引全局排序+按序处理。考虑到排序方案可复用,需要增加sort lib全局排序公共库,供索引类算子全局排序方案使用。
算子设计团队
增加sort lib全局排序公共库,供索引类算子全局排序方案使用,简化索引类算子确定性方案开发成本
SortLib 是 ops-nn/index 目录下的 header-only 公共排序库,为 index 类算子(scatter_add、index_add等)提供统一的 稳定基数排序(SIMT LSD radix sort)能力,避免各算子重复实现排序 + 索引 permutation 逻辑。
ops-nn/index
scatter_add
index_add
x
totalElements
sortedValues
sortedIndices
sortedValues[i] == x[sortedIndices[i]]
DAV_3510
SUPPORT_COMPUTE_UNIT "ascend950"
TILING_DIR "arch35"
isDescending
AscendC::Sort
totalElements==0
DISABLE_IN_OPP TRUE
../sort_lib/
dependency_parser.py
/assign
Thanks for sending an requirement! Please fill in the following template to help quickly solve your problem.
Backgroud(背景信息)
索引类算子在涉及处理多个重复索引时,由于atomicadd等导致的计算顺序不确定,可能出现多次执行结果不一致问题。针对该类算子提供一套统一解决方案,索引线性化+索引全局排序+按序处理。考虑到排序方案可复用,需要增加sort lib全局排序公共库,供索引类算子全局排序方案使用。
Origin(信息来源)
算子设计团队
Benefit / Necessity (价值/作用)
增加sort lib全局排序公共库,供索引类算子全局排序方案使用,简化索引类算子确定性方案开发成本
Design(设计方案)
1.1 定位与目标
SortLib 是
ops-nn/index目录下的 header-only 公共排序库,为 index 类算子(scatter_add、index_add等)提供统一的 稳定基数排序(SIMT LSD radix sort)能力,避免各算子重复实现排序 + 索引 permutation 逻辑。x(长度totalElements)。sortedValues与排序索引sortedIndices(permutation,满足sortedValues[i] == x[sortedIndices[i]])。1.2 支持范围
DAV_3510,SUPPORT_COMPUTE_UNIT "ascend950"、TILING_DIR "arch35")isDescending)1.3 关键特性
AscendC::Sort快路径(0 SyncAll、0 workspace);大 N 走自研多核 LSD radix sort。totalElements==0时 host 返回固定配置、kernel 直接 return,不写 workspace(避免 0 字节越界)。DISABLE_IN_OPP TRUE,无独立 op,由依赖方通过../sort_lib/引用;编译依赖自动解析(dependency_parser.py)。