Vector read functions don't use command queue
- Dominant language
- C++
- Stars
- 1.7k
- Forks
- 340
- PR merge metrics
- No merged PRs in 30d
Description
I've noticed inconsistent behavior when reading values from vector using `.back()` routine. Digging it I've realized that essentially most of the vector read routines rely on the buffer_value class to read values from buffer and it uses some dummy command queue.
```
operator value_type() const
{
if(m_buffer.get()){
const context &context = m_buffer.get_context();
const device &device = context.get_device();
command_queue queue(context, device);
return detail::read_single_value(m_buffer, m_index / sizeof(T), queue);
}
else {
return m_value;
}
}
```
I suggest to add command queue argument to read routines, this way you can ensure that operations on the buffer have been performed before actually reading values from it.
Contributor guide
Assessment
This issue has not been assessed yet.