Skip to content

perf: add dsv2 performance change#1370

Open
baominghelly wants to merge 1 commit into
mainfrom
feat/dsv2-perf_optimization
Open

perf: add dsv2 performance change#1370
baominghelly wants to merge 1 commit into
mainfrom
feat/dsv2-perf_optimization

Conversation

@baominghelly

@baominghelly baominghelly commented Jul 7, 2026

Copy link
Copy Markdown
Contributor

Summary

  • cat.cc 海光上将大量小Memcpy改成按输出切片执行 copy_from,减少MLA拼接开销,仅海光平台
  • deepseek_moe_nvidia.cu 针对不同token规模增加多条MoE计算路径,优化Decode和Prefill,NVIDIA和海光共享文件,部分优化仅海光
  • paged_attention_mla_hd576_v512.cu 海光Paged MLA Decode默认split数从4调整为8, 仅海光平台

Test evidence

海光平台

deepseek moe
nv_ops_paged_attention

cat
hy_ops_ds_cat

paged attention
hy_ops_ds_paged_attention

英伟达平台

deepseek moe
nv_ops_ds_moe

cat
nv_ops_cat

paged attention
nv_ops_paged_attention

@baominghelly baominghelly requested review from a team and wooway777 July 7, 2026 02:56
@baominghelly baominghelly force-pushed the feat/dsv2-perf_optimization branch from 98fdf2e to 2d5e163 Compare July 7, 2026 09:02
@wooway777 wooway777 changed the title feat: add dsv2 performance change oerf: add dsv2 performance change Jul 7, 2026
@wooway777 wooway777 changed the title oerf: add dsv2 performance change perf: add dsv2 performance change Jul 7, 2026
}
assert(dim_shape == out->shape()[dim]);

if (out->device().getType() == Device::Type::HYGON) {

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

这个判定是非得加么?如果这么做更好,能否扩展到其他平台?

if (expert >= 0 && static_cast<size_t>(expert) < num_experts) {
const T *down = reinterpret_cast<const T *>(down_weights[expert]) + h * intermediate_size;
acc += to_float<T>(intermediate[route * intermediate_size + j]) * to_float<T>(down[j]);
#if defined(ENABLE_HYGON_API)

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

相关优化是只有海光有效果,还是其他平台也能复用?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants