Skip to content

Commit

Permalink
throwing an exception if alloc_bo/alloc_userptrbo is failed (#7602)
Browse files Browse the repository at this point in the history
  • Loading branch information
chvamshi-xilinx authored Jun 26, 2023
1 parent b1e154b commit cf1562f
Showing 1 changed file with 6 additions and 0 deletions.
6 changes: 6 additions & 0 deletions src/runtime_src/core/edge/user/shim.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -296,6 +296,9 @@ xclAllocBO(size_t size, unsigned flags)
{
drm_zocl_create_bo info = { size, 0xffffffff, flags};
int result = ioctl(mKernelFD, DRM_IOCTL_ZOCL_CREATE_BO, &info);

if (result)
throw std::bad_alloc();

xclLog(XRT_DEBUG, "%s: size %ld, flags 0x%x", __func__, size, flags);
xclLog(XRT_INFO, "%s: ioctl return %d, bo handle %d", __func__, result, info.handle);
Expand All @@ -311,6 +314,9 @@ xclAllocUserPtrBO(void *userptr, size_t size, unsigned flags)
drm_zocl_userptr_bo info = {reinterpret_cast<uint64_t>(userptr), size, 0xffffffff, flags};
int result = ioctl(mKernelFD, DRM_IOCTL_ZOCL_USERPTR_BO, &info);

if (result)
throw std::bad_alloc();

xclLog(XRT_DEBUG, "%s: userptr %p size %ld, flags 0x%x", __func__, userptr, size, flags);
xclLog(XRT_INFO, "%s: ioctl return %d, bo handle %d", __func__, result, info.handle);

Expand Down

0 comments on commit cf1562f

Please sign in to comment.