Skip to content

fix(ascend): detect exact SoC version - #986

Open
baominghelly wants to merge 1 commit into
masterfrom
fix/ascend-soc-detection-910c
Open

baominghelly wants to merge 1 commit into
masterfrom
fix/ascend-soc-detection-910c

Conversation

@baominghelly

Copy link
Copy Markdown
Contributor

Summary

  • Prefer the exact device name returned by torch_npu, such as Ascend910_9362, when automatically selecting Ascend SOC_VERSION.
  • Resolve the detector Python from _TORCH_PYTHON, Python_EXECUTABLE, or PATH in that order.
  • Keep npu-smi info as a fallback, but only accept model-qualified names such as 910B4 or Ascend910_9362.
  • Preserve Ascend910B4 as the final fallback for existing environments where an exact model cannot be determined.
  • Add CMake script tests for exact torch_npu detection, rejection of HBM numbers such as 3109, and model-qualified npu-smi fallback.

Motivation

Ascend 910C hosts can report the generic name Ascend910 through npu-smi, while AscendC compilation requires the exact SoC name Ascend910_9362. The previous text search could also mistake an HBM value such as 3109 / 65536 for an Ascend 3109 device. This makes automatic custom-kernel builds select the wrong SoC or fall back unnecessarily.

Closes #

Type of Change

  • feat — new feature / new operator / new platform
  • fix — bug fix
  • perf — performance improvement (no behavioral change)
  • refactor — code restructuring without behavior change
  • test — adding or fixing tests only
  • docs — documentation only
  • build / ci — build system or CI configuration
  • Breaking change (requires a ! in the Conventional Commits prefix or a BREAKING CHANGE: footer)

Platforms Affected

  • CPU (WITH_CPU)
  • NVIDIA (WITH_NVIDIA)
  • Iluvatar (WITH_ILUVATAR)
  • MetaX (WITH_METAX)
  • Cambricon (WITH_CAMBRICON)
  • Moore (WITH_MOORE)
  • Ascend (WITH_ASCEND)
  • PyTorch C++ bindings (WITH_TORCH)
  • Build system / CMake / CI
  • Python bindings / user-facing API

Smoke Test Result

Affected-platform smoke build was not run for this final rebased head. The changed detector was validated directly with:

docker run --rm \
  --security-opt seccomp=unconfined \
  -e PYTEST_ADDOPTS="-p no:cacheprovider" \
  -v "$PWD":/src:ro -w /src \
  infiniops-ci/ascend:cann9.1.0-torch2.10.0-npu-post4-20260909 \
  python3 -m pytest tests/test_ascend_soc_detection.py -q

3 passed, 14 warnings in 0.09s

Real Ascend 910C detector result:

device: Ascend910_9362
-- DETECTED_SOC=Ascend910_9362

Test Results on Supported Platforms

Platform Affected Build / Smoke Result Full Result / Notes
NVIDIA No N/A - not affected N/A - not affected
Iluvatar No N/A - not affected N/A - not affected
MetaX No N/A - not affected N/A - not affected
Cambricon No N/A - not affected N/A - not affected
Moore No N/A - not affected N/A - not affected
Ascend Yes Not run - targeted detector test and real 910C detector validation passed Full suite not run; change is limited to Ascend SoC detection
Full `pytest` output (optional)
Not run - full Ascend smoke suite is deferred; this draft only changes SoC detection and has targeted detector coverage.

Benchmark / Performance Impact

N/A

Notes for Reviewers

  • An explicitly supplied SOC_VERSION still takes precedence over automatic detection.
  • torch_npu is preferred because it returns the exact runtime device model.
  • The fallback deliberately rejects bare Ascend910/Ascend310 and numeric-only tokens to avoid interpreting HBM values as SoC names.
  • Real-hardware validation was performed on Ascend 910C (Ascend910_9362). The existing fallback preserves 910B4 behavior, but 310P was not hardware-validated for this change.

@baominghelly
baominghelly marked this pull request as ready for review September 15, 2026 08:45
@baominghelly
baominghelly requested review from a team and voltjia September 15, 2026 08:45
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.

1 participant