Unverified Commit 1c4aa225 authored by Robert Kimball's avatar Robert Kimball Committed by GitHub

Bug fix for invalid memory access to Constant (GPU backend) (#2162)

Fix the incorrect way to query the size of Constant tensor, which lead invalid memory access
parent 244c9fcf
......@@ -309,8 +309,7 @@ void runtime::gpu::GPU_ExternalFunction::emit_constant_declarations()
// get an allocator for transient per kernel gpu memory
runtime::gpu::GPUAllocator allocator =
m_shared_context->m_primitive_emitter->get_memory_allocator();
size_t idx = allocator.reserve_argspace(c->get_data_ptr(),
tv->size() * tv->get_element_type().size());
size_t idx = allocator.reserve_argspace(c->get_data_ptr(), tv->size());
m_writer << "static size_t " << tv->get_name() << "_idx = " << idx << ";\n";
m_writer << "static " << tv->get_element_type().c_type_string() << "* "
<< tv->get_name() << " = nullptr;\n";
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment