Repository navigation
Conversation
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.
Change
Port the NVFP4 host-bank copy optimization to the current expert-piece loader. During CPU host-bank placement, temporarily use one PyTorch intra-op thread and restore the prior setting on success or failure. The scope is NVFP4 host banks; resident GPU packing and other expert formats retain their current threading.
The previous optimization lived in a model-specific loader, which upstream has since replaced with
build_expert_banks. This patch applies at that shared placement point. It also isolates the loader optimization from the broader GLM-5.3 Flash PR (#292).Evidence
On this host, 100 warmed 128 KiB CPU
copy_calls took 3.03–4.38 seconds with 12 intra-op threads and 0.0003 seconds with one thread. This is a microbenchmark of the copy operation, not a model startup or inference benchmark.CUDA_VISIBLE_DEVICES='' PYTHONPATH=python /home/umbrel/.venv/bin/python -m pytest tests/moe/test_expert_bank_threading.py tests/moe/test_offload.py tests/moe/test_nvfp4_backends.py -q -m 'not needs_weights': 23 passed, 14 skipped (GPU-dependent on this host).Focused Ruff F checks and
git diff --checkpass. The new test verifies bank contents, one-thread placement, and restoration after a packing error.