Skip to content
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -1011,13 +1011,14 @@ class HammingDistTopKSplitSKernel {
if ASCEND_IS_AIC { return; }

// topK小于32,不使用内部API排序
if (curKScalar < 32) { useInnerSort = false; }
// (TODO) do not enable inner sort for now as 910B3 has bug
// if (curKScalar < 32) { useInnerSort = false; }

if (useInnerSort) {
CustomSort(topKIndexOutTensor, curKScalar);
SelectBlockTableFromTopK(curBatchIdx, curKScalar, outGmOffset);
return;
}
// if (useInnerSort) {
// CustomSort(topKIndexOutTensor, curKScalar);
// SelectBlockTableFromTopK(curBatchIdx, curKScalar, outGmOffset);
// return;
// }

// 将 TopK 的“chunk索引”映射成 block_id,并写回 GM(indices)
WriteBlockTableFromTopK(curBatchIdx, topKIndexOutTensor, curKScalar, outGmOffset);
Expand Down Expand Up @@ -1509,9 +1510,11 @@ class HammingDistTopKSplitSKernel {

LocalTensor<int32_t> blockIdUb = topKIndexInnerInQueue_.AllocTensor<int32_t>();
LocalTensor<int32_t> tableBlockTensor = tableBlockBuf_.template Get<int32_t>();
DataCopyParams copyParams{1, static_cast<uint16_t>(param_.blockCount * sizeof(int32_t)), 0,
0};
DataCopy(tableBlockTensor, keyBlockTableGm_[curBatchIdx * param_.blockCount], copyParams);
DataCopyExtParams copyParams{1, static_cast<uint16_t>(param_.blockCount * sizeof(int32_t)),
0, 0, 0};
DataCopyPadExtParams<int32_t> copyPadParams{false, 0, 0, 0};
DataCopyPad(tableBlockTensor, keyBlockTableGm_[curBatchIdx * param_.blockCount], copyParams,
copyPadParams);

::AscendC::WriteBlockTableFromTopK(curBatchIdx, topKIndexUb, blockIdUb, curKScalar,
outGmOffset, tableBlockTensor, indicesGm_,
Expand Down
Loading