feat(sddmm): add SDDMM operator with NPU-native kernels for Ascend - #16
Open
xuejiakn wants to merge 4 commits into
Open
feat(sddmm): add SDDMM operator with NPU-native kernels for Ascend#16xuejiakn wants to merge 4 commits into
xuejiakn wants to merge 4 commits into
Conversation
- Add sddmm_dot_kernel.cpp: Ascend C kernel for dot op (FP32/FP16, COO format) - Add sddmm_copy_lhs_kernel.cpp: NPU-native gather kernel for copy_lhs/copy_rhs (avoids CPU roundtrip that caused PyTorch NPU stream sync issues with autograd) - Add sddmm.cc: host dispatch supporting all ops (dot/add/sub/mul/div/copy_lhs/copy_rhs) - dot: NPU kernel (COO + CSR via CSRToCOO) - copy_lhs/copy_rhs: NPU gather kernel (no CPU roundtrip) - add/sub/mul/div: CPU fallback (FP32 only) - int64 index: cast to int32 then delegate to int32 path - Modify kernel.cc: SDDMM/CSRSDDMM/COOSDDMM dispatch macros to ATEN_XPU_SWITCH_CUDA_ASCEND
- _sparse_ops.py: ensure CPU fallback path for add/sub/mul/div is taken when NPU stream sync is involved - sddmm.cc: align fallback dispatch with the fix Source: cherry-pick from dgl-ascend PR BUPT-GAMMA#15 commit 14b4e38 (test file excluded, belongs to the dedicated test PR).
This was referenced Jul 28, 2026
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
Add SDDMM (Sampled Dense Matrix Multiplication) operator with Ascend NPU-native kernels.
Changes
Restructure note
Replaces SDDMM commits from #14[1][7] and #15[4][9] (duplicates). Base on master; the _sparse_ops.py change has a small intersection with the stream-sync PR (#1) but is independently reviewable.