Skip to content

fix(compile): derive Device label from resolved EP, not CLI default#280

Merged
xieofxie merged 6 commits into
mainfrom
hualxie/fix-bug-C
Apr 13, 2026
Merged

fix(compile): derive Device label from resolved EP, not CLI default#280
xieofxie merged 6 commits into
mainfrom
hualxie/fix-bug-C

Conversation

@xieofxie
Copy link
Copy Markdown
Contributor

@xieofxie xieofxie commented Apr 9, 2026

Summary

  • Import _EP_TO_DEVICE in compile.py and use _EP_TO_DEVICE.get(provider, device) to derive the displayed Device: label from the resolved execution provider rather than the raw CLI --device default (npu).
  • Fixes the case where wmk compile --ep dml would display Device: npu instead of Device: gpu.

Test plan

  • TestCompileDeviceDisplayLabel::test_dml_ep_shows_gpu_device — invokes compile with --ep dml and asserts output contains Device: gpu and not Device: npu

Extracted from #209 (Bug C only).

🤖 Generated with Claude Code

…ault

Use _EP_TO_DEVICE[provider] to display the correct device when --ep
overrides the default device (e.g. --ep dml shows 'gpu' not 'npu').

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
@xieofxie xieofxie requested a review from a team as a code owner April 9, 2026 08:06
@xieofxie xieofxie changed the title fix(compile): derive Device label from resolved EP, not CLI default (Bug C) fix(compile): derive Device label from resolved EP, not CLI default Apr 13, 2026
hualxie and others added 3 commits April 13, 2026 11:26
Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
compile_onnx and WinMLCompileConfig are imported inside the function body,
so they're never bound at the commands.compile module level. The correct
patch target for lazy imports is the source module (winml.modelkit.compiler).

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
is_compiled_onnx is a module-level import that parses the ONNX file before
the Device label is printed; patch it so the test doesn't need a valid model.

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
@xieofxie xieofxie enabled auto-merge (squash) April 13, 2026 05:36
@xieofxie xieofxie merged commit e8186c5 into main Apr 13, 2026
8 checks passed
@xieofxie xieofxie deleted the hualxie/fix-bug-C branch April 13, 2026 05:40
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