Repository navigation
perf(tensor): streamline broadcasting and dense tensor reordering - #7
Merged
Merged
Conversation
Precompute broadcast row strides and copy contiguous trailing blocks. Preserve dense ownership and autograd registration; cover Qwen head parity. Correct empty/singleton broadcast shapes and dtype-aware permute copying.
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
0with1must stay0, not become1and read an empty tensor.matmul_rhs_T, so the output-head production code is intentionally unchanged.This is a small adaptation of local performance work to the upstream dense/eager tensor representation, not a wholesale copy of the local strided-view implementation. The separate reshape-gradient change in #6 is not duplicated here. No optimizer/hyperparameter, checkpoint format, model weights, or datasets are changed.
Validation
TokenizerHFGoldeninternally skips because no external fixture is configured: 21 exercised tests + 1 fixture-dependent skip, not 22 fully exercised tests.Reproduction commands and boundaries are in
docs/tensor_iteration_performance.md.Limits
No end-to-end speedup number is claimed for upstream. Earlier local Qwen/PIQA timing/accuracy figures used a different tensor implementation and cannot be transferred to this PR. No RSS improvement, official task accuracy, Linux runtime, Termux/phone result, or strict PyTorch/ORT numerical parity is claimed.
The existing source-archive
data/ export-ignoreissue is not part of this performance change. Use a full repository checkout for CMake's dataset-loader sources.