Skip to content

studio: fetch the XPU triton wheel with --dest, not pip's -d - #10073

Merged
oobabooga merged 5 commits into
unslothai:mainfrom
Sletch:fix/10018-xpu-triton-download-dest-flag
Sep 1, 2026
Merged

oobabooga merged 5 commits into
unslothai:mainfrom
Sletch:fix/10018-xpu-triton-download-dest-flag

Conversation

@Sletch

@Sletch Sletch commented Aug 31, 2026

Copy link
Copy Markdown
Contributor

Refs #10018.

The defect

Fast-Install, Fast-Uninstall and Fast-Download all declare the same parameter block:

param([Parameter(ValueFromRemainingArguments=$true)]$Args_)

A [Parameter()] attribute makes a function advanced, so PowerShell binds the common
parameters 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_:

Fast-Download --no-deps --only-binary=:all: -d $_tritonTmp $_tritonXpuSpec --index-url $XpuIndexUrl

pip download therefore receives the staged temp directory as a bare positional requirement,
and the swap that exists to stop triton-windows shadowing torch's XPU triton quietly does
nothing.

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 has
never completed.

Reproduced at head

studio/setup.ps1:5511, on pwsh 7.6.5:

arguments the call passes 7
arguments that reach $Args_ 6 — -d is absent
$DebugPreference inside the call Continue (it bound as -Debug)
what pip is asked to download C:\…\unsloth_triton_xpu_0da4251b as a requirement
what the user is shown ERROR: 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

--dest at both call sites — the verbose and the quiet branch of the swap. A long flag is not
a parameter-name token, so it passes through untouched.

The package name is deliberately unchanged. The report suggests triton-xpu is wrong and
should be pytorch-triton-xpu. The comment above the block already answers that:

The spec is read from the installed torch (renamed pytorch-triton-xpu -> triton-xpu in
torch 2.10).

$_tritonXpuSpec is not hard-coded — it is parsed out of the installed torch's own
requires('torch') metadata, so on the reporter's torch 2.10.0+xpu triton-xpu==3.6.0 is
the correct spec. Both spellings are already covered by
tests/studio/test_xpu_triton_swap.py::test_handles_the_triton_xpu_rename. The name in the
report is right; the flag next to it was not.

The wrappers stay advanced functions. Dropping [Parameter()] would let short flags
through 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 Intel
Arc, no XPU index, no network. A new file rather than an extension: the existing setup.ps1
helper suites cover different helpers (Studio.Setup.Output the stdout sink,
Studio.Setup.Vs2026 the VS generator, tests/studio/test_torch_index_pin_hardening.ps1 the
index-path helpers), and this directory is run as a whole by
studio-windows-inference-smoke.yml, so the new file needs no workflow registration.

test pins fails without the change
passes no single-dash flag that prefixes a common parameter no Fast-* call site passes a flag the binder captures yes — names setup.ps1:5511 and :5515
fetches the XPU triton wheel with --dest both branches of the swap stage the wheel yes — finds 0, expects 2
swallows -d as -Debug instead of forwarding it the binding rule itself no — parity guard
declares ValueFromRemainingArguments on all three wrappers the precondition that makes short flags unsafe no — parity guard
finds the wrapper call sites at all guards the scan against a vacuous pass no — parity guard
reaches pip with --dest and the directory adjacent the real extracted Fast-Download forwards the destination no — parity guard
loses the directory when the short flag is used documents the #10018 failure against the real wrapper no — parity guard

The scan derives its list from [System.Management.Automation.Internal.CommonParameters]
rather than hard-coding one, and covers all three wrappers — so a later -d or -v added to
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.

Collateral

Same tree, before and after, on Windows:

surface before after
tests/studio_setup_ps1 (Pester 6.1.0) 64 passed / 0 failed 71 passed / 0 failed
tests/studio/test_xpu_triton_swap.py 60 passed 60 passed
tests/studio/test_setup_xpu_runtime_prereport.ps1 pass pass
tests/studio/test_xpu_arm64_torchaudio.ps1 pass pass
tests/studio/test_intel_registry_fallback.ps1 pass pass

The 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 a
real 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:

  • The success banner after a failed XPU step. The report is right that
    Unsloth Studio Setup Complete should not print when a required XPU component failed. That
    turns a [WARN] into a fatal path and is worth its own PR.
  • Orphaned triton-*.dist-info left behind by the replacement.
  • Post-install verification (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.

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.
@Sletch
Sletch requested a review from danielhanchen as a code owner August 31, 2026 12:01
@oobabooga

Copy link
Copy Markdown
Member

@codex review

@chatgpt-codex-connector

chatgpt-codex-connector Bot commented Aug 31, 2026 •

Copy link
Copy Markdown

Codex Review Summary

This comment shows the latest Codex review activity on this pull request.

Review Status Commit Review trigger
📝 Code Review ✅ Completed 2026-09-01T17:08:46.950484Z 0371b53 Manual request
ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review" or "@codex security review".

Codex reacts with 👀 while any review is running, comments if it has suggestions, and reacts with 👍 once all reviews finish with no findings.

@chatgpt-codex-connector

Copy link
Copy Markdown

Codex Review: Didn't find any major issues. 👍

Reviewed commit: f8b8f5bc01

ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review".

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".

@danielhanchen

Copy link
Copy Markdown
Member

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.

@oobabooga

Copy link
Copy Markdown
Member

@codex review

1 similar comment
@oobabooga

Copy link
Copy Markdown
Member

@codex review

@chatgpt-codex-connector

Copy link
Copy Markdown

Codex Review: Didn't find any major issues. Breezy!

Reviewed commit: 0371b53278

ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review".

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".

@oobabooga

Copy link
Copy Markdown
Member

Thanks @Sletch, this is the right diagnosis. I checked the binding under Windows PowerShell 5.1, the shell the installer launches setup.ps1 with. -d binds to -Debug, so only 6 of the 7 arguments reach $Args_. --dest forwards all 7, and both shipped call sites reach pip with the staged directory adjacent to the flag. The package name is fine as it stands: triton-xpu==3.6.0 resolves on the XPU index, so the flag was the whole failure.

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.

@oobabooga
oobabooga merged commit 32dcc75 into unslothai:main Sep 1, 2026
66 of 68 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants