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++
app: the Work profile takes 80% of the physical cores rounded up (the engine's own count at most), keeps no more than 1536 MiB on a card of 16 GB or less, and a CPU picture reader no longer raises the reserve to 2048 (RTX 5070, Gyro-S 64K: 9 workers + 2048 33 tok/s, 5 + 1536 46)
Niko1221acf63bef7312
diff --git a/apps/host/server/native-resources.mjs b/apps/host/server/native-resources.mjsindex f42c5a353..f7f14a487 100644--- a/apps/host/server/native-resources.mjs+++ b/apps/host/server/native-resources.mjs@@ -28,12 +28,16 @@ export function defaultReserves(config,hardware,baselineReserve=0){const placement=Array.isArray(config.gpu)?config.gpu:[config.gpu??0];const placed=(hardware?.gpus??[]).filter(g=>placement.includes(g.index)),gpuMemory=placed.map(g=>g.vram_gb).filter(n=>Number.isFinite(n)&&n>0);const headless=placed.length>0&&placed.every(computeOnly); // no display on the card (the desktop is on an integrated GPU): no desktop to keep room for- const floor=headless?(config.vision?ENGINE_DEFAULT_RESERVE_MIB:COMPUTE_ONLY_RESERVE_MIB):gpuMemory.length&&Math.min(...gpuMemory)>16?1024:1536;- const safety=headless?floor:Math.max(config.vision?2048:floor,baselineReserve);+ /* Only a picture reader that runs on the GPU needs VRAM of its own: the CPU reader (vision.gpu false) took the same 2048 floor and cost a 12 GB card a quarter of its expert cache (0.2.3 tuning, notes-023-tune.md). */+ const pictures=config.vision?(typeof config.vision==='object'?Boolean(config.vision.gpu):true):false;+ const floor=headless?(pictures?ENGINE_DEFAULT_RESERVE_MIB:COMPUTE_ONLY_RESERVE_MIB):gpuMemory.length&&Math.min(...gpuMemory)>16?1024:1536;+ const safety=headless?floor:Math.max(pictures?2048:floor,baselineReserve);/* A card that shares the PC's memory (Strix Halo, other APUs) has no memory of its own to keep a fifth of: that fifth is RAM, and "Leave 20% for my work" already keeps it* through the RAM budget. A fifth of the shared pool here held back 16 GB of expert cache for nothing (#3510); the display floor stays. */const shared=placed.length>0&&placed.some(g=>g.uma===true||g.unified===true);- return {work:gpuMemory.length&&!headless&&!shared?Math.max(safety,Math.floor(Math.min(...gpuMemory)*1024*.2)):safety,performance:safety};+ /* "work" keeps a fifth of the card, but on a card of 16 GB or less no more than 1536 MiB: a fifth of 12 GB (2457) cost 20% of the speed against 1536, which already leaves 1.1 GiB of VRAM free after the load (RTX 5070, Gyro-S 64K, 5 pairs; notes-023-tune.md). */+ const fifth=gpuMemory.length?Math.floor(Math.min(...gpuMemory)*1024*.2):0,cap=gpuMemory.length&&Math.min(...gpuMemory)<=16?1536:Infinity;+ return {work:gpuMemory.length&&!headless&&!shared?Math.max(safety,Math.min(fifth,cap)):safety,performance:safety};}/** The reserve the person asked for (null: nothing) and the default for each profile. A 0.2.0-beta file has the key and the same number in "args" with no note that the@@ -63,7 +67,8 @@ export function resourceSettings(config,hardware,profile,model={},values={}){const cores=Number(hardware?.cpu?.cores)||0;if(profile==='work'&&cores>1){const at=args.indexOf('--pool-workers'),previous=at>=0?Number(args[at+1]):0;- const workers=Math.max(1,Math.floor(cores*.8));remove('--pool-workers');+ /* 80% of the physical cores rounded UP, never more than the cores less the host thread (the engine's own count): floor(0.8 x 6) = 4 ran 8-10% slower than the engine's 5 on a 6-core Ryzen (notes-023-tune.md); 12 logical threads gave 9 in 0.2.1. */+ const workers=Math.max(1,Math.min(cores-1,Math.ceil(cores*.8)));remove('--pool-workers');args.push('--pool-workers',String(previous>0?Math.min(previous,workers):workers));}// Preserve calibrated worker counts and the installation's safety/vision reserve.diff --git a/apps/host/tests/native-onboarding.test.mjs b/apps/host/tests/native-onboarding.test.mjsindex eeed9fcce..a68bd9fbe 100644--- a/apps/host/tests/native-onboarding.test.mjs+++ b/apps/host/tests/native-onboarding.test.mjs@@ -17,7 +17,7 @@ test('new native downloads use the selected model root without adding a legacy stest('work profile reserves GPU memory and CPU workers while preserving model arguments',()=>{const hardware={cpu:{cores:10},gpus:[{index:0,vram_gb:24}]};- const original={gpu:0,args:['--max-context','32768','--pool-workers','10','--vram-reserve-mib','700'],vision:{gpu:0}};+ const original={gpu:0,args:['--max-context','32768','--pool-workers','10','--vram-reserve-mib','700'],vision:{gpu:true}};const work=resourceSettings(original,hardware,'work');assert.deepEqual(work.args.slice(0,2),['--max-context','32768']);assert.equal(work.args[work.args.indexOf('--pool-workers')+1],'8');@@ -100,7 +100,7 @@ test('the consumer can change resource preference later and restore full performconst performance=await finishJob(f.control,f.control.operation('load',{model:'iq2_xs',resourceProfile:'performance'}).id);assert.equal(performance.state,'done',performance.error);assert.equal(f.control.state().instances.length,1);const config=JSON.parse(readFileSync(join(f.repo,'strata-iq2_xs.json')));- assert.equal(config.ui_resource_profile,'performance');assert.equal(config.vram_reserve_mib,2048);+ assert.equal(config.ui_resource_profile,'performance');assert.equal(config.vram_reserve_mib,1024); // the fixture's picture reader is the CPU one (gpu:0): no VRAM, so the 24 GB card's 1024 floorassert.equal(config.args.includes('--pool-workers'),false);}finally{await f.cleanup();}});@@ -166,7 +166,7 @@ test('download-and-load prepares vision automatically while loading text only wh});test('a card that shares the PC memory does not hold back a fifth of the shared pool as graphics memory (#3510)',()=>{- const original={gpu:0,args:['--max-context','131072','--pool-workers','10'],vision:{gpu:0}};+ const original={gpu:0,args:['--max-context','131072','--pool-workers','10'],vision:{gpu:true}};const shared={cpu:{cores:16},ram_gb:128,gpus:[{index:0,vram_gb:82,uma:true,name:'AMD Radeon 8060S'}]};const apu=resourceSettings(original,shared,'work');assert.equal(apu.vram_reserve_mib,2048,'the display floor with pictures, not 20% of 82 GB (16 GB)');diff --git a/apps/host/tests/resource-ram.test.mjs b/apps/host/tests/resource-ram.test.mjsindex 86e29750b..aaf0c0553 100644--- a/apps/host/tests/resource-ram.test.mjs+++ b/apps/host/tests/resource-ram.test.mjs@@ -90,3 +90,28 @@ test('an engine that stopped because the GPU expert cache got no room is startedassert.equal(flag(saferStart(cfg, tenGb, undefined, 'server_exited: strata serve: verify: needs the profile-filled VRAM expert tier').config.args, '--vram-reserve-mib'), '1092', 'without the numbers: a fixed step, no model size needed');assert.equal(cfg.args[cfg.args.indexOf('--vram-reserve-mib') + 1], '2048', 'the input config is not changed');});++test('0.2.3 tuning: the Work profile takes 80% of the PHYSICAL cores rounded up, never more than the cores less the host thread', () => {+ const w = cores => Number(flag(resourceSettings({ gpu: 0, args: [] }, { cpu: { cores }, ram_gb: 64, gpus: [{ index: 0, vram_gb: 12 }] }, 'work').args, '--pool-workers'));+ assert.equal(w(6), 5, 'Ryzen 5 7600: the engine\'s own 5 (floor gave 4, 8-10% slower; 12 logical threads gave 9 in 0.2.1)');+ assert.equal(w(4), 3);+ assert.equal(w(8), 7);+ assert.equal(w(10), 8);+ assert.equal(w(12), 10);+ assert.equal(w(16), 13);+ assert.equal(w(2), 1);+ const own = { gpu: 0, args: ['--pool-workers', '3'] };+ assert.equal(flag(resourceSettings(own, { cpu: { cores: 6 }, ram_gb: 64, gpus: [] }, 'work').args, '--pool-workers'), '3', 'a count the person set stays when it is lower');+});++test('0.2.3 tuning: Work keeps a fifth of the card but no more than 1536 MiB on a card of 16 GB or less; a CPU picture reader needs no 2048 floor', () => {+ const card = gb => ({ cpu: { cores: 6 }, ram_gb: 64, gpus: [{ index: 0, vram_gb: gb, drives_display: true }] });+ assert.equal(resourceSettings({ gpu: 0, args: [] }, card(11.9), 'work').vram_reserve_mib, 1536, 'RTX 5070: 2437 gave 38 tok/s, 1536 gave 46 (Gyro-S 64K), with 1.1 GiB still free');+ assert.equal(resourceSettings({ gpu: 0, args: [] }, card(16), 'work').vram_reserve_mib, 1536);+ assert.equal(resourceSettings({ gpu: 0, args: [] }, card(24), 'work').vram_reserve_mib, 4915, 'above 16 GB the fifth stays');+ assert.equal(resourceSettings({ gpu: 0, args: [], vision: { gpu: false } }, card(12), 'performance').vram_reserve_mib, 1536, 'the CPU reader takes no VRAM');+ assert.equal(resourceSettings({ gpu: 0, args: [], vision: { gpu: false } }, card(12), 'work').vram_reserve_mib, 1536);+ assert.equal(resourceSettings({ gpu: 0, args: [], vision: { gpu: true } }, card(12), 'performance').vram_reserve_mib, 2048, 'the GPU reader keeps its 2048');+ assert.equal(resourceSettings({ gpu: 0, args: [], vision: { gpu: true } }, card(12), 'work').vram_reserve_mib, 2048);+ assert.equal(resourceSettings({ gpu: 0, args: ['--vram-reserve-mib', '3000'], user_args: ['--vram-reserve-mib', '3000'] }, card(12), 'work').vram_reserve_mib, 3000, 'the person\'s own number is kept');+});diff --git a/apps/host/tests/user-args.test.mjs b/apps/host/tests/user-args.test.mjsindex b678934a6..b3123f58a 100644--- a/apps/host/tests/user-args.test.mjs+++ b/apps/host/tests/user-args.test.mjs@@ -78,7 +78,7 @@ test('3215: a reserve of 0 is kept on both resource profiles; the safety defaultassert.equal(resourceSettings({ gpu: 0, args: [], vision: { gpu: true } }, display, 'performance').vram_reserve_mib, 2048, 'a display card with pictures: the safety default');assert.equal(resourceSettings({ gpu: 0, args: [] }, display, 'performance').vram_reserve_mib, 1536);assert.equal(resourceSettings({ gpu: 0, args: [] }, unknown, 'performance').vram_reserve_mib, 1536, 'not known to be headless: the safety default');- assert.equal(resourceSettings({ gpu: 0, args: [] }, display, 'work').vram_reserve_mib, Math.floor(12 * 1024 * 0.2));+ assert.equal(resourceSettings({ gpu: 0, args: [] }, display, 'work').vram_reserve_mib, 1536, 'a fifth of 12 GB (2457) is capped at 1536 on a card of 16 GB or less (0.2.3 tuning)');// a card that drives no display: 512 MiB (700 with pictures), and "Leave 20% for my work" has no desktop to keep room forfor (const profile of ['work', 'performance']) {assert.equal(resourceSettings({ gpu: 0, args: [] }, headless, profile).vram_reserve_mib, 512, profile);