[Bug] Fix DLPack field offset truncation and two allocator bugs.#768
Open
duburcqa wants to merge 4 commits into
Open
[Bug] Fix DLPack field offset truncation and two allocator bugs.#768duburcqa wants to merge 4 commits into
duburcqa wants to merge 4 commits into
Conversation
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.
Issue: N/A
Brief Summary
copilot:summary
Three host-side memory-safety fixes, found while root-causing a Genesis simulation NaN that appeared once a SNode tree grew past 2 GiB:
int(field_to_dlpack). For a field placed past 2^31 bytes in its tree, the wrapped offset failed the>= 0guard and was silently dropped, so the exported view aliased the tree base: reads returned unrelated fields and writes corrupted them. Fixed by keeping the offsetsize_t/uint64_tend to end (DLTensor::byte_offsetisuint64_t). Regression test:test_dlpack_field_offset_past_2gib(markedslow+run_in_serial, 2.24 GB allocation), verified to fail before the fix and pass after.UnifiedAllocatoroverstated the chunk tail (tail = data + size + allocation_sizeinstead ofdata + allocation_size), so a follow-up allocation could be handed an address past the real end of the mmap'd chunk. Regression test added inhost_memory_pool_test.cpp.CachingAllocator::allocatedereferenced an erased iterator (it_blk->secondaftermem_blocks_.erase(it_blk)); erase order swapped.Walkthrough
copilot:walkthrough