converting assert to throw to accomodate legacy API where the lock() was possible to be called

This commit is contained in:
myshevts 2021-12-02 17:02:47 +03:00
parent 84017fae8c
commit d841404903

View File

@ -306,7 +306,8 @@ gpu_usm::gpu_usm(ocl_engine* engine, const layout& layout, allocation_type type)
}
void* gpu_usm::lock(const stream& stream, mem_lock_type /*type*/) {
assert(get_allocation_type() != allocation_type::usm_device && "Can't lock usm device memory!");
if (get_allocation_type() == allocation_type::usm_device)
throw std::runtime_error("[GPU] Can't lock usm device memory! ");
std::lock_guard<std::mutex> locker(_mutex);
if (0 == _lock_count) {
stream.finish(); // Synchronization needed for OOOQ.