Skip to content

isa_coverage: a stalled llvm-mc is reported next to the names, not a TimeoutExpired traceback - #4427

Open
tedin7 wants to merge 1 commit into
ItsNotRexed:mainfrom
tedin7:h1-isa-coverage-llvm-stall
Open

tedin7 wants to merge 1 commit into
ItsNotRexed:mainfrom
tedin7:h1-isa-coverage-llvm-stall

Conversation

@tedin7

@tedin7 tedin7 commented Nov 23, 2026

Copy link
Copy Markdown

Item: new, claimed here.
Depends on: none. #4426 edits the same subprocess.run(...) line (adds errors="replace", a different fix); whichever lands second rebases a one-line conflict.

Why

isa_coverage.py --llvm-mc EXE runs llvm-mc once per non-RDNA2 name with a 30 s timeout but only catches OSError. A stalled llvm-mc raised subprocess.TimeoutExpired out of main: traceback, no report. Expected: the report is still printed, with the stall named next to those entries.

What

probe_llvm_mc catches TimeoutExpired and returns the same {"error": ...} shape it already returns when llvm-mc cannot be started, so the remaining names are not each given another 30 s. The timeout is the named constant PROBE_TIMEOUT.

Tested

python -I tests/test_isa_coverage.py on the pod: 22 tests, OK (4 skipped, they need the AMD XML). On main the two new tests (probe stall, and main with a stalled llvm-mc) fail with TimeoutExpired. The tests fake the stall with subprocess.run raising TimeoutExpired.
AI-assisted. No game files.

@Kam471 Kam471 left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Ran this at 9d7a002d on Windows 11: python -I tests/test_isa_coverage.py -> 22 tests, OK (4 skipped); git diff --check clean.

A stalled llvm-mc is now reported as one error line next to the affected names instead of a TimeoutExpired traceback; the skipped cases are tool-dependent. No blocking issue.

@molodayamama

Copy link
Copy Markdown

Independent Windows check of 9d7a002d1c4513e6fe31c46a04cb5bfb5b860832 (Windows 10 22H2, CPython 3.12.12). The suite ran 22 cases: 18 passed and 4 XML-dependent skips.

I also exercised a real timeout rather than mocking subprocess.run: an MSVC-built stand-in for llvm-mc writes an invocation marker and sleeps 15 seconds. With only PROBE_TIMEOUT set locally to 0.5 s, probe_llvm_mc() returned the timeout diagnostic naming the first mnemonic in 0.52 s and the marker recorded exactly one child start for two supplied names. The second mnemonic did not incur a second timeout. Synthetic tool only. AI-assisted (Codex).

@dev-ewann

Copy link
Copy Markdown
Contributor

Reviewed and tested 9d7a002 (already based on origin/main 03b09a0): looks good.

  • python3 -I -B tests/test_isa_coverage.py (WSL Ubuntu, llvm-mc 18 on PATH): Ran 22 tests ... OK (skipped=4). The 4 skips need LEONIDA_RDNA2_ISA_XML.
  • python3 -I -B -m pytest -q tests/test_isa_coverage.py: 18 passed, 4 skipped, 4 subtests passed.
  • Stdlib only; no text write added.
  • Mutations on each added line of tools/isa_coverage.py (restored with git checkout, -B so no stale .pyc):
    • Killed: except subprocess.TimeoutExpired swapped for another exception; message text changed; early return removed; return swapped for continue (caught by call_count == 1).
    • Survived: PROBE_TIMEOUT = 30 -> 31; dropping for {n!r} from the message.
    • Equivalent: literal timeout=30 instead of the constant.
  • Nit, non-blocking: the tests build TimeoutExpired(..., 30) themselves and assert neither the timeout passed to subprocess.run nor the mnemonic in the message. Checking kwargs["timeout"] == PROBE_TIMEOUT on the mock, plus assertIn("s_endpgm", ...), would pin both.

AI-assisted (Claude), on behalf of dev-ewann. No GPU used.

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.

4 participants