[GPU] Friendly exception msg for alloc failure (#10953)

This commit is contained in:
Mingyu Kim 2022-03-15 15:48:31 +09:00 committed by GitHub
parent a9ff10b365
commit 0a8f97f429
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -87,7 +87,11 @@ const cl::UsmHelper& ocl_engine::get_usm_helper() const {
memory::ptr ocl_engine::allocate_memory(const layout& layout, allocation_type type, bool reset) {
if (layout.bytes_count() > get_device_info().max_alloc_mem_size) {
throw std::runtime_error("exceeded max size of memory object allocation");
std::stringstream ss;
ss << "Exceeded max size of memory object allocation: "
<< "Requested " << layout.bytes_count() << " bytes "
<< "but max alloc size is " << get_device_info().max_alloc_mem_size << " bytes";
throw std::runtime_error(ss.str());
}
if (type != allocation_type::cl_mem && !supports_allocation(type)) {