[NPU][1/N] NPU basic functions refactor and new modelslim quant type#13359
Merged
iforgetmyname merged 40 commits intosgl-project:mainfrom Dec 4, 2025
Merged
[NPU][1/N] NPU basic functions refactor and new modelslim quant type#13359iforgetmyname merged 40 commits intosgl-project:mainfrom
iforgetmyname merged 40 commits intosgl-project:mainfrom
Conversation
sglang-bot
approved these changes
Nov 16, 2025
python/sglang/srt/_custom_ops.py
Outdated
| logger.warning("Failed to import from custom_ar with %r", e) | ||
|
|
||
|
|
||
| if not is_hip() and not is_npu(): | ||
| if not CUSTOM_ALLREDUCE_AVAILABLE: |
Member
There was a problem hiding this comment.
help us clean the code
if is_cuda:
...
elif is_hip:
...
elif is_npu:
...
else:
4 tasks
…4DynamicMoEMethod
e7d8c38 to
a19ba11
Compare
Collaborator
Author
|
/tag-and-rerun-ci |
Collaborator
Author
|
/tag-and-rerun-ci |
hnyls2002
approved these changes
Dec 4, 2025
tom-jerr
pushed a commit
to tom-jerr/sglang
that referenced
this pull request
Dec 4, 2025
30 tasks
yingluosanqian
pushed a commit
to yingluosanqian/sglang
that referenced
this pull request
Dec 4, 2025
tonyluj
pushed a commit
to openanolis/sglang
that referenced
this pull request
Dec 5, 2025
tonyluj
pushed a commit
to openanolis/sglang
that referenced
this pull request
Dec 5, 2025
yuchengz816-bot
pushed a commit
to yuchengz816-bot/sglang
that referenced
this pull request
Dec 8, 2025
17 tasks
Kevin-XiongC
pushed a commit
to novitalabs/sglang
that referenced
this pull request
Dec 9, 2025
28 tasks
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.
Motivation
Due to the underlying structural difference between gpgpus and npus, we have introduced a lot of
is_npubranches in current repository from previous commits. Though literarlly it helps the out-of-box experience for our end-users and matches our rapid development pace, this way of orignizing codes breaks readability and of cource maintainability of the whole sglang project. We believe this is not a long-term solution and a healthy and robust way of continously maintaining multi-hardware support, such that starting with this pr, we are trying to refactoring npu-related codes into a specific folder that hides hardware differences and only exposes simplified interfaces that can be called by different models.Modifications
transfer_to_npuwhen engine is starting that mocks all supportedtorch.cudacalls totorch.npunpu_format_castthat wraps data format casting on npu and condition checks for npu-only, this data format casting helps 5% performance improvement on npuTokenToKVPool,PagedTokenToKVPoolAllocator, top_k forward and ascend attention backendmodelslimthat supports npu-specific W8A8, W4A8-MoE, W4A16-MoE mixed quant methodsAccuracy Tests
CI should cover all.
Benchmarking and Profiling
Checklist