From dc16e3a7cb3bb0049266c00100b0cdced307d3ed Mon Sep 17 00:00:00 2001 From: Niko1221 Date: Wed, 21 Oct 2026 00:23:09 +0200 Subject: [PATCH] Fix #3510: on a card that shares the PC memory (Strix Halo) the Work profile no longer reserves a fifth of the shared pool as graphics memory --- apps/host/server/native-resources.mjs | 5 ++++- apps/host/tests/native-onboarding.test.mjs | 9 +++++++++ 2 files changed, 13 insertions(+), 1 deletion(-) diff --git a/apps/host/server/native-resources.mjs b/apps/host/server/native-resources.mjs index 10c82636..f42c5a35 100644 --- a/apps/host/server/native-resources.mjs +++ b/apps/host/server/native-resources.mjs @@ -30,7 +30,10 @@ export function defaultReserves(config,hardware,baselineReserve=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); - return {work:gpuMemory.length&&!headless?Math.max(safety,Math.floor(Math.min(...gpuMemory)*1024*.2)):safety,performance:safety}; + /* 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}; } /** 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 diff --git a/apps/host/tests/native-onboarding.test.mjs b/apps/host/tests/native-onboarding.test.mjs index 5db0a676..eeed9fcc 100644 --- a/apps/host/tests/native-onboarding.test.mjs +++ b/apps/host/tests/native-onboarding.test.mjs @@ -164,3 +164,12 @@ test('download-and-load prepares vision automatically while loading text only wh assert.deepEqual(JSON.parse(readFileSync(join(f.repo,'strata-iq2_xs.json'))).vision,{gpu:0}); }finally{await f.cleanup();} }); + +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 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)'); + const discrete=resourceSettings(original,{cpu:{cores:16},ram_gb:128,gpus:[{index:0,vram_gb:82,name:'a card'}]},'work'); + assert.equal(discrete.vram_reserve_mib,Math.floor(82*1024*.2),'a card with its own memory keeps its fifth'); +});