Skip to content

fix(npu): probe AIE columns via temp file, not -o /dev/stdout#893

Merged
thinmintdev merged 2 commits into
mainfrom
fix/npu-column-probe-tempfile
Jun 19, 2026
Merged

fix(npu): probe AIE columns via temp file, not -o /dev/stdout#893
thinmintdev merged 2 commits into
mainfrom
fix/npu-column-probe-tempfile

Conversation

@thinmintdev

Copy link
Copy Markdown
Contributor

Problem

The NPU occupancy dashboard card always showed column probe unavailable instead of N/8 columns claimed. Root cause: the AIE-column probe (xrt-smi examine -r aie-partitions) always failed against the live FLM image:

  1. As written (-o /dev/stdout) → ERROR: output file '/dev/stdout' already existsexit 1read_aie_columns returns None.
  2. Even with --force, xrt-smi writes JSON to the -o target and prints its human-readable console report to stdout — with -o /dev/stdout the two interleave, so json.loads chokes on the leading banner → None.

Either way columns_available stayed False, and the route silently degraded to the single-tenant "all 8 columns" fallback. The gauge looked plausible (8/8 is right for one slot), so the honest multi-tenant path never actually ran.

Fix

Run the probe through sh -c inside the container: write JSON to a private per-exec temp file ($$), cat it back (JSON only), then remove it. A failed probe propagates a non-zero exit so the existing returncode check degrades cleanly.

Verified end-to-end against hal0-slot-npu on CT 105 — returns clean JSON, partitions: [(0, 8)], exit 0.

Tests

  • New regression test test_read_uses_tempfile_shell_not_dev_stdout pins the sh -c + --force + temp-file shape and asserts /dev/stdout never reappears.
  • All existing probe + occupancy tests pass (20 passed).

🤖 Generated with Claude Code

thinmintdev and others added 2 commits June 19, 2026 01:18
The NPU-occupancy card showed "column probe unavailable" because the
xrt-smi probe always failed. The live xrt-smi build rejects
`-o /dev/stdout` with "output file already exists" (exit 1), and with
`--force` it interleaves its human-readable console report onto stdout
alongside the JSON, so json.loads chokes. Either way read_aie_columns
returned None and the route degraded to the single-tenant "all 8 columns"
fallback.

Run the probe through `sh -c` instead: write JSON to a private per-exec
temp file (`$$`), cat it back (JSON only), then remove it. A failed probe
propagates a non-zero exit so the existing returncode check still
degrades cleanly. Verified end-to-end against hal0-slot-npu on CT 105.

Add a regression test pinning the `sh -c` + --force + temp-file shape so
nobody reverts to `-o /dev/stdout`.

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
@thinmintdev
thinmintdev enabled auto-merge (squash) June 19, 2026 05:34
@thinmintdev
thinmintdev merged commit fb940bf into main Jun 19, 2026
3 checks passed
@thinmintdev
thinmintdev deleted the fix/npu-column-probe-tempfile branch June 23, 2026 21:54
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