Repository navigation
fix(macaq): release dead rotation buffers before flip sweep (#4401) - #4431
Merged
Merged
Conversation
`macaq_quantize_weight` kept the pre-scaled `weight`/`hessian` and the rotated Hessian referenced through the flip sweep even though the rotated copies are the only values read afterwards. With every module of a layer quantizing concurrently, that retained three extra C^2-sized fp32 copies per module. Drop the two pre-scaled locals after rotation and the rotated Hessian after the flip metric is cloned. The packed codes and E8M0 exponents are unchanged; a CPU regression test pins the pre-fix packed bytes and asserts with weakrefs that the three buffers are dead when the sweep starts.
This was referenced Nov 16, 2026
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
macaq_quantize_weightkept the pre-scaledweight/hessianand the rotated Hessian alive through the flip sweep even though only the rotated copies are read afterwards. With every module of a layer quantizing concurrently that retained three extra C^2-sized fp32 copies per module.Addresses the MACaQ item of #4401.
What Changed
gptqmodel/nn_modules/quantizer/macaq/...: drop the two pre-scaled locals after rotation and the rotated Hessian after the flip metric is cloned.Tests
Measured on the OLMoE repro: peak RSS down 7.2% (the retained copies are per-module, so the win scales with layer width).
Logic Flow Documentation
Not applicable — local lifetime shortening inside one function; no control-flow or resolution change.
Review Requirements