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++

GPU choice (0.2.1): Automatic skips cards the engine cannot run, one card sent as gpu, settings-file GPUs kept, readable dropdown, Monitor opens on assigned cards (#3203 #3195 #3256 #3221 #3211)

Niko1221952cce7752be
diff --git a/apps/host/server/native-control.mjs b/apps/host/server/native-control.mjs
index ae4ec6485..743638b30 100644
--- a/apps/host/server/native-control.mjs
+++ b/apps/host/server/native-control.mjs
@@ -132,7 +132,7 @@ export function createNativeControl({directory,requests=()=>[],changed=()=>{},sp
function save(model,{values,mcp}){if([...jobs.values()].some(j=>j.state==='running'))throw new Error('Finish the current operation before saving native settings.');const {path,config}=record(model);if(busy(requests().filter(r=>instances.get(r.instanceId)?.model===model)))throw new Error('Finish this model’s requests before saving its settings.');const patch=validateNativeSettings(values??{}),next={...config};for(const field of nativeFields())if(field.supported===false&&patch[field.id]!=null&&JSON.stringify(patch[field.id])!==JSON.stringify(config[field.id]))throw new Error(`${field.label} needs a newer native Strata installation. Update it in Settings → About.`);for(const [key,value] of Object.entries(patch)){if(key==='env')next.env=restoreNativeEnv(value,config.env??{});else if(value===null)delete next[key];else next[key]=value;}if(mcp!==undefined){next.mcp_servers=validateMcpServers(mcp,config.mcp_servers??config.mcpServers??{});delete next.mcpServers;}copyFileSync(path,path+'.bak');chmodSync(path+'.bak',0o600);const temp=path+'.ui-tmp';writeFileSync(temp,JSON.stringify(next,null,2)+'\n',{mode:0o600});renameSync(temp,path);return settings(model);}
function previousEngine(){if(packaged)return !!snapshot.engine?.previous;try{const data=snapshot.installed?.data_dir??snapshot.installed?.data_folder;return [join(preferences.repo,'engine/.previous'),data&&join(data,'engine/.previous')].filter(Boolean).some(existsSync)&&readFileSync(join(preferences.repo,'setup.py'),'utf8').includes('--rollback-engine');}catch{return false;}}
async function plan(args){await refresh();if(!snapshot.available)throw new Error(snapshot.error);return tool('strata_install',installArgs(args,false));}
- function installArgs(args,confirm){const allowed=['family','model','context','vision','kv','gpu','gpus','backend','low_ram','port','gguf_dir'];const size=snapshot.catalog?.families?.find(f=>f.family===args.family)?.sizes.find(s=>s.model===args.model);const existing=snapshot.installed?.models?.find(m=>m.model===size?.id);/* A model adopted from the person's own GGUF folder reports that folder's parent as its data folder: it is theirs, not Strata's, so a second preparation never uses it for the packs. */const data=nativeDataDirectory(args.data_dir??(args.gguf_dir?undefined:existing?.dataFolder)??preferences.downloadDirectory??modelsDirectory?.());return {...(data?{data_dir:data}:{}),...Object.fromEntries(allowed.filter(k=>args[k]!==undefined).map(k=>[k,args[k]])),/* Picture reading is only downloaded when it was asked for (Read pictures); the default stays the smaller download. */...(packaged&&args.vision===undefined?{vision:'no'}:{}),confirm};}
+ function installArgs(args,confirm){const allowed=['family','model','context','vision','kv','gpu','gpus','backend','low_ram','port','gguf_dir'];const size=snapshot.catalog?.families?.find(f=>f.family===args.family)?.sizes.find(s=>s.model===args.model);const existing=snapshot.installed?.models?.find(m=>m.model===size?.id);/* A model adopted from the person's own GGUF folder reports that folder's parent as its data folder: it is theirs, not Strata's, so a second preparation never uses it for the packs. */const data=nativeDataDirectory(args.data_dir??(args.gguf_dir?undefined:existing?.dataFolder)??preferences.downloadDirectory??modelsDirectory?.());return {...(data?{data_dir:data}:{}),...Object.fromEntries(allowed.filter(k=>args[k]!==undefined).map(k=>[k,args[k]])),/* One card is "gpu", never "gpus" (the installer wants two or more there: "Gpus='0' is not valid", #3203). */...(/^\d{1,2}$/.test(String(args.gpus??''))?{gpu:Number(args.gpus),gpus:undefined}:{}),/* Picture reading is only downloaded when it was asked for (Read pictures); the default stays the smaller download. */...(packaged&&args.vision===undefined?{vision:'no'}:{}),confirm};}
function begin(kind,run,metadata={}){if([...jobs.values()].some(j=>j.state==='running'))throw new Error('Finish or cancel the current engine operation first.');const job={id:randomUUID(),kind,state:'running',startedAt:new Date().toISOString(),summary:'Starting…',result:null,error:null,...metadata};for(const [id,old] of jobs)if(jobs.size>=12&&old.state!=='running')jobs.delete(id);jobs.set(job.id,job);emit();void run(job).then(result=>{if(job.state==='running'){Object.assign(job,{state:'done',summary:result?.summary??'Complete',result,finishedAt:new Date().toISOString()});}}).catch(error=>{if(job.state==='running')Object.assign(job,{state:'error',error:error.message,summary:error.message,...(error.details?{details:error.details}:{}),finishedAt:new Date().toISOString()});}).finally(()=>{if(job.kind.startsWith('update')||job.kind==='rollback')disconnect();lastRead=0;emit();void refresh(true);});return state().jobs.find(j=>j.id===job.id);}
async function watchInstall(job,current){job.summary=current.step??'Resuming preparation status…';job.result={install:current};while(job.state==='running'){await new Promise(r=>setTimeout(r,1500));const result=await tool('strata_install');job.summary=result.summary;job.result=result;emit();if(!result.install?.running){if(result.install?.exit_code!==0)throw new Error(result.install?.error??'Preparation did not finish. Retry to reuse completed files.');return {summary:'Model preparation complete. Load it from Models.'};}}}
@@ -194,7 +194,9 @@ return {summary:result.summary??'Deleted',removed:result.plan?.gb??null};}
const visionPreferences=args.vision!==undefined?{ui_vision_enabled:args.vision!=='no',ui_vision_device:args.vision==='no'?config.ui_vision_device??'yes':args.vision}:{};
const resources=args.resourceProfile?resourceSettings({...config,vision},snapshot.hardware,args.resourceProfile,modelArena(args.model)):null;
const cfg={...config,...visionPreferences,...(resources?{...resources,ui_resource_profile:args.resourceProfile}:{}),host:'127.0.0.1',open_browser:false,...validateNativeSettings(args.values??{}),vision};
- if(args.gpus!==undefined){const detected=new Set((snapshot.hardware?.gpus??[]).map(g=>g.index));if(!Array.isArray(args.gpus)||!args.gpus.length||new Set(args.gpus).size!==args.gpus.length||args.gpus.some(g=>!Number.isInteger(g)||!detected.has(g)))throw new Error('Choose distinct detected GPUs. CPU-only text inference is not supported by this native adapter.');cfg.gpu=args.gpus.length===1?args.gpus[0]:args.gpus;cfg.layer_split=args.gpus.length>1?validateNativeSettings({layer_split:args.layerSplit??'auto'}).layer_split:'auto';if(cfg.layer_split!=='auto'&&cfg.layer_split.split(',').length!==args.gpus.length-1)throw new Error('Choose one layer split point between each pair of GPUs.');}
+ /* The app's suggested cards only fill a gap: a model whose settings file already names its GPUs ("gpu": [1, 0], with "gpu_order": "as_given") keeps them (#3256). A card the person picked in the screen always wins. */
+ const namedInFile=Array.isArray(config.gpu)?config.gpu.length>0:config.gpu!==undefined&&config.gpu!==null&&config.gpu!=='';
+ if(args.gpus!==undefined&&!(args.gpusFromRecommendation&&namedInFile)){const detected=new Set((snapshot.hardware?.gpus??[]).map(g=>g.index));if(!Array.isArray(args.gpus)||!args.gpus.length||new Set(args.gpus).size!==args.gpus.length||args.gpus.some(g=>!Number.isInteger(g)||!detected.has(g)))throw new Error('Choose distinct detected GPUs. CPU-only text inference is not supported by this native adapter.');cfg.gpu=args.gpus.length===1?args.gpus[0]:args.gpus;cfg.layer_split=args.gpus.length>1?validateNativeSettings({layer_split:args.layerSplit??'auto'}).layer_split:'auto';if(cfg.layer_split!=='auto'&&cfg.layer_split.split(',').length!==args.gpus.length-1)throw new Error('Choose one layer split point between each pair of GPUs.');}
if(cfg.vram_reserve_mib!==undefined&&cfg.vram_reserve_mib!==null){cfg.args=[...(cfg.args??[])];const at=cfg.args.indexOf('--vram-reserve-mib');if(at>=0)cfg.args.splice(at,2);cfg.args.push('--vram-reserve-mib',String(cfg.vram_reserve_mib));}if(cfg.vision){if(cfg.vision_tokens!=null)cfg.vision={...cfg.vision,max_tokens:cfg.vision_tokens};if(cfg.vision_min_tokens!=null)cfg.vision={...cfg.vision,min_tokens:cfg.vision_min_tokens};}cfg.mcp={...(cfg.mcp??{}),...(cfg.mcp_timeout_s!=null?{timeout_s:cfg.mcp_timeout_s}:{}),...(cfg.mcp_max_rounds!=null?{max_rounds:cfg.mcp_max_rounds}:{}),...(cfg.mcp_max_result_chars!=null?{max_result_chars:cfg.mcp_max_result_chars}:{})};
/* The model's own choices win over what setup wrote into the arguments: "Draft layer (MTP)" off leaves --mtp out of every start, and a picture reading that is off leaves --vision out (setup writes both again whenever it runs; the saved settings are applied here, on every load). */
if(cfg.mtp===false&&Array.isArray(cfg.args))cfg.args=withoutDraftLayer(cfg.args);
diff --git a/apps/host/src/components/NativeModels.tsx b/apps/host/src/components/NativeModels.tsx
index da5f786aa..249175856 100644
--- a/apps/host/src/components/NativeModels.tsx
+++ b/apps/host/src/components/NativeModels.tsx
@@ -4,7 +4,7 @@ import { Screen } from './layout';
import { VersionPicker } from './VersionPicker';
import { FamilySwitch } from './FamilySwitch';
import { PcFitCard } from './PcFitCard';
-import { fitOn } from '../lib/native-fit';
+import { fitOn, runCards } from '../lib/native-fit';
import { Btn, Dialog, ErrorNotice, Icon, Select } from './ui';
import { installProgress, installStage, stageText, useDownloadEta } from '../lib/download-eta';
import { useKept } from '../lib/kept-state';
@@ -53,6 +53,7 @@ export function NativeModels({ onOtherModels, onReady, onImport, onConnectEngine
// The model that is running is shown as running, with Unload: not offered for loading again.
const downloaded = native?.installed?.models ?? [], allSizes = families.flatMap(f => f.sizes);
// This computer for the fit figures: the biggest usable graphics card, or the ones chosen under Expert settings.
+ const runGpus = runCards(native?.hardware?.gpus, native?.hardware?.engine_vendor);
const pcGpus = (native?.hardware?.gpus ?? []).filter(g => g.usable !== false), pcGpu = [...pcGpus].sort((x, y) => y.vram_gb - x.vram_gb)[0] ?? null;
const pcRam = native?.hardware?.ram_gb || hardware?.memory.totalGb || null, pcVram = pcGpu?.vram_gb ?? 0;
// What the models that stay loaded (Run multiple models) already take: the fit figures are for what is left.
@@ -96,7 +97,7 @@ export function NativeModels({ onOtherModels, onReady, onImport, onConnectEngine
const lessKept = (words: string, cards: number[]) => { const gone = Math.round(keptRam + keptVramOn(cards)); return gone > 0 ? words.replace(/of the (\d+) GB available/, (_m, n) => `of the ${Math.max(0, Number(n) - gone)} GB available`) : words; };
const shownSize = useRef(selectedSize?.id);
useEffect(() => { if (shownSize.current !== selectedSize?.id) { shownSize.current = selectedSize?.id; setCardsKey(null); } }, [selectedSize?.id]);
- const values = useMemo(() => ({ family: selectedSize?.sourceFamily, model: selectedSize?.model, context, vision: selectedSize?.images ? vision : 'no', kv, low_ram: lowRam, resourceProfile, ...(expert && gpus.length ? { gpus: gpus.join(',') } : cardsGpus.length > 1 ? { gpus: cardsGpus.join(',') } : cardsGpus.length === 1 ? { gpu: cardsGpus[0] } : {}), loadAfter: true, multiple: expert && multiple }), [selectedSize?.sourceFamily, selectedSize?.model, context, vision, kv, lowRam, resourceProfile, gpus.join(','), cardsGpus.join(','), expert, multiple]);
+ const values = useMemo(() => ({ family: selectedSize?.sourceFamily, model: selectedSize?.model, context, vision: selectedSize?.images ? vision : 'no', kv, low_ram: lowRam, resourceProfile, ...(expert && gpus.length === 1 ? { gpu: gpus[0] } : expert && gpus.length ? { gpus: gpus.join(',') } : cardsGpus.length > 1 ? { gpus: cardsGpus.join(',') } : cardsGpus.length === 1 ? { gpu: cardsGpus[0] } : {}), loadAfter: true, multiple: expert && multiple }), [selectedSize?.sourceFamily, selectedSize?.model, context, vision, kv, lowRam, resourceProfile, gpus.join(','), cardsGpus.join(','), expert, multiple]);
const downloadValues = { ...values, vision: selectedSize?.images && vision !== 'no' ? 'yes' : 'no', loadVision: selectedSize?.images ? vision : 'no' };
useEffect(() => { if (!native?.catalog || family)
return; const current = native.instances.find(i => i.id === native.defaultId); const rec = native.catalog.recommendation ?? { family: null, model: null }; const loadedFamily = families.find(f => f.sizes.some(s => s.id === current?.model)); const have = new Set((native.installed?.models ?? []).filter(m => m.ready).map(m => m.model)); const installedFamily = families.find(f => f.sizes.some(s => have.has(s.id))); const f = loadedFamily ?? installedFamily ?? families.find(f => f.family === rec.family || f.sizes.some(s => s.sourceFamily === rec.family)) ?? families[0]; if (f) {
@@ -148,7 +149,7 @@ export function NativeModels({ onOtherModels, onReady, onImport, onConnectEngine
} }
async function load() { if (!selectedSize)
return; await perform(async () => { if (installed?.ready && context === installed.context && (!selectedSize?.images || vision === 'no' || installed.images && installed.images !== 'off') && (!installed.kv || kv === installed.kv || kv === tunedNow?.fields.kv) && (lowRam === (installed.lowRamMode ?? 'auto') || lowRam === tunedNow?.fields.lowRam)) {
- const result = await nativeAction<NativeJob>('operations', { kind: 'load', args: { model: selectedSize.id, resourceProfile, vision: selectedSize?.images ? vision : 'no', multiple: expert && multiple, ...(expert && gpus.length ? { gpus, layerSplit: split } : cardsGpus.length ? { gpus: cardsGpus } : {}), values: {} } });
+ const result = await nativeAction<NativeJob>('operations', { kind: 'load', args: { model: selectedSize.id, resourceProfile, vision: selectedSize?.images ? vision : 'no', multiple: expert && multiple, ...(expert && gpus.length ? { gpus, layerSplit: split } : cardsGpus.length ? { gpus: cardsGpus, gpusFromRecommendation: !cardsKey } : {}), values: {} } });
setJobId(result.id);
}
else
@@ -190,7 +191,7 @@ export function NativeModels({ onOtherModels, onReady, onImport, onConnectEngine
<div className="native-model-actions">{tr(loadedSelected ? <><Btn disabled={pending || !!active} onClick={() => void perform(() => nativeAction(`instances/${loadedSelected.id}/unload`))}>{tr("Unload")}</Btn>{tr(onReady ? <Btn variant="primary" onClick={onReady}>{tr("Start chatting")}</Btn> : <span className="native-ready">{tr("Ready")}</span>)}</> : onReady && native?.instances.some(i => i.status === 'ready') ? <Btn variant="primary" onClick={onReady}>{tr("Start chatting")}</Btn> : <><Btn icon="gauge" disabled={!installed?.ready || !native?.available || !!active || !selectedSize || selectedSize.needsNewerEngine} onClick={() => setTuneOpen(true)}>{tr("Tune model")}</Btn><Btn variant="primary" icon="models" disabled={pending || !native?.available || !!active || !selectedSize || !!selectedSize.needsNewerEngine || expert && deviceChoice === 'split' && gpus.length < 2} onClick={() => void load()}>{tr(pending ? 'Checking…' : installed?.ready ? 'Load model' : 'Download & load')}</Btn></>)}</div>
</section>
{tr(expert && IMAGE_GENERATION_VISIBLE ? <><details className="native-generation"><summary>{tr("Image generation ")}<span className="muted">{tr("Optional")}</span></summary><RunImageModel library={imageLibrary} disabled={pending || !!active} onChange={() => { }}/></details></> : null)}
- {tr(expert ? <section id="native-expert-settings" ref={expertSection} className="st-card native-execution"><h2 className="h4">{tr("Expert settings")}</h2>{tr(tunedNow ? <p className="small muted native-tuned-note">{tr("Showing the values of your tuning '{0}'.", [tunedNow.name])}</p> : null)}<label className="native-toggle"><span><strong>{tr("Run multiple models")}</strong><small>{tr("Loading another model keeps the others loaded.")}</small></span><button className="st-toggle" role="switch" aria-label={tr("Run multiple models")} aria-checked={multiple} onClick={() => setMultiple(v => !v)}/></label><h3 className="small strong">{tr("Run on")}</h3><p className="small muted">{tr("Automatic uses the installation\u2019s GPU placement. Choose a GPU, or split this model across several GPUs.")}</p><Select ariaLabel={tr("Run on")} value={deviceChoice} options={[{ value: 'auto', label: 'Automatic' }, ...(native?.hardware?.gpus ?? []).map(g => ({ value: String(g.index), label: `GPU ${g.index + 1} · ${g.name}` })), ...((native?.hardware?.gpus.length ?? 0) > 1 ? [{ value: 'split', label: 'Split across GPUs…' }] : [])]} onChange={value => { setDeviceChoice(value); setGpus(value === 'auto' ? [] : value === 'split' ? (native?.hardware?.gpus ?? []).map(g => g.index) : [Number(value)]); }}/>{tr(deviceChoice === 'split' ? <div className="native-gpu-options">{tr(native?.hardware?.gpus.map(g => <label key={g.index}><input type="checkbox" checked={gpus.includes(g.index)} onChange={e => setGpus(old => e.target.checked ? [...old, g.index] : old.filter(i => i !== g.index))}/><span>{tr("GPU ")}{tr(g.index + 1)} · {tr(g.name)}<small>{tr(g.vram_gb)}{tr(" GB VRAM")}</small></span></label>))}</div> : null)}{tr(gpus.length > 1 ? <label className="input-field"><span>{tr("Layer split")}</span><input className="st-input" value={split} placeholder={tr("auto or 16,32")} onChange={e => setSplit(e.target.value)}/></label> : null)}<div className="native-field-grid"><label className="input-field"><span>{tr("Context memory")}</span><Select ariaLabel={tr("Native KV format")} value={kv} options={[{ value: 'int8', label: 'INT8' }, { value: 'q4_0', label: 'Q4' }, { value: 'k8v4', label: 'K8 / V4' }]} onChange={setKv}/></label><label className="input-field"><span>{tr("Low-RAM mode")}</span><Select ariaLabel={tr("Native low RAM mode")} value={lowRam} options={['auto', 'resident', 'mmap'].map(v => ({ value: v, label: v === 'auto' ? 'Automatic' : v === 'resident' ? 'Keep experts in RAM' : 'Read experts from disk' }))} onChange={setLowRam}/></label></div>{tr(installed ? <><NativeSettingsFile model={installed.model}/><NativeSettings model={installed.model}/></> : <p className="small muted">{tr("More engine parameters become available after preparing this version.")}</p>)}</section> : null)}
+ {tr(expert ? <section id="native-expert-settings" ref={expertSection} className="st-card native-execution"><h2 className="h4">{tr("Expert settings")}</h2>{tr(tunedNow ? <p className="small muted native-tuned-note">{tr("Showing the values of your tuning '{0}'.", [tunedNow.name])}</p> : null)}<label className="native-toggle"><span><strong>{tr("Run multiple models")}</strong><small>{tr("Loading another model keeps the others loaded.")}</small></span><button className="st-toggle" role="switch" aria-label={tr("Run multiple models")} aria-checked={multiple} onClick={() => setMultiple(v => !v)}/></label><h3 className="small strong">{tr("Run on")}</h3><p className="small muted">{tr("Automatic uses the installation\u2019s GPU placement. Choose a GPU, or split this model across several GPUs.")}</p><Select ariaLabel={tr("Run on")} value={deviceChoice} options={[{ value: 'auto', label: 'Automatic' }, ...runGpus.map(g => ({ value: String(g.index), label: `GPU ${g.index + 1} · ${g.name}` })), ...(runGpus.length > 1 ? [{ value: 'split', label: 'Split across GPUs…' }] : [])]} onChange={value => { setDeviceChoice(value); setGpus(value === 'auto' ? [] : value === 'split' ? runGpus.map(g => g.index) : [Number(value)]); }}/>{tr(deviceChoice === 'split' ? <div className="native-gpu-options">{tr(runGpus.map(g => <label key={g.index}><input type="checkbox" checked={gpus.includes(g.index)} onChange={e => setGpus(old => e.target.checked ? [...old, g.index] : old.filter(i => i !== g.index))}/><span>{tr("GPU ")}{tr(g.index + 1)} · {tr(g.name)}<small>{tr(g.vram_gb)}{tr(" GB VRAM")}</small></span></label>))}</div> : null)}{tr(gpus.length > 1 ? <label className="input-field"><span>{tr("Layer split")}</span><input className="st-input" value={split} placeholder={tr("auto or 16,32")} onChange={e => setSplit(e.target.value)}/></label> : null)}<div className="native-field-grid"><label className="input-field"><span>{tr("Context memory")}</span><Select ariaLabel={tr("Native KV format")} value={kv} options={[{ value: 'int8', label: 'INT8' }, { value: 'q4_0', label: 'Q4' }, { value: 'k8v4', label: 'K8 / V4' }]} onChange={setKv}/></label><label className="input-field"><span>{tr("Low-RAM mode")}</span><Select ariaLabel={tr("Native low RAM mode")} value={lowRam} options={['auto', 'resident', 'mmap'].map(v => ({ value: v, label: v === 'auto' ? 'Automatic' : v === 'resident' ? 'Keep experts in RAM' : 'Read experts from disk' }))} onChange={setLowRam}/></label></div>{tr(installed ? <><NativeSettingsFile model={installed.model}/><NativeSettings model={installed.model}/></> : <p className="small muted">{tr("More engine parameters become available after preparing this version.")}</p>)}</section> : null)}
</div>
<aside className="stack stack--lg"><PcFitCard gpuName={pcGpu?.name} ramGb={pcRam} vramGb={pcVram} inUse={keptModels.length ? { ramGb: Math.round(keptRam), vramGb: Math.round(keptVramOn(chosenCards)) } : null} fit={selectedSize ? fitOn(selectedSize, fitHardware) : null}/><section className="st-card"><h2 className="h4">{tr("Model files")}</h2><p className="small muted">{tr("Strata prepares all shards, the draft layer and shared files. Completed downloads are reused.")}</p><code className="native-path">{installed?.dataFolder ?? native?.downloadDirectory ?? native?.installed?.data_folder ?? 'Choose an installation'}</code><Btn size="sm" variant="ghost" onClick={() => { setSettingsSection('Storage'); go('settings'); }}>{tr("Storage settings")}</Btn></section><Btn size="sm" variant="ghost" onClick={onOtherModels}>{tr("Other local models\u2026")}</Btn></aside>
</div>
diff --git a/apps/host/src/lib/native-fit.ts b/apps/host/src/lib/native-fit.ts
index 39cfc4e24..23dad9e6d 100644
--- a/apps/host/src/lib/native-fit.ts
+++ b/apps/host/src/lib/native-fit.ts
@@ -89,3 +89,18 @@ export function recommendedVersions<V extends { sourceFamily: string; model: str
if (gyroM) out.push({ r: { family: 'gyro', model: 'Gyro-M', note: OTHER_NOTE }, v: gyroM });
return [...out, ...rest.filter(x => x.v !== gyroM)];
}
+
+/** A card as the installer's hardware report lists it. */
+export interface RunCard { index: number; name: string; vram_gb: number; usable?: boolean; vendor?: string; uma?: boolean; integrated?: boolean; unified_gb?: number }
+
+/**
+ * The cards a model can be placed on: the ones this engine can drive (strata_control/gpu_fit.py `usable_cards` and `for_vendor`, same rule).
+ * A card the engine has no code for, a card of the other make (an engine drives one make; the report numbers each make from 0, so
+ * two cards could share a number) and a chip that shares the system memory while the computer has a card of its own are left out.
+ */
+export function runCards<T extends RunCard>(gpus: T[] | null | undefined, engineVendor?: string | null): T[] {
+ const sharesMemory = (g: RunCard) => !!(g.integrated || g.uma || g.unified_gb);
+ const mine = (gpus ?? []).filter(g => g.usable !== false && (!engineVendor || !g.vendor || g.vendor === engineVendor));
+ const hasReal = mine.some(g => !sharesMemory(g) && g.vram_gb >= 4);
+ return mine.filter(g => !(hasReal && sharesMemory(g)));
+}
diff --git a/apps/host/src/lib/native.ts b/apps/host/src/lib/native.ts
index 1202a868b..0fb14b67a 100644
--- a/apps/host/src/lib/native.ts
+++ b/apps/host/src/lib/native.ts
@@ -12,7 +12,7 @@ export interface NativeState {
/** The picture reader (strata-vision) is installed with the engine, so models marked for pictures can read them here. */
/** Strata Control's view of the engine for this computer (the app): usable false = none found or recognised; `notice` says why in plain words. */
engine?:{usable:boolean;notice?:string|null;wrongMake?:boolean;version?:string|null};
- visionReader?: boolean;available:boolean;repo:string;downloadDirectory?:string;version?:string|null;summary:string;error:string|null;catalog:{families:NativeFamily[];contexts:number[];recommendation:{family:string|null;model:string|null;context?:number;why?:string};context_note:string}|null;installed:{models:{model:string;config:string;model_name:string;ready:boolean;/** The picture-reading files are on this computer (notes-split-agent8.md, item 8). */visionPrepared?:boolean;context?:number;kv?:string;images?:string;visionEnabled?:boolean;visionDevice?:string;lowRamMode?:string;resourceProfile?:'work'|'performance';dataFolder?:string;diskGb?:number;diskBytes?:number;/** Files this model shares with another (the picture reader, the draft layer): counted once, in `usage`. */sharedBytes?:number;/** What Delete frees: files in Strata's own folders that no other model uses. */removableGb?:number;missing_files?:string[]}[];/** What all models take on disk, from their real files, shared files counted once. */usage?:{total_bytes:number;total_gb:number;shared_bytes:number;shared_gb:number;models:Record<string,{bytes:number;gb:number}>}|null;data_folder:string;engine:{version:string|null}}|null;hardware:{ram_gb:number;gpus:{index:number;name:string;vram_gb:number;usable:boolean}[]}|null;fields:NativeField[];instances:NativeInstance[];defaultId:string|null;jobs:NativeJob[];capabilities:{responses?:boolean;updates:boolean;rollback:boolean;calibration:boolean;componentUpdates?:boolean}}
+ visionReader?: boolean;available:boolean;repo:string;downloadDirectory?:string;version?:string|null;summary:string;error:string|null;catalog:{families:NativeFamily[];contexts:number[];recommendation:{family:string|null;model:string|null;context?:number;why?:string};context_note:string}|null;installed:{models:{model:string;config:string;model_name:string;ready:boolean;/** The picture-reading files are on this computer (notes-split-agent8.md, item 8). */visionPrepared?:boolean;context?:number;kv?:string;images?:string;visionEnabled?:boolean;visionDevice?:string;lowRamMode?:string;resourceProfile?:'work'|'performance';dataFolder?:string;diskGb?:number;diskBytes?:number;/** Files this model shares with another (the picture reader, the draft layer): counted once, in `usage`. */sharedBytes?:number;/** What Delete frees: files in Strata's own folders that no other model uses. */removableGb?:number;missing_files?:string[]}[];/** What all models take on disk, from their real files, shared files counted once. */usage?:{total_bytes:number;total_gb:number;shared_bytes:number;shared_gb:number;models:Record<string,{bytes:number;gb:number}>}|null;data_folder:string;engine:{version:string|null}}|null;hardware:{ram_gb:number;engine_vendor?:string;gpus:{index:number;name:string;vram_gb:number;usable:boolean;vendor?:string;uma?:boolean;integrated?:boolean;unified_gb?:number;problem?:string|null}[]}|null;fields:NativeField[];instances:NativeInstance[];defaultId:string|null;jobs:NativeJob[];capabilities:{responses?:boolean;updates:boolean;rollback:boolean;calibration:boolean;componentUpdates?:boolean}}
let state:NativeState|null=null;
const listeners=new Set<()=>void>();
function put(value:NativeState){if(state&&JSON.stringify(state)===JSON.stringify(value))return;state=value;listeners.forEach(fn=>fn());}
@@ -64,7 +64,7 @@ export const nativeState=()=>state;
/** Connection-list projection only; memory reservations are not inferred. */
export function nativeRouting(native:NativeState|null,hardware:Hardware|null):RuntimeModels|null{
if(!native?.instances.length)return null;
- return {revision:Date.now(),mode:'real',capabilities:{multipleModels:true,deviceAssignment:true},defaultId:native.defaultId,instances:native.instances.filter(i=>i.status==='ready').map(i=>({id:i.id,apiModelId:i.apiModelId,variantId:i.model,family:i.label,name:i.model,quant:i.model,loadedAt:i.loadedAt,status:'ready',phase:i.phase as RuntimeModels['instances'][number]['phase'],active:i.metrics?.live?.running??0,queued:i.metrics?.live?.queued??0,prompt:{done:0,total:0,pct:0},outputTps:i.metrics?.live?.tok_s??0,promptTps:i.metrics?.live?.prefill_tok_s_mean??0,context:{usedTokens:0,maxTokens:i.metrics?.engine?.max_context??i.context??0,pct:0},gpuIds:i.gpus.map(index=>{const g=hardware?.gpus.find(g=>g.index===index);return g?.id??`${g?.vendor??'native'}:${index}`;}),memory:{context:i.metrics?.engine?.max_context??i.context??0,ramGb:0,gpuGb:0,spillGb:0,reserveGb:0,totalGb:0,devices:[]}})),memory:{ramGb:0,budgetGb:0,reserveGb:0,totalGb:0,fits:true,devices:[]}};
+ return {revision:Date.now(),mode:'real',capabilities:{multipleModels:true,deviceAssignment:true},defaultId:native.defaultId,instances:native.instances.filter(i=>i.status==='ready').map(i=>({id:i.id,apiModelId:i.apiModelId,variantId:i.model,family:i.label,name:i.model,quant:i.model,loadedAt:i.loadedAt,status:'ready',phase:i.phase as RuntimeModels['instances'][number]['phase'],active:i.metrics?.live?.running??0,queued:i.metrics?.live?.queued??0,prompt:{done:0,total:0,pct:0},outputTps:i.metrics?.live?.tok_s??0,promptTps:i.metrics?.live?.prefill_tok_s_mean??0,context:{usedTokens:0,maxTokens:i.metrics?.engine?.max_context??i.context??0,pct:0},gpuIds:/* Automatic placement names no card in the config: the cards the engine reports (or the only card) are the ones it runs on. */(i.gpus.length?i.gpus:(i.metrics?.hardware?.gpus??[]).map((g:{index:number})=>g.index).filter((n:unknown)=>typeof n==='number')).map((index:number)=>{const g=hardware?.gpus.find(g=>g.index===index);return g?.id??`${g?.vendor??'native'}:${index}`;}),memory:{context:i.metrics?.engine?.max_context??i.context??0,ramGb:0,gpuGb:0,spillGb:0,reserveGb:0,totalGb:0,devices:[]}})),memory:{ramGb:0,budgetGb:0,reserveGb:0,totalGb:0,fits:true,devices:[]}};
}
export async function nativeAction<T=unknown>(path:string,body:unknown={}){const result=await api.post<T>(`/api/native/${path}`,body);
// A started operation is a job: show it at once instead of waiting for the next read (the owner saw download progress only after switching tabs).
diff --git a/apps/host/src/lib/plain-errors.ts b/apps/host/src/lib/plain-errors.ts
index 8ca6def74..538b305f6 100644
--- a/apps/host/src/lib/plain-errors.ts
+++ b/apps/host/src/lib/plain-errors.ts
@@ -17,6 +17,7 @@ const MEMORY_NEXT = 'Close other programs and try again, or choose “Leave 20%
const RULES: Rule[] = [
{ kind: 'tunnel-own-running', match: /Strata’s tunnel for this address is already running \(PID/i, message: 'Strata’s tunnel for this address is already running.', next: 'Stop it first, or use it as it is, then connect again here.' },
{ kind: 'gpu-shared', match: /GPU \d+ is already used by .*, so this model did not fit there/i, message: 'Another model on the same graphics card left no room for this one.', next: 'Load it on a different GPU, or unload the other model first.' },
+ { kind: 'gpu-no-code', match: /none of this computer.s graphics cards has code in this Strata engine|not an architecture this Strata engine was compiled for/i, message: 'This Strata engine has no code for the graphics card it tried to use.', next: 'Pick another card under Run on, or open Details to see which cards were found and what the engine is built for.' },
{ kind: 'engine-too-old', match: /needs a newer engine: .* needs engine/i, message: 'This model needs a newer engine.', next: 'Update the engine (Settings, Engine, Update engine), then try again.' },
{ kind: 'settings-file', match: /settings file for this model has a mistake/i, message: 'Your settings file has a mistake, so the model was not started.', next: 'Open the settings file under Expert settings, fix the line shown under Details, then load the model again.' },
{ kind: 'connector-missing', match: /connector \(cloudflared\) is not installed/i, message: 'Strata could not find Cloudflare’s connector (cloudflared) on this computer.', next: 'Install cloudflared (with your package manager, or from Cloudflare’s website), then press Retry setup. Strata finds it on your PATH and in the usual places.' },
diff --git a/apps/host/src/locales/de.json b/apps/host/src/locales/de.json
index e24fe16f9..d31b41a3b 100644
--- a/apps/host/src/locales/de.json
+++ b/apps/host/src/locales/de.json
@@ -3343,5 +3343,7 @@
"s8254": "Das hat nicht geklappt",
"s8255": "Keine passenden Karten.",
"s8256": "Im Moment nichts hier.",
- "s8257": "alle {0} Min."
+ "s8257": "alle {0} Min.",
+ "s8258": "Diese Strata-Engine hat keinen Code für die Grafikkarte, die sie verwenden wollte.",
+ "s8259": "Wähle unter „Ausführen auf“ eine andere Karte, oder öffne die Details: Dort steht, welche Karten gefunden wurden und wofür die Engine gebaut ist."
}
diff --git a/apps/host/src/locales/en.json b/apps/host/src/locales/en.json
index 44dc7202b..553903f98 100644
--- a/apps/host/src/locales/en.json
+++ b/apps/host/src/locales/en.json
@@ -3343,5 +3343,7 @@
"s8254": "That did not work",
"s8255": "No matching cards.",
"s8256": "Nothing here right now.",
- "s8257": "every {0} min"
+ "s8257": "every {0} min",
+ "s8258": "This Strata engine has no code for the graphics card it tried to use.",
+ "s8259": "Pick another card under Run on, or open Details to see which cards were found and what the engine is built for."
}
diff --git a/apps/host/src/locales/es.json b/apps/host/src/locales/es.json
index a61b6d859..265a0ffb4 100644
--- a/apps/host/src/locales/es.json
+++ b/apps/host/src/locales/es.json
@@ -3343,5 +3343,7 @@
"s8254": "Eso no funcionó",
"s8255": "No hay tarjetas que coincidan.",
"s8256": "Nada por aquí ahora mismo.",
- "s8257": "cada {0} min"
+ "s8257": "cada {0} min",
+ "s8258": "Este motor de Strata no tiene código para la tarjeta gráfica que intentó usar.",
+ "s8259": "Elige otra tarjeta en «Ejecutar en», o abre los detalles para ver qué tarjetas se encontraron y para cuáles está compilado el motor."
}
diff --git a/apps/host/src/locales/ja.json b/apps/host/src/locales/ja.json
index 2ea9e8cb5..33f2bdade 100644
--- a/apps/host/src/locales/ja.json
+++ b/apps/host/src/locales/ja.json
@@ -3343,5 +3343,7 @@
"s8254": "うまくいきませんでした",
"s8255": "一致するカードはありません。",
"s8256": "今は何もありません。",
- "s8257": "{0}分ごと"
+ "s8257": "{0}分ごと",
+ "s8258": "この Strata エンジンには、使おうとしたグラフィックスカード用のコードが含まれていません。",
+ "s8259": "「実行先」で別のカードを選ぶか、「詳細」を開いて、見つかったカードとエンジンの対応状況を確認してください。"
}
diff --git a/apps/host/src/locales/ko.json b/apps/host/src/locales/ko.json
index 5acfc7034..a012405ee 100644
--- a/apps/host/src/locales/ko.json
+++ b/apps/host/src/locales/ko.json
@@ -3343,5 +3343,7 @@
"s8254": "실패했습니다",
"s8255": "일치하는 카드가 없습니다.",
"s8256": "지금은 아무것도 없습니다.",
- "s8257": "{0}분마다"
+ "s8257": "{0}분마다",
+ "s8258": "이 Strata 엔진에는 사용하려던 그래픽 카드용 코드가 없습니다.",
+ "s8259": "“실행 장치”에서 다른 카드를 고르거나, “세부 정보”에서 찾은 카드와 엔진이 지원하는 카드를 확인하세요."
}
diff --git a/apps/host/src/locales/pt.json b/apps/host/src/locales/pt.json
index 06614f99e..f87837051 100644
--- a/apps/host/src/locales/pt.json
+++ b/apps/host/src/locales/pt.json
@@ -3343,5 +3343,7 @@
"s8254": "Isso não funcionou",
"s8255": "Nenhum cartão correspondente.",
"s8256": "Nada aqui por enquanto.",
- "s8257": "a cada {0} min"
+ "s8257": "a cada {0} min",
+ "s8258": "Este motor do Strata não tem código para a placa de vídeo que tentou usar.",
+ "s8259": "Escolha outra placa em «Executar em» ou abra os detalhes para ver quais placas foram encontradas e para quais o motor foi compilado."
}
diff --git a/apps/host/src/locales/ru.json b/apps/host/src/locales/ru.json
index 51bae0e13..45306e720 100644
--- a/apps/host/src/locales/ru.json
+++ b/apps/host/src/locales/ru.json
@@ -3343,5 +3343,7 @@
"s8254": "Не получилось",
"s8255": "Нет подходящих карточек.",
"s8256": "Сейчас здесь пусто.",
- "s8257": "каждые {0} мин"
+ "s8257": "каждые {0} мин",
+ "s8258": "В этом движке Strata нет кода для видеокарты, которую он попытался использовать.",
+ "s8259": "Выберите другую карту в разделе «Запускать на» или откройте «Подробности»: там указано, какие карты найдены и для каких собран движок."
}
diff --git a/apps/host/src/locales/zh.json b/apps/host/src/locales/zh.json
index e0cf24ecb..30c1f52fb 100644
--- a/apps/host/src/locales/zh.json
+++ b/apps/host/src/locales/zh.json
@@ -3343,5 +3343,7 @@
"s8254": "操作没有成功",
"s8255": "没有匹配的卡片。",
"s8256": "目前这里没有内容。",
- "s8257": "每 {0} 分钟"
+ "s8257": "每 {0} 分钟",
+ "s8258": "此 Strata 引擎没有适用于它尝试使用的显卡的代码。",
+ "s8259": "请在“运行于”中选择另一块显卡,或打开详情,查看找到了哪些显卡以及引擎支持哪些显卡。"
}
diff --git a/apps/host/src/screens/Monitor.tsx b/apps/host/src/screens/Monitor.tsx
index 371c4dfff..2496caf6b 100644
--- a/apps/host/src/screens/Monitor.tsx
+++ b/apps/host/src/screens/Monitor.tsx
@@ -14,6 +14,7 @@ import { Screen } from '../components/layout';
import { contextLabel, duration, tokens, tps } from '../lib/format';
import { gpuCapacity, gpuId, gpuMetric, hasReading } from '../lib/monitor-hardware';
import { useStore } from '../lib/store';
+import { useKept } from '../lib/kept-state';
import type { Hardware, MonitorState, ServeRequest } from '../lib/types';
import { useNative, nativeRouting, type NativeState } from '../lib/native';
import { nativeMonitorData, withHostSensors } from '../lib/native-monitor';
@@ -72,7 +73,8 @@ function LegacyMonitorScreen({ native }: {
const selection = selectedInstance?.id ?? 'all';
const scoped = native ? live : scopedMonitor(live, runtime ?? null, selection, serving?.requests ?? []);
const scopeLabel = selectedInstance ? instanceLabel(selectedInstance) : `${runtime?.instances.length ?? 0} loaded models`;
- const [gpuSelection, setGpuSelection] = useState('all'), [cpuSelection, setCpuSelection] = useState('all'), [showAll, setShowAll] = useState(false);
+ // null = the person has not chosen: a model with assigned cards shows those (#3211); a choice is kept while the app stays open.
+ const [gpuSelection, setGpuSelection] = useKept<string | null>('monitor.gpu', null), [cpuSelection, setCpuSelection] = useState('all'), [showAll, setShowAll] = useState(false);
const [frozen, setFrozen] = useState<{
data: MonitorState;
hardware: Hardware | null;
@@ -106,7 +108,8 @@ function LegacyMonitorScreen({ native }: {
return <Screen title={tr("Monitor")}><p className="muted">{tr("Waiting for engine telemetry\u2026")}</p></Screen>;
// A display adapter that has no sensors and no memory of its own (an integrated one) cannot be measured; counting it would blank every total.
const devices = (hardware?.gpus ?? []).filter(g => g.backend !== 'vulkan' || g.vramGb > 0), processors = hardware?.processors?.length ? hardware.processors : hardware ? [{ ...hardware.cpu, id: 'cpu', socket: '' }] : [];
- const gpuChoice = gpuSelection === 'assigned' && selectedInstance ? 'assigned' : devices.some(g => gpuId(g) === gpuSelection) ? gpuSelection : 'all';
+ const assignedDevices = selectedInstance ? devices.filter(g => selectedInstance.gpuIds.includes(gpuId(g))) : [];
+ const gpuChoice = gpuSelection === 'assigned' && selectedInstance ? 'assigned' : devices.some(g => gpuId(g) === gpuSelection) ? gpuSelection! : gpuSelection === 'all' || !assignedDevices.length ? 'all' : 'assigned';
const cpuChoice = processors.some(p => p.id === cpuSelection) ? cpuSelection : 'all';
const selectedGpus = gpuChoice === 'assigned' ? devices.filter(g => selectedInstance?.gpuIds.includes(gpuId(g))) : gpuChoice === 'all' ? devices : devices.filter(g => gpuId(g) === gpuChoice);
const selectedCpus = cpuChoice === 'all' ? processors : processors.filter(p => p.id === cpuChoice);
@@ -149,13 +152,13 @@ function LegacyMonitorScreen({ native }: {
const promptSpeed = data.totals.promptMs ? data.totals.uncachedTokens / (data.totals.promptMs / 1000) : null;
const outputSpeed = data.totals.decodeMs ? data.totals.tokensOut / (data.totals.decodeMs / 1000) : null;
const multipleScope = selection === 'all' && (runtime?.instances.length ?? 0) > 1;
- const chooseInstance = (id: string) => { setInstanceSelection(id); setGpuSelection(id !== 'all' && (runtime?.instances.find(instance => instance.id === id)?.gpuIds.length ?? 0) > 0 ? 'assigned' : 'all'); };
+ const chooseInstance = (id: string) => { setInstanceSelection(id); setGpuSelection(null); };
const overview = <div className="stack stack--lg monitor-capture monitor-dashboard" ref={snapshotRef}>
{tr(frozen ? <header className="section-toolbar"><div><div className="snapshot__brand-title"><Brand variant="lockup" height={24} decorative/></div><p className="small muted">{tr(frozen.modelLabel)} · {tr(frozen.time)}</p></div></header> : null)}
{tr(multipleModels ? <section className="st-card"><h2 className="h4">{tr("Model performance")}</h2><div className="st-tablewrap"><table className="st-table native-performance-table"><thead><tr><th>{tr("Model / device")}</th><th>{tr("Generating tok/s")}</th><th>{tr("Reading tok/s")}</th><th>{tr("State")}</th><th>{tr("Active / queued")}</th></tr></thead><tbody>{tr(runtime?.instances.map(i => { const recent = (data.requests ?? []).find(r => r.instanceId === i.id); const writing = i.phase === 'generating' || i.phase === 'thinking', reading = i.phase === 'reading'; return <tr key={i.id}><td><button className="text-btn strong" onClick={() => chooseInstance(i.id)}>{tr(instanceLabel(i))}</button><small>{tr(deviceLabel(i.gpuIds, inventory))}</small></td><td>{tr(number(writing ? i.outputTps : recent?.tps, 1))}<small>{tr(writing ? 'Now' : recent ? 'Last request' : 'No request yet')}</small></td><td>{tr(number(reading ? i.promptTps : recent?.promptTps, 0))}<small>{tr(reading ? 'Now' : recent ? 'Last request' : 'No request yet')}</small></td><td>{tr(i.phase)}{tr(runtime.mode === 'simulated' ? <small>{tr("Illustrative")}</small> : null)}</td><td>{tr(number(i.active))} / {tr(number(i.queued))}</td></tr>; }))}</tbody></table></div></section> : null)}
{tr(multipleModels ? <p className="xs muted monitor-scope-note">{tr(selectedInstance ? selectedInstance.gpuIds.length ? 'Requests, context and speed are scoped to this model. GPU readings include all work on the selected devices.' : 'CPU-only model. Requests and context are scoped to this model; system metrics are shared host measurements.' : 'Select a model for its context and speed. GPU readings and system RAM are shared host measurements.')}</p> : null)}
<section className="st-card monitor-state" aria-label={tr("Model state")} data-snapshot-skip>
- <div className="monitor-state__head"><h2 className="h4">{tr(multipleScope ? 'Model activity' : 'Model state')}</h2><div className="monitor-state__badges">{tr([{ id: 'idle', label: 'Idle' }, { id: 'reading', label: 'Reading' }, { id: 'generating', label: 'Generating' }, { id: 'queued', label: 'Queued' }, { id: 'error', label: 'Error' }].map(s => <span key={s.id} className="st-badge" data-phase={s.id} data-active={phase === s.id || s.id === 'queued' && data.queue.waiting > 0}>{tr(s.label)}{tr(s.id === 'queued' && data.queue.waiting > 0 ? ` (${data.queue.waiting})` : '')}</span>))}</div><div className="monitor-device-selectors">{tr(devices.length > 1 ? <Select ariaLabel={tr("Monitor GPU")} value={gpuChoice} options={[...(selectedInstance ? [{ value: 'assigned', label: 'Assigned GPUs' }] : []), { value: 'all', label: `All GPUs (${devices.length})` }, ...devices.map((gpu, i) => ({ value: gpuId(gpu), label: `GPU ${i + 1} · ${gpu.name}` }))]} onChange={setGpuSelection}/> : null)}{tr(processors.length > 1 ? <Select ariaLabel={tr("Monitor processor")} value={cpuChoice} options={[{ value: 'all', label: `All processors (${processors.length})` }, ...processors.map((p, i) => ({ value: p.id, label: `CPU ${i + 1} · ${p.model}` }))]} onChange={setCpuSelection}/> : null)}</div></div>
+ <div className="monitor-state__head"><h2 className="h4">{tr(multipleScope ? 'Model activity' : 'Model state')}</h2><div className="monitor-state__badges">{tr([{ id: 'idle', label: 'Idle' }, { id: 'reading', label: 'Reading' }, { id: 'generating', label: 'Generating' }, { id: 'queued', label: 'Queued' }, { id: 'error', label: 'Error' }].map(s => <span key={s.id} className="st-badge" data-phase={s.id} data-active={phase === s.id || s.id === 'queued' && data.queue.waiting > 0}>{tr(s.label)}{tr(s.id === 'queued' && data.queue.waiting > 0 ? ` (${data.queue.waiting})` : '')}</span>))}</div><div className="monitor-device-selectors">{tr(devices.length > 1 ? <Select ariaLabel={tr("Monitor GPU")} value={gpuChoice} options={[...(selectedInstance ? [{ value: 'assigned', label: 'Assigned GPUs' }] : []), { value: 'all', label: `All GPUs (${devices.length})` }, ...devices.map((gpu, i) => ({ value: gpuId(gpu), label: `GPU ${i + 1} · ${gpu.name}` }))]} menuMinWidth={340} onChange={setGpuSelection}/> : null)}{tr(processors.length > 1 ? <Select ariaLabel={tr("Monitor processor")} value={cpuChoice} options={[{ value: 'all', label: `All processors (${processors.length})` }, ...processors.map((p, i) => ({ value: p.id, label: `CPU ${i + 1} · ${p.model}` }))]} onChange={setCpuSelection}/> : null)}</div></div>
<div className="monitor-state__reading small"><span>{tr(multipleScope ? `${number(data.queue.running)} active · ${number(data.queue.waiting)} queued` : data.phase === 'idle' ? 'Waiting for a request' : data.phaseLabel)}</span><span className="muted num">{tr(statusDetail)}</span></div>
{tr(!multipleScope ? <Bar label={tr("Model progress")} value={progress ?? 0} indeterminate={writing && !hasReading(progress)} tone={data.phase === 'reading' ? 'info' : 'accent'}/> : null)}
</section>
diff --git a/apps/host/src/styles/annotation-fixes.css b/apps/host/src/styles/annotation-fixes.css
index 020e6280b..5eecaf9db 100644
--- a/apps/host/src/styles/annotation-fixes.css
+++ b/apps/host/src/styles/annotation-fixes.css
@@ -486,7 +486,9 @@ html[data-motion='reduced'] .task-tree-row[data-leaving] { opacity: 0; }
.provider-options[open] > .provider-fields { margin-top: 16px; }
/* Keep each downloaded model name on one line, with a wider desktop popup. */
-.select__option-label { min-width: 0; flex: 1; }
+.select__option-label { min-width: 0; flex: 1; overflow-wrap: anywhere; }
+/* A long name (a graphics card as the system reports it) wraps inside its own row instead of running over the next one (#3221). */
+.select__opt { height: auto; min-height: 36px; padding-top: 6px; padding-bottom: 6px; line-height: 1.35; }
.select__pop--single-line .select__option-label { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.select__pop--single-line .select__tick { flex: none; }
.settings-versions { padding: 4px 20px 0; }
diff --git a/apps/host/tests/native-gpu-choice.test.mjs b/apps/host/tests/native-gpu-choice.test.mjs
new file mode 100644
index 000000000..b209cdcb0
--- /dev/null
+++ b/apps/host/tests/native-gpu-choice.test.mjs
@@ -0,0 +1,98 @@
+/** 0.2.1, group 2: choosing graphics cards (#3203 #3195 #3256 #3221 #3211). */
+import test from 'node:test';
+import assert from 'node:assert/strict';
+import { readFile } from 'node:fs/promises';
+import { fileURLToPath } from 'node:url';
+import { build, transform } from 'esbuild';
+import { nativeFixture, finishJob } from './helpers/native-fixture.mjs';
+
+const fit = await transform(await readFile(new URL('../src/lib/native-fit.ts', import.meta.url), 'utf8'), { loader: 'ts', format: 'esm' });
+const { runCards } = await import(`data:text/javascript;base64,${Buffer.from(fit.code).toString('base64')}`);
+const native = await build({ entryPoints: ['src/lib/native.ts'], bundle: true, platform: 'node', format: 'esm', write: false, alias: { react: fileURLToPath(new URL('./helpers/react-stub.mjs', import.meta.url)) }, logLevel: 'silent' });
+
+const card = (index, name, vram, extra = {}) => ({ index, name, vram_gb: vram, usable: true, ...extra });
+
+test('#3195: the cards to choose from are the ones the engine drives; the other make and the iGPU are not listed', () => {
+ // two RTX 3090 and an AMD chip that the report numbers 0 again (the same number as the first 3090)
+ const gpus = [card(0, 'NVIDIA GeForce RTX 3090', 24, { vendor: 'nvidia' }), card(1, 'NVIDIA GeForce RTX 3090', 24, { vendor: 'nvidia' }),
+ card(0, 'AMD Radeon (gfx1036)', 2, { vendor: 'amd', usable: false })];
+ const shown = runCards(gpus, 'nvidia');
+ assert.deepEqual(shown.map(g => g.index), [0, 1], 'no second card 0');
+ assert.equal(new Set(shown.map(g => g.index)).size, shown.length, 'every number once, so one tick never moves another');
+ // even when the chip is flagged usable, the engine's make decides
+ assert.deepEqual(runCards([...gpus.slice(0, 2), card(0, 'AMD Radeon 760M', 8, { vendor: 'amd' })], 'nvidia').map(g => g.name), ['NVIDIA GeForce RTX 3090', 'NVIDIA GeForce RTX 3090']);
+});
+
+test('#3195: a chip that shares the system memory is left out while a card of its own exists, and is the only choice when it is alone', () => {
+ const igpu = card(0, 'AMD Radeon 8060S', 64, { vendor: 'amd', uma: true });
+ const real = card(1, 'AMD Radeon RX 9070 XT', 16, { vendor: 'amd' });
+ assert.deepEqual(runCards([igpu, real], 'amd').map(g => g.index), [1]);
+ assert.deepEqual(runCards([igpu], 'amd').map(g => g.index), [0]);
+});
+
+test('#3203: a card the engine cannot use (usable false) is never offered', () => {
+ const gpus = [card(0, 'AMD Radeon 760M', 8, { vendor: 'amd', usable: false }), card(1, 'AMD Radeon RX 6800 XT', 16, { vendor: 'amd', usable: false })];
+ assert.deepEqual(runCards(gpus, 'amd'), []);
+ assert.deepEqual(runCards(null, 'amd'), []);
+});
+
+test('#3256: the model settings file keeps its GPU order when the app only suggests cards; a card picked in the screen wins', async () => {
+ const f = nativeFixture();
+ try {
+ await f.control.refresh(true);
+ const load = async args => { const done = await finishJob(f.control, f.control.operation('load', args).id); assert.equal(done.state, 'done', done.error); return f.control.resolveInstance(done.result.instanceId); };
+ // the fixture's file says "gpu": 0; the screen suggests card 1
+ const suggested = await load({ model: 'iq2_xs', gpus: [1], gpusFromRecommendation: true });
+ assert.deepEqual(suggested.gpus, [0], 'the file names its card, so the suggestion does not replace it');
+ await f.control.unload(suggested.id);
+ const picked = await load({ model: 'iq2_xs', gpus: [1] });
+ assert.deepEqual(picked.gpus, [1], 'a pick in the screen is the person\'s word');
+ } finally { await f.cleanup(); }
+});
+
+test('#3256: with no GPU in the file the suggested cards apply, in the order given', async () => {
+ const f = nativeFixture();
+ try {
+ await f.control.refresh(true);
+ const { readFileSync, writeFileSync } = await import('node:fs');
+ const { join } = await import('node:path');
+ const path = join(f.repo, 'strata-iq2_xs.json');
+ const config = JSON.parse(readFileSync(path, 'utf8')); delete config.gpu; writeFileSync(path, JSON.stringify(config));
+ await f.control.refresh(true);
+ const done = await finishJob(f.control, f.control.operation('load', { model: 'iq2_xs', gpus: [1, 0], gpusFromRecommendation: true }).id);
+ assert.equal(done.state, 'done', done.error);
+ assert.deepEqual(f.control.resolveInstance(done.result.instanceId).gpus, [1, 0]);
+ } finally { await f.cleanup(); }
+});
+
+test('#3203: one chosen card is sent to the installer as "gpu", never as "gpus" (it asks for two or more there)', async () => {
+ const f = nativeFixture();
+ try {
+ await f.control.refresh(true);
+ await f.control.plan({ family: 'qwen', model: 'IQ2_XS', context: 131072, gpus: '0' });
+ const call = f.rpcCalls.filter(c => c.name === 'strata_install').pop();
+ assert.equal(call.arguments.gpu, 0);
+ assert.equal('gpus' in call.arguments && call.arguments.gpus !== undefined, false);
+ await f.control.plan({ family: 'qwen', model: 'IQ2_XS', context: 131072, gpus: '0,1' });
+ const two = f.rpcCalls.filter(c => c.name === 'strata_install').pop();
+ assert.equal(two.arguments.gpus, '0,1');
+ } finally { await f.cleanup(); }
+});
+
+test('#3211: automatic placement names no card in the config; the cards the engine reports are the model\'s assigned cards', async () => {
+ const mod = await import(`data:text/javascript;base64,${Buffer.from(native.outputFiles[0].text).toString('base64')}`);
+ const hardware = { gpus: [{ id: 'nvidia:0', index: 0, vendor: 'nvidia' }, { id: 'nvidia:1', index: 1, vendor: 'nvidia' }] };
+ const instance = (gpus, reported) => ({ id: 'a', apiModelId: 'a', model: 'm', label: 'M', status: 'ready', loadedAt: 'x', phase: 'idle', gpus, metrics: reported ? { hardware: { gpus: reported } } : null });
+ const routed = (inst) => mod.nativeRouting({ instances: [inst], defaultId: 'a' }, hardware).instances[0].gpuIds;
+ assert.deepEqual(routed(instance([1], null)), ['nvidia:1'], 'a named card stays as it was');
+ assert.deepEqual(routed(instance([], [{ index: 0 }])), ['nvidia:0'], 'Automatic: the card the engine reports');
+ assert.deepEqual(routed(instance([], null)), [], 'nothing known: no assigned cards, so the Monitor shows all');
+});
+
+test('#3211 #3221: the Monitor opens on the model\'s assigned cards and the dropdown rows grow with their text', async () => {
+ const monitor = await readFile(new URL('../src/screens/Monitor.tsx', import.meta.url), 'utf8');
+ assert.match(monitor, /useKept<string \| null>\('monitor\.gpu', null\)/, 'unchosen until the person picks, and the pick is kept');
+ assert.match(monitor, /gpuSelection === 'all' \|\| !assignedDevices\.length \? 'all' : 'assigned'/, 'assigned by default when the model has cards');
+ const css = await readFile(new URL('../src/styles/annotation-fixes.css', import.meta.url), 'utf8');
+ assert.match(css, /\.select__opt \{ height: auto; min-height: 36px;/, 'a wrapped name no longer runs over the next row');
+});
diff --git a/apps/host/tests/plain-errors.test.mjs b/apps/host/tests/plain-errors.test.mjs
index 7802d347a..ab380f3c0 100644
--- a/apps/host/tests/plain-errors.test.mjs
+++ b/apps/host/tests/plain-errors.test.mjs
@@ -34,6 +34,8 @@ const cases = [
['component-missing', 'assistant-missing', /coding assistant/],
['Strata Control did not answer within 60 s (models list).', 'control', /couldn’t read its own components/],
['Prepare this model’s vision files before enabling picture reading.', 'picture-reading', /Picture reading isn’t available/],
+ ['server_exited (exit code 1): strata generate: GPU 0 (AMD Radeon 760M Graphics, gfx1103) is not an architecture this Strata engine was compiled for (gfx1200,gfx1201); compile it for this card', 'gpu-no-code', /no code for the graphics card/],
+ ['server_exited (exit code 1): [strata] none of this computer\'s graphics cards has code in this Strata engine (it is built for gfx1200,gfx1201). Cards found: AMD Radeon RX 6800 XT (gfx1030).', 'gpu-no-code', /no code for the graphics card/],
['Traceback (most recent call last):\n File "x.py", line 3', 'technical', /Something went wrong/],
];
diff --git a/docs/AMD_HIP.md b/docs/AMD_HIP.md
index eff82a73e..e20e3ce6a 100644
--- a/docs/AMD_HIP.md
+++ b/docs/AMD_HIP.md
@@ -84,6 +84,13 @@ per library set, and 7.10 crashes in the HSA runtime on a Strix Halo with a new
Each package carries the engine, the CPU picture reader and the GPU picture reader (`strata-vision-hip`) for the same architectures, and
the rocBLAS and hipBLASLt kernel data for them only. A package whose GPU code does not cover the card is refused with one line that
names the card family ("This build of Strata is for AMD RX 9000 cards. This computer has an AMD RX 7000 card ...").
+**The RX 6000 series (gfx1030, RX 6800 / 6900) is in no package of this release**, on Windows or Linux: the app says so plainly instead of naming a
+build to ask for. An engine built for it ([RDNA2](#rdna2-gfx1030), `STRATA_HIP_ARCHS=gfx1030`) still runs it.
+
+**Automatic card (0.2.1):** with no card named in the model's settings, the engine start asks the package's `strata-device --list-devices`
+and skips cards the package has no code for and integrated chips (a mini PC's Radeon 760M / 890M is HIP's device 0) while a card of its own
+can run. Device 0 stays the choice when it is already such a card. When none of the computer's cards can run, the start stops
+with one line that names the cards found and what the engine is built for. `HIP_VISIBLE_DEVICES`, a `"gpu"` in the settings file or `hip_ordinal` is never overridden.
What was run on real hardware:
diff --git a/serve/server.py b/serve/server.py
index 94a488c66..d84fa900c 100644
--- a/serve/server.py
+++ b/serve/server.py
@@ -3089,6 +3089,89 @@ def ordered_gpus(cfg: dict, scores=None, vrams=None) -> list[int]:
return out
+#: AMD chips that share the system memory (an iGPU): never preferred over a card that has memory of its own.
+HIP_IGPU_ARCHS = ("gfx1035", "gfx1036", "gfx1037", "gfx1103", "gfx1150", "gfx1151", "gfx1152", "gfx90c")
+
+
+def parse_hip_devices(text: str) -> list[dict]:
+ """`strata-device --list-devices`: [{"index", "name", "arch", "vram_gb", "integrated", "cannot_run"}], numbered as the HIP runtime numbers them."""
+ found: list[dict] = []
+ for line in text.splitlines():
+ s = line.strip()
+ m = re.match(r"device\s+(\d+):\s*(.*)$", s)
+ if m:
+ found.append({"index": int(m.group(1)), "name": m.group(2).strip(), "arch": "", "vram_gb": 0.0, "integrated": False, "cannot_run": None})
+ continue
+ if not found:
+ continue
+ a = re.match(r"arch\s+(gfx[0-9a-f]+)\s*,\s*([\d.]+)\s*GiB(.*)$", s)
+ if a and not found[-1]["arch"]:
+ found[-1]["arch"], found[-1]["vram_gb"] = a.group(1), float(a.group(2))
+ found[-1]["integrated"] = "integrated" in a.group(3) # a newer engine says so itself
+ elif s.startswith("cannot run:"):
+ found[-1]["cannot_run"] = s[len("cannot run:"):].strip()
+ for d in found:
+ d["integrated"] = d["integrated"] or d["arch"] in HIP_IGPU_ARCHS
+ return found
+
+
+def hip_no_card_message(devices: list[dict]) -> str:
+ """The plain line when the engine has code for none of the computer's cards."""
+ cards = ", ".join(f"{d['name'] or 'graphics card'} ({d['arch'] or 'unknown'}{', integrated' if d['integrated'] else ''})" for d in devices)
+ built = next((m.group(1) for d in devices for m in [re.search(r"compiled for \(([^)]*)\)", d["cannot_run"] or "")] if m), "")
+ text = f"[strata] none of this computer's graphics cards has code in this Strata engine{f' (it is built for {built})' if built else ''}. Cards found: {cards}."
+ note = engine_component.no_package_note([d["arch"] for d in devices])
+ return text + (f" {note}" if note else "")
+
+
+def pick_hip_devices(devices: list[dict]) -> tuple[list[int] | None, str | None]:
+ """Which card an "Automatic" start runs on: (HIP_VISIBLE_DEVICES to set, or None to leave the runtime's own order; a plain problem or
+ None). Cards this engine has no code for are skipped, and so are integrated chips while a card of its own can run (#3203: a mini PC's
+ Radeon 760M is HIP's device 0 and the engine died on it; the RX 6800 XT behind it was never tried). When device 0 is already the right
+ kind nothing changes."""
+ if not devices:
+ return None, None
+ runnable = [d for d in devices if not d["cannot_run"]]
+ if not runnable:
+ return None, hip_no_card_message(devices)
+ pool = [d for d in runnable if not d["integrated"]] or runnable
+ if devices[0] in pool:
+ return None, None
+ best = max(pool, key=lambda d: (round(d["vram_gb"]), -d["index"]))
+ return [best["index"]], None
+
+
+def hip_auto_devices(cfg: dict, env: dict) -> list[int] | None:
+ """HIP_VISIBLE_DEVICES for a start that names no card (see pick_hip_devices), asked of the engine package's own `strata-device`.
+ None leaves everything as it was: a card the config or the environment names, no probe next to the engine, or a probe that fails.
+ SystemExit with the plain line when no card of this computer can run."""
+ if cfg.get("backend") != "hip" or gpu_list(cfg) or str(cfg.get("hip_ordinal") if cfg.get("hip_ordinal") is not None else "").strip() \
+ or env.get("HIP_VISIBLE_DEVICES") or env.get("ROCR_VISIBLE_DEVICES"):
+ return None
+ exe = cfg.get("exe")
+ if not isinstance(exe, str) or not exe or engine_component.is_reference(exe):
+ return None
+ probe = Path(exe).with_name("strata-device.exe" if os.name == "nt" else "strata-device")
+ if not probe.is_file():
+ return None
+ try:
+ done = subprocess.run([str(probe), "--list-devices"], capture_output=True, text=True, timeout=60, cwd=str(probe.parent), env=env,
+ creationflags=getattr(subprocess, "CREATE_NO_WINDOW", 0))
+ except (OSError, subprocess.SubprocessError):
+ return None
+ if done.returncode != 0:
+ return None
+ devices = parse_hip_devices(done.stdout)
+ visible, problem = pick_hip_devices(devices)
+ if problem:
+ raise SystemExit(problem)
+ if visible:
+ d = next(x for x in devices if x["index"] == visible[0])
+ print(f"[strata] automatic GPU choice: GPU {d['index']} ({d['name']}, {d['arch']}); the engine skips cards it has no code for and "
+ f"integrated chips while a card of its own can run", flush=True)
+ return visible
+
+
def child_env(cfg: dict, *, offline: bool = False) -> dict:
"""The engine's environment: the CUDA libraries setup installed (pip's nvidia packages, or the toolkit that
compiled it) first on the library search path."""
@@ -3119,6 +3202,9 @@ def child_env(cfg: dict, *, offline: bool = False) -> dict:
env[var] = os.pathsep.join(dirs + ([env[var]] if env.get(var) else []))
if cfg.get("backend") == "hip":
hip_env_guard(env, cfg)
+ auto = hip_auto_devices(cfg, env)
+ if auto:
+ env["HIP_VISIBLE_DEVICES"] = ",".join(str(i) for i in auto)
return env
diff --git a/serve/test_server.py b/serve/test_server.py
index 12604f5aa..629352d36 100644
--- a/serve/test_server.py
+++ b/serve/test_server.py
@@ -1771,6 +1771,67 @@ class GpuChoice(unittest.TestCase):
self.assertEqual(sc, {0: 128 * 2350.0, 1: 64 * 2000.0, 2: 128 * 2350.0})
self.assertIsNone(hip_speed_scores([0, 1, 2, 3], root=d)) # a card the topology does not have
+ DEVICES_MINI_PC = (
+ "device 0: AMD Radeon 760M Graphics\n arch gfx1103, 8.0 GiB, wave32\n cannot run: GPU 0 (AMD Radeon 760M Graphics, gfx1103) is not an "
+ "architecture this Strata engine was compiled for (gfx1200,gfx1201); compile it\n"
+ "device 1: AMD Radeon RX 9070 XT\n arch gfx1201, 15.9 GiB, wave32\n")
+
+ def test_automatic_card_skips_what_the_engine_cannot_run(self):
+ """#3203: a mini PC's Radeon 760M is HIP's device 0 and has no code in the engine; Automatic must run on the card behind it."""
+ from serve.server import hip_auto_devices, parse_hip_devices, pick_hip_devices
+ devices = parse_hip_devices(self.DEVICES_MINI_PC)
+ self.assertEqual([(d["index"], d["arch"], d["integrated"], bool(d["cannot_run"])) for d in devices],
+ [(0, "gfx1103", True, True), (1, "gfx1201", False, False)])
+ self.assertEqual(pick_hip_devices(devices), ([1], None))
+ # an integrated chip that does have code loses to a card of its own; the card of its own wins even when it is device 1
+ both = parse_hip_devices("device 0: Radeon 890M\n arch gfx1150, 16.0 GiB, wave32\ndevice 1: RX 9070 XT\n arch gfx1201, 15.9 GiB, wave32\n")
+ self.assertEqual(pick_hip_devices(both), ([1], None))
+ # an integrated chip alone stays the choice; device 0 already right: nothing is changed
+ self.assertEqual(pick_hip_devices(parse_hip_devices("device 0: Radeon 8060S\n arch gfx1151, 64.0 GiB, wave32\n")), (None, None))
+ self.assertEqual(pick_hip_devices(parse_hip_devices("device 0: R9700\n arch gfx1201, 31.9 GiB, wave32\ndevice 1: R9700\n arch gfx1201, 31.9 GiB, wave32\n")), (None, None))
+ self.assertEqual(pick_hip_devices([]), (None, None))
+ # the engine's own flag for an integrated chip is honoured as well
+ flagged = parse_hip_devices("device 0: X\n arch gfx1300, 8.0 GiB, wave32, integrated\ndevice 1: Y\n arch gfx1201, 4.0 GiB, wave32\n")
+ self.assertEqual(pick_hip_devices(flagged), ([1], None))
+ # nothing runnable: the plain line names the cards, what the engine is built for and, for the RX 6800 XT, that no package exists
+ nothing = parse_hip_devices(
+ "device 0: AMD Radeon 760M Graphics\n arch gfx1103, 8.0 GiB, wave32\n cannot run: x is not an architecture this Strata engine was compiled for "
+ "(gfx1200,gfx1201); y\ndevice 1: AMD Radeon RX 6800 XT\n arch gfx1030, 16.0 GiB, wave32\n cannot run: z compiled for (gfx1200,gfx1201); y\n")
+ picked, problem = pick_hip_devices(nothing)
+ self.assertIsNone(picked)
+ self.assertIn("none of this computer's graphics cards has code in this Strata engine (it is built for gfx1200,gfx1201)", problem)
+ self.assertIn("AMD Radeon RX 6800 XT (gfx1030)", problem)
+ self.assertIn("760M Graphics (gfx1103, integrated)", problem)
+ self.assertIn("no ready-made Strata engine for the AMD RX 6000 series", problem)
+ # through the engine's own program, and never over a card the config or the environment names
+ with tempfile.TemporaryDirectory() as d:
+ exe = Path(d) / ("strata.exe" if os.name == "nt" else "strata")
+ probe = Path(d) / ("strata-device.exe" if os.name == "nt" else "strata-device")
+ exe.write_text("")
+ probe.write_text("")
+ cfg = {"backend": "hip", "exe": str(exe), "args": []}
+ done = SimpleNamespace(returncode=0, stdout=self.DEVICES_MINI_PC)
+ with mock.patch("serve.server.subprocess.run", return_value=done) as run, contextlib.redirect_stdout(io.StringIO()) as out:
+ self.assertEqual(hip_auto_devices(cfg, {}), [1])
+ self.assertEqual(run.call_args[0][0], [str(probe), "--list-devices"])
+ self.assertIn("automatic GPU choice: GPU 1", out.getvalue())
+ with mock.patch("serve.server.subprocess.run", return_value=done) as run:
+ self.assertIsNone(hip_auto_devices({**cfg, "gpu": 0}, {}))
+ self.assertIsNone(hip_auto_devices({**cfg, "hip_ordinal": 2}, {}))
+ self.assertIsNone(hip_auto_devices(cfg, {"HIP_VISIBLE_DEVICES": "0"}))
+ self.assertIsNone(hip_auto_devices({**cfg, "backend": "cuda"}, {}))
+ run.assert_not_called()
+ with mock.patch("serve.server.subprocess.run", return_value=SimpleNamespace(returncode=1, stdout="")):
+ self.assertIsNone(hip_auto_devices(cfg, {})) # a probe that fails changes nothing
+ with mock.patch("serve.server.subprocess.run", return_value=SimpleNamespace(returncode=0, stdout=(
+ "device 0: A\n arch gfx1030, 16.0 GiB, wave32\n cannot run: compiled for (gfx1200)\n"))):
+ with self.assertRaises(SystemExit) as stop:
+ hip_auto_devices(cfg, {})
+ self.assertIn("none of this computer's graphics cards", str(stop.exception))
+ exe.unlink()
+ probe.unlink()
+ self.assertIsNone(hip_auto_devices(cfg, {})) # no probe next to the engine: as before
+
def test_vision_device(self):
# #408: the image encoder on its own card; the engine's environment stays as it was
from serve.server import child_env, vision_env
diff --git a/strata_control/engine_component.py b/strata_control/engine_component.py
index b23c52d1c..38f7e901d 100644
--- a/strata_control/engine_component.py
+++ b/strata_control/engine_component.py
@@ -638,8 +638,24 @@ def hip_family(arch: str) -> str:
return next((name for name, archs in HIP_FAMILIES if arch in archs), arch)
+#: AMD architectures no ready-made engine package of this release covers (the packages: RX 9000, RX 7000 + Ryzen AI Max): the RX 6000 series.
+#: Setup and a source build can still target them (docs/AMD_HIP.md); the app's one-click engine cannot.
+NO_PACKAGE_HIP = {"gfx1030": "RX 6000", "gfx1031": "RX 6000"}
+NO_PACKAGE_SENTENCE = ("This release has no ready-made Strata engine for the AMD {0} series. Strata can only run on it with an engine built for "
+ "that card (docs/AMD_HIP.md, \"RDNA2\").")
+
+
+def no_package_note(archs) -> str | None:
+ """One plain sentence when some of these architectures (gfx1030 ...) have no ready-made package in this release, else None."""
+ families = sorted({NO_PACKAGE_HIP[a] for a in archs if a in NO_PACKAGE_HIP})
+ return NO_PACKAGE_SENTENCE.format(" and ".join(families)) if families else None
+
+
def arch_notice(built: tuple[str, ...], here: list[str]) -> str:
"""The plain sentence for an AMD engine that has code for other cards than this computer's (a tester build for another card)."""
+ if here and all(a in NO_PACKAGE_HIP for a in here): # asking for "the RX 6000 build" would send the person to one that does not exist
+ have = sorted({hip_family(a) for a in here})
+ return (f"This computer has an AMD {' and '.join(have)} card ({', '.join(sorted(set(here)))}). {no_package_note(here)}")
built_for = sorted({hip_family(a) for a in built})
have = sorted({hip_family(a) for a in here})
make = lambda names: " and ".join(names) # noqa: E731
diff --git a/tests/terminal/test_release_matrix.py b/tests/terminal/test_release_matrix.py
index fbeca849a..a0548e1ab 100644
--- a/tests/terminal/test_release_matrix.py
+++ b/tests/terminal/test_release_matrix.py
@@ -120,6 +120,22 @@ class ReleaseSelection(unittest.TestCase):
self.assertEqual(ec.arch_notice(("gfx1151",), ["gfx1201"]),
"This build of Strata is for AMD Ryzen AI Max cards. This computer has an AMD RX 9000 card (gfx1201). Ask for the RX 9000 build.")
+ def test_rx6000_has_no_ready_made_package_and_the_notice_says_so_instead_of_naming_a_build_that_does_not_exist(self):
+ """#3203: an RX 6800 XT (gfx1030) is in none of the release's engine packages on either OS; the line must not say "Ask for the RX 6000 build"."""
+ from strata_control import engine_component as ec
+ covered = {a for p in RELEASE if p["backend"] == "hip" for a in p["archs"]}
+ for gfx in ec.NO_PACKAGE_HIP:
+ self.assertNotIn(gfx, covered, f"{gfx} is in a package now: drop it from NO_PACKAGE_HIP")
+ for platform in ("windows-x86_64", "linux-x86_64"):
+ self.assertIsNone(self.pick(pc(platform, "hip", gfx=["gfx1030"]))[0])
+ text = ec.arch_notice(("gfx1200", "gfx1201"), ["gfx1030"])
+ self.assertIn("This computer has an AMD RX 6000 card (gfx1030).", text)
+ self.assertIn("no ready-made Strata engine for the AMD RX 6000 series", text)
+ self.assertNotIn("Ask for", text)
+ self.assertIsNone(ec.no_package_note(["gfx1201", "gfx1100"]))
+ # a PC with an RX 9000 card next to the RX 6000 one is told the ordinary way (a build exists for one of them)
+ self.assertIn("Ask for the", ec.arch_notice(("gfx1100",), ["gfx1201", "gfx1030"]))
+
def test_the_platform_decides_first(self):
self.assertIsNone(self.pick(pc("macos-arm64", "cuda", "590.10", ["sm_86"]))[0])
self.assertEqual(self.pick(pc("macos-arm64", "metal"))[0], ("macos-arm64", "metal", ""))
diff --git a/tools/strata_mcp.py b/tools/strata_mcp.py
index f9ddcc04f..ae4f586d6 100644
--- a/tools/strata_mcp.py
+++ b/tools/strata_mcp.py
@@ -869,12 +869,34 @@ class Strata:
if g.get("uma") and g.get("usable"):
g["usable"], g["problem"] = False, "integrated graphics: Strata uses the NVIDIA card in this computer"
hw["gpus"] = nv + amd
+ self._engine_code(hw)
self._engine_vendor(hw)
if WIN:
hw["display_adapters"] = windows_video_controllers()
hw["nvidia_smi"] = bool(shutil.which("nvidia-smi"))
return hw
+ @staticmethod
+ def _engine_code(hw: dict) -> None:
+ """An AMD card the installed engine package has no code for is not one Strata can run on (the engine would stop on it, #3203): flag it
+ unusable with the plain reason, so the card lists and "Automatic" leave it out. Only a package that lists its archs speaks here."""
+ amd = [g for g in hw.get("gpus", []) if g.get("vendor") == "amd" and g.get("arch")]
+ if not amd:
+ return
+ try:
+ from strata_control import engine_component as ec
+ rep = ec.status()
+ eng = rep.get("engine") or {}
+ built = [a for a in eng.get("archs") or [] if str(a).startswith("gfx")]
+ if not rep.get("usable") or eng.get("backend") != "hip" or not built:
+ return
+ except Exception: # noqa: BLE001 - never break the hardware page over this
+ return
+ for g in amd:
+ if g["arch"] not in built and g.get("usable") is not False:
+ g["usable"] = False
+ g["problem"] = (ec.no_package_note([g["arch"]]) or f"this Strata engine has no code for {g['arch']} (it is built for {', '.join(built)})")
+
@staticmethod
def _engine_vendor(hw: dict) -> None:
"""One engine drives the cards of ONE make (CUDA: NVIDIA, HIP: AMD, ...): note which one for this PC (the installed engine's, else the one
diff --git a/tools/test_strata_mcp.py b/tools/test_strata_mcp.py
index 1bcb31d1c..c810be30a 100644
--- a/tools/test_strata_mcp.py
+++ b/tools/test_strata_mcp.py
@@ -757,6 +757,28 @@ class MixedGraphics(unittest.TestCase):
with mock.patch.object(M.sys, "platform", "linux"), mock.patch.object(M, "WIN", False), mock.patch.object(S, "gpus", lambda: []), mock.patch.object(S, "amd_gpus", lambda: [dict(g) for g in igpu]), mock.patch.object(S, "amd_problem", lambda g: None):
self.assertTrue(s._hardware()["gpus"][0]["usable"])
+ def test_an_amd_card_the_installed_engine_has_no_code_for_is_not_usable(self):
+ """#3203: the engine package lists its GPU code; a card outside it is flagged unusable with the plain reason, so no list offers it."""
+ status = {"usable": True, "engine": {"backend": "hip", "archs": ["gfx1200", "gfx1201"]}}
+ hw = {"gpus": [{"vendor": "amd", "index": 0, "name": "AMD Radeon 760M", "arch": "gfx1103", "usable": False, "problem": "integrated"},
+ {"vendor": "amd", "index": 1, "name": "AMD Radeon RX 6800 XT", "arch": "gfx1030", "usable": True, "problem": None},
+ {"vendor": "amd", "index": 2, "name": "AMD Radeon RX 9070 XT", "arch": "gfx1201", "usable": True, "problem": None},
+ {"vendor": "nvidia", "index": 0, "name": "NVIDIA GeForce RTX 3060", "arch": "86", "usable": True, "problem": None}]}
+ with mock.patch("strata_control.engine_component.status", lambda: status):
+ M.Strata._engine_code(hw)
+ by = {g["name"]: g for g in hw["gpus"]}
+ self.assertFalse(by["AMD Radeon RX 6800 XT"]["usable"])
+ self.assertIn("no ready-made Strata engine for the AMD RX 6000 series", by["AMD Radeon RX 6800 XT"]["problem"])
+ self.assertEqual(by["AMD Radeon 760M"]["problem"], "integrated", "an earlier reason stays")
+ self.assertTrue(by["AMD Radeon RX 9070 XT"]["usable"])
+ self.assertTrue(by["NVIDIA GeForce RTX 3060"]["usable"])
+ # no engine package that lists archs (a source build, no engine yet): nothing is judged
+ for other in ({"usable": False}, {"usable": True, "engine": {"backend": "cuda", "archs": ["sm_86"]}}):
+ again = {"gpus": [{"vendor": "amd", "index": 1, "name": "x", "arch": "gfx1030", "usable": True, "problem": None}]}
+ with mock.patch("strata_control.engine_component.status", lambda other=other: other):
+ M.Strata._engine_code(again)
+ self.assertTrue(again["gpus"][0]["usable"])
+
@mock.patch("strata_control.engine_component.status", lambda: {"usable": False}) # not this PC's installed (CUDA) engine
def test_windows_lists_an_amd_card_and_not_the_integrated_radeon(self):
s = M.Strata(HERE.parent)