Skip to content

Commit bb8f4ec

Browse files
authored
[GPU] Use src buffer size for copy_to() call when called for two cldnn::memory objects (#29542)
### Details: - Use src buffer size for copy_to() call when called for two cldnn::memory objects - Simplified backport of #29534 ### Tickets: - [CVS-164403](https://jira.devtools.intel.com/browse/CVS-164403)
1 parent 88032d3 commit bb8f4ec

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_buf_to_large_with_out_of_bound_access) {
493+
auto& ocl_engine = dynamic_cast<ocl::ocl_engine&>(get_test_engine());
494+
auto& stream = get_test_stream();
495+
auto small_buffer_size = 2048;
496+
auto large_buffer_size = 3072;
497+
498+
auto small_buffer = ocl_engine.allocate_memory({{small_buffer_size}, data_types::u8, format::bfyx}, allocation_type::cl_mem, false);
499+
auto large_buffer = ocl_engine.allocate_memory({{large_buffer_size}, data_types::u8, format::bfyx}, allocation_type::cl_mem, false);
500+
501+
OV_ASSERT_NO_THROW(small_buffer->copy_to(stream, *large_buffer, true));
502+
}

0 commit comments

Comments
 (0)