Merge f-027-app2: master switches in the app and Terminal settings
DS4_DEFAULTS=026 behind the DeepSeek speed-ups Off toggle, the 12 GB NVIDIA route-prior row, the Advanced-only Qwen '0.2.6 behaviour' row (STRATA_DEFAULTS=026), and the app-ui Quit test fix. Terminal suites pass; host suite failures on Linux also fail on the base.
This commit is contained in:
commit
03d709820d
14 files changed
+231
-34
No files matched your search
@@ -39,12 +39,17 @@ export const SPEED_SWITCHES=[
|
||||
{id:'faster_long_prompts',label:'Faster long prompts',group:'Speed',
|
||||
hint:'Reads very long prompts faster by approximating part of the work. Off by default: answers about long documents can miss or mix up details.',
|
||||
default:'off',env:{STRATA_KVA:'1'}},
|
||||
{id:'faster_12gb_nvidia',label:'Faster answers on 12 GB NVIDIA cards',group:'Speed',
|
||||
hint:'Prefers the parts of the model already on the graphics card, which makes answers much faster on 12 GB cards. Turn off if answers look worse than before.',
|
||||
default:'on',env:{STRATA_ROUTE_PRIOR:'0'}},
|
||||
{id:'faster_radeon_9000',label:'Faster answers on Radeon RX 9000 / AI PRO R9700',group:'Speed',
|
||||
hint:'Shares the work between the graphics card and the processor in a way that makes answers faster on these cards. Turn off to go back to the previous setting, which is slower.',
|
||||
default:'on',env:{STRATA_PCIE_FRAC_DEFAULT:'old'}},
|
||||
{id:'deepseek_speedups',label:'DeepSeek speed-ups',group:'Speed',
|
||||
hint:'Reads long prompts faster and loads the parts of the model it needs faster. Turn off if DeepSeek stops working or its answers look wrong; it then runs as in version 0.2.6.',
|
||||
default:'on',env:{DS4_FAST_ATTN:'0',DS4_ATTN_SLAB:'0',DS4_COPY_PIN:'0',DS4_COPY_HUGETLB:'0',DS4_STORE_SPARE:'0',DS4_STORE_PUT:'0'}},
|
||||
default:'on',env:{DS4_DEFAULTS:'026',DS4_FAST_ATTN:'0',DS4_ATTN_SLAB:'0',DS4_COPY_PIN:'0',DS4_COPY_HUGETLB:'0',DS4_STORE_SPARE:'0',DS4_STORE_PUT:'0'},
|
||||
/* an earlier test build wrote only these six for the same state: they read as the switch being set, and go with it */
|
||||
legacy:{DS4_FAST_ATTN:'0',DS4_ATTN_SLAB:'0',DS4_COPY_PIN:'0',DS4_COPY_HUGETLB:'0',DS4_STORE_SPARE:'0',DS4_STORE_PUT:'0'}},
|
||||
];
|
||||
const GFX12=/^gfx120[01]$/i, RADEON_9000=/\b(?:RX\s*9\d{3}|AI\s*PRO\s*R97\d{2}|R97\d{2})\b/i;
|
||||
/**
|
||||
@@ -53,21 +58,29 @@ const GFX12=/^gfx120[01]$/i, RADEON_9000=/\b(?:RX\s*9\d{3}|AI\s*PRO\s*R97\d{2}|R
|
||||
* the Qwen3.8-Flash-Next files (the original, Swift, Coder, Unsloth, Gyro, NVFP4) have none. KVA was measured on the Flash-Next shape (48 layers, 512
|
||||
* experts) and the engine declines it on any other, so "Faster long prompts" is shown for a model without an "arch" only.
|
||||
*/
|
||||
/** A discrete NVIDIA card of 13 GiB or less: the engine's rule for residency-biased routing (not an integrated chip, not a card that shares system memory). */
|
||||
const smallNvidia=gpus=>(gpus??[]).some(g=>{
|
||||
if(g.usable===false||g.uma||g.integrated||(g.unified_gb??0)>0)return false;
|
||||
const vendor=String(g.vendor??'').toLowerCase();
|
||||
if(vendor!=='nvidia'&&!(vendor===''&&/nvidia|geforce|\brtx\b|\bgtx\b|quadro|tesla/i.test(String(g.name??''))))return false;
|
||||
return g.vram_gb>0&&g.vram_gb<=13;
|
||||
});
|
||||
export function speedSwitchApplies(id,{deepseek=false,backend=null,gpus=[],arch=null}={}){
|
||||
if(id==='deepseek_speedups')return !!deepseek;
|
||||
if(deepseek)return false; // the Qwen engine's switches
|
||||
if(id==='faster_long_prompts')return !arch&&(backend==='cuda'||backend==='hip');
|
||||
if(id==='faster_12gb_nvidia')return !arch&&backend==='cuda'&&smallNvidia(gpus); // the engine's routing needs the Flash-Next shape (512 experts, top-10) and a CUDA build
|
||||
if(id==='faster_radeon_9000')return backend==='hip'&&(gpus??[]).some(g=>(!g.vendor||g.vendor==='amd')&&(GFX12.test(String(g.arch??''))||(!g.arch&&RADEON_9000.test(String(g.name??'')))));
|
||||
return false;
|
||||
}
|
||||
/** The switch is outside its default when every entry it writes is in the environment with its value; anything less or other (a hand-edited file, STRATA_KVA=0) is the default state and is left alone. */
|
||||
export function speedSwitchIsSet(env,id){const sw=SPEED_SWITCHES.find(s=>s.id===id);return !!sw&&Object.entries(sw.env).every(([name,value])=>env?.[name]===value);}
|
||||
export function speedSwitchIsSet(env,id){const sw=SPEED_SWITCHES.find(s=>s.id===id),has=entries=>!!entries&&Object.keys(entries).length>0&&Object.entries(entries).every(([name,value])=>env?.[name]===value);return !!sw&&(has(sw.env)||has(sw.legacy));}
|
||||
/** Is the feature on for a launch with this environment? */
|
||||
export function speedSwitchIsOn(env,id){const sw=SPEED_SWITCHES.find(s=>s.id===id);return !!sw&&speedSwitchIsSet(env,id)!==(sw.default==='on');}
|
||||
/** The environment with the feature on or off: its default removes the switch's entries, the other state writes them. Nothing else in it changes. */
|
||||
export function setSpeedSwitch(env,id,on){
|
||||
const sw=SPEED_SWITCHES.find(s=>s.id===id);if(!sw)throw new Error(`Unknown speed switch: ${id}`);
|
||||
const write=on!==(sw.default==='on'),next={...(env??{})};for(const [name,value] of Object.entries(sw.env)){if(write)next[name]=value;else delete next[name];}return next;
|
||||
const write=on!==(sw.default==='on'),next={...(env??{})};for(const [name,value] of Object.entries(sw.env)){if(write)next[name]=value;else delete next[name];}if(!write)for(const name of Object.keys(sw.legacy??{}))delete next[name];return next;
|
||||
}
|
||||
/** What the settings answer carries: each switch that applies, with its words, its default, the entries it writes outside the default, and whether the feature is on. */
|
||||
export function speedSwitchRows(env,context){return SPEED_SWITCHES.filter(s=>speedSwitchApplies(s.id,context)).map(s=>({...s,on:speedSwitchIsOn(env,s.id)}));}
|
||||
|
||||
@@ -16,8 +16,11 @@ interface SpeedSwitch {
|
||||
hint: string;
|
||||
default: 'on' | 'off';
|
||||
env: Record<string, string>;
|
||||
/** What an earlier test build wrote for the same state: it reads as set, and goes with it. */
|
||||
legacy?: Record<string, string>;
|
||||
}
|
||||
const switchIsSet = (sw: SpeedSwitch, env: Record<string, string> | undefined) => Object.entries(sw.env).every(([name, value]) => env?.[name] === value);
|
||||
const switchHas = (entries: Record<string, string> | undefined, env: Record<string, string> | undefined) => !!entries && Object.keys(entries).length > 0 && Object.entries(entries).every(([name, value]) => env?.[name] === value);
|
||||
const switchIsSet = (sw: SpeedSwitch, env: Record<string, string> | undefined) => switchHas(sw.env, env) || switchHas(sw.legacy, env);
|
||||
const switchIsOn = (sw: SpeedSwitch, env: Record<string, string> | undefined) => switchIsSet(sw, env) !== (sw.default === 'on');
|
||||
export function NativeSettings({ model }: {
|
||||
model: string;
|
||||
@@ -61,7 +64,7 @@ export function NativeSettings({ model }: {
|
||||
}, [model,revision]);
|
||||
const change = (id: string, value: any) => { const next = { ...values, [id]: value }; setValues(next); setText(JSON.stringify(next, null, 2)); setNotice(''); };
|
||||
/** The default removes the switch's environment entries, the other state writes them: the model's file then carries nothing for a default launch. */
|
||||
const changeSwitch = (sw: SpeedSwitch, on: boolean) => { const env = { ...(values.env ?? {}) }; const write = on !== (sw.default === 'on'); for (const [name, value] of Object.entries(sw.env)) { if (write) env[name] = value; else delete env[name]; } change('env', env); };
|
||||
const changeSwitch = (sw: SpeedSwitch, on: boolean) => { const env = { ...(values.env ?? {}) }; const write = on !== (sw.default === 'on'); for (const [name, value] of Object.entries(sw.env)) { if (write) env[name] = value; else delete env[name]; } if (!write) for (const name of Object.keys(sw.legacy ?? {})) delete env[name]; change('env', env); };
|
||||
async function save() {
|
||||
setPending(true);
|
||||
setError('');
|
||||
|
||||
@@ -77,5 +77,7 @@
|
||||
"fx76": "Ein (empfohlen)",
|
||||
"fx77": "Das ist ein sehr großes Modell. Der Download umfasst {0} GB und braucht etwa so viel freien Speicherplatz. Es läuft auf NVIDIA-RTX-Karten der Serien 30, 40 und 50, auf einer Radeon AI PRO R9700 (Linux) oder auf einem Ryzen-AI-Max-/Strix-Halo-PC (Windows); wie schnell es ist, hängt von Speicher und Grafikkarte ab (die Zeile darunter sagt, was auf diesem Computer zu erwarten ist). Was nicht in den Speicher passt, wird von deiner SSD gelesen, deshalb zählt eine NVMe-SSD.",
|
||||
"fx78": "Noch nicht getestet. Ein so langer Kontext nimmt dem Modell Grafikspeicher weg, und lange Prompts werden langsam gelesen.",
|
||||
"fx79": "Aus (empfohlen)"
|
||||
"fx79": "Aus (empfohlen)",
|
||||
"fx82": "Schnellere Antworten auf NVIDIA-Karten mit 12 GB",
|
||||
"fx83": "Bevorzugt die Teile des Modells, die schon auf der Grafikkarte liegen. Das macht Antworten auf Karten mit 12 GB deutlich schneller. Schalten Sie die Option aus, wenn die Antworten schlechter aussehen als vorher."
|
||||
}
|
||||
@@ -77,5 +77,7 @@
|
||||
"fx76": "On (recommended)",
|
||||
"fx77": "This is a very large model. The download is {0} GB and it needs about as much free disk space. It runs on NVIDIA RTX 30, 40 and 50 cards, on a Radeon AI PRO R9700 (Linux) or on a Ryzen AI Max / Strix Halo PC (Windows); how fast it is depends on the memory and card (the line below says what to expect on this computer). What does not fit in memory is read from your SSD, so an NVMe drive matters.",
|
||||
"fx78": "Not tested yet. A context this long takes graphics memory from the model and reads long prompts slowly.",
|
||||
"fx79": "Off (recommended)"
|
||||
"fx79": "Off (recommended)",
|
||||
"fx82": "Faster answers on 12 GB NVIDIA cards",
|
||||
"fx83": "Prefers the parts of the model already on the graphics card, which makes answers much faster on 12 GB cards. Turn off if answers look worse than before."
|
||||
}
|
||||
@@ -77,5 +77,7 @@
|
||||
"fx76": "Activado (recomendado)",
|
||||
"fx77": "Es un modelo muy grande. La descarga es de {0} GB y necesita casi el mismo espacio libre en disco. Funciona con tarjetas NVIDIA RTX de las series 30, 40 y 50, con una Radeon AI PRO R9700 (Linux) o en un PC con Ryzen AI Max / Strix Halo (Windows); su velocidad depende de la memoria y de la tarjeta (la línea de abajo indica qué esperar en este equipo). Lo que no cabe en memoria se lee de tu SSD, así que importa que sea NVMe.",
|
||||
"fx78": "Aún sin probar. Un contexto tan largo le quita memoria gráfica al modelo y lee los prompts largos con lentitud.",
|
||||
"fx79": "Desactivado (recomendado)"
|
||||
"fx79": "Desactivado (recomendado)",
|
||||
"fx82": "Respuestas más rápidas en tarjetas NVIDIA de 12 GB",
|
||||
"fx83": "Prefiere las partes del modelo que ya están en la tarjeta gráfica, lo que hace las respuestas mucho más rápidas en tarjetas de 12 GB. Desactívalo si las respuestas parecen peores que antes."
|
||||
}
|
||||
@@ -77,5 +77,7 @@
|
||||
"fx76": "オン(推奨)",
|
||||
"fx77": "とても大きなモデルです。ダウンロードは {0} GB で、ほぼ同じ大きさの空き容量が必要です。NVIDIA RTX 30・40・50 シリーズ、Radeon AI PRO R9700(Linux)、または Ryzen AI Max / Strix Halo の PC(Windows)で動きます。速さはメモリとカードによって変わります(この PC での目安は下の行に表示されます)。メモリに入らない分は SSD から読むため、NVMe ドライブが重要です。",
|
||||
"fx78": "まだテストされていません。これほど長いコンテキストは、モデルが使うグラフィックスメモリを消費し、長いプロンプトの読み込みも遅くなります。",
|
||||
"fx79": "オフ(推奨)"
|
||||
"fx79": "オフ(推奨)",
|
||||
"fx82": "12 GB の NVIDIA カードでの高速な応答",
|
||||
"fx83": "グラフィックスカード上にすでにあるモデルの部分を優先して使うため、12 GB のカードで応答がとても速くなります。以前より回答が悪くなったと感じたらオフにしてください。"
|
||||
}
|
||||
@@ -77,5 +77,7 @@
|
||||
"fx76": "켬(권장)",
|
||||
"fx77": "매우 큰 모델입니다. 다운로드는 {0}GB이고, 거의 같은 크기의 여유 디스크 공간이 필요합니다. NVIDIA RTX 30·40·50 시리즈 카드, Radeon AI PRO R9700(Linux), 또는 Ryzen AI Max / Strix Halo PC(Windows)에서 실행됩니다. 속도는 메모리와 카드에 따라 달라집니다(아래 줄에 이 컴퓨터에서 기대할 수 있는 속도가 표시됩니다). 메모리에 들어가지 않는 부분은 SSD에서 읽으므로 NVMe 드라이브가 중요합니다.",
|
||||
"fx78": "아직 테스트하지 않았습니다. 이렇게 긴 컨텍스트는 모델이 쓸 그래픽 메모리를 차지하고, 긴 프롬프트를 느리게 읽습니다.",
|
||||
"fx79": "끔(권장)"
|
||||
"fx79": "끔(권장)",
|
||||
"fx82": "12GB NVIDIA 카드에서 더 빠른 응답",
|
||||
"fx83": "이미 그래픽 카드에 올라와 있는 모델 부분을 우선 사용해 12GB 카드에서 응답이 훨씬 빨라집니다. 답변이 이전보다 나빠 보이면 끄세요."
|
||||
}
|
||||
@@ -77,5 +77,7 @@
|
||||
"fx76": "Ativado (recomendado)",
|
||||
"fx77": "Este é um modelo muito grande. O download tem {0} GB e precisa de quase o mesmo espaço livre em disco. Ele roda em placas NVIDIA RTX das séries 30, 40 e 50, em uma Radeon AI PRO R9700 (Linux) ou em um PC com Ryzen AI Max / Strix Halo (Windows); a velocidade depende da memória e da placa (a linha abaixo diz o que esperar neste computador). O que não cabe na memória é lido do seu SSD, então um NVMe faz diferença.",
|
||||
"fx78": "Ainda não testado. Um contexto tão longo tira memória gráfica do modelo e lê prompts longos devagar.",
|
||||
"fx79": "Desativado (recomendado)"
|
||||
"fx79": "Desativado (recomendado)",
|
||||
"fx82": "Respostas mais rápidas em placas NVIDIA de 12 GB",
|
||||
"fx83": "Prefere as partes do modelo que já estão na placa de vídeo, o que deixa as respostas bem mais rápidas em placas de 12 GB. Desative se as respostas parecerem piores do que antes."
|
||||
}
|
||||
@@ -77,5 +77,7 @@
|
||||
"fx76": "Вкл. (рекомендуется)",
|
||||
"fx77": "Это очень большая модель. Загрузка — {0} ГБ, и нужно почти столько же свободного места на диске. Она работает на видеокартах NVIDIA RTX серий 30, 40 и 50, на Radeon AI PRO R9700 (Linux) или на ПК с Ryzen AI Max / Strix Halo (Windows); скорость зависит от памяти и видеокарты (строка ниже подскажет, чего ждать на этом компьютере). То, что не помещается в память, читается с вашего SSD, поэтому важен накопитель NVMe.",
|
||||
"fx78": "Ещё не проверено. Такой длинный контекст отнимает у модели видеопамять, а длинные запросы читаются медленно.",
|
||||
"fx79": "Выкл. (рекомендуется)"
|
||||
"fx79": "Выкл. (рекомендуется)",
|
||||
"fx82": "Более быстрые ответы на видеокартах NVIDIA с 12 ГБ",
|
||||
"fx83": "Отдаёт предпочтение частям модели, которые уже находятся на видеокарте, поэтому ответы на картах с 12 ГБ становятся намного быстрее. Отключите, если ответы стали выглядеть хуже, чем раньше."
|
||||
}
|
||||
@@ -77,5 +77,7 @@
|
||||
"fx76": "开启(推荐)",
|
||||
"fx77": "这是一个非常大的模型。下载大小为 {0} GB,需要差不多同样大小的可用磁盘空间。它可在 NVIDIA RTX 30、40 和 50 系列显卡、Radeon AI PRO R9700(Linux)或 Ryzen AI Max / Strix Halo 电脑(Windows)上运行;速度取决于内存和显卡(下面一行会说明在这台电脑上的预期)。内存放不下的部分会从你的 SSD 读取,所以 NVMe 硬盘很重要。",
|
||||
"fx78": "尚未测试。这么长的上下文会占用本该给模型使用的显存,读取长提示词也会很慢。",
|
||||
"fx79": "关闭(推荐)"
|
||||
"fx79": "关闭(推荐)",
|
||||
"fx82": "12 GB NVIDIA 显卡上更快的回答",
|
||||
"fx83": "优先使用已经在显卡上的模型部分,使 12 GB 显卡上的回答快很多。如果回答看起来比以前差,请关闭。"
|
||||
}
|
||||
@@ -12,6 +12,8 @@ import { checkComponentUpdates } from '../server/updates.mjs';
|
||||
|
||||
const root = fileURLToPath(new URL('..', import.meta.url));
|
||||
const delay = ms => new Promise(r => setTimeout(r, ms));
|
||||
/** Wait until `done()` is true, polling every 10 ms for up to `ms` (a busy PC can hold a timer back by far more than a fixed 20 ms sleep). */
|
||||
const until = async (done, ms = 5000) => { const end = Date.now() + ms; while (!done() && Date.now() < end) await delay(10); return done(); };
|
||||
const bridgeEnv = { STRATA_SHELL_BRIDGE: 'http://127.0.0.1:5555', STRATA_SHELL_TOKEN: 'a'.repeat(32) };
|
||||
|
||||
test('a host nobody started has no window mode, no Quit and no updater', () => {
|
||||
@@ -40,7 +42,8 @@ test('browser mode (chosen): Quit works once and the app updater says why it is
|
||||
assert.equal(ui.updater.unavailable, BROWSER_UPDATE_MESSAGE);
|
||||
await assert.rejects(ui.updater.check(), error => error.code === APP_UPDATE_UNAVAILABLE && error.message === BROWSER_UPDATE_MESSAGE);
|
||||
assert.equal(ui.quit().status, 202);
|
||||
await delay(20);
|
||||
assert.ok(await until(() => stopped >= 1), 'the shutdown callback ran');
|
||||
await delay(50); // and only once
|
||||
assert.equal(stopped, 1);
|
||||
});
|
||||
|
||||
|
||||
@@ -13,16 +13,19 @@ import { nativeFixture } from './helpers/native-fixture.mjs';
|
||||
const read = rel => readFileSync(fileURLToPath(new URL(rel, import.meta.url)), 'utf8').replace(/\r\n/g, '\n');
|
||||
const ENV = { // what each switch writes outside its default
|
||||
faster_long_prompts: { STRATA_KVA: '1' },
|
||||
faster_12gb_nvidia: { STRATA_ROUTE_PRIOR: '0' },
|
||||
faster_radeon_9000: { STRATA_PCIE_FRAC_DEFAULT: 'old' },
|
||||
deepseek_speedups: { DS4_FAST_ATTN: '0', DS4_ATTN_SLAB: '0', DS4_COPY_PIN: '0', DS4_COPY_HUGETLB: '0', DS4_STORE_SPARE: '0', DS4_STORE_PUT: '0' },
|
||||
deepseek_speedups: { DS4_DEFAULTS: '026', DS4_FAST_ATTN: '0', DS4_ATTN_SLAB: '0', DS4_COPY_PIN: '0', DS4_COPY_HUGETLB: '0', DS4_STORE_SPARE: '0', DS4_STORE_PUT: '0' },
|
||||
};
|
||||
const DEFAULT = { faster_long_prompts: 'off', faster_radeon_9000: 'on', deepseek_speedups: 'on' };
|
||||
const SIX = ['DS4_FAST_ATTN', 'DS4_ATTN_SLAB', 'DS4_COPY_PIN', 'DS4_COPY_HUGETLB', 'DS4_STORE_SPARE', 'DS4_STORE_PUT'];
|
||||
const DEFAULT = { faster_long_prompts: 'off', faster_12gb_nvidia: 'on', faster_radeon_9000: 'on', deepseek_speedups: 'on' };
|
||||
const RTX3060 = { index: 0, name: 'NVIDIA GeForce RTX 3060', vendor: 'nvidia', arch: '86', vram_gb: 12 };
|
||||
const R9700 = { index: 0, name: 'AMD Radeon AI PRO R9700', vendor: 'amd', arch: 'gfx1201', vram_gb: 32 };
|
||||
const RX7900 = { index: 0, name: 'AMD Radeon RX 7900 XTX', vendor: 'amd', arch: 'gfx1100', vram_gb: 24 };
|
||||
const RTX = { index: 0, name: 'NVIDIA GeForce RTX 4090', vendor: 'nvidia', arch: '89', vram_gb: 24 };
|
||||
const STRIX = { index: 0, name: 'AMD Radeon 8060S', vendor: 'amd', arch: 'gfx1151', vram_gb: 96, uma: true };
|
||||
|
||||
test('there are exactly three switches; each writes the engine names of the contract and has its default (KVA off, the others on)', () => {
|
||||
test('there are exactly four switches in the app (the Terminal has one more); each writes the engine names of the contract and has its default (KVA off, the others on)', () => {
|
||||
assert.deepEqual(SPEED_SWITCHES.map(s => s.id), Object.keys(ENV));
|
||||
for (const sw of SPEED_SWITCHES) {
|
||||
assert.deepEqual(sw.env, ENV[sw.id], sw.id);
|
||||
@@ -30,6 +33,50 @@ test('there are exactly three switches; each writes the engine names of the cont
|
||||
}
|
||||
});
|
||||
|
||||
test('the Terminal\'s Qwen "0.2.6 behaviour" switch is not in the app', () => {
|
||||
assert.ok(!SPEED_SWITCHES.some(s => s.env.STRATA_DEFAULTS || /0\.2\.6 behaviour/.test(s.label)));
|
||||
assert.ok(!Object.values(SPEED_SWITCHES.flatMap(s => Object.keys(s.env))).includes('STRATA_DEFAULTS'));
|
||||
});
|
||||
|
||||
test('Faster answers on 12 GB NVIDIA cards: only for Qwen on a discrete CUDA card of 13 GiB or less; Off writes STRATA_ROUTE_PRIOR=0', () => {
|
||||
const ids = context => speedSwitchRows({}, context).map(r => r.id);
|
||||
assert.deepEqual(ids({ backend: 'cuda', gpus: [RTX3060] }), ['faster_long_prompts', 'faster_12gb_nvidia']);
|
||||
assert.deepEqual(ids({ backend: 'cuda', gpus: [{ ...RTX3060, vram_gb: 13 }] }), ['faster_long_prompts', 'faster_12gb_nvidia'], '13 GiB counts');
|
||||
assert.deepEqual(ids({ backend: 'cuda', gpus: [{ ...RTX3060, vram_gb: 13.5 }] }), ['faster_long_prompts']);
|
||||
assert.deepEqual(ids({ backend: 'cuda', gpus: [{ ...RTX3060, vram_gb: 16 }] }), ['faster_long_prompts'], 'a 16 GB card is not a 12 GB card');
|
||||
assert.deepEqual(ids({ backend: 'cuda', gpus: [RTX] }), ['faster_long_prompts']);
|
||||
assert.deepEqual(ids({ backend: 'cuda', gpus: [RTX, RTX3060] }), ['faster_long_prompts', 'faster_12gb_nvidia'], 'one small card among others');
|
||||
assert.deepEqual(ids({ backend: 'cuda', gpus: [{ ...RTX3060, uma: true }] }), ['faster_long_prompts'], 'not a chip that shares system memory');
|
||||
assert.deepEqual(ids({ backend: 'cuda', gpus: [{ ...RTX3060, integrated: true }] }), ['faster_long_prompts']);
|
||||
assert.deepEqual(ids({ backend: 'cuda', gpus: [{ ...RTX3060, usable: false }] }), ['faster_long_prompts']);
|
||||
assert.deepEqual(ids({ backend: 'cuda', gpus: [{ name: 'GeForce RTX 3060', vram_gb: 12 }] }), ['faster_long_prompts', 'faster_12gb_nvidia'], 'no vendor reported: the name decides');
|
||||
assert.deepEqual(ids({ backend: 'cuda', gpus: [{ name: 'Mystery card', vram_gb: 12 }] }), ['faster_long_prompts']);
|
||||
assert.deepEqual(ids({ backend: 'hip', gpus: [{ name: 'AMD Radeon RX 7700 XT', vendor: 'amd', arch: 'gfx1101', vram_gb: 12 }] }), ['faster_long_prompts'], 'not a Radeon');
|
||||
assert.deepEqual(ids({ backend: 'sycl', gpus: [RTX3060] }), [], 'not a CUDA build');
|
||||
assert.deepEqual(ids({ backend: 'cuda', gpus: [RTX3060], arch: 'qwen35moe' }), [], 'Qwen3.6-35B-A3B: the routing needs 512 experts');
|
||||
assert.deepEqual(ids({ deepseek: true, backend: 'cuda', gpus: [RTX3060] }), ['deepseek_speedups']);
|
||||
const off = setSpeedSwitch({ PATH: '/bin' }, 'faster_12gb_nvidia', false);
|
||||
assert.deepEqual(off, { PATH: '/bin', STRATA_ROUTE_PRIOR: '0' });
|
||||
assert.equal(speedSwitchIsOn(off, 'faster_12gb_nvidia'), false);
|
||||
assert.equal(speedSwitchIsOn({}, 'faster_12gb_nvidia'), true);
|
||||
assert.deepEqual(setSpeedSwitch(off, 'faster_12gb_nvidia', true), { PATH: '/bin' });
|
||||
assert.equal(speedSwitchIsOn({ STRATA_ROUTE_PRIOR: '2.0' }, 'faster_12gb_nvidia'), true, 'any other value is the user\'s own and reads as the default');
|
||||
});
|
||||
|
||||
test('DeepSeek speed-ups Off writes DS4_DEFAULTS=026 and the six; On removes all seven; the six alone (an earlier test build) still read as Off', () => {
|
||||
const env = { DS4_ASYNC_T: '4' };
|
||||
const off = setSpeedSwitch(env, 'deepseek_speedups', false);
|
||||
assert.deepEqual(Object.keys(off).slice(0, 2), ['DS4_ASYNC_T', 'DS4_DEFAULTS'], 'the master switch first');
|
||||
assert.deepEqual(off, { DS4_ASYNC_T: '4', DS4_DEFAULTS: '026', ...Object.fromEntries(SIX.map(k => [k, '0'])) });
|
||||
assert.equal(speedSwitchIsOn(off, 'deepseek_speedups'), false);
|
||||
assert.deepEqual(setSpeedSwitch(off, 'deepseek_speedups', true), env);
|
||||
const six = { DS4_ASYNC_T: '4', ...Object.fromEntries(SIX.map(k => [k, '0'])) };
|
||||
assert.equal(speedSwitchIsOn(six, 'deepseek_speedups'), false);
|
||||
assert.deepEqual(setSpeedSwitch(six, 'deepseek_speedups', true), env, 'turning it on removes the six too');
|
||||
assert.equal(speedSwitchIsOn({ DS4_DEFAULTS: '026' }, 'deepseek_speedups'), true, 'the master switch alone is a hand-edited file: left alone');
|
||||
assert.deepEqual(speedSwitchRows(six, { deepseek: true }).map(r => [r.id, r.on, Object.keys(r.legacy).length]), [['deepseek_speedups', false, 6]], 'the client gets the six to recognise and remove');
|
||||
});
|
||||
|
||||
test('a default launch has none of the new environment entries: KVA reads as off, the others as on, and an environment in its default stays as it is', () => {
|
||||
for (const sw of SPEED_SWITCHES) assert.equal(speedSwitchIsSet({}, sw.id), false);
|
||||
const env = { PATH: '/native/bin', STRATA_PREFILL: '2' };
|
||||
|
||||
@@ -26,14 +26,19 @@ class Switch:
|
||||
label: str # the words the app shows
|
||||
effect: str # one plain sentence: what it does and what the other choice does
|
||||
env: tuple[tuple[str, str], ...] # the environment entries written when the switch is NOT in its default state
|
||||
only: str # "qwen-gpu" | "qwen-radeon-9000" | "deepseek": where it applies
|
||||
only: str # "qwen-gpu" | "qwen-cuda-12gb" | "qwen-radeon-9000" | "deepseek" | "qwen-any": where it applies
|
||||
default: str = "on" # "on" | "off": what a launch without the entries does
|
||||
legacy: tuple[tuple[str, str], ...] = () # entries an earlier 0.2.7 test build wrote for the same state: they read as the switch being set, and are removed with it
|
||||
terminal_only: bool = False # shown in the Terminal's Advanced table only, never in the app
|
||||
|
||||
|
||||
SWITCHES: tuple[Switch, ...] = (
|
||||
Switch("faster_long_prompts", "Faster long prompts",
|
||||
"Reads very long prompts faster by approximating part of the work. Off by default: answers about long documents can miss or mix up details.",
|
||||
(("STRATA_KVA", "1"),), "qwen-gpu", default="off"),
|
||||
Switch("faster_12gb_nvidia", "Faster answers on 12 GB NVIDIA cards",
|
||||
"Prefers the parts of the model already on the graphics card, which makes answers much faster on 12 GB cards. Turn off if answers look worse than before.",
|
||||
(("STRATA_ROUTE_PRIOR", "0"),), "qwen-cuda-12gb"),
|
||||
Switch("faster_radeon_9000", "Faster answers on Radeon RX 9000 / AI PRO R9700",
|
||||
"Shares the work between the graphics card and the processor in a way that makes answers faster on these cards. "
|
||||
"Turn off to go back to the previous setting, which is slower.",
|
||||
@@ -41,8 +46,15 @@ SWITCHES: tuple[Switch, ...] = (
|
||||
Switch("deepseek_speedups", "DeepSeek speed-ups",
|
||||
"Reads long prompts faster and loads the parts of the model it needs faster. "
|
||||
"Turn off if DeepSeek stops working or its answers look wrong; it then runs as in version 0.2.6.",
|
||||
(("DS4_FAST_ATTN", "0"), ("DS4_ATTN_SLAB", "0"), ("DS4_COPY_PIN", "0"), ("DS4_COPY_HUGETLB", "0"),
|
||||
("DS4_STORE_SPARE", "0"), ("DS4_STORE_PUT", "0")), "deepseek"),
|
||||
# DS4_DEFAULTS=026: the engine's master switch back to the 0.2.6 defaults; the six are what older engines (and the test builds) read
|
||||
(("DS4_DEFAULTS", "026"), ("DS4_FAST_ATTN", "0"), ("DS4_ATTN_SLAB", "0"), ("DS4_COPY_PIN", "0"), ("DS4_COPY_HUGETLB", "0"),
|
||||
("DS4_STORE_SPARE", "0"), ("DS4_STORE_PUT", "0")), "deepseek",
|
||||
legacy=(("DS4_FAST_ATTN", "0"), ("DS4_ATTN_SLAB", "0"), ("DS4_COPY_PIN", "0"), ("DS4_COPY_HUGETLB", "0"),
|
||||
("DS4_STORE_SPARE", "0"), ("DS4_STORE_PUT", "0"))),
|
||||
# Troubleshooting only, in the Terminal's Advanced table and nowhere else: every Qwen 0.2.7 default back to its 0.2.6 behaviour.
|
||||
Switch("qwen_defaults_026", "Qwen: 0.2.6 behaviour",
|
||||
"Starts every Qwen speed setting new in 0.2.7 the way 0.2.6 did, for troubleshooting. Use it if something that worked before no longer does.",
|
||||
(("STRATA_DEFAULTS", "026"),), "qwen-any", default="off", terminal_only=True),
|
||||
)
|
||||
|
||||
BY_ID = {s.id: s for s in SWITCHES}
|
||||
@@ -51,6 +63,20 @@ _GFX12 = re.compile(r"^gfx120[01]$", re.IGNORECASE)
|
||||
_RADEON_9000 = re.compile(r"\b(?:RX\s*9\d{3}|AI\s*PRO\s*R97\d{2}|R97\d{2})\b", re.IGNORECASE)
|
||||
|
||||
|
||||
def _small_nvidia(gpus: Iterable[Mapping[str, Any]] | None) -> bool:
|
||||
"""A discrete NVIDIA card of 13 GiB or less (the engine's rule for residency-biased routing: not an integrated chip, not a card that shares system memory)."""
|
||||
for g in gpus or []:
|
||||
if g.get("usable") is False or g.get("uma") or g.get("integrated") or (g.get("unified_gb") or 0) > 0:
|
||||
continue
|
||||
vendor = str(g.get("vendor") or "").lower()
|
||||
if vendor not in ("nvidia", "") or (vendor == "" and not re.search(r"nvidia|geforce|\brtx\b|\bgtx\b|quadro|tesla", str(g.get("name") or ""), re.IGNORECASE)):
|
||||
continue
|
||||
vram = float(g.get("vram_gb") or 0)
|
||||
if 0 < vram <= 13.0:
|
||||
return True
|
||||
return False
|
||||
|
||||
|
||||
def is_deepseek(cfg: Mapping[str, Any] | None) -> bool:
|
||||
cfg = cfg or {}
|
||||
return cfg.get("arch") == "deepseek41" or bool(re.search(r"strata-dsv41", str(cfg.get("exe") or ""), re.IGNORECASE))
|
||||
@@ -74,11 +100,16 @@ def applies(switch: Switch | str, cfg: Mapping[str, Any] | None, gpus: Iterable[
|
||||
return is_deepseek(cfg)
|
||||
if is_deepseek(cfg):
|
||||
return False
|
||||
if sw.only == "qwen-any":
|
||||
return True
|
||||
backend = (cfg or {}).get("backend") or backend
|
||||
if sw.only == "qwen-gpu":
|
||||
# KVA was measured on the Qwen3.8-Flash-Next shape (48 layers, 512 experts); the engine declines any other. Setup writes "arch" only for the
|
||||
# families with an engine path of their own (Qwen3.6-35B-A3B: qwen35moe), so a Flash-Next config (the original, Swift, Coder, Unsloth, Gyro, NVFP4) has none.
|
||||
return not (cfg or {}).get("arch") and backend in ("cuda", "hip")
|
||||
if sw.only == "qwen-cuda-12gb":
|
||||
# the engine's residency-biased routing needs the Flash-Next shape (512 experts, top-10) and a CUDA build; a Qwen3.6 config has an "arch"
|
||||
return not (cfg or {}).get("arch") and backend == "cuda" and _small_nvidia(gpus)
|
||||
if sw.only == "qwen-radeon-9000":
|
||||
return backend == "hip" and _radeon_9000(gpus)
|
||||
return False
|
||||
@@ -89,11 +120,17 @@ def applicable(cfg: Mapping[str, Any] | None, gpus: Iterable[Mapping[str, Any]]
|
||||
return [s for s in SWITCHES if applies(s, cfg, gpus, backend)]
|
||||
|
||||
|
||||
def app_switches() -> list[Switch]:
|
||||
"""The switches the app shows (apps/host/server/native-settings.mjs SPEED_SWITCHES): all but the Terminal-only ones."""
|
||||
return [s for s in SWITCHES if not s.terminal_only]
|
||||
|
||||
|
||||
def is_set(env: Mapping[str, Any] | None, switch: Switch | str) -> bool:
|
||||
"""Every entry the switch writes is there with its value (the switch is out of its default). A file with only some of them, or other values
|
||||
(``STRATA_KVA=0``), is in the default state and is left alone."""
|
||||
sw = BY_ID[switch] if isinstance(switch, str) else switch
|
||||
return all((env or {}).get(name) == value for name, value in sw.env)
|
||||
have = lambda entries: bool(entries) and all((env or {}).get(name) == value for name, value in entries) # noqa: E731
|
||||
return have(sw.env) or have(sw.legacy)
|
||||
|
||||
|
||||
def is_on(env: Mapping[str, Any] | None, switch: Switch | str) -> bool:
|
||||
@@ -112,6 +149,9 @@ def set_switch(env: Mapping[str, Any] | None, switch: Switch | str, on: bool) ->
|
||||
out[name] = value
|
||||
else:
|
||||
out.pop(name, None)
|
||||
if not write:
|
||||
for name, _ in sw.legacy:
|
||||
out.pop(name, None)
|
||||
return out
|
||||
|
||||
|
||||
|
||||
@@ -21,11 +21,17 @@ ROOT = Path(__file__).resolve().parents[2]
|
||||
|
||||
ENV = { # what each switch writes outside its default
|
||||
"faster_long_prompts": {"STRATA_KVA": "1"},
|
||||
"faster_12gb_nvidia": {"STRATA_ROUTE_PRIOR": "0"},
|
||||
"faster_radeon_9000": {"STRATA_PCIE_FRAC_DEFAULT": "old"},
|
||||
"deepseek_speedups": {"DS4_FAST_ATTN": "0", "DS4_ATTN_SLAB": "0", "DS4_COPY_PIN": "0", "DS4_COPY_HUGETLB": "0",
|
||||
"deepseek_speedups": {"DS4_DEFAULTS": "026", "DS4_FAST_ATTN": "0", "DS4_ATTN_SLAB": "0", "DS4_COPY_PIN": "0", "DS4_COPY_HUGETLB": "0",
|
||||
"DS4_STORE_SPARE": "0", "DS4_STORE_PUT": "0"},
|
||||
"qwen_defaults_026": {"STRATA_DEFAULTS": "026"}, # the Terminal's troubleshooting switch: not in the app
|
||||
}
|
||||
DEFAULT = {"faster_long_prompts": "off", "faster_radeon_9000": "on", "deepseek_speedups": "on"}
|
||||
DEFAULT = {"faster_long_prompts": "off", "faster_12gb_nvidia": "on", "faster_radeon_9000": "on", "deepseek_speedups": "on", "qwen_defaults_026": "off"}
|
||||
SIX = ("DS4_FAST_ATTN", "DS4_ATTN_SLAB", "DS4_COPY_PIN", "DS4_COPY_HUGETLB", "DS4_STORE_SPARE", "DS4_STORE_PUT")
|
||||
RTX3060 = {"name": "NVIDIA GeForce RTX 3060", "vendor": "nvidia", "arch": "86", "vram_gb": 12.0}
|
||||
RTX4070S = {"name": "NVIDIA GeForce RTX 4070 SUPER", "vendor": "nvidia", "arch": "89", "vram_gb": 12.0}
|
||||
RTX4060TI16 = {"name": "NVIDIA GeForce RTX 4060 Ti 16GB", "vendor": "nvidia", "arch": "89", "vram_gb": 16.0}
|
||||
R9700 = {"name": "AMD Radeon AI PRO R9700", "vendor": "amd", "arch": "gfx1201"}
|
||||
RX7900 = {"name": "AMD Radeon RX 7900 XTX", "vendor": "amd", "arch": "gfx1100"}
|
||||
STRIX = {"name": "AMD Radeon 8060S", "vendor": "amd", "arch": "gfx1151", "uma": True}
|
||||
@@ -37,11 +43,12 @@ DEEPSEEK = {"arch": "deepseek41", "exe": "C:/s/engine-dsv41/0.1.52-win/strata-ds
|
||||
|
||||
|
||||
def ids(cfg, gpus, backend=None):
|
||||
return [s.id for s in W.applicable(cfg, gpus, backend)]
|
||||
"""The switches the app would show (the Terminal-only one is tested apart)."""
|
||||
return [s.id for s in W.applicable(cfg, gpus, backend) if not s.terminal_only]
|
||||
|
||||
|
||||
class Contract(unittest.TestCase):
|
||||
def test_three_switches_with_the_contract_names_and_their_defaults(self):
|
||||
def test_five_switches_with_the_contract_names_and_their_defaults(self):
|
||||
self.assertEqual([s.id for s in W.SWITCHES], list(ENV))
|
||||
for s in W.SWITCHES:
|
||||
self.assertEqual(dict(s.env), ENV[s.id], s.id)
|
||||
@@ -49,7 +56,8 @@ class Contract(unittest.TestCase):
|
||||
|
||||
def test_an_effect_text_says_what_the_feature_does_in_plain_words(self):
|
||||
for s in W.SWITCHES:
|
||||
self.assertRegex(s.effect, r"Off by default" if s.default == "off" else r"[Tt]urn off", s.id)
|
||||
if not s.terminal_only:
|
||||
self.assertRegex(s.effect, r"Off by default" if s.default == "off" else r"[Tt]urn off", s.id)
|
||||
self.assertNotRegex(s.effect, r"STRATA_|DS4_|--|env", s.id)
|
||||
self.assertEqual(W.SWITCHES[0].effect, "Reads very long prompts faster by approximating part of the work. Off by default: answers about long documents can miss or mix up details.")
|
||||
|
||||
@@ -67,6 +75,59 @@ class Contract(unittest.TestCase):
|
||||
self.assertEqual(ids({**DEEPSEEK, "backend": "cuda"}, [RTX]), ["deepseek_speedups"])
|
||||
self.assertEqual(ids({"exe": "C:/x/strata-dsv41.exe"}, [RTX]), ["deepseek_speedups"], "found by the engine's name too")
|
||||
|
||||
def test_faster_answers_on_12gb_nvidia_cards_only_where_the_engine_routing_default_applies(self):
|
||||
"""The engine turns residency-biased routing on by default on a DISCRETE NVIDIA card of 13 GiB or less in a CUDA build (the Flash-Next shape)."""
|
||||
self.assertEqual(ids(QWEN, [RTX3060]), ["faster_long_prompts", "faster_12gb_nvidia"])
|
||||
self.assertEqual(ids(QWEN, [RTX4070S]), ["faster_long_prompts", "faster_12gb_nvidia"])
|
||||
self.assertEqual(ids(QWEN, [{**RTX3060, "vram_gb": 13.0}]), ["faster_long_prompts", "faster_12gb_nvidia"], "13 GiB counts")
|
||||
self.assertEqual(ids(QWEN, [{**RTX3060, "vram_gb": 13.5}]), ["faster_long_prompts"])
|
||||
self.assertEqual(ids(QWEN, [RTX4060TI16]), ["faster_long_prompts"], "16 GB is not a 12 GB card")
|
||||
self.assertEqual(ids(QWEN, [RTX]), ["faster_long_prompts"])
|
||||
self.assertEqual(ids(QWEN, [RTX3060, RTX]), ["faster_long_prompts", "faster_12gb_nvidia"], "one small card among others")
|
||||
self.assertEqual(ids(QWEN, [{**RTX3060, "uma": True}]), ["faster_long_prompts"], "not a chip that shares system memory")
|
||||
self.assertEqual(ids(QWEN, [{**RTX3060, "integrated": True}]), ["faster_long_prompts"])
|
||||
self.assertEqual(ids(QWEN, [{**RTX3060, "usable": False}]), ["faster_long_prompts"])
|
||||
self.assertEqual(ids({**QWEN, "backend": "hip"}, [{"name": "AMD Radeon RX 7700 XT", "vendor": "amd", "arch": "gfx1101", "vram_gb": 12.0}]), ["faster_long_prompts"], "not a Radeon")
|
||||
self.assertEqual(ids({**QWEN, "backend": "sycl"}, [RTX3060]), [], "not a CUDA build")
|
||||
self.assertEqual(ids(QWEN36, [RTX3060]), [], "Qwen3.6-35B-A3B: the routing needs 512 experts")
|
||||
self.assertEqual(ids(DEEPSEEK, [RTX3060]), ["deepseek_speedups"])
|
||||
self.assertEqual(ids(QWEN, [{"name": "GeForce RTX 3060", "vram_gb": 12.0}]), ["faster_long_prompts", "faster_12gb_nvidia"], "no vendor reported: the name decides")
|
||||
self.assertEqual(ids(QWEN, [{"name": "Mystery card", "vram_gb": 12.0}]), ["faster_long_prompts"])
|
||||
|
||||
def test_the_12gb_switch_off_writes_route_prior_zero_and_on_removes_it(self):
|
||||
env = {"PATH": "/bin"}
|
||||
off = W.set_switch(env, "faster_12gb_nvidia", False)
|
||||
self.assertEqual(off, {"PATH": "/bin", "STRATA_ROUTE_PRIOR": "0"})
|
||||
self.assertFalse(W.is_on(off, "faster_12gb_nvidia"))
|
||||
self.assertTrue(W.is_on({}, "faster_12gb_nvidia"))
|
||||
self.assertEqual(W.set_switch(off, "faster_12gb_nvidia", True), env)
|
||||
self.assertTrue(W.is_on({"STRATA_ROUTE_PRIOR": "2.0"}, "faster_12gb_nvidia"), "any other value is the user's own and reads as the default")
|
||||
|
||||
def test_deepseek_off_writes_the_master_switch_and_the_six_and_on_removes_all_seven(self):
|
||||
env = {"DS4_ASYNC_T": "4"}
|
||||
off = W.set_switch(env, "deepseek_speedups", False)
|
||||
self.assertEqual(list(off)[:2], ["DS4_ASYNC_T", "DS4_DEFAULTS"], "the master switch first")
|
||||
self.assertEqual(off, {"DS4_ASYNC_T": "4", "DS4_DEFAULTS": "026", **{k: "0" for k in SIX}})
|
||||
self.assertFalse(W.is_on(off, "deepseek_speedups"))
|
||||
self.assertEqual(W.set_switch(off, "deepseek_speedups", True), env)
|
||||
# an earlier test build wrote only the six: it still reads as off, and turning it on removes them
|
||||
six = {"DS4_ASYNC_T": "4", **{k: "0" for k in SIX}}
|
||||
self.assertFalse(W.is_on(six, "deepseek_speedups"))
|
||||
self.assertEqual(W.set_switch(six, "deepseek_speedups", True), env)
|
||||
self.assertTrue(W.is_on({"DS4_DEFAULTS": "026"}, "deepseek_speedups"), "the master switch alone is not the whole switch: a hand-edited file is left alone")
|
||||
|
||||
def test_the_terminal_only_switch_is_for_qwen_and_never_in_the_app(self):
|
||||
sw = W.BY_ID["qwen_defaults_026"]
|
||||
self.assertTrue(sw.terminal_only)
|
||||
self.assertEqual(dict(sw.env), {"STRATA_DEFAULTS": "026"})
|
||||
self.assertNotIn("qwen_defaults_026", [s.id for s in W.app_switches()])
|
||||
for cfg, gpus in ((QWEN, [RTX]), (QWEN36, [RTX]), ({**QWEN, "backend": "sycl"}, []), ({**QWEN, "backend": "cpu"}, [])):
|
||||
self.assertIn("qwen_defaults_026", [s.id for s in W.applicable(cfg, gpus)])
|
||||
self.assertNotIn("qwen_defaults_026", [s.id for s in W.applicable(DEEPSEEK, [RTX])], "DeepSeek has its own master switch (DS4_DEFAULTS)")
|
||||
self.assertEqual(W.set_switch({"PATH": "/bin"}, sw, True), {"PATH": "/bin", "STRATA_DEFAULTS": "026"})
|
||||
self.assertFalse(W.is_on({}, sw))
|
||||
self.assertEqual(W.set_switch({"STRATA_DEFAULTS": "026"}, sw, False), {})
|
||||
|
||||
def test_faster_long_prompts_is_for_qwen38_flash_next_only(self):
|
||||
"""KVA was measured on the 48-layer / 512-expert Flash-Next shape and the engine declines other shapes: no row for Qwen3.6-35B-A3B (arch qwen35moe) or DeepSeek."""
|
||||
self.assertEqual(ids(QWEN36, [RTX]), [], "Qwen3.6-35B-A3B on CUDA: no KVA row")
|
||||
@@ -130,10 +191,23 @@ class Terminal(unittest.TestCase):
|
||||
def names(cfg, gpus, extra=None):
|
||||
rows = P.build_rows(None, cfg["args"], None, cfg["env"], None, extra or {}, P.switch_params(W.applicable(cfg, gpus)))
|
||||
return [r.name for r in rows if r.name in W.env_names()]
|
||||
self.assertEqual(names(QWEN, [RTX]), ["STRATA_KVA"])
|
||||
self.assertEqual(names({**QWEN, "backend": "hip"}, [R9700]), ["STRATA_KVA", "STRATA_PCIE_FRAC_DEFAULT"])
|
||||
self.assertEqual(names(DEEPSEEK, [R9700]), list(ENV["deepseek_speedups"]), "the six, in the contract order")
|
||||
self.assertEqual(names({**QWEN, "backend": "sycl"}, [R9700]), [])
|
||||
# (STRATA_DEFAULTS, the Qwen "0.2.6 behaviour" row, closes every Qwen table; the DeepSeek table has DS4_DEFAULTS instead)
|
||||
self.assertEqual(names(QWEN, [RTX]), ["STRATA_KVA", "STRATA_DEFAULTS"])
|
||||
self.assertEqual(names(QWEN, [RTX3060]), ["STRATA_KVA", "STRATA_ROUTE_PRIOR", "STRATA_DEFAULTS"])
|
||||
self.assertEqual(names({**QWEN, "backend": "hip"}, [R9700]), ["STRATA_KVA", "STRATA_PCIE_FRAC_DEFAULT", "STRATA_DEFAULTS"])
|
||||
self.assertEqual(names(DEEPSEEK, [R9700]), list(ENV["deepseek_speedups"]), "the master switch and the six, in the contract order")
|
||||
self.assertEqual(names({**QWEN, "backend": "sycl"}, [R9700]), ["STRATA_DEFAULTS"])
|
||||
self.assertEqual(names(QWEN36, [RTX]), ["STRATA_DEFAULTS"])
|
||||
|
||||
def test_the_qwen_0_2_6_row_in_the_advanced_table(self):
|
||||
rows = P.build_rows(None, QWEN["args"], None, QWEN["env"], None, {}, P.switch_params(W.applicable(QWEN, [RTX])))
|
||||
row = next(r for r in rows if r.name == "STRATA_DEFAULTS")
|
||||
self.assertEqual((row.default, row.yours, row.known), ("off", "", True))
|
||||
self.assertIn("Qwen: 0.2.6 behaviour", row.description)
|
||||
self.assertIn("off by default; set 026 to turn on", row.description)
|
||||
cfg = derive_config(QWEN, S.LaunchSettings(extra=S.settings_from_pairs(["STRATA_DEFAULTS=026"])), bool_flags=frozenset())
|
||||
self.assertEqual(cfg["env"], {**QWEN["env"], "STRATA_DEFAULTS": "026"})
|
||||
self.assertEqual(derive_config(QWEN, S.LaunchSettings(), bool_flags=frozenset())["env"], QWEN["env"], "a default launch carries nothing")
|
||||
|
||||
def test_a_row_shows_its_default_until_it_is_changed_and_explains_itself(self):
|
||||
rows = P.build_rows(None, QWEN["args"], None, QWEN["env"], None, {}, P.switch_params(W.applicable(QWEN, [RTX])))
|
||||
@@ -151,7 +225,7 @@ class Terminal(unittest.TestCase):
|
||||
|
||||
def test_the_six_deepseek_rows_say_they_go_together(self):
|
||||
text = W.env_words("DS4_COPY_PIN")
|
||||
self.assertIn("all 6 speed-up rows go together", text)
|
||||
self.assertIn("all 7 speed-up rows go together", text)
|
||||
self.assertEqual({W.env_names()[n].id for n in ENV["deepseek_speedups"]}, {"deepseek_speedups"})
|
||||
|
||||
|
||||
@@ -159,15 +233,16 @@ class SameAsTheApp(unittest.TestCase):
|
||||
@unittest.skipUnless(shutil.which("node"), "node is not installed")
|
||||
def test_the_apps_table_has_the_same_names_and_words(self):
|
||||
script = ("import {SPEED_SWITCHES} from './apps/host/server/native-settings.mjs';"
|
||||
"console.log(JSON.stringify(SPEED_SWITCHES.map(s=>({id:s.id,label:s.label,hint:s.hint,default:s.default,env:s.env}))))")
|
||||
"console.log(JSON.stringify(SPEED_SWITCHES.map(s=>({id:s.id,label:s.label,hint:s.hint,default:s.default,env:s.env,legacy:s.legacy??{}}))))")
|
||||
out = subprocess.run(["node", "--input-type=module", "-e", script], cwd=ROOT, capture_output=True, text=True, timeout=60, check=True).stdout
|
||||
app = json.loads(out)
|
||||
self.assertEqual([a["id"] for a in app], [s.id for s in W.SWITCHES])
|
||||
for a, s in zip(app, W.SWITCHES):
|
||||
self.assertEqual([a["id"] for a in app], [s.id for s in W.app_switches()], "the Terminal-only switch is not in the app's table")
|
||||
for a, s in zip(app, W.app_switches()):
|
||||
self.assertEqual(a["label"], s.label)
|
||||
self.assertEqual(a["hint"], s.effect, s.id)
|
||||
self.assertEqual(a["env"], dict(s.env), s.id)
|
||||
self.assertEqual(a["default"], s.default, s.id)
|
||||
self.assertEqual(a["legacy"], dict(s.legacy), s.id)
|
||||
|
||||
|
||||
if __name__ == "__main__":
|
||||
|
||||
Reference in new issue
Block a user