fix(allocator): reuse pinned free blocks - #569
Merged
voltjia merged 1 commit intoSep 11, 2026
Merged
Conversation
voltjia
merged commit Sep 11, 2026
f21b8f9
into
refactor/adopt-modern-infini-stack
8 of 9 checks passed
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
Motivation
The modern-stack PagedCompiler captures decode graphs for many batch sizes. The allocator previously refused to reuse a free block whose
pin_countwas nonzero, so each captured graph duplicated its scratch storage. At the documented NVIDIA capacity boundary, this causedPinnableBlockAllocatorallocation failures during P01 warmup and P04reset_cache.The same two-line allocator change was validated on NVIDIA A100-SXM4-80GB:
total_time=33219.85 msreset_cachetotal_time=46100.18 msAllocator tracing for P01 showed underlying allocation events falling from
17331to5097with this change.Type of Change
fix— bug fixTest Results of Involved Models on Supported Platforms
python -m unittest test.static.test_infinicore_runtime_contracts -v: 55/55 passed.python -m unittest discover -s test/static -p 'test_*.py' -v: 104/104 passed.Benchmark / Performance Impact
This is primarily a capacity and correctness fix. The successful diagnostic runs are listed under Motivation. P01 used an instrumented diagnostic library, so its wall time is not used for performance attribution; P04 was uninstrumented and completed in
46100.18 ms.Notes for Reviewers
The important invariant is that graph destruction still releases its
PinLease, and trim still refuses to free blocks with a nonzeropin_count. Reuse is allowed only after tensor owners mark the block!in_use; this restores sequential same-stream graph behavior without releasing addresses that captured graphs reference.The A100 diagnostic validation used the historical modern-stack checkout that reproduced the failures plus this allocator change. Static tests and formatting were run on the exact PR head.
CI / ChatOps
CI will be triggered manually after the PR is created.
Checklist
Title, Branch, and Commits
<type>/xxx-yyyy-zzzz.main.fixup!/squash!/wipcommits remain.Scope and Design
General Code Hygiene
C++ Specific
csrc/models/llama_legacy/.Python Specific
python/infinilm/auto_config.py.Testing
Build, CI, and Tooling
Documentation
Security and Safety