Skip to content

add ascend 910B npu support #24

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
wants to merge 1 commit into
base: main
Choose a base branch
from
Open

Conversation

narc1ssus1
Copy link

910B的支持,已在CANN8通过测试,需要依赖onnxruntime-cann

@SWHL SWHL requested a review from Copilot May 29, 2025 06:18
@SWHL
Copy link
Member

SWHL commented May 29, 2025

感谢感谢,等我晚点并入,发版

Copy link

@Copilot Copilot AI left a comment

Choose a reason for hiding this comment

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

Pull Request Overview

Adds support for Ascend 910B NPU by integrating the ONNXRuntime CANN execution provider.

  • Introduces a new CANNExecutionProvider enum and related configuration flag
  • Extends session setup to conditionally prepend the CANN EP with its specific options
  • Updates the main entrypoint to accept and forward a use_cann argument

Reviewed Changes

Copilot reviewed 2 out of 2 changed files in this pull request and generated 2 comments.

File Description
rapid_layout/utils/infer_engine.py Added CANN_EP enum, cfg_use_cann handling, _check_cann and EP insertion logic
rapid_layout/main.py Exposed new use_cann parameter and passed it into OrtInferSession configuration
Comments suppressed due to low confidence (2)

rapid_layout/main.py:54

  • No tests cover the new use_cann code path; consider adding unit or integration tests to verify the CANNExecutionProvider logic.
use_cann: bool = False,

@@ -51,6 +51,7 @@ def __init__(
iou_thres: float = 0.5,
use_cuda: bool = False,
use_dml: bool = False,
use_cann: bool = False,
Copy link
Preview

Copilot AI May 29, 2025

Choose a reason for hiding this comment

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

[nitpick] The new use_cann parameter is not documented in the function docstring or CLI help; consider updating documentation to describe this option.

Copilot uses AI. Check for mistakes.

@@ -71,6 +73,16 @@ def _get_ep_list(self) -> List[Tuple[str, Dict[str, Any]]]:
}
EP_list = [(EP.CPU_EP.value, cpu_provider_opts)]

self.use_cann = self._check_cann()
Copy link
Preview

Copilot AI May 29, 2025

Choose a reason for hiding this comment

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

[nitpick] Provider initialization follows a similar pattern across _check_* methods and EP_list insertion; consider refactoring common logic into a helper to reduce duplication.

Copilot uses AI. Check for mistakes.

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