[NPU] add device print#28126
Open
zhaozx-cn wants to merge 6 commits into
Open
Conversation
Signed-off-by: zhaozx-cn <zhaozx2116@163.com>
Contributor
|
Warning You have reached your daily quota limit. Please wait up to 24 hours and I will start processing your requests again! |
AndyLi429
reviewed
Jun 14, 2026
| _ensure_device_print_registered() | ||
|
|
||
| if isinstance(value, torch.Tensor): | ||
| torch.ops.npu.device_print_tensor(value) |
Contributor
Author
There was a problem hiding this comment.
sgl-project/sgl-kernel-npu#552 is required.
ping1jing2
reviewed
Jun 17, 2026
Comment on lines
+357
to
+360
| except AttributeError as exc: | ||
| raise RuntimeError( | ||
| "device_print requires _C_ascend.device_print ops to be available " | ||
| "when custom ops are enabled in the current Ascend build." |
Collaborator
There was a problem hiding this comment.
please tell user how to install sgl_kernel_npu when they faced import issue
Collaborator
|
please solve the lint issue |
McZyWu
reviewed
Jun 18, 2026
| try: | ||
| # Mark device_print ops side-effectful so FX/Inductor does not DCE or reorder these debug callbacks. | ||
| import sgl_kernel_npu # noqa: F401 | ||
|
|
Contributor
Author
There was a problem hiding this comment.
maybe need to lazy init here
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
This PR adds device print support for npu graph mode. The main use case is debugging, especially when investigating and fixing accuracy issues on npu.
Modifications
add device_print func.
Accuracy Tests
Speed Tests and Profiling
Checklist
Review and Merge Process
/tag-and-rerun-ci,/tag-run-ci-label,/rerun-failed-ciCI States
Latest PR Test (Base): ❌ Run #29152080111
Latest PR Test (Extra): ❌ Run #29152079992