[PR #4894] [Other] setup: the ready-made engine fetch keeps the GPU family the install was told to use (Fix #4861) #5235

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

📋 Pull Request Information

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

Base: main ← Head: fix/setup-feed-engine-keeps-the-backend


📝 Commits (2)

  • f66b617 Fix #4861: the ready-made engine fetch keeps the GPU family setup was told to install
  • 4d39db1 The fetched package is checked as the family setup was told to use (#4861, second half)

📊 Changes

2 files changed (+56 additions, -6 deletions)

View changed files

📝 setup.py (+15 -6)
📝 tools/test_setup_feed_engine.py (+41 -0)

📄 Description

Problem and result

On a PC that has an AMD card and an NVIDIA card, a source setup run with --backend hip fetched the CUDA 13 engine
package for its ready-made engine step, then failed its own test start, and ended where the report began: "no ready-made
AMD engine for this Strata version" - with a 621,585,315-byte CUDA package left in engine-feed/.updates/partial/.

Cause, first half: when the flat HIP zip is not published for this version, setup asks for the ready-made engine by
running strata.py update --no-control as a child process. That child detects the GPU itself, and on Windows the
display adapters decide first with NVIDIA ahead of AMD. So on a mixed PC the update chose the CUDA package although
setup had already been told --backend hip; it downloaded it, its test start failed (the CUDA build cannot run on the
AMD card), and setup reported the only thing it could see - no usable AMD engine. The family setup chose is now handed
to that child as STRATA_ENGINE_BACKEND, so a HIP setup fetches the HIP package.

Cause, second half (found on the same mixed PC by the reporter of #4861, after the first half was fixed): setup then read
the fetched package back with ec.resolve(store, full=True) and no family. resolve() runs detect_backend() when
it is given none, and that is the same detection the fetch path had just bypassed - on a mixed PC it says cuda. The
HIP package was therefore refused as the wrong make ("This Strata is for AMD RX 9000 cards. Your PC has an NVIDIA card:
download the NVIDIA version ..."), the EngineMissing went to setup's top-level handler, and the install stopped one
check after the fetch. The family is now handed to that check too, so the fetch, the read-back and the run config a HIP
setup writes all name the same make.

#4861 - the report: the run's setup line, the feed's own failed record, the sha256 of the downloaded file matching the
feed's cuda-cuda13 entry, and the HIP package that works on the same PC when installed by hand.
exploitmenot's re-run on the mixed AMD+NVIDIA PC -
verified the first half end to end on real hardware and reported the remaining refusal, which this commit fixes; that
comment is also the third-party verification in ## Validation below.
#3688 / #3835 - the guard that an update never crosses GPU makes: it works on an installation that already has an engine
(the installed make is remembered), but the fresh engine-feed store setup uses has no installed engine to remember, so
the child fell back to detection.

Approach

setup.py:

  • engine_from_feed() takes the family setup is installing for and puts it in the child's environment as
    STRATA_ENGINE_BACKEND (strata_control.engine_component.ENV_BACKEND). Both HIP call sites pass "hip"; the two flat-zip
    fallbacks in the standard path pass "cuda". An empty value keeps the old behaviour (detect), so no other caller changes.
  • The same family is passed to the read-back of the fetched package: ec.resolve(store, full=True, backend=backend or None).
    A backend argument is the smallest way to make the run agree: it is the only later read-back in the source setup path
    (hip_probe_path() already asks for hip, and the run config and the server take the backend from the config itself),
    and it does not mutate the environment of every later setup action and subprocess. The child process gets the env value
    because it is a separate process - that is the only place an environment value is needed.
  • The variant is not forced: the update/read-back still detect this PC's gfx names and pick the matching AMD build
    (rx9070, rdna2, ...) from the feed.

Validation

Passed (third-party, on a mixed AMD+NVIDIA PC): verified by exploitmenot in
the comment above - Windows 11, AMD Radeon RX 9070
(gfx1201, 16 GB) plus an NVIDIA adapter, Ryzen 9 5900X, a fresh sandbox copy of the 0.2.9 tree with engine/ and
engine-feed/ removed, command setup.py --backend hip --model IQ2_XS --context 32768 --vision no --no-start --yes:

  • Unit tests both ways: main setup.py + this branch's test file -> Ran 6 tests FAILED (failures=2);
    this branch's setup.py -> OK; 12 related setup test modules (190 tests) -> 0 failures. (That is the first half,
    before this commit; those counts are from the tree as it was then. The test file now has 7 cases, including the one for
    the read-back below.)
  • End to end, the fetch: the .part file name is the first 16 hex of the chosen feed entry's sha256, so it names the
    variant before any bytes are written: before the fix 34f399a0a22e4af8.part (621,585,315 B, feed cuda-cuda13), with
    the fix 83b6e70ed0663182.part (568,281,872 B, feed hip-rx9070). It passed sha256, unpacked as
    engine-feed/engine/0.1.55-windows-x86_64-hip-rx9070, and the test start ran the engine for real: hipBLASLt tuning
    enabled (32 rows, gfx1201, version 100500), prompt 53 tokens at 28.6 tok/s, 1 generated in 40 ms (24.9 tok/s), decode
    expert cache hit rate 68.7%.
  • Then the remaining refusal: setup printed [X] This Strata is for AMD RX 9000 cards. Your PC has an NVIDIA card: download the NVIDIA version from ... and stopped. That is the read-back of ## Problem and result's second half,
    fixed by this commit. (The tester disclosed that the 542 MB transfer was crawling, so he placed the byte-identical
    release asset into partial/83b6e70ed0663182.part and let the run pick it up; the variant choice is observable before
    any bytes arrive and the sha256 check, unpack and test start all ran for real.)

Passed: the new test fails on the previous branch head and passes with this commit. With the previous branch head's
setup.py (everything else including the new test unchanged):

python -m unittest tools.test_setup_feed_engine
... AssertionError: None != 'hip' : the package read back is checked without the family setup was told to use
Ran 7 tests in 0.061s
FAILED (failures=1)

With this commit:

python -m unittest tools.test_setup_feed_engine
Ran 7 tests in 0.059s
OK

The new case drives the real engine_from_feed() with mock.patch on the child subprocess.run and on ec.resolve:
the fetched-package read-back is asserted to be asked for the HIP family. That resolve(backend=...) itself takes the
family and never runs the adapter detection is already pinned by
tests/terminal/test_engine_component.py (test_the_package_for_the_backend_is_chosen and
test_another_backend_is_refused_with_the_reason).

Passed: the adjacent suites on this checkout (Windows 11, Python 3.11.16):

python -m pytest tests/terminal/test_gfx_selection.py tests/terminal/test_make_guard.py tests/terminal/test_engine_component.py -q
70 passed, 2 skipped, 4 subtests passed in 4.01s

python -m unittest tools.test_setup_amd
Ran 53 tests in 6.508s
OK

including the mixed-adapters case that pins NVIDIA-first detection (test_both_makes_keep_the_usual_order), which is the
behaviour this change deliberately bypasses for the engine fetch and its read-back.

Failed: none.

Not run: a real mixed AMD+NVIDIA PC by me - this machine cannot be one; that run is the third-party verification
quoted above. The tester offered to re-run the same end-to-end once this commit is in, and I have asked him to. The
feed's own signed content was not fetched to check the HIP package for this PC.

Limits

  • The change fixes the family (cuda / hip), not the variant. If the update cannot read this PC's AMD gfx names at all,
    the feed logic still refuses to guess between AMD builds and reports a plain reason - unchanged.
  • Only the ready-made engine fetch and its read-back are fixed. The app's bundled installer path
    (control_engine_step() -> EC.resolve(full=False), setup.py:7752) is a different entry point with no --backend, so
    it still detects for itself; it was not part of this report.
  • The primary release-asset path (releases/latest/download/, which the report notes answers 404 for the engine package
    now) and the rest of setup's vendor choice are not touched.
  • Any other code that starts the update child without STRATA_ENGINE_BACKEND keeps detecting for itself; only setup's
    own fetch passes the family it was asked to install.

🔄 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/4894 **Author:** [@XiaoBinGan](https://github.com/XiaoBinGan) **Created:** 11/1/2026 **Status:** 🔄 Open **Base:** `main` ← **Head:** `fix/setup-feed-engine-keeps-the-backend` --- ### 📝 Commits (2) - [`f66b617`](https://github.com/Niko1221/Strata/commit/f66b617320da8e434e88df0b07796cda28e75010) Fix #4861: the ready-made engine fetch keeps the GPU family setup was told to install - [`4d39db1`](https://github.com/Niko1221/Strata/commit/4d39db15c600def491801bbfb494d0bd57318982) The fetched package is checked as the family setup was told to use (#4861, second half) ### 📊 Changes **2 files changed** (+56 additions, -6 deletions) <details> <summary>View changed files</summary> 📝 `setup.py` (+15 -6) 📝 `tools/test_setup_feed_engine.py` (+41 -0) </details> ### 📄 Description ## Problem and result On a PC that has an AMD card and an NVIDIA card, a source setup run with `--backend hip` fetched the **CUDA 13** engine package for its ready-made engine step, then failed its own test start, and ended where the report began: "no ready-made AMD engine for this Strata version" - with a 621,585,315-byte CUDA package left in `engine-feed/.updates/partial/`. Cause, first half: when the flat HIP zip is not published for this version, setup asks for the ready-made engine by running `strata.py update --no-control` as a child process. That child detects the GPU itself, and on Windows the display adapters decide first with NVIDIA ahead of AMD. So on a mixed PC the update chose the CUDA package although setup had already been told `--backend hip`; it downloaded it, its test start failed (the CUDA build cannot run on the AMD card), and setup reported the only thing it could see - no usable AMD engine. The family setup chose is now handed to that child as `STRATA_ENGINE_BACKEND`, so a HIP setup fetches the HIP package. Cause, second half (found on the same mixed PC by the reporter of #4861, after the first half was fixed): setup then read the fetched package back with `ec.resolve(store, full=True)` and **no family**. `resolve()` runs `detect_backend()` when it is given none, and that is the same detection the fetch path had just bypassed - on a mixed PC it says `cuda`. The HIP package was therefore refused as the wrong make ("This Strata is for AMD RX 9000 cards. Your PC has an NVIDIA card: download the NVIDIA version ..."), the `EngineMissing` went to setup's top-level handler, and the install stopped one check after the fetch. The family is now handed to that check too, so the fetch, the read-back and the run config a HIP setup writes all name the same make. ## Related discussion #4861 - the report: the run's setup line, the feed's own `failed` record, the sha256 of the downloaded file matching the feed's `cuda-cuda13` entry, and the HIP package that works on the same PC when installed by hand. [exploitmenot's re-run on the mixed AMD+NVIDIA PC](https://github.com/Niko1221/Strata/pull/4894#issuecomment-6560789418) - verified the first half end to end on real hardware and reported the remaining refusal, which this commit fixes; that comment is also the third-party verification in `## Validation` below. #3688 / #3835 - the guard that an update never crosses GPU makes: it works on an installation that already has an engine (the installed make is remembered), but the fresh `engine-feed` store setup uses has no installed engine to remember, so the child fell back to detection. ## Approach `setup.py`: - `engine_from_feed()` takes the family setup is installing for and puts it in the child's environment as `STRATA_ENGINE_BACKEND` (`strata_control.engine_component.ENV_BACKEND`). Both HIP call sites pass `"hip"`; the two flat-zip fallbacks in the standard path pass `"cuda"`. An empty value keeps the old behaviour (detect), so no other caller changes. - The same family is passed to the read-back of the fetched package: `ec.resolve(store, full=True, backend=backend or None)`. A `backend` argument is the smallest way to make the run agree: it is the only later read-back in the source setup path (`hip_probe_path()` already asks for `hip`, and the run config and the server take the backend from the config itself), and it does not mutate the environment of every later setup action and subprocess. The child process gets the env value because it is a separate process - that is the only place an environment value is needed. - The variant is not forced: the update/read-back still detect this PC's gfx names and pick the matching AMD build (`rx9070`, `rdna2`, ...) from the feed. ## Validation **Passed (third-party, on a mixed AMD+NVIDIA PC):** verified by [exploitmenot](https://github.com/exploitmenot) in [the comment above](https://github.com/Niko1221/Strata/pull/4894#issuecomment-6560789418) - Windows 11, AMD Radeon RX 9070 (gfx1201, 16 GB) **plus an NVIDIA adapter**, Ryzen 9 5900X, a fresh sandbox copy of the 0.2.9 tree with `engine/` and `engine-feed/` removed, command `setup.py --backend hip --model IQ2_XS --context 32768 --vision no --no-start --yes`: - **Unit tests both ways:** main `setup.py` + this branch's test file -> `Ran 6 tests` **FAILED (failures=2)**; this branch's `setup.py` -> **OK**; 12 related setup test modules (190 tests) -> 0 failures. (That is the first half, before this commit; those counts are from the tree as it was then. The test file now has 7 cases, including the one for the read-back below.) - **End to end, the fetch:** the `.part` file name is the first 16 hex of the chosen feed entry's sha256, so it names the variant before any bytes are written: before the fix `34f399a0a22e4af8.part` (621,585,315 B, feed `cuda-cuda13`), with the fix `83b6e70ed0663182.part` (568,281,872 B, feed `hip-rx9070`). It passed sha256, unpacked as `engine-feed/engine/0.1.55-windows-x86_64-hip-rx9070`, and the test start ran the engine for real: hipBLASLt tuning enabled (32 rows, gfx1201, version 100500), prompt 53 tokens at 28.6 tok/s, 1 generated in 40 ms (24.9 tok/s), decode expert cache hit rate 68.7%. - **Then the remaining refusal:** setup printed `[X] This Strata is for AMD RX 9000 cards. Your PC has an NVIDIA card: download the NVIDIA version from ...` and stopped. That is the read-back of `## Problem and result`'s second half, fixed by this commit. (The tester disclosed that the 542 MB transfer was crawling, so he placed the byte-identical release asset into `partial/83b6e70ed0663182.part` and let the run pick it up; the variant choice is observable before any bytes arrive and the sha256 check, unpack and test start all ran for real.) **Passed:** the new test fails on the previous branch head and passes with this commit. With the previous branch head's `setup.py` (everything else including the new test unchanged): ```text python -m unittest tools.test_setup_feed_engine ... AssertionError: None != 'hip' : the package read back is checked without the family setup was told to use Ran 7 tests in 0.061s FAILED (failures=1) ``` With this commit: ```text python -m unittest tools.test_setup_feed_engine Ran 7 tests in 0.059s OK ``` The new case drives the real `engine_from_feed()` with mock.patch on the child `subprocess.run` and on `ec.resolve`: the fetched-package read-back is asserted to be asked for the HIP family. That `resolve(backend=...)` itself takes the family and never runs the adapter detection is already pinned by `tests/terminal/test_engine_component.py` (`test_the_package_for_the_backend_is_chosen` and `test_another_backend_is_refused_with_the_reason`). **Passed:** the adjacent suites on this checkout (Windows 11, Python 3.11.16): ```text python -m pytest tests/terminal/test_gfx_selection.py tests/terminal/test_make_guard.py tests/terminal/test_engine_component.py -q 70 passed, 2 skipped, 4 subtests passed in 4.01s python -m unittest tools.test_setup_amd Ran 53 tests in 6.508s OK ``` including the mixed-adapters case that pins NVIDIA-first detection (`test_both_makes_keep_the_usual_order`), which is the behaviour this change deliberately bypasses for the engine fetch and its read-back. **Failed:** none. **Not run:** a real mixed AMD+NVIDIA PC by me - this machine cannot be one; that run is the third-party verification quoted above. The tester offered to re-run the same end-to-end once this commit is in, and I have asked him to. The feed's own signed content was not fetched to check the HIP package for this PC. ## Limits - The change fixes the family (cuda / hip), not the variant. If the update cannot read this PC's AMD gfx names at all, the feed logic still refuses to guess between AMD builds and reports a plain reason - unchanged. - Only the ready-made engine fetch and its read-back are fixed. The app's bundled installer path (`control_engine_step()` -> `EC.resolve(full=False)`, setup.py:7752) is a different entry point with no `--backend`, so it still detects for itself; it was not part of this report. - The primary release-asset path (`releases/latest/download/`, which the report notes answers 404 for the engine package now) and the rest of setup's vendor choice are not touched. - Any other code that starts the update child without `STRATA_ENGINE_BACKEND` keeps detecting for itself; only setup's own fetch passes the family it was asked to install. --- <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#5235
No description provided.