Repository navigation
fix(cpu-moe): size the CPU pool to the cgroup CPU quota - #931
Draft
RaunakGengiti2725 wants to merge 1 commit into
Draft
RaunakGengiti2725 wants to merge 1 commit into
RaunakGengiti2725 wants to merge 1 commit into
Conversation
With an automatic thread count the spinning pool took one thread per physical core, even in a container whose CPU quota is below that. It now takes at most floor(quota) - 3, where the quota is the smallest cpu.max of the process's cgroup and its parents (cgroup v1 files as a fallback). With an explicit --moe-cpu-threads, or a cgroup without a quota, the pool size is unchanged; the torch intra-op thread clamp counts the quota in both the automatic and the explicit case. The 3 is measured on two machines: 2.08 CPUs left beside the pool was throttled, 2.44 and 3.08 were not.
4 tasks done
This branch has not been deployed
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.
Fixes #938.
With
--moe-cpu-threadsunset, the spinning pool took every physical core, even under a smaller container CPU quota, so hybrid decode ran 5x slower. It now takes at mostfloor(quota) - 3cores (coordinator included), the quota being the smallestcpu.maxof the cgroup and its parents (v1 as fallback), and logs the cap. With an explicit count or no quota the pool is unchanged; the torch intra-op thread clamp counts the quota even with an explicit count (no unit test).A/B against main 2fb371e. GPU RTX 5090 (575 W), CPU EPYC 9354, driver 615.71.09, checkpoint
nvidia/Qwen3.6-35B-A3B-NVFP4,cpu.max15.36 CPUs of 128 visible. Both arms, sameFREETOKEN_BENCHBW_PATH:ft serve --model nvidia/Qwen3.6-35B-A3B-NVFP4 --enable-timings-report --moe-strategy hybrid --moe-cache-rate 0.2 --max-running-requests 1,--moe-cpu-threadsunset.Server timings; 2 passes, 256 warm-up, 512 timed tokens, 2 rounds reversed. The branch logged
CPU MoE pool: 12 of 64 physical cores, to fit the cgroup CPU quota of 15.36 CPUs.Tests (10 CPU-only cases in
tests/moe/test_cpu_moe_fp8_block.py, run on a Mac) fail if the pool stops leaving 3 CPUs, takes the nearest quota, lets amaxlevel end the walk, loses the v1 fallback, or caps an explicit count. Removingreps = reps[:fit]fails 4.Tested on real hardware by me.