Repository navigation
Fix make_buffer_copy unfoldable gap after skipped extent-1 dimensions - #9681
Open
derek-gerstmann wants to merge 1 commit into
Open
derek-gerstmann wants to merge 1 commit into
derek-gerstmann wants to merge 1 commit into
Conversation
…#9563) Track the count of inserted non-trivial dimensions in make_buffer_copy() and use it to bound the sorted insertion search and shift loops, preventing skipped extent-1 dimensions from leaving unused {extent = 1, stride = 0} slots that block contiguous chunk folding. Fixes #9563 Co-authored-by: Copilot App <223556219+Copilot@users.noreply.github.com>
This branch has not been deployed
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
make_buffer_copy()insrc/runtime/device_buffer_utils.hskips extent-1 dimensions, but previously bounded both the sorted insertion search loop and the element-shift loop by the source dimension indexiinstead of the number of dimensions inserted so far. When an extent-1 dimension preceded a non-trivial dimension, an unused{extent = 1, stride = 0}slot remained at position 0 (or between inserted dimensions), preventing the contiguous-dimension folding loop (chunk_size == src_stride_bytes[0] && chunk_size == dst_stride_bytes[0]) from coalescing dense copies into a single chunk.Changes
src/runtime/device_buffer_utils.h:inserted) inmake_buffer_copy().copy_extent = min(src->dim[i].extent, dst->dim[i].extent)and skip dimensions wherecopy_extent == 1.insert < inserted) and shift loop (j = inserted; j > insert; j--) byinsertedrather thani.test/runtime/device_buffer_utils.cpp:test/performance/device_copy.cpp:{1, 1024, 1024, 6}).Fixes #9563
Breaking changes
None.
Checklist
Co-authored-by: Copilot App 223556219+Copilot@users.noreply.github.com