Repository navigation
Conversation
This was referenced Nov 17, 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
Root cause:
gptqmodel/_alloc_conf.pyinstalledPYTORCH_ALLOC_CONF='expandable_segments:True,max_split_size_mb:256,garbage_collection_threshold:0.7'on every backend, including CUDA.max_split_size_mb:256caps the largest block the allocator is willing to split, so a freed 256 MiB block cannot serve the next layer's slightly smaller request. GPTQ's per-layer Hessian/workspace churn then maps new pages instead of reusing the cache: reserved VRAM grows per layer while active memory stays flat (measured 1.23 GiB allocated vs 5.40 GiB reserved;expandable_segments:Truealone reserves 1.67 GiB).What Changed
expandable_segments:Trueonly;max_split_size_mbis removed. Expandable segments is the knob that actually removes the fragmentation cliff.garbage_collection_threshold:0.7is dropped rather than paired with a memory fraction: it is a ratio of the device's total memory (0.7 on a 48 GiB card only collects above ~33 GiB), so it never fired during the reported run. Setting a process memory fraction would cap the allocator and trade the reservation for OOMs.max_split_size_mb:256,garbage_collection_threshold:0.7, noexpandable_segments): [BUG] AWQ quantization grows reserved VRAM by ~1 GiB per layer on ROCm (256 MiB segments never reused), starving other processes on the GPU #4313's regression tests pin this exact value and the ROCm path already mitigates the 256 MiB split cap with a per-layerempty_cache(). Changing it is a separate ROCm decision.default_alloc_conf(backend=None)now accepts an explicit"cuda"/"rocm"so the policy is unit-testable without a device; the no-arg detection used by the import-time hook is unchanged.PYTORCH_ALLOC_CONF/PYTORCH_CUDA_ALLOC_CONF(andPYTORCH_HIP_ALLOC_CONFon ROCm) still wins; the new test pins that.docs/rocm-default-environment.mdupdated to describe the CUDA default.Tests
The 7 skips are the device-only tests in those files (no CUDA/ROCm device here).
End-to-end env check in a fresh interpreter:
What could not be run
test_expandable_segments_are_active_on_cudawere not executed. The fix is verified at the config/unit level against the numbers in [MEM] CUDA default alloc conf (expandable_segments + max_split_size_mb:256) grows reserved VRAM per layer during GPTQ (1B: 5.4 GiB reserved for 1.23 allocated; 8B: ~45 GiB), AllSpark keeps both weight layouts resident, CPU fp16 TorchLinear ~120x slow GEMM #4389.TorchLinearGEMM) are separate follow-ups and out of scope for this config-only PR: both need kernel/linear changes outside this PR's region, and item 2 also needs R9700/AllSpark hardware to verify.Model Support / Module Plan
N/A — no new model types or registry entries.
Fixes #4389