-
Notifications
You must be signed in to change notification settings - Fork 1.1k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Support copying the overlapping region from one buffer to another. #8463
base: main
Are you sure you want to change the base?
Conversation
…stead of being restricted to copy to the entire dst buffer).
One of the build bots died? Can we restart one build specifically manually? Or will everything have to rerun? |
Sorry, I had to restart the buildmaster. You may need to rerun everything :-/ |
I ran into a crash on my application. Will try to figure out what that is before I reopen for review. It seems to be an out-of-memory issue which is not reported as such. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This is just to satisfy the formatter right?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yes. I put a comment on it in the PR. I have clang-format-18, but the build bots still run clang-format-17. Version 18 wants this change for some reason.
auto result = cuda_do_multidimensional_copy(user_context, c, c.src + c.src_begin, c.dst, dst->dimensions, from_host, to_host, stream); | ||
auto result = cuda_do_multidimensional_copy( | ||
user_context, c, c.src + c.src_begin, c.dst + c.dst_begin, | ||
dst->dimensions, from_host, to_host, stream); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Adds offset for destination as well as source.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yes? I don't really know if you have a comment or are just describing.
Update, I tested this again, and I got this: Error: OpenCL error: CL_MEM_OBJECT_ALLOCATION_FAILURE buffer copy failed This seems the correct error for this case. Will reopen. |
TLDR: This PR makes it possible to copy from a smaller buffer to a bigger buffer as well (i.e. blit a buffer onto another buffer). Use case: workaround for #8235: realize pipeline to a buffer that acts as a crop, and then copy the result back.
This PR makes it possible to copy from any buffer to any other buffer with the same number of dimensions. This is in contrast to the original functionality where it tries to copy from src to the entire number of elements in the dst buffer (even if src is smaller).
dst_begin
indevice_copy
.src_begin
anddst_begin
values.CL_MISALIGNED_SUB_BUFFER_OFFSET
#8235 where I make new a new buffer that acts as a crop (but is not), and copy the result back to the original buffer after the pipeline is done.Irrelevant: my clang-format for some reason wanted to move two things in Halide::Runtime::Buffer, which is compatible with the one on the automatic test here. It seems to be the difference between clang-format-17 (github test) and clang-format-18 (my machine).