Skip to content

Make videos on the computer you already own. FreeVideo runs MiniMax H3 in as little as 8 GB of VRAM and 16 GB of RAM, and adapts its acceleration path to your hardware.

Try cheaper Windows plans before host staging and flag idle VRAM (#32)

Bowen Xue6eb1b884f7dc
diff --git a/freevideo_engine/policy.py b/freevideo_engine/policy.py
index 1dd4e43..050ecf5 100644
--- a/freevideo_engine/policy.py
+++ b/freevideo_engine/policy.py
@@ -614,6 +614,19 @@ def choose(hardware: Hardware, *, vram_gib=None, ram_gib=None, attention='auto',
# 10.00 GiB budget for a group measuring 10.53.
while head > 4 and activation_bytes(head, effective_tokens) > gpu_budget:
head //= 2
+ # The GPU-output workspace below adds the wider group's surcharge to
+ # its head-8 estimate, and a miss there moves attention outputs and
+ # residuals to host memory. Narrow the group first; the second
+ # transfer slot is given up below before anything is staged. A 32 GB
+ # RTX 4080 SUPER at 1344x768x736 fit sixteen heads by 0.10 GiB, missed
+ # their workspace by 4.77 and staged both, holding 14.5 of its 32 GB at
+ # 360-595 s/step; eight heads needed 25.07 of its 30.40 GiB budget.
+ # Without this, 26 to 30 s at 1344x768 staged and 31 to 38 s did not.
+ if not small and not ampere:
+ while head > 8 and (windows_gpu_output_workspace(effective_tokens, prefetch=False)
+ + activation_bytes(head, effective_tokens)
+ - activation_bytes(8, effective_tokens)) > gpu_budget:
+ head //= 2
else:
# The widest group the request can afford at its own token count.
# A fixed budget threshold cannot express this: 41472 tokens take
@@ -835,6 +848,11 @@ def choose(hardware: Hardware, *, vram_gib=None, ram_gib=None, attention='auto',
if host_need > ram_budget >= (50 - without_slot) * block_bytes + int(2.5 * GiB):
prefetch = False
windows_workspace -= BLOCK_BYTES
+ # The second transfer slot is worth about 2.5%; host attention outputs
+ # and a host residual cost 15% to 2x. Give up the slot first.
+ if prefetch and windows_workspace > gpu_budget >= windows_workspace - BLOCK_BYTES:
+ prefetch = False
+ windows_workspace -= BLOCK_BYTES
resident = min(resident, max(0, int((gpu_budget - windows_workspace) / block_bytes)))
# Do not enable FF recomputation merely to retain all host mappings.
# Native 5060 Ti measurements show that doing so makes the same layer
diff --git a/freevideo_engine/support_report.py b/freevideo_engine/support_report.py
index e3a5f4b..d1e920a 100644
--- a/freevideo_engine/support_report.py
+++ b/freevideo_engine/support_report.py
@@ -88,6 +88,22 @@ def summarize(report, engine, encoding):
hints.append(dict(kind='configuration', message='CPU attention/residual staging is active. Check live VRAM and '
'policy decisions before attributing slow sampling to GPU compute.',
message_zh='已启用 attention 输出或残差的 CPU 暂存;需结合当时剩余显存及策略理由判断采样变慢原因。'))
+ passes = engine.get('sampling_passes')
+ for index, row in enumerate(passes if isinstance(passes, list) else [], 1):
+ # Staging is a capacity route. Several GiB of the budget left unused
+ # means the plan was more conservative than the request needed, as in
+ # issue #30: 13.5 of 30.3 GiB on a 32 GB card.
+ staged = mapping(mapping(row).get('compute_configuration'))
+ admission = mapping(mapping(row).get('pass_cache_admission'))
+ budget, peak = number(admission.get('gpu_budget_bytes')), number(admission.get('measured_peak_reserved_bytes'))
+ if (staged.get('attention_cpu_outputs') or staged.get('residual_offload')) and budget and peak \
+ and budget - peak >= 4 * 2**30:
+ hints.append(dict(kind='needs_investigation',
+ message='Sampling pass %d staged in host memory while its peak used %.1f of a %.1f GiB VRAM budget. '
+ 'The plan may be more conservative than this request needs; please report it with this file.'
+ % (index, peak / 2**30, budget / 2**30),
+ message_zh='第 %d 遍采样启用了内存暂存,但峰值只用了 %.1f/%.1f GiB 显存预算,策略可能过于保守,请附上本文件反馈。'
+ % (index, peak / 2**30, budget / 2**30)))
reserved = number(engine.get('torch_peak_reserved_bytes'))
capacity = number(hardware.get('vram_total'))
if hardware.get('system') == 'Windows' and reserved and capacity and reserved > capacity: