Repository navigation
fix: decouple inference memory settings and check budgets at startup - #70
Merged
Merged
Conversation
Three inference memory settings each controlled a second thing: the base RAM was also the unified-memory margin, the host RAM coefficient also routed GPUs, and mem_safety_factor sized feature jobs too. - structure_inference_unified_memory_margin_mb sets the spill margin - structure_inference_vram_per_token_sq_mb sets GPU routing and demand - structure_inference_mem_safety_factor overrides the factor for inference only All default to today's values. With unified memory on and the fraction auto, startup now stops with a WorkflowError when any batch's estimated budget on its smallest routed GPU is below its estimated need, unless structure_inference_skip_memory_check is set. Routing and the check share routed_tier_min_vram_gb, so they cannot disagree. The default inference retry multiplier rises from 1.1 to 1.5. Closes #66. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Three inference memory keys each controlled a second thing their names don't mention, so tuning host RAM also changed the spill margin, GPU routing or feature memory. In the October campaign,
structure_inference_ram_bytes: 60000withmem_safety_factor: 0.2set the margin above the request. That clamped theautofraction to 1.000, and about 100 AF3 jobs failed withRESOURCE_EXHAUSTED.Changes
New keys. Each defaults to today's value, so an unmodified config submits the same first attempts:
structure_inference_unified_memory_margin_mbstructure_inference_ram_bytes(spill margin)structure_inference_vram_per_token_sq_mbstructure_inference_ram_per_token_sq_mb(GPU routing)structure_inference_mem_safety_factormem_safety_factormem_safety_factor(inference only)Startup feasibility check. It runs when unified memory is on and the fraction is
auto:max_mem_mb.WorkflowError. The error names how many batches fall short, the worst batch (tokens, request, margin, VRAM, budget, need) and the knobs to adjust.structure_inference_min_gpu_vram_gbis set, andstructure_inference_skip_memory_check: truebypasses it.routed_tier_min_vram_gb()is factored out ofgpu_exclude_nodes()and used by the check, so routing and the check cannot disagree.[memory]startup lines appear whenstructure_inference_ram_bytes,structure_inference_ram_per_token_sq_mbormem_safety_factoris set explicitly. They say what each key now controls.The default
structure_inference_ram_scalinggoes from 1.1 to 1.5, in the Snakefile,config/config.yamland the README.README "Unified memory" now covers the budget formula, the three keys, why peak RSS undercounts need, and the check.
Testing
structure_inference_ram_bytes: 60000loggedmargin_mb=60000and fraction1.000for both backends. The margin now stays at the backend default, giving fractions 1.328 (AF2) and 1.502 (AF3).structure_inference_ram_per_token_sq_mbto 0.001 dropped the--excludefor a 4,608-token fold. Routing now follows onlystructure_inference_vram_per_token_sq_mb.structure_inference_mem_safety_factor: 0.5was ignored: inferencemem_mbwas 20068 where 8027 was expected. Featuremem_mbstays at 95000 either way.need_mb=95551.max_mem_mbcap.routed_tier_min_vram_gbmatchesgpu_exclude_nodesacross tiers and headroom;unified_memory_budget_shortfallsis tested across caps, tiers, margin and headroom.test_auto_fraction_margin_follows_structure_inference_ram_bytesis replaced, as the issue proposes, because it pinned the coupling being removed.Compatibility
[memory]lines say so:structure_inference_ram_bytesno longer moves the spill margin;structure_inference_ram_per_token_sq_mbno longer moves GPU routing;mem_safety_factorstill applies to both stages unlessstructure_inference_mem_safety_factoris set.structure_inference_ram_scaling: 1.1explicitly keep the old behaviour.max_mem_mbcaps a large fold below its need. The check is an estimate from the tier minima, not fromnvidia-smi. Setstructure_inference_skip_memory_check: trueto proceed anyway.Not in this PR (follow-ups listed in the issue): sizing host RAM from need minus the routed VRAM, and recording each fold's device peak memory.
Closes #66.
🤖 Generated with Claude Code