Skip to content

fix(install): route Linux Intel GPU hosts away from CPU-only torch - #5274

Merged
danielhanchen merged 1 commit into
unslothai:mainfrom
andomeder:fix/linux-intel-xpu-install-routing
Oct 5, 2026
Merged

danielhanchen merged 1 commit into
unslothai:mainfrom
andomeder:fix/linux-intel-xpu-install-routing

Conversation

@andomeder

Copy link
Copy Markdown
Contributor

Linux Intel GPU hosts can currently fall through to the CPU-only torch path in the normal local Studio install flow.

That means a user doing:

git clone https://github.com/leizhenyuan/unsloth unsloth-intel
cd unsloth-intel
git checkout zhenyuan_enable_studio
./install.sh --local

can get the wrong install path even when /sys/class/drm shows an Intel GPU.

This patch keeps that Linux install flow on the Intel/XPU path instead of the CPU fallback.

What changed

  • add _has_intel_xpu_gpu() in install.sh
  • if no NVIDIA or AMD ROCm path applies, return the xpu install path
  • add _install_intel_xpu_stack() for the Intel extras path
  • keep the normal --local overlay flow after the Intel install path runs
  • add a shell test for Intel DRM vendor detection

Linux installer routing only.

Validation

Ran locally on an Intel Linux machine:

  • bash tests/sh/test_get_torch_index_url.sh → 28 passed, 0 failed
  • bash -n install.sh → pass
  • ./install.sh --local → pass

Installer output now includes:

Intel GPU detected -- installing Intel XPU-enabled PyTorch and Unsloth extras

Note

UV_SKIP_WHEEL_FILENAME_CHECK=1 stays inside the installer for the current Intel extras path because one preview-wheel filename is rejected by uv otherwise.

Related:

@gemini-code-assist gemini-code-assist Bot 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.

Code Review

This pull request introduces support for Intel XPU GPUs by adding detection logic via DRM sysfs and a dedicated installation path for Intel-enabled PyTorch and Unsloth extras. It also refactors the Unsloth installation stages and updates the test suite to include Intel GPU scenarios. Review feedback identified a typo in a function call for runtime dependencies, accidental version downgrades for the Unsloth package, and missing unsloth-zoo git overlays in several refactored local installation paths.

Comment thread install.sh Resolved
Comment thread install.sh Resolved
Comment thread install.sh Resolved
Comment thread install.sh Resolved
Comment thread install.sh Resolved
Comment thread install.sh Resolved
@andomeder

Copy link
Copy Markdown
Contributor Author

/gemini review

@gemini-code-assist gemini-code-assist Bot 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.

Code Review

This pull request introduces support for Intel XPU GPUs in the installation script. Key changes include the addition of Intel GPU detection via DRM sysfs, a specialized installation routine for the Intel XPU PyTorch stack, and updates to the torch index URL selection logic. The PR also refactors local repository overlay logic into a reusable function and includes unit tests for the new detection paths. Review feedback recommends adding the --upgrade-package flag to Intel-specific installation commands for consistency and ensuring the new overlay function is used in all applicable local installation branches.

Comment thread install.sh Resolved
Comment thread install.sh Resolved
@andomeder

Copy link
Copy Markdown
Contributor Author

/gemini review

@gemini-code-assist gemini-code-assist Bot 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.

Code Review

This pull request introduces support for Intel XPU GPUs in the installation script by adding detection logic via DRM sysfs and a dedicated installation path for Intel-enabled PyTorch and Unsloth extras. It also refactors local repository overlay logic into a reusable function and updates the test suite to cover Intel GPU detection. A review comment identifies a discrepancy in the Intel XPU installation stack where version constraints and the unsloth-zoo package were missing in the non-local installation path, and suggests using the dynamic package name variable for better consistency.

Comment thread install.sh Resolved
@andomeder
andomeder marked this pull request as ready for review May 4, 2026 18:25
Comment thread install.sh Outdated
fi
}

_overlay_local_repos() {

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.

why do you have this in your PR? seems like it leaked from another PR i already merged?

@danielhanchen

Copy link
Copy Markdown
Member

Confirmed main's get_torch_index_url still has no Intel autodetect, so routing Linux Intel hosts to the xpu index is worth having, though matching any 0x8086 DRM vendor id will also catch ordinary integrated graphics on CPU-only laptops. Could you narrow the detection and drop the unrelated hunks Roland flagged, the removed tauri_log STEP line and the reshuffled unsloth install block, then rebase since this now conflicts?

@danielhanchen

Copy link
Copy Markdown
Member

Re-checked against main and the branch is unchanged since my last note, so the 0x8086 match still catches ordinary Intel integrated graphics and the unrelated hunks (removed tauri_log STEP line, reshuffled unsloth install block) are still in. Could you narrow the detection, drop those hunks and rebase, and also take a look at #9084 which is covering similar ground so you two are not duplicating work?

@danielhanchen

Copy link
Copy Markdown
Member

Main still has no Intel autodetect in get_torch_index_url, but matching any 0x8086 DRM vendor would also send Linux machines with only Intel integrated graphics to the xpu torch and extras install. Could you limit detection to discrete or XPU-capable devices, drop the unrelated overlay changes Roland flagged, and rebase?

@danielhanchen danielhanchen self-assigned this Oct 5, 2026
@danielhanchen
danielhanchen force-pushed the fix/linux-intel-xpu-install-routing branch from f8dddca to a5a2134 Compare October 5, 2026 08:15
@danielhanchen
danielhanchen marked this pull request as ready for review October 5, 2026 08:15
@danielhanchen

Copy link
Copy Markdown
Member

Thank you so much for the PR and for looking into Intel GPU support on Linux, we really appreciate it!

We won't be taking the change itself, for a few reasons:

  1. Main already supports Intel XPU installs on Linux through an explicit pin (UNSLOTH_TORCH_INDEX_FAMILY=xpu, or an xpu UNSLOTH_TORCH_INDEX_URL). That path also installs the XPU bitsandbytes build and repairs a mismatched torch flavor on re-runs, building on enable studio for intel GPU #4724.
  2. Linux Intel support is intentionally opt-in rather than autodetected. Matching any 0x8086 DRM vendor id would also catch ordinary Intel integrated graphics, so most Intel laptops and desktops without a supported Arc / Xe GPU would be moved from CPU torch to the multi-GB XPU stack.
  3. The branch had drifted a long way from main (the installer has changed substantially since) and also touched unrelated parts of the install flow, such as the Desktop progress step.

We still want to credit your contribution, so this PR is merged as an empty commit that keeps you as the author. If you would like to pursue autodetection further, a narrower probe limited to XPU-supported device ids, or a hint pointing Intel GPU users to UNSLOTH_TORCH_INDEX_FAMILY=xpu, would be a great follow-up. Thanks again!

@chatgpt-codex-connector

Copy link
Copy Markdown

You have reached your Codex usage limits for security reviews. Please try again later.

@danielhanchen
danielhanchen merged commit 26db015 into unslothai:main Oct 5, 2026
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