Repository navigation
studio: fetch the XPU triton wheel with --dest, not pip's -d - #10073
Conversation
Fast-Install, Fast-Uninstall and Fast-Download all declare `param([Parameter(ValueFromRemainingArguments=$true)]$Args_)`. A [Parameter()] attribute makes a function ADVANCED, so PowerShell binds the common parameters before it collects remaining arguments -- and `-d`, pip's own spelling of `--dest`, is a unique prefix of `-Debug`. It binds there and never reaches $Args_, so the Intel XPU triton swap hands pip a bare directory instead of a destination, and the swap that is supposed to stop triton-windows shadowing torch's XPU triton quietly does nothing. Reproduced at head: the call at studio/setup.ps1:5511 forwards six arguments, not seven. `-d` is absent from $Args_ and $DebugPreference is `Continue` inside the call. Running pip with what actually arrives prints `ERROR: Directory '...\unsloth_triton_xpu_0da4251b' is not installable. Neither 'setup.py' nor 'pyproject.toml' found.` -- the line in unslothai#10018, and it is printed before the index is ever queried, which is why the failure reads as a missing package. The package name is deliberately left alone. $_tritonXpuSpec is read from the installed torch's own `requires('torch')` metadata, and the pytorch-triton-xpu -> triton-xpu rename is already covered by tests/studio/test_xpu_triton_swap.py::test_handles_the_triton_xpu_rename, so the name in the report is correct and is not the fault. The wrappers stay advanced functions: dropping [Parameter()] would pass short flags through everywhere, but it changes argument binding for all 32 call sites, and the two call sites are the smaller surface. Whether a failed XPU component should end the run rather than warn is a separate behaviour question and is untouched. tests/studio_setup_ps1/Studio.Setup.FastWrapperFlags.Tests.ps1 pins it. Two of its seven fail without this change: the call-site scan, which names setup.ps1:5511 and :5515, and the assertion that both the verbose and the quiet branch fetch with `--dest`. The other five are parity guards on PowerShell's binding itself and hold either way. The scan derives its list from [CommonParameters] instead of hard-coding one and covers all three wrappers, so a later `-d` or `-v` on any call site fails the same way. Of the 32 call sites -- 29 Fast-Install, 1 Fast-Uninstall, 2 Fast-Download -- only these two used a short flag. One consequence worth naming: the guard is source-level, so a call site that genuinely needs a single-dash flag now has to spell it long or go through `--%`. Refs unslothai#10018. The orphaned `triton-*.dist-info` cleanup and the success banner printed after a failed XPU step are not addressed here.
|
@codex review |
Codex Review SummaryThis comment shows the latest Codex review activity on this pull request.
ℹ️ About Codex in GitHubYour team has set up Codex to review pull requests in this repo. Reviews are triggered when you
Codex reacts with 👀 while any review is running, comments if it has suggestions, and reacts with 👍 once all reviews finish with no findings. |
|
Codex Review: Didn't find any major issues. 👍 Reviewed commit: ℹ️ About Codex in GitHubYour team has set up Codex to review pull requests in this repo. Reviews are triggered when you
If Codex has suggestions, it will comment; otherwise it will react with 👍. Codex can also answer questions or update the PR. Try commenting "@codex address that feedback". |
|
Confirmed this hits studio/setup.ps1:5511 and :5515, where -d binds to -Debug on the advanced Fast-Download wrapper and the temp directory reaches pip as a positional requirement. Will get this reviewed. |
|
@codex review |
1 similar comment
|
@codex review |
|
Codex Review: Didn't find any major issues. Breezy! Reviewed commit: ℹ️ About Codex in GitHubYour team has set up Codex to review pull requests in this repo. Reviews are triggered when you
If Codex has suggestions, it will comment; otherwise it will react with 👍. Codex can also answer questions or update the PR. Try commenting "@codex address that feedback". |
|
Thanks @Sletch, this is the right diagnosis. I checked the binding under Windows PowerShell 5.1, the shell the installer launches setup.ps1 with. I also walked the download, uninstall and reinstall path through its failure branches, since this is the first time it can get past the fetch. The install manifest is restored in every case that is not the loud one. Routing is unchanged for CUDA, ROCm, CPU and no-torch hosts, and the two red checks here reproduce on main. I have no Intel Arc machine, so the final import on real hardware is still from the report in #10018. |
Refs #10018.
The defect
Fast-Install,Fast-UninstallandFast-Downloadall declare the same parameter block:A
[Parameter()]attribute makes a function advanced, so PowerShell binds the commonparameters before it collects remaining arguments.
-d— pip's own spelling of--dest—is a unique prefix of
-Debug. It binds there and never reaches$Args_:pip downloadtherefore receives the staged temp directory as a bare positional requirement,and the swap that exists to stop
triton-windowsshadowing torch's XPU triton quietly doesnothing.
The flag has been this way since the block was added in #7706 (2026-08-04) —
git log -S'-d $_tritonTmp'returns that commit and nothing since — so on Windows + Intel XPU the swap hasnever completed.
Reproduced at head
studio/setup.ps1:5511, on pwsh 7.6.5:$Args_-dis absent$DebugPreferenceinside the callContinue(it bound as-Debug)C:\…\unsloth_triton_xpu_0da4251bas a requirementERROR: Directory '…' is not installable. Neither 'setup.py' nor 'pyproject.toml' found.That error is printed before the index is ever queried, which is why the failure reads as
a missing package rather than a dropped flag.
The change
--destat both call sites — the verbose and the quiet branch of the swap. A long flag is nota parameter-name token, so it passes through untouched.
The package name is deliberately unchanged. The report suggests
triton-xpuis wrong andshould be
pytorch-triton-xpu. The comment above the block already answers that:$_tritonXpuSpecis not hard-coded — it is parsed out of the installed torch's ownrequires('torch')metadata, so on the reporter's torch 2.10.0+xputriton-xpu==3.6.0isthe correct spec. Both spellings are already covered by
tests/studio/test_xpu_triton_swap.py::test_handles_the_triton_xpu_rename. The name in thereport is right; the flag next to it was not.
The wrappers stay advanced functions. Dropping
[Parameter()]would let short flagsthrough everywhere, but it changes argument binding for all 32 call sites. The two call sites
are the smaller and more reviewable surface.
Tests
tests/studio_setup_ps1/Studio.Setup.FastWrapperFlags.Tests.ps1— 7 tests, no GPU, no IntelArc, no XPU index, no network. A new file rather than an extension: the existing setup.ps1
helper suites cover different helpers (
Studio.Setup.Outputthe stdout sink,Studio.Setup.Vs2026the VS generator,tests/studio/test_torch_index_pin_hardening.ps1theindex-path helpers), and this directory is run as a whole by
studio-windows-inference-smoke.yml, so the new file needs no workflow registration.passes no single-dash flag that prefixes a common parameterFast-*call site passes a flag the binder capturessetup.ps1:5511and:5515fetches the XPU triton wheel with --destswallows -d as -Debug instead of forwarding itdeclares ValueFromRemainingArguments on all three wrappersfinds the wrapper call sites at allreaches pip with --dest and the directory adjacentFast-Downloadforwards the destinationloses the directory when the short flag is usedThe scan derives its list from
[System.Management.Automation.Internal.CommonParameters]rather than hard-coding one, and covers all three wrappers — so a later
-dor-vadded toany call site fails the same way. Of the 32 call sites (29
Fast-Install, 1Fast-Uninstall,2
Fast-Download), only these two used a short flag.Collateral
Same tree, before and after, on Windows:
tests/studio_setup_ps1(Pester 6.1.0)tests/studio/test_xpu_triton_swap.pytests/studio/test_setup_xpu_runtime_prereport.ps1tests/studio/test_xpu_arm64_torchaudio.ps1tests/studio/test_intel_registry_fallback.ps1The Pester delta is exactly the seven new tests. No pre-existing failures on these surfaces.
One consequence worth naming
The guard is source-level, so it constrains how the wrappers may be called: a call site that
genuinely needs a single-dash flag now has to spell it long, or go through
--%. That is areal restriction, accepted because the failure it prevents is silent.
Not in scope
Measured and deliberately left alone — each is a behaviour change rather than a dropped flag,
and I did not want to bundle them:
Unsloth Studio Setup Completeshould not print when a required XPU component failed. Thatturns a
[WARN]into a fatal path and is worth its own PR.triton-*.dist-infoleft behind by the replacement.from triton._C.libtriton import intel).I have not reproduced the reporter's environment — no Intel Arc hardware here, so the
downstream
cannot import name 'intel' from 'triton._C.libtriton'is taken from the report.What is measured above is the argument binding and pip's response to it, on pwsh 7.6.5 on
Windows. That is the layer the fix acts on, and it is reached before any XPU-specific code
runs.