Unverified Commit c0b0bf8f authored by Zhiqiang Xie's avatar Zhiqiang Xie Committed by GitHub

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

Fix the incorrect way to query the size of Constant tensor, which lead invalid memory access
parent db3aa558
......@@ -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