Repository navigation
Clear deferred-free state when the custom GPU allocator frees a block - #1375
Merged
biochem-fan merged 1 commit intoOct 15, 2026
Merged
Conversation
…3dem#1374) _free() marked a block free but kept its freeWhenReady flag and its completed readyEvent, which AccPtr::freeDevice() sets on most frees. Since 3dem#1369, alloc() can return a free block itself on an exact fit, so the next _freeReadyAllocs() freed it again under its new owner, and the owner's own free then hit a block that was already freed or merged away. Destroy the event and clear freeWhenReady in _free(), so a free block carries no pending deferred free. The HIP allocator has the same code. Fixes 3dem#1374 Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
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.
Fixes #1374.
_free()marks a block free but keeps itsfreeWhenReadyflag and completedreadyEvent, whichAccPtr::freeDevice()sets on most frees. Since #1369,alloc()can hand that block back out on an exact fit, so the next_freeReadyAllocs()frees it again under its new owner, and the owner's own free then hits a block that was already freed or merged away.This destroys the event and clears
freeWhenReadyin_free(), so a free block carries no pending deferred free. The HIP allocator has the same code and gets the same change; only CUDA was tested.Testing: the command from #1374 on an NVIDIA L40S, with RELION built from 108ef3c (allocator code identical to the current
ver5.1), CUDA 12.8 and gcc 12.4. Without this patch it segfaults inCudaCustomAllocator::_freein the first expectation iteration; with this patch the refinement runs through.🤖 Generated with Claude Code