Skip to content

Commit 69a5d8a

Browse files
committed
[GPU] Use src buffer size for copy_to() call
1 parent 1bc6fa5 commit 69a5d8a

File tree

2 files changed

+13
-1
lines changed

2 files changed

+13
-1
lines changed

src/plugins/intel_gpu/include/intel_gpu/runtime/memory.hpp

+1-1
Original file line numberDiff line numberDiff line change
@@ -110,7 +110,7 @@ struct memory {
110110

111111
virtual event::ptr copy_to(stream& stream, memory& other, bool blocking = true) const {
112112
const auto zero_offset = 0;
113-
const auto data_size = other._bytes_count;
113+
const auto data_size = _bytes_count;
114114
return copy_to(stream, other, zero_offset, zero_offset, data_size, blocking);
115115
}
116116

src/plugins/intel_gpu/tests/unit/module_tests/usm_memory_test.cpp

+12
Original file line numberDiff line numberDiff line change
@@ -488,3 +488,15 @@ INSTANTIATE_TEST_SUITE_P(mem_test,
488488
mem_test_params{0, 79, 381},
489489
mem_test_params{100, 79, 381}),
490490
::testing::Values(false, true)));
491+
492+
TEST(mem_test, copy_small_to_large) {
493+
auto& engine = get_test_engine();
494+
auto& stream = get_test_stream();
495+
auto small_buffer_size = 2048;
496+
auto large_buffer_size = small_buffer_size * 8;
497+
498+
auto small_buffer = engine.allocate_memory({{small_buffer_size}, data_types::u8, format::bfyx});
499+
auto large_buffer = engine.allocate_memory({{large_buffer_size}, data_types::u8, format::bfyx});
500+
501+
OV_ASSERT_NO_THROW(small_buffer->copy_to(stream, *large_buffer, true));
502+
}

0 commit comments

Comments
 (0)