Repository navigation
feat(compile): prepare tensor inputs for document compression - #12
Open
yu-chen-code wants to merge 1 commit into
Open
yu-chen-code wants to merge 1 commit into
yu-chen-code wants to merge 1 commit into
Conversation
yu-chen-code
force-pushed
the
feat-graph-packed-metadata
branch
from
November 9, 2026 11:24
b7c7b9c to
cc5e077
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.
What type of PR is this?
/kind feature
What does this PR do / why do we need it:
Refreshed on 2026-11-09 against fork/upstream master
a6be99d3. PR1421 is now merged upstream, so its duplicate prerequisite has been removed. Current head:cc5e07742b4cebd421cedb340ac3fcaa3b000947; retained feature/dependency commits:cc5e0774. Git range-diff confirms unchanged feature patches. Focused CPU regression on this exact head: 110 JUnit records, 0 failures, 0 errors. The isolated refresh environments now include master-required PEFT 0.21.2 and accelerate 1.13.0; pip check passes. All numerical runs and older source hashes below are pre-refresh evidence. NPU precision training and formal upstream CI were not rerun for this rebase.Separate CPU document-boundary planning from graph replay for document-local compression.
DocumentCompressionPlan.prepare(device)reuses the existing plan to materialize row indices and original block-start positions before capture. The resultingPreparedCompressionPlanis a pytree: its two index tensors are runtime inputs, while only the model's compression ratio is static.Its pooling and rotary-position selection avoid Python document loops during replay. Pooling shares the original FP32-softmax helper with the eager plan, preserving its numerical formula and dtype. A single captured joint graph can consume changing document boundaries and complete-block counts at a fixed sequence length.
This is the CP1 metadata foundation, not complete packed DeepSeek-V4.1 DSA support. Multi-rank CP preparation is rejected. The existing model runtime and DSA/Indexer packing-only admission guard remain unchanged: consuming these prepared tensors in native DSA and replacing the Indexer's document loops are separate follow-up work. No fused-attention math or model-specific behavior is added to the compiler.
Validation:
torch.equalacross 1200 recorded gradient/parameter/Adam tensors. CPU before/after eager and dynamic-graph runs also passed.ValueError: packing-only graph inputs require compression and indexing to be disabled, confirming this PR does not silently admit unsupported native DSA/Indexer execution.Exact source manifests, commands, before/after tensor receipts and raw failures are retained under T020 runs/20261106-graph-capability-spikes. No formal upstream gate is requested or claimed.
Which issue(s) this PR fixes:
None.
Code review checklist [illustration]: