Skip to content

Commit

Permalink
Fix Metal multidimensional copy.
Browse files Browse the repository at this point in the history
  • Loading branch information
mcourteaux committed Feb 20, 2025
1 parent dcb5802 commit 14c5a3c
Showing 1 changed file with 4 additions and 3 deletions.
7 changes: 4 additions & 3 deletions src/runtime/metal.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -301,8 +301,8 @@ namespace {
void do_device_to_device_copy(void *user_context, mtl_blit_command_encoder *encoder,
const device_copy &c, uint64_t src_offset, uint64_t dst_offset, int d) {
if (d == 0) {
buffer_to_buffer_1d_copy(encoder, ((device_handle *)c.src)->buf, c.src_begin,
((device_handle *)c.dst)->buf, c.dst_begin, c.chunk_size);
buffer_to_buffer_1d_copy(encoder, ((device_handle *)c.src)->buf, src_offset,
((device_handle *)c.dst)->buf, dst_offset, c.chunk_size);
} else {
// TODO: deal with negative strides. Currently the code in
// device_buffer_utils.h does not do so either.
Expand Down Expand Up @@ -1108,7 +1108,8 @@ WEAK int halide_metal_buffer_copy(void *user_context, struct halide_buffer_t *sr
const char *buffer_label = "halide_metal_buffer_copy";
mtl_command_buffer *blit_command_buffer = new_command_buffer(metal_context.queue, buffer_label, strlen(buffer_label));
mtl_blit_command_encoder *blit_encoder = new_blit_command_encoder(blit_command_buffer);
do_device_to_device_copy(user_context, blit_encoder, c, ((device_handle *)c.src)->offset + c.src_begin,
do_device_to_device_copy(user_context, blit_encoder, c,
((device_handle *)c.src)->offset + c.src_begin,
((device_handle *)c.dst)->offset + c.dst_begin, dst->dimensions);
end_encoding(blit_encoder);
commit_command_buffer(blit_command_buffer);
Expand Down

0 comments on commit 14c5a3c

Please sign in to comment.