Convert per-block routing storage from Tensor to ndarray#2
Open
lmcafee-nvidia wants to merge 3 commits intosidsingh-nvidia:siddharth/support-nemo-rl-router-replayfrom
Conversation
…ility. Move routing indices from per-request step-by-step accumulation to per-block storage on KVBlockAllocator. At request completion, routing is reconstructed by concatenating per-block routing in block order. Matched (prefix-cached) blocks retain routing from the original request, so reconstruction naturally covers all tokens including skipped prefixes. Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
Aligns with PR NVIDIA#3925's conversion of routing_indices to np.ndarray. Changes block_routing dict, store/get/reconstruct methods, and _store_routing_per_block to use numpy throughout. Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
69a0403 to
2d90296
Compare
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.
Summary
block_routingdict,store_block_routing,get_block_routing,_reconstruct_routing_from_blocks,_store_routing_per_block) fromtorch.Tensortonp.ndarray, aligning with PR Dump router recording data into a ray store for Nemo-RL NVIDIA/Megatron-LM#3925's conversion ofrouting_indicestonp.ndarray.TestPerBlockRoutingtests to use numpy (np.int16dtype,np.allclose,np.random.randint).Test plan
TestPerBlockRoutingtests pass (pytest ... ::TestPerBlockRouting -xvs)🤖 Generated with Claude Code