Repository navigation
fix(platforms): handle Ascend A3 multi-chip rows and stop before npu-smi process table - #1099
Liuchenbing-2026 wants to merge 2 commits into
Conversation
…nd skip process rows Signed-off-by: liuchenbing <chenliumail@163.com>
Dong1017
left a comment
There was a problem hiding this comment.
LGTM
Posted by Dong-bot (review), an automated agent acting on behalf of @Dong1017 (always-on-bot, model auto-smart?optimize_for=balanced).
PR review verdict — PASS
Reviewed base 6050c76 and head b8e5a2f (first review of this head; full diff). pr/prior-reviews.md shows no formal reviews, no Approve on this head and no outstanding CHANGES_REQUESTED, so this is the first independent review, not a re-check.
Verified by reading the code (src/inferrsi/apps/host/platforms/__init__.py L27-59 at head, and the new test in tests/apps/test_inspection.py):
_npu_smi_recordsnow accepts only 3-cell framed rows whose second cell is a known health value (ok/warning/alarm/critical/general/unknown). Chip rows (PCI Bus-Id orNAin column 2), the title/version row (1 cell), and the column-header rows ("Health", "Bus-Id") are all skipped. The existingNPC_TABLEfixture (910B3,310P3) still parses to ids0and1, so the previous tests are unaffected.- The old
re.search([A-Za-z])filter is gone.910_9391(A3), the multi-token910 ProBand numeric-only910now produce records, with the name rebuilt fromhead[1:]. - The loop stops at the first 2+-cell row containing "process" or "pid", so the trailing process table cannot add records. Process rows have 4 cells and
NAchip tokens, so they would also fail the 3-cell/health check. Thebreakis therefore a second guard. - I traced the model matching in
parsed_tool_facts/_normalized_model(L84-120).Ascend 910_9391normalises to9109391,910 ProBto910prob, andAscend910to910. Each matches its record. The new assertions (devices list,selection_verified, absent process-table id9not verified) agree with what the code does. - The change is scoped to discovery and parsing. It makes no compatibility or performance claim, and
.github/is untouched.
Non-blocking notes:
- The health allowlist is closed. A health string outside the list drops that device, so it fails closed ("No device records parsed" or "ID absent") and never admits a false device. Consider a short comment saying so, or a follow-up if real
npu-smioutput shows other values. - The new test does not isolate the
break. Process rows are already rejected by the 3-cell/health filter, so the test passes without the early stop. A process-table row shaped like a 3-cell device row, such as| 9 foo | OK | ... |, would cover it. This is optional. - Model matching is substring-based after normalisation, so a requested
910matches910_9391as well. That is existing behaviour and out of scope.
Not verified here: I did not run the test suite and have not seen CI results. I did not compare against real A3 npu-smi info captures; the fixture is synthetic. No governing issue is linked in pr/meta.json, so I could not check scope against one.
Eligibility: this Approve is one vote from the posting account. The ruleset still needs two qualifying approvals, and merge is left to the integrator.
amy-why-3459
left a comment
There was a problem hiding this comment.
LGTM
inferRSI, acting for @amy-why-3459.
PR review verdict — PASS
Reviewed base 6050c76 and head b8e5a2f.
Verified _npu_smi_records in src/inferrsi/apps/host/platforms/__init__.py and the new regression in tests/apps/test_inspection.py:
- Device rows must have exactly 3 framed cells and a known health value in column 2 (
ok/warning/alarm/critical/general/unknown). Chip rows with a Bus-Id orNAin that column, and 1-cell title/version rows, are skipped. ExistingNPC_TABLEcases (910B3,310P3) still parse to ids0and1. - Names are taken from
head[1:]after a numeric id, so910_9391,910 ProB, and numeric910become records. The old alphabetic-name filter is gone. - Parsing stops at the first 2+-cell row whose cells contain "process" or "pid", so the trailing process table cannot add a device. Process rows in the new fixture also fail the 3-cell/health check; id
9is not verified. _normalized_modelstill drives selection:Ascend 910_9391matches910_9391,910 ProBmatches itself, andAscend910matches910. Return type stays a list of{id, name}records; CUDA/ROCm and scheduling are untouched.- Accuracy and performance comparison experiments are not applicable: this is host discovery parsing only, with no model-output or performance claims.
Before submitting I re-read the reviews and comments on this head. #1099 (review) is an Approve, not a blocking review.
No actionable findings. I did not rerun the unit tests or compare against a live Atlas A3 npu-smi info capture. The fixture is synthetic. No governing issue is linked; the PR itself bounds the slice to this parser and its tests.
Bounty-hunter
left a comment
There was a problem hiding this comment.
Claude Code agent, acting for @Bounty-hunter.
PR review verdict — interim comment (no formal approve / request-changes state).
Reviewed base 6050c76 (main) and head b8e5a2f.
I was not invited to review this revision, so this is non-voting feedback from a read of the diff; I did not submit a formal review state.
What I checked
I read the full diff and traced _npu_smi_records through inspect_ascend → parsed_tool_facts. I imported src/inferrsi/apps/host/platforms/__init__.py at this head with the sibling cuda/mlx imports stubbed, and exercised parsed_tool_facts(..., records=_npu_smi_records) directly — the same path inspect_ascend uses.
Results:
- The new A3 fixture parses to
[{"id": "0", "name": "910_9391"}, {"id": "1", "name": "910 ProB"}, {"id": "2", "name": "910"}]; ids0/1/2qualify asavailablewith the matching models, and NPU9from the trailing process table does not qualify. - The pre-existing
NPC_TABLEfixture still parses to[{"id": "0", "name": "910B3"}, {"id": "1", "name": "310P3"}]. The behaviours the existing ascend tests pin still hold: a temperature token is not an ID (ids=("3",)→tool_available,selection_verifiedfalse),ids=("1",), model="910B3"→device_model_mismatch, and empty output →No device records parsed from npu-smi output. - The old parser run against the same A3 fixture returns
[{"id": "0", "name": "NA"}, {"id": "9", "name": "NA"}], which confirms both halves of the reported bug (process rows misread as devices, A3 model names missed) and that this diff removes them.
I did not review the CUDA/ROCm/MLX paths; the diff does not touch them.
Findings
No blocking findings in the reviewed diff. Three non-blocking observations:
Suggestion 1 — src/inferrsi/apps/host/platforms/__init__.py:52: len(cells) != 3 is stricter than the parser it replaces. The removed code accepted any row whose first cell split into an id plus an alphabetic name, so a device row carrying an extra column group (a fourth pipe cell) would have parsed before and is now silently skipped. Since the premise of this change is that layouts vary across npu-smi versions and SKUs, len(cells) >= 3 with cells[1] as the discriminator keeps the same discrimination without dropping wider rows. Optional — I have no capture showing such a layout, so I am not treating it as a defect.
Suggestion 2 — src/inferrsi/apps/host/platforms/__init__.py:52: the health allowlist is fail-closed, which is the right direction for a discovery fact (no false available), but the failure mode is total: an unlisted health word drops every device row and yields No device records parsed from npu-smi output. Worth one sentence in the docstring so the next reader knows a wording change looks like "no devices" rather than a partial parse.
Suggestion 3 — src/inferrsi/apps/host/platforms/__init__.py:50: _is_npu_process_header matches process/pid in any cell and breaks the loop. Correct for the documented layout where the process table is last, but it turns any future row that merely mentions a process into a hard stop for the rest of the output. A comment recording that assumption would make the next layout change visible.
Evidence gap (non-blocking) — the A3 fixture is hand-written; no real npu-smi info capture is committed with the PR, and the PR body itself lists "Live Atlas A3 host verification if desired" as open. The parse is only as good as that fixture's column layout. A redacted capture from one A3 host would make the layout claim checkable and would also settle Suggestion 1.
Checks
At the time of this comment the only check run on head b8e5a2f was declarations (completed, success); the full pytest matrix had not reported. The author's local claim (Ran 13 tests ... OK on tests/apps/test_inspection.py) is consistent with what I reproduced for the ascend cases, but I did not run the whole file.
zengchuang-hw
left a comment
There was a problem hiding this comment.
PR review verdict — DO NOT PASS
dot, acting for @zengchuang-hw.
Reviewed 6050c767d5ed46867a992ed051f521cd8469fbb2 → b8e5a2fd8a33cdcb1cd5fe321a0b34bf7b060b70 as independent reviewer on the first Ready revision under the review rules.
One [P1] blocking finding inline: the new numeric-name path can qualify a device which the driver reports as not started or absent. The inspection suite passed (20 tests, 11 subtests); a separate CPU fixture reproduced the regression against base and head. No live A3 execution. Only the declarations check was visible on this head; CI is not the basis of the finding.
| continue | ||
| if _is_npu_process_header(cells): | ||
| break | ||
| if len(cells) != 3 or cells[1].casefold() not in _NPU_HEALTH_VALUES: |
There was a problem hiding this comment.
[P1] Keep UNKNOWN devices out of the verified selection. I passed | 0 910 | UNKNOWN | NA NA | through the actual Ascend probe with exit 0, ID 0 and model 910: base rejects the numeric row; this head returns status=available and selection_verified=True. The npu-smi reference defines UNKNOWN as a device that does not exist or is not started. The CLI uses both fields to admit the run, so this is more than a display problem. Do not let an UNKNOWN row satisfy selection; add this as a negative control alongside the existing positive numeric-model fixture.
…tion Do not treat `npu-smi info` rows with `UNKNOWN` health (device absent or not started) as verified Ascend devices, and add a negative control regression test alongside the positive numeric-model fixture. Signed-off-by: liuchenbing <chenliumail@163.com>
10a714b
Bounty-hunter
left a comment
There was a problem hiding this comment.
Claude Code agent, acting for @Bounty-hunter.
The [P1] in review 6202004142 is resolved on head 10a714bccd7d: an UNKNOWN row no longer produces a device record, so it can never satisfy selection. No new blocking finding in the delta. Posted as COMMENT because there is no review invitation on this head.
What I checked
Reviewed base 6050c767d5ed46867a992ed051f521cd8469fbb2 → head 10a714bccd7ddf79172369cc7f7ddefee2a3a0ad (commit 10a714b, "fix(platforms): exclude UNKNOWN npu-smi health rows from Ascend selection").
- Delta:
unknownremoved from_NPU_HEALTH_VALUES(src/inferrsi/apps/host/platforms/__init__.py:27-30), plustest_ascend_unknown_health_row_never_qualifies_a_device(tests/apps/test_inspection.py:221-235). Nothing else changed. - I imported the module at this head with the sibling
cuda/mlximports stubbed and ranparsed_tool_facts(..., records=_npu_smi_records)— the pathinspect_ascenduses — on these fixtures:| 0 910 | UNKNOWN | NA NA |withids=("0",),model="910":devices=[],status=tool_available,selection_verified=False, reasonNo device records parsed from npu-smi output. Same result without ids, and with ids but no model.- Lower-case
unknown: also excluded. - Mixed table (id
0OK, id1UNKNOWN): requesting id1is rejected (Requested device IDs absent…: 1); id0still qualifies. - A four-cell UNKNOWN row: also excluded — it drops at the 3-cell check, so the fail-closed path holds for wider layouts.
- Existing
NPC_TABLE(910B3/310P3) and the A3 fixture parse unchanged; process id9is still not verified.
- The allowlist is now closed: any unlisted future health word drops the row instead of admitting it. That is the right direction for a discovery fact, and worth one docstring sentence the next time this parser is touched.
Still open from the earlier reviews here (non-blocking, untouched by this commit): the len(cells) != 3 strictness against wider device rows, and the unconditional break on any process/pid cell. Neither has a real capture behind it.
Not verified: the full pytest matrix on this head, CI results, or a live Atlas A3 npu-smi info capture. The fixture is still synthetic.
Governing Issue and delivery slice
_npu_smi_records()insrc/inferrsi/apps/host/platforms/__init__.pyso Ascendnpu-smi infooutput is accurately parsed on Atlas A3 multi-chip topologies (e.g.NPU ID+Chip ID+ multi-token / numeric model names likeAscend 910B2/910B3) and stops parsing before the lowerProcess idtable section so process rows are never misclassified as NPU devices. Adds focused unit regression tests intests/apps/test_inspection.py.Knowledge authorship declaration
Not applicable — this PR modifies only
src/inferrsi/apps/host/platforms/__init__.pyandtests/apps/test_inspection.py(no knowledge-policy protected paths).Changed artifacts and evidence
src/inferrsi/apps/host/platforms/__init__.pyunittestontests/apps/test_inspection.py: 13/13 PASSpytestmatrixnpu-smi infoprocess section rows from being treated as devicessrc/inferrsi/apps/host/platforms/__init__.py,tests/apps/test_inspection.pytest_ascend_parses_a3_multi_token_and_numeric_models_without_process_rows: PASSChecks and dependencies
unittesttest cases intests/apps/test_inspection.pyon Python 3.12 againstsrc/(Ran 13 tests in 0.276s — OK).pytest/ linter / CI workflows were not run locally and will run in repository CI._npu_smi_records()return formattuple[tuple[str, str], ...].