[PR #5184] [TUI] engine component: an integrated GPU no longer decides this PC's engine family (Fix #4971) #5336

Open
opened 2026-11-07 16:34:26 +07:00 by bsakaguchi · 0 comments
Owner

📋 Pull Request Information

Original PR: https://github.com/Niko1221/Strata/pull/5184
Author: @XiaoBinGan
Created: 11/4/2026
Status: 🔄 Open

Base: main ← Head: reserve/fix-integrated-gpu-vendor


📝 Commits (1)

  • eb95fbd [TUI] engine component: an integrated GPU no longer decides this PC's engine family (#4971)

📊 Changes

2 files changed (+90 additions, -7 deletions)

View changed files

📝 strata_control/engine_component.py (+31 -7)
➕ tests/terminal/test_gpu_vendor_integrated.py (+59 -0)

📄 Description

Problem and result

strata_control/engine_component.py::_drm_vendor_backend() decides this PC's engine family from the PCI vendors in
/sys/class/drm when the vendor tools are not on PATH, in a fixed order (NVIDIA 0x10de, AMD 0x1002, Intel
0x8086) and returns the first one present. An integrated GPU therefore decides the machine:

  • the report's PC has an Intel Arc Pro B60 (discrete, xe, 24 GB) and an AMD Raphael APU iGPU (amdgpu, 512 MiB
    BIOS carve-out) visible in sysfs. _drm_vendor_backend() returned hip, so the whole PC was classified as an AMD
    machine and the installed SYCL engine was refused: "This Strata is for Intel cards. Your PC has an AMD card" —
    this PC linux-x86_64, hip (sysfs pci vendor).

After the change a card whose own VRAM is an integrated GPU's small carve-out is skipped while another card is
present, and the report's machine answers sycl:

$ python -c "from strata_control import engine_component as ec; print(ec._drm_vendor_backend('<tmp drm with 0x1002 512MiB + 0x8086 no size>'))"
sycl

with the old order otherwise intact (a discrete AMD card still decides hip; a Radeon card beside an APU keeps
hip; NVIDIA keeps cuda; an integrated card alone keeps its old answer; no sysfs tree is still None).

#4971 — the report, with both broken paths named (strata_cli/launch/catalog.py for the card list, and
strata_control/engine_component.py::_drm_vendor_backend for the backend). This change fixes the backend half only;
catalog.py is owned by other work in flight, so the launcher's card-list merge is deliberately not touched here —
it is the same report's other half and is named in the limits.

Approach

  • INTEGRATED_MAX_VRAM_MIB = 2048: the most own VRAM an integrated GPU can show. The smallest card Strata runs has
    several GiB, so a card below 2 GiB is not a usable target (the report's APU shows 512 MiB).
  • _own_vram(card) reads device/mem_info_vram_total (amdgpu's own-VRAM size) and returns True above the bar,
    False below it, and None when the file is absent. NVIDIA and Intel write no such file, so their cards are
    not classified as integrated by a missing file — they fall back to the old order.
  • _drm_vendor_backend() groups the cards by vendor and skips a vendor whose every card is positively integrated
    (False) while another vendor has a card that is not. A card that reports no own-VRAM size (None) counts as
    usable, so a missing file cannot change a vendor's rank.
  • When every card is integrated, the old first-vendor answer is kept, so a single-APU box is classified as before.
  • Read-only sysfs; nothing runs, and nothing outside this function changes.

Validation

Passed: the new regression test, tests/terminal/test_gpu_vendor_integrated.py (6 tests), on a temporary
/sys/class/drm tree per case:

$ python -m pytest tests/terminal/test_gpu_vendor_integrated.py -q
6 passed

The report's case (AMD APU 512 MiB + Intel Arc with no mem_info_vram_total) is sycl; a discrete AMD card alone is
hip; an APU beside a discrete Radeon is hip; NVIDIA keeps cuda beside an AMD APU; an integrated card alone is
hip; a missing tree is None.

Passed: the A/B — with strata_control/engine_component.py reverted to main, the report's case fails:

$ python -m pytest tests/terminal/test_gpu_vendor_integrated.py -q      # engine_component.py from main
1 failed, 5 passed
FAILED ...::test_an_apu_beside_an_intel_arc_does_not_make_the_pc_amd
AssertionError: 'hip' != 'sycl'

Passed: the surrounding component tests (this checkout, Windows 11, Python 3.11.16):

$ python -m pytest tests/terminal/test_gpu_vendor_integrated.py tests/terminal/test_engine_component.py \
    tests/terminal/test_sycl_package.py tests/terminal/test_mixed_vendors.py tests/terminal/test_make_guard.py -q
85 passed, 2 skipped, 4 subtests passed

Failed: none.

Not run: a real Linux PC with the report's two adapters — the sysfs tree is built in a temp directory in the
tests, not read from /sys/class/drm. The real values quoted (vendor ids, 512 MiB carve-out, the Arc writing no
mem_info_vram_total) come from the report's own /sys/class/drm excerpt. No engine build is touched: this is the
Python Control package only, and the function it changes is called only on Linux (os.name != "nt").

Limits

  • The 2 GiB bar is a heuristic: an integrated GPU whose driver reported a bigger own-VRAM size would still count as
    discrete. No such device is known, and a card that reports no size is never called integrated.
  • Only amdgpu's mem_info_vram_total is read; the AMD APU is the reported case. Another vendor's integrated GPU
    that writes no size keeps today's behaviour.
  • This is the backend-detection half of #4971. The launcher's own path
    (strata_cli/launch/catalog.py: the Arc is consulted only when the shared reader found no card at all) is not
    changed here, so on that machine strata launch may still see only the APU row until that side is fixed; the
    report's workaround (STRATA_ENGINE_BACKEND=sycl) is then still needed for the launcher.
  • A PC whose only card is integrated keeps the old answer (the classification is about which engine to run, not
    about refusing the card).

🔄 This issue represents a GitHub Pull Request. It cannot be merged through Gitea due to API limitations.

## 📋 Pull Request Information **Original PR:** https://github.com/Niko1221/Strata/pull/5184 **Author:** [@XiaoBinGan](https://github.com/XiaoBinGan) **Created:** 11/4/2026 **Status:** 🔄 Open **Base:** `main` ← **Head:** `reserve/fix-integrated-gpu-vendor` --- ### 📝 Commits (1) - [`eb95fbd`](https://github.com/Niko1221/Strata/commit/eb95fbd23390415ada553be1192c919e98fe9ff3) [TUI] engine component: an integrated GPU no longer decides this PC's engine family (#4971) ### 📊 Changes **2 files changed** (+90 additions, -7 deletions) <details> <summary>View changed files</summary> 📝 `strata_control/engine_component.py` (+31 -7) ➕ `tests/terminal/test_gpu_vendor_integrated.py` (+59 -0) </details> ### 📄 Description ## Problem and result `strata_control/engine_component.py::_drm_vendor_backend()` decides this PC's engine family from the PCI vendors in `/sys/class/drm` when the vendor tools are not on PATH, in a fixed order (NVIDIA `0x10de`, AMD `0x1002`, Intel `0x8086`) and returns the first one present. An **integrated** GPU therefore decides the machine: - the report's PC has an Intel Arc Pro B60 (discrete, `xe`, 24 GB) and an AMD Raphael APU iGPU (`amdgpu`, 512 MiB BIOS carve-out) visible in sysfs. `_drm_vendor_backend()` returned `hip`, so the whole PC was classified as an AMD machine and the installed SYCL engine was refused: *"This Strata is for Intel cards. Your PC has an AMD card"* — `this PC linux-x86_64, hip (sysfs pci vendor)`. After the change a card whose own VRAM is an integrated GPU's small carve-out is skipped while another card is present, and the report's machine answers `sycl`: ```text $ python -c "from strata_control import engine_component as ec; print(ec._drm_vendor_backend('<tmp drm with 0x1002 512MiB + 0x8086 no size>'))" sycl ``` with the old order otherwise intact (a discrete AMD card still decides `hip`; a Radeon card beside an APU keeps `hip`; NVIDIA keeps `cuda`; an integrated card alone keeps its old answer; no sysfs tree is still `None`). ## Related discussion #4971 — the report, with both broken paths named (`strata_cli/launch/catalog.py` for the card list, and `strata_control/engine_component.py::_drm_vendor_backend` for the backend). This change fixes the backend half only; `catalog.py` is owned by other work in flight, so the launcher's card-list merge is deliberately **not** touched here — it is the same report's other half and is named in the limits. ## Approach - `INTEGRATED_MAX_VRAM_MIB = 2048`: the most own VRAM an integrated GPU can show. The smallest card Strata runs has several GiB, so a card below 2 GiB is not a usable target (the report's APU shows 512 MiB). - `_own_vram(card)` reads `device/mem_info_vram_total` (amdgpu's own-VRAM size) and returns `True` above the bar, `False` below it, and `None` when the file is absent. NVIDIA and Intel write no such file, so their cards are **not** classified as integrated by a missing file — they fall back to the old order. - `_drm_vendor_backend()` groups the cards by vendor and skips a vendor whose every card is positively integrated (`False`) while another vendor has a card that is not. A card that reports no own-VRAM size (`None`) counts as usable, so a missing file cannot change a vendor's rank. - When every card is integrated, the old first-vendor answer is kept, so a single-APU box is classified as before. - Read-only sysfs; nothing runs, and nothing outside this function changes. ## Validation **Passed:** the new regression test, `tests/terminal/test_gpu_vendor_integrated.py` (6 tests), on a temporary `/sys/class/drm` tree per case: ```text $ python -m pytest tests/terminal/test_gpu_vendor_integrated.py -q 6 passed ``` The report's case (AMD APU 512 MiB + Intel Arc with no `mem_info_vram_total`) is `sycl`; a discrete AMD card alone is `hip`; an APU beside a discrete Radeon is `hip`; NVIDIA keeps `cuda` beside an AMD APU; an integrated card alone is `hip`; a missing tree is `None`. **Passed:** the A/B — with `strata_control/engine_component.py` reverted to `main`, the report's case fails: ```text $ python -m pytest tests/terminal/test_gpu_vendor_integrated.py -q # engine_component.py from main 1 failed, 5 passed FAILED ...::test_an_apu_beside_an_intel_arc_does_not_make_the_pc_amd AssertionError: 'hip' != 'sycl' ``` **Passed:** the surrounding component tests (this checkout, Windows 11, Python 3.11.16): ```text $ python -m pytest tests/terminal/test_gpu_vendor_integrated.py tests/terminal/test_engine_component.py \ tests/terminal/test_sycl_package.py tests/terminal/test_mixed_vendors.py tests/terminal/test_make_guard.py -q 85 passed, 2 skipped, 4 subtests passed ``` **Failed:** none. **Not run:** a real Linux PC with the report's two adapters — the sysfs tree is built in a temp directory in the tests, not read from `/sys/class/drm`. The real values quoted (vendor ids, 512 MiB carve-out, the Arc writing no `mem_info_vram_total`) come from the report's own `/sys/class/drm` excerpt. No engine build is touched: this is the Python Control package only, and the function it changes is called only on Linux (`os.name != "nt"`). ## Limits - The 2 GiB bar is a heuristic: an integrated GPU whose driver reported a bigger own-VRAM size would still count as discrete. No such device is known, and a card that reports no size is never called integrated. - Only amdgpu's `mem_info_vram_total` is read; the AMD APU is the reported case. Another vendor's integrated GPU that writes no size keeps today's behaviour. - This is the backend-detection half of #4971. The launcher's own path (`strata_cli/launch/catalog.py`: the Arc is consulted only when the shared reader found no card at all) is not changed here, so on that machine `strata launch` may still see only the APU row until that side is fixed; the report's workaround (`STRATA_ENGINE_BACKEND=sycl`) is then still needed for the launcher. - A PC whose only card is integrated keeps the old answer (the classification is about which engine to run, not about refusing the card). --- <sub>🔄 This issue represents a GitHub Pull Request. It cannot be merged through Gitea due to API limitations.</sub>
Sign in to join this conversation.
No milestone
No project
No assignees
1 participant
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Dependencies

No dependencies set.

Reference
Niko1221/Strata#5336
No description provided.