SWDEV-369955 - Support hipDrvGetErrorString and hipDrvGetErrorName on Nvidia headers
Change-Id: I54cfa8faed2f45f310682625f94952aa3c2ee27f
[ROCm/hipother commit: b222f4f13d]
Esse commit está contido em:
@@ -827,6 +827,136 @@ inline static hipError_t hipCUResultTohipError(CUresult cuError) {
|
||||
}
|
||||
}
|
||||
|
||||
inline static CUresult hipErrorToCUResult(hipError_t hError) {
|
||||
switch (hError) {
|
||||
case hipSuccess:
|
||||
return CUDA_SUCCESS;
|
||||
case hipErrorOutOfMemory:
|
||||
return CUDA_ERROR_OUT_OF_MEMORY;
|
||||
case hipErrorInvalidValue:
|
||||
return CUDA_ERROR_INVALID_VALUE;
|
||||
case hipErrorInvalidDevice:
|
||||
return CUDA_ERROR_INVALID_DEVICE;
|
||||
case hipErrorDeinitialized:
|
||||
return CUDA_ERROR_DEINITIALIZED;
|
||||
case hipErrorNoDevice:
|
||||
return CUDA_ERROR_NO_DEVICE;
|
||||
case hipErrorInvalidContext:
|
||||
return CUDA_ERROR_INVALID_CONTEXT;
|
||||
case hipErrorNotInitialized:
|
||||
return CUDA_ERROR_NOT_INITIALIZED;
|
||||
case hipErrorInvalidHandle:
|
||||
return CUDA_ERROR_INVALID_HANDLE;
|
||||
case hipErrorMapFailed:
|
||||
return CUDA_ERROR_MAP_FAILED;
|
||||
case hipErrorProfilerDisabled:
|
||||
return CUDA_ERROR_PROFILER_DISABLED;
|
||||
case hipErrorProfilerNotInitialized:
|
||||
return CUDA_ERROR_PROFILER_NOT_INITIALIZED;
|
||||
case hipErrorProfilerAlreadyStarted:
|
||||
return CUDA_ERROR_PROFILER_ALREADY_STARTED;
|
||||
case hipErrorProfilerAlreadyStopped:
|
||||
return CUDA_ERROR_PROFILER_ALREADY_STOPPED;
|
||||
case hipErrorInvalidImage:
|
||||
return CUDA_ERROR_INVALID_IMAGE;
|
||||
case hipErrorContextAlreadyCurrent:
|
||||
return CUDA_ERROR_CONTEXT_ALREADY_CURRENT;
|
||||
case hipErrorUnmapFailed:
|
||||
return CUDA_ERROR_UNMAP_FAILED;
|
||||
case hipErrorArrayIsMapped:
|
||||
return CUDA_ERROR_ARRAY_IS_MAPPED;
|
||||
case hipErrorAlreadyMapped:
|
||||
return CUDA_ERROR_ALREADY_MAPPED;
|
||||
case hipErrorNoBinaryForGpu:
|
||||
return CUDA_ERROR_NO_BINARY_FOR_GPU;
|
||||
case hipErrorAlreadyAcquired:
|
||||
return CUDA_ERROR_ALREADY_ACQUIRED;
|
||||
case hipErrorNotMapped:
|
||||
return CUDA_ERROR_NOT_MAPPED;
|
||||
case hipErrorNotMappedAsArray:
|
||||
return CUDA_ERROR_NOT_MAPPED_AS_ARRAY;
|
||||
case hipErrorNotMappedAsPointer:
|
||||
return CUDA_ERROR_NOT_MAPPED_AS_POINTER;
|
||||
case hipErrorECCNotCorrectable:
|
||||
return CUDA_ERROR_ECC_UNCORRECTABLE;
|
||||
case hipErrorUnsupportedLimit:
|
||||
return CUDA_ERROR_UNSUPPORTED_LIMIT;
|
||||
case hipErrorContextAlreadyInUse:
|
||||
return CUDA_ERROR_CONTEXT_ALREADY_IN_USE;
|
||||
case hipErrorPeerAccessUnsupported:
|
||||
return CUDA_ERROR_PEER_ACCESS_UNSUPPORTED;
|
||||
case hipErrorInvalidKernelFile:
|
||||
return CUDA_ERROR_INVALID_PTX;
|
||||
case hipErrorInvalidGraphicsContext:
|
||||
return CUDA_ERROR_INVALID_GRAPHICS_CONTEXT;
|
||||
case hipErrorInvalidSource:
|
||||
return CUDA_ERROR_INVALID_SOURCE;
|
||||
case hipErrorFileNotFound:
|
||||
return CUDA_ERROR_FILE_NOT_FOUND;
|
||||
case hipErrorSharedObjectSymbolNotFound:
|
||||
return CUDA_ERROR_SHARED_OBJECT_SYMBOL_NOT_FOUND;
|
||||
case hipErrorSharedObjectInitFailed:
|
||||
return CUDA_ERROR_SHARED_OBJECT_INIT_FAILED;
|
||||
case hipErrorOperatingSystem:
|
||||
return CUDA_ERROR_OPERATING_SYSTEM;
|
||||
case hipErrorIllegalState:
|
||||
return CUDA_ERROR_ILLEGAL_STATE;
|
||||
case hipErrorNotFound:
|
||||
return CUDA_ERROR_NOT_FOUND;
|
||||
case hipErrorNotReady:
|
||||
return CUDA_ERROR_NOT_READY;
|
||||
case hipErrorIllegalAddress:
|
||||
return CUDA_ERROR_ILLEGAL_ADDRESS;
|
||||
case hipErrorLaunchOutOfResources:
|
||||
return CUDA_ERROR_LAUNCH_OUT_OF_RESOURCES;
|
||||
case hipErrorLaunchTimeOut:
|
||||
return CUDA_ERROR_LAUNCH_TIMEOUT;
|
||||
case hipErrorPeerAccessAlreadyEnabled:
|
||||
return CUDA_ERROR_PEER_ACCESS_ALREADY_ENABLED;
|
||||
case hipErrorPeerAccessNotEnabled:
|
||||
return CUDA_ERROR_PEER_ACCESS_NOT_ENABLED;
|
||||
case hipErrorSetOnActiveProcess:
|
||||
return CUDA_ERROR_PRIMARY_CONTEXT_ACTIVE;
|
||||
case hipErrorContextIsDestroyed:
|
||||
return CUDA_ERROR_CONTEXT_IS_DESTROYED;
|
||||
case hipErrorAssert:
|
||||
return CUDA_ERROR_ASSERT;
|
||||
case hipErrorHostMemoryAlreadyRegistered:
|
||||
return CUDA_ERROR_HOST_MEMORY_ALREADY_REGISTERED;
|
||||
case hipErrorHostMemoryNotRegistered:
|
||||
return CUDA_ERROR_HOST_MEMORY_NOT_REGISTERED;
|
||||
case hipErrorLaunchFailure:
|
||||
return CUDA_ERROR_LAUNCH_FAILED;
|
||||
case hipErrorCooperativeLaunchTooLarge:
|
||||
return CUDA_ERROR_COOPERATIVE_LAUNCH_TOO_LARGE;
|
||||
case hipErrorNotSupported:
|
||||
return CUDA_ERROR_NOT_SUPPORTED;
|
||||
case hipErrorStreamCaptureUnsupported:
|
||||
return CUDA_ERROR_STREAM_CAPTURE_UNSUPPORTED;
|
||||
case hipErrorStreamCaptureInvalidated:
|
||||
return CUDA_ERROR_STREAM_CAPTURE_INVALIDATED;
|
||||
case hipErrorStreamCaptureMerge:
|
||||
return CUDA_ERROR_STREAM_CAPTURE_MERGE;
|
||||
case hipErrorStreamCaptureUnmatched:
|
||||
return CUDA_ERROR_STREAM_CAPTURE_UNMATCHED;
|
||||
case hipErrorStreamCaptureUnjoined:
|
||||
return CUDA_ERROR_STREAM_CAPTURE_UNJOINED;
|
||||
case hipErrorStreamCaptureIsolation:
|
||||
return CUDA_ERROR_STREAM_CAPTURE_ISOLATION;
|
||||
case hipErrorStreamCaptureImplicit:
|
||||
return CUDA_ERROR_STREAM_CAPTURE_IMPLICIT;
|
||||
case hipErrorCapturedEvent:
|
||||
return CUDA_ERROR_CAPTURED_EVENT;
|
||||
case hipErrorStreamCaptureWrongThread:
|
||||
return CUDA_ERROR_STREAM_CAPTURE_WRONG_THREAD;
|
||||
case hipErrorGraphExecUpdateFailure:
|
||||
return CUDA_ERROR_GRAPH_EXEC_UPDATE_FAILURE;
|
||||
case hipErrorUnknown:
|
||||
default:
|
||||
return CUDA_ERROR_UNKNOWN; // Note - translated error.
|
||||
}
|
||||
}
|
||||
|
||||
inline static cudaError_t hipErrorToCudaError(hipError_t hError) {
|
||||
switch (hError) {
|
||||
case hipSuccess:
|
||||
@@ -1702,6 +1832,14 @@ inline static const char* hipGetErrorName(hipError_t error) {
|
||||
return cudaGetErrorName(hipErrorToCudaError(error));
|
||||
}
|
||||
|
||||
inline static hipError_t hipDrvGetErrorString(hipError_t error, const char** errorString) {
|
||||
return hipCUResultTohipError(cuGetErrorString(hipErrorToCUResult(error), errorString));
|
||||
}
|
||||
|
||||
inline static hipError_t hipDrvGetErrorName(hipError_t error, const char** errorString) {
|
||||
return hipCUResultTohipError(cuGetErrorName(hipErrorToCUResult(error), errorString));
|
||||
}
|
||||
|
||||
inline static hipError_t hipGetDeviceCount(int* count) {
|
||||
return hipCUDAErrorTohipError(cudaGetDeviceCount(count));
|
||||
}
|
||||
|
||||
Referência em uma Nova Issue
Bloquear um usuário