Skip to content

Spool native warnings without pipes during EP compilation (#1266) [cherry-pick to v0.3.0] - #1267

Open
KayMKM wants to merge 1 commit into
release/v0.3.0from
cherry-pick-1266-v0.3.0
Open

Spool native warnings without pipes during EP compilation (#1266) [cherry-pick to v0.3.0]#1267
KayMKM wants to merge 1 commit into
release/v0.3.0from
cherry-pick-1266-v0.3.0

Conversation

@KayMKM

@KayMKM KayMKM commented Jul 31, 2026

Copy link
Copy Markdown
Contributor

Cherry-picks #1266 into the v0.3.0 release branch.

This replaces pipe-backed native warning capture with a temporary-file spool, avoiding EP compiler hangs while preserving warning filtering and bounded memory use.

Original commit: e27a0faf by @KayMKM. Cherry-picked cleanly onto release tip e1d6f874 as ce11819c.

## Summary
- replace the pipe used by native warning suppression with a file-backed
temporary spool
- filter and replay preserved native diagnostics only after restoring
stderr
- retain fail-open behavior, Windows handle restoration, warning
filtering, and bounded memory usage

## Root cause
The warning filter introduced in #1246 redirected native stderr to a
pipe. VitisAI can hang inside `ort.InferenceSession` when its compiler
sees that pipe handle. The reader was draining correctly, so this was
not the full-buffer deadlock fixed by #1223; changing the reader to
defer replay still hung, which isolated the pipe handle itself as the
trigger.

A temporary file preserves warning filtering without pipe semantics or a
finite producer buffer. With an empty VAIP cache and no VitisAI-specific
bypass, `facebook/convnext-tiny-224` completed on VitisAI NPU in 144.1
seconds. Disabling warning filtering entirely completed the same
workload in 145.1 seconds.

## Validation
- `uv run --no-sync pytest tests/unit/utils/test_native_stderr.py
tests/unit/commands/test_perf_cli.py -q --basetemp
temp/pytest_tmp/native-warning-file-backed-final` (143 passed, 1
platform skip)
- `uvx ruff check src/winml/modelkit/utils/native_stderr.py
tests/unit/utils/test_native_stderr.py
src/winml/modelkit/commands/perf.py
tests/unit/commands/test_perf_cli.py`
- cold-cache VitisAI NPU perf with warning filtering enabled: PASS in
144.1s
@KayMKM
KayMKM requested a review from a team as a code owner July 31, 2026 08:30
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