Skip to content

Commit 6c4c00e

Browse files
committed
Handle not found for cuda
1 parent 5efadf1 commit 6c4c00e

File tree

2 files changed

+12
-1
lines changed

2 files changed

+12
-1
lines changed

offload/plugins-nextgen/cuda/dynamic_cuda/cuda.h

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -106,6 +106,7 @@ typedef enum cudaError_enum {
106106
CUDA_ERROR_INVALID_VALUE = 1,
107107
CUDA_ERROR_NO_DEVICE = 100,
108108
CUDA_ERROR_INVALID_HANDLE = 400,
109+
CUDA_ERROR_NOT_FOUND = 500,
109110
CUDA_ERROR_NOT_READY = 600,
110111
CUDA_ERROR_TOO_MANY_PEERS = 711,
111112
} CUresult;

offload/plugins-nextgen/cuda/src/rtl.cpp

Lines changed: 11 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1526,8 +1526,18 @@ static Error Plugin::check(int32_t Code, const char *ErrFmt, ArgsTy... Args) {
15261526
if (Ret != CUDA_SUCCESS)
15271527
REPORT("Unrecognized " GETNAME(TARGET_NAME) " error code %d\n", Code);
15281528

1529+
// TODO: Add more entries to this switch
1530+
ErrorCode OffloadErrCode;
1531+
switch (ResultCode) {
1532+
case CUDA_ERROR_NOT_FOUND:
1533+
OffloadErrCode = ErrorCode::NOT_FOUND;
1534+
break;
1535+
default:
1536+
OffloadErrCode = ErrorCode::UNKNOWN;
1537+
}
1538+
15291539
// TODO: Create a map for CUDA error codes to Offload error codes
1530-
return Plugin::error(ErrorCode::UNKNOWN, ErrFmt, Args..., Desc);
1540+
return Plugin::error(OffloadErrCode, ErrFmt, Args..., Desc);
15311541
}
15321542

15331543
} // namespace plugin

0 commit comments

Comments
 (0)