Skip to content

Qwen3.8-Flash-Next on any consumer hardware: one-click install for Windows / Linux. Strata inference engine, OpenAI/Anthropic API on localhost, optional image input.

C++

AMD picture reader: the no-GPU/arch refusal only in the HIP program; the app's CPU choice starts the CPU reader program

Niko1221b31c13875e34
diff --git a/apps/host/server/native-vision.mjs b/apps/host/server/native-vision.mjs
index 922ddfd29..0394ea024 100644
--- a/apps/host/server/native-vision.mjs
+++ b/apps/host/server/native-vision.mjs
@@ -5,5 +5,6 @@ export function runtimeVision(config,requested){
if(mode==='no')return undefined;
if(mode===undefined)return config.vision;
if(!config.vision)throw new Error('Prepare this model’s vision files before enabling picture reading.');
+ if(mode==='cpu'&&config.vision.cpu_exe){const {cpu_exe,...rest}=config.vision;return {...rest,exe:cpu_exe,gpu:false};} // AMD: the CPU reader program, not the HIP one with the GPU hidden
return {...config.vision,...(mode==='cpu'?{gpu:false}:mode==='gpu'?{gpu:true}:{})};
}
diff --git a/apps/host/tests/native-onboarding.test.mjs b/apps/host/tests/native-onboarding.test.mjs
index 1357756ad..5db0a676e 100644
--- a/apps/host/tests/native-onboarding.test.mjs
+++ b/apps/host/tests/native-onboarding.test.mjs
@@ -145,6 +145,10 @@ test('runtime vision checks prepared files, validates mode, and leaves the sourc
assert.equal(runtimeVision(config,'cpu').gpu,false);
assert.equal(runtimeVision(config,'yes').mmproj,config.vision.mmproj);
assert.deepEqual(config,before);
+ const amd={vision:{exe:'/e/strata-vision-hip',cpu_exe:'/e/strata-vision',mmproj:'/m.gguf',gpu:true}};
+ assert.deepEqual(runtimeVision(amd,'cpu'),{exe:'/e/strata-vision',mmproj:'/m.gguf',gpu:false});
+ assert.equal(runtimeVision(amd,'gpu').exe,'/e/strata-vision-hip');assert.equal(runtimeVision(amd,'gpu').cpu_exe,'/e/strata-vision');
+ assert.equal(runtimeVision(amd,'yes').gpu,true);
assert.throws(()=>runtimeVision({},'yes'),/Prepare/);
assert.throws(()=>runtimeVision(config,'invalid'),/picture reading/);
});
diff --git a/tools/vision/strata_vision.cpp b/tools/vision/strata_vision.cpp
index 293e0198b..85979b664 100644
--- a/tools/vision/strata_vision.cpp
+++ b/tools/vision/strata_vision.cpp
@@ -117,27 +117,21 @@ int main(int argc, char** argv) {
llama_log_set(quiet_log, nullptr);
mtmd_helper_log_set(quiet_log, nullptr);
llama_backend_init();
+#ifdef STRATA_VISION_HIP
if (gpu) {
- // Starting the backends prints the GPU line; with --gpu and no GPU, mtmd would quietly use the CPU, and a card
- // the HIP build has no code for would abort at its first kernel. Both end here with a line the server reads
- // (it then starts the CPU reader).
+ // The AMD GPU reader: starting the backends prints the GPU line. With --gpu and no GPU, mtmd would quietly use the CPU
+ // (a second, slower CPU reader inside the HIP program), and a card the build has no code for would abort at its first
+ // kernel. Both end here with a line the server reads: it then starts the CPU reader (serve/server.py, Vision._start).
bool have_gpu = false;
for (size_t i = 0; i < ggml_backend_dev_count(); ++i) {
const auto type = ggml_backend_dev_type(ggml_backend_dev_get(i));
have_gpu = have_gpu || type == GGML_BACKEND_DEVICE_TYPE_GPU || type == GGML_BACKEND_DEVICE_TYPE_IGPU;
}
if (!have_gpu) {
- std::printf("ERR this picture reader found no GPU (it was built for: %s)\n",
-#ifdef STRATA_VISION_HIP
- STRATA_VISION_HIP_ARCHS
-#else
- "none"
-#endif
- );
+ std::printf("ERR this picture reader found no GPU (it was built for: %s)\n", STRATA_VISION_HIP_ARCHS);
std::fflush(stdout);
return 3;
}
-#ifdef STRATA_VISION_HIP
const char* check = std::getenv("STRATA_VISION_ARCH_CHECK");
if (!g_gfx.empty() && (check == nullptr || std::atoi(check) != 0) &&
!strata_arch_listed(STRATA_VISION_HIP_ARCHS, g_gfx.front())) {
@@ -146,8 +140,8 @@ int main(int argc, char** argv) {
std::fflush(stdout);
return 3;
}
-#endif
}
+#endif
const auto load_t0 = std::chrono::steady_clock::now();
#if !defined(_WIN32) && !defined(__APPLE__) // macOS has no posix_fadvise