fix(tensor): harden #296 chunk API — range guard, n==0 no-op, self-alias rejection (release-review findings from #324)#341
Merged
Conversation
… quantizeFloatToAsym n==0 no-op, reject self-aliased accumulate increments (release-review PR #324)
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.
Addresses the three CodeRabbit findings posted on release PR #324 against the #296 Stage-2 code. All three were triaged as REAL — latent public-API hardening (no in-tree caller can reach them; each is one future caller away from silent OOB or mid-stream grid corruption):
dequantChunkToFloat: range-vs-source guard (elemOffset > norcount > n - elemOffset→ fail fast) — previously only chunk-size + alignment were checked.quantizeFloatToAsym:n == 0no-op guard in the shared static (covers FLOAT32→ASYM, which lacked the sibling guards Tasks 7/8 added elsewhere; old code readvalues[0]— UB).accumulateTensorIntoSym{FixedGrid,Rescale},accumulateTensorIntoAsymRescale): explicit self-alias rejection — the rescale engines rewrite the target's grid between phases, so an aliased increment would decode old codes against the new grid. Rejection chosen over metadata snapshotting (the funnel epilogue never aliases; simplest honest contract). Header docs updated.Strict TDD: each guard's test shown RED (no exit / silent corruption today) before the guard, GREEN after.
UnitTestTensorConversion70/70 (3 new); full ctest 72/72.🤖 Generated with Claude Code