diff --git a/src/program/generate.cpp b/src/program/generate.cpp index 615a2da0..ad06c3a1 100644 --- a/src/program/generate.cpp +++ b/src/program/generate.cpp @@ -5079,7 +5079,10 @@ int main(int argc, char** argv) { size_t free_b = 0, total_b = 0; free_b = strata::core::device_free_bytes(); (void) total_b; const auto& lay = strata::kernels::cpu::expert_layout(); - const uint64_t budget = (uint64_t) o.expert_cache * lay.max_blob; // what the uniform sizing granted + // what the uniform sizing granted, in the 256-byte slots the loop below counts: the blob formats of 1280 / 2560 + // rows are whole multiples of 256 already; an NVFP4 blob's 16-byte scale tail is not, and the unrounded budget + // held one slot fewer than asked (--expert-cache 1: none) + const uint64_t budget = (uint64_t) o.expert_cache * ((lay.max_blob + 255) / 256 * 256); uint64_t used = 0; const size_t keep_free = ((size_t) o.vram_reserve_mib << 20) + (size_t) pipe_first; size_t free_room = free_b > keep_free ? free_b - keep_free : 0;