[HIP] Unify hipError_t (Step 3): Sync nvcc path (#1778)

* [HIP] Unify hipError_t (Step 3): Sync nvcc path

* [HIP][fix] Add CUDA 10.x support to nvcc path
This commit is contained in:
Evgeny Mankov
2020-01-10 11:17:18 +03:00
gecommit door Maneesh Gupta
bovenliggende 02848e0b80
commit a005a8550d
2 gewijzigde bestanden met toevoegingen van 245 en 14 verwijderingen
@@ -694,9 +694,9 @@ const std::map<llvm::StringRef, hipCounter> CUDA_RUNTIME_TYPE_NAME_MAP {
{"cudaErrorStartupFailure", {"hipErrorStartupFailure", "", CONV_NUMERIC_LITERAL, API_RUNTIME, HIP_UNSUPPORTED}}, // 127
// CUDA_ERROR_INVALID_IMAGE
{"cudaErrorInvalidKernelImage", {"hipErrorInvalidImage", "", CONV_NUMERIC_LITERAL, API_RUNTIME}}, // 200
// Typo fixed in 10.2
// CUDA_ERROR_INVALID_CONTEXT
{"cudaErrorDeviceUninitialized", {"hipErrorInvalidContext", "", CONV_NUMERIC_LITERAL, API_RUNTIME}}, // 201
// Typo fixed in 10.2
// CUDA_ERROR_INVALID_CONTEXT
{"cudaErrorDeviceUninitilialized", {"hipErrorInvalidContext", "", CONV_NUMERIC_LITERAL, API_RUNTIME}}, // 201
// CUDA_ERROR_MAP_FAILED
+244 -13
Bestand weergeven
@@ -283,8 +283,6 @@ inline static hipError_t hipCUDAErrorTohipError(cudaError_t cuError) {
return hipErrorInvalidDevicePointer;
case cudaErrorInvalidMemcpyDirection:
return hipErrorInvalidMemcpyDirection;
case cudaErrorUnknown:
return hipErrorUnknown;
case cudaErrorInvalidResourceHandle:
return hipErrorInvalidHandle;
case cudaErrorNotReady:
@@ -305,12 +303,53 @@ inline static hipError_t hipCUDAErrorTohipError(cudaError_t cuError) {
return hipErrorAssert;
case cudaErrorNotSupported:
return hipErrorNotSupported;
case cudaErrorCudartUnloading:
return hipErrorDeinitialized;
case cudaErrorInvalidKernelImage:
return hipErrorInvalidImage;
case cudaErrorUnmapBufferObjectFailed:
return hipErrorUnmapFailed;
case cudaErrorNoKernelImageForDevice:
return hipErrorNoBinaryForGpu;
case cudaErrorECCUncorrectable:
return hipErrorECCNotCorrectable;
case cudaErrorDeviceAlreadyInUse:
return hipErrorContextAlreadyInUse;
case cudaErrorInvalidPtx:
return hipErrorInvalidKernelFile;
case cudaErrorLaunchTimeout:
return hipErrorLaunchTimeOut;
#if CUDA_VERSION >= 10010
case cudaErrorInvalidSource:
return hipErrorInvalidSource;
case cudaErrorFileNotFound:
return hipErrorFileNotFound;
case cudaErrorSymbolNotFound:
return hipErrorNotFound;
case cudaErrorArrayIsMapped:
return hipErrorArrayIsMapped;
case cudaErrorNotMappedAsPointer:
return hipErrorNotMappedAsPointer;
case cudaErrorNotMappedAsArray:
return hipErrorNotMappedAsArray;
case cudaErrorNotMapped:
return hipErrorNotMapped;
case cudaErrorAlreadyAcquired:
return hipErrorAlreadyAcquired;
case cudaErrorAlreadyMapped:
return hipErrorAlreadyMapped;
#endif
#if CUDA_VERSION >= 10020
case cudaErrorDeviceUninitialized:
return hipErrorInvalidContext;
#endif
case cudaErrorUnknown:
default:
return hipErrorUnknown; // Note - translated error.
}
}
inline static hipError_t hipCUResultTohipError(CUresult cuError) { // TODO Populate further
inline static hipError_t hipCUResultTohipError(CUresult cuError) {
switch (cuError) {
case CUDA_SUCCESS:
return hipSuccess;
@@ -329,21 +368,107 @@ inline static hipError_t hipCUResultTohipError(CUresult cuError) { // TODO Popu
case CUDA_ERROR_NOT_INITIALIZED:
return hipErrorNotInitialized;
case CUDA_ERROR_INVALID_HANDLE:
return hipErrorInvalidHandle;
return hipErrorInvalidHandle;
case CUDA_ERROR_MAP_FAILED:
return hipErrorMapFailed;
return hipErrorMapFailed;
case CUDA_ERROR_PROFILER_DISABLED:
return hipErrorProfilerDisabled;
case CUDA_ERROR_PROFILER_NOT_INITIALIZED:
return hipErrorProfilerNotInitialized;
case CUDA_ERROR_PROFILER_ALREADY_STARTED:
return hipErrorProfilerAlreadyStarted;
case CUDA_ERROR_PROFILER_ALREADY_STOPPED:
return hipErrorProfilerAlreadyStopped;
case CUDA_ERROR_INVALID_IMAGE:
return hipErrorInvalidImage;
case CUDA_ERROR_CONTEXT_ALREADY_CURRENT:
return hipErrorContextAlreadyCurrent;
case CUDA_ERROR_UNMAP_FAILED:
return hipErrorUnmapFailed;
case CUDA_ERROR_ARRAY_IS_MAPPED:
return hipErrorArrayIsMapped;
case CUDA_ERROR_ALREADY_MAPPED:
return hipErrorAlreadyMapped;
case CUDA_ERROR_NO_BINARY_FOR_GPU:
return hipErrorNoBinaryForGpu;
case CUDA_ERROR_ALREADY_ACQUIRED:
return hipErrorAlreadyAcquired;
case CUDA_ERROR_NOT_MAPPED:
return hipErrorNotMapped;
case CUDA_ERROR_NOT_MAPPED_AS_ARRAY:
return hipErrorNotMappedAsArray;
case CUDA_ERROR_NOT_MAPPED_AS_POINTER:
return hipErrorNotMappedAsPointer;
case CUDA_ERROR_ECC_UNCORRECTABLE:
return hipErrorECCNotCorrectable;
case CUDA_ERROR_UNSUPPORTED_LIMIT:
return hipErrorUnsupportedLimit;
case CUDA_ERROR_CONTEXT_ALREADY_IN_USE:
return hipErrorContextAlreadyInUse;
case CUDA_ERROR_PEER_ACCESS_UNSUPPORTED:
return hipErrorPeerAccessUnsupported;
case CUDA_ERROR_INVALID_PTX:
return hipErrorInvalidKernelFile;
case CUDA_ERROR_INVALID_GRAPHICS_CONTEXT:
return hipErrorInvalidGraphicsContext;
case CUDA_ERROR_INVALID_SOURCE:
return hipErrorInvalidSource;
case CUDA_ERROR_FILE_NOT_FOUND:
return hipErrorFileNotFound;
case CUDA_ERROR_SHARED_OBJECT_SYMBOL_NOT_FOUND:
return hipErrorSharedObjectSymbolNotFound;
case CUDA_ERROR_SHARED_OBJECT_INIT_FAILED:
return hipErrorSharedObjectInitFailed;
case CUDA_ERROR_OPERATING_SYSTEM:
return hipErrorOperatingSystem;
case CUDA_ERROR_NOT_FOUND:
return hipErrorNotFound;
case CUDA_ERROR_NOT_READY:
return hipErrorNotReady;
case CUDA_ERROR_ILLEGAL_ADDRESS:
return hipErrorIllegalAddress;
case CUDA_ERROR_LAUNCH_OUT_OF_RESOURCES:
return hipErrorLaunchOutOfResources;
case CUDA_ERROR_LAUNCH_TIMEOUT:
return hipErrorLaunchTimeOut;
case CUDA_ERROR_PEER_ACCESS_ALREADY_ENABLED:
return hipErrorPeerAccessAlreadyEnabled;
case CUDA_ERROR_PEER_ACCESS_NOT_ENABLED:
return hipErrorPeerAccessNotEnabled;
case CUDA_ERROR_PRIMARY_CONTEXT_ACTIVE:
return hipErrorSetOnActiveProcess;
case CUDA_ERROR_ASSERT:
return hipErrorAssert;
case CUDA_ERROR_HOST_MEMORY_ALREADY_REGISTERED:
return hipErrorHostMemoryAlreadyRegistered;
case CUDA_ERROR_HOST_MEMORY_NOT_REGISTERED:
return hipErrorHostMemoryNotRegistered;
case CUDA_ERROR_LAUNCH_FAILED:
return hipErrorLaunchFailure;
case CUDA_ERROR_NOT_SUPPORTED:
return hipErrorNotSupported;
case CUDA_ERROR_UNKNOWN:
default:
return hipErrorUnknown; // Note - translated error.
}
}
// TODO match the error enum names of hip and cuda
inline static cudaError_t hipErrorToCudaError(hipError_t hError) {
switch (hError) {
case hipSuccess:
return cudaSuccess;
case hipErrorOutOfMemory:
return cudaErrorMemoryAllocation;
case hipErrorProfilerDisabled:
return cudaErrorProfilerDisabled;
case hipErrorProfilerNotInitialized:
return cudaErrorProfilerNotInitialized;
case hipErrorProfilerAlreadyStarted:
return cudaErrorProfilerAlreadyStarted;
case hipErrorProfilerAlreadyStopped:
return cudaErrorProfilerAlreadyStopped;
case hipErrorInvalidConfiguration:
return cudaErrorInvalidConfiguration;
case hipErrorLaunchOutOfResources:
return cudaErrorLaunchOutOfResources;
case hipErrorInvalidValue:
@@ -362,22 +487,128 @@ inline static cudaError_t hipErrorToCudaError(hipError_t hError) {
return cudaErrorNoDevice;
case hipErrorNotReady:
return cudaErrorNotReady;
case hipErrorUnknown:
return cudaErrorUnknown;
case hipErrorPeerAccessNotEnabled:
return cudaErrorPeerAccessNotEnabled;
case hipErrorPeerAccessAlreadyEnabled:
return cudaErrorPeerAccessAlreadyEnabled;
case hipErrorRuntimeMemory:
return cudaErrorUnknown; // Does not exist in CUDA
case hipErrorRuntimeOther:
return cudaErrorUnknown; // Does not exist in CUDA
case hipErrorHostMemoryAlreadyRegistered:
return cudaErrorHostMemoryAlreadyRegistered;
case hipErrorHostMemoryNotRegistered:
return cudaErrorHostMemoryNotRegistered;
case hipErrorDeinitialized:
return cudaErrorCudartUnloading;
case hipErrorInvalidSymbol:
return cudaErrorInvalidSymbol;
case hipErrorInsufficientDriver:
return cudaErrorInsufficientDriver;
case hipErrorMissingConfiguration:
return cudaErrorMissingConfiguration;
case hipErrorPriorLaunchFailure:
return cudaErrorPriorLaunchFailure;
case hipErrorInvalidDeviceFunction:
return cudaErrorInvalidDeviceFunction;
case hipErrorInvalidImage:
return cudaErrorInvalidKernelImage;
case hipErrorInvalidContext:
#if CUDA_VERSION >= 10020
return cudaErrorDeviceUninitialized;
#else
return cudaErrorUnknown;
#endif
case hipErrorMapFailed:
return cudaErrorMapBufferObjectFailed;
case hipErrorUnmapFailed:
return cudaErrorUnmapBufferObjectFailed;
case hipErrorArrayIsMapped:
#if CUDA_VERSION >= 10010
return cudaErrorArrayIsMapped;
#else
return cudaErrorUnknown;
#endif
case hipErrorAlreadyMapped:
#if CUDA_VERSION >= 10010
return cudaErrorAlreadyMapped;
#else
return cudaErrorUnknown;
#endif
case hipErrorNoBinaryForGpu:
return cudaErrorNoKernelImageForDevice;
case hipErrorAlreadyAcquired:
#if CUDA_VERSION >= 10010
return cudaErrorAlreadyAcquired;
#else
return cudaErrorUnknown;
#endif
case hipErrorNotMapped:
#if CUDA_VERSION >= 10010
return cudaErrorNotMapped;
#else
return cudaErrorUnknown;
#endif
case hipErrorNotMappedAsArray:
#if CUDA_VERSION >= 10010
return cudaErrorNotMappedAsArray;
#else
return cudaErrorUnknown;
#endif
case hipErrorNotMappedAsPointer:
#if CUDA_VERSION >= 10010
return cudaErrorNotMappedAsPointer;
#else
return cudaErrorUnknown;
#endif
case hipErrorECCNotCorrectable:
return cudaErrorECCUncorrectable;
case hipErrorUnsupportedLimit:
return cudaErrorUnsupportedLimit;
case hipErrorContextAlreadyInUse:
return cudaErrorDeviceAlreadyInUse;
case hipErrorPeerAccessUnsupported:
return cudaErrorPeerAccessUnsupported;
case hipErrorInvalidKernelFile:
return cudaErrorInvalidPtx;
case hipErrorInvalidGraphicsContext:
return cudaErrorInvalidGraphicsContext;
case hipErrorInvalidSource:
#if CUDA_VERSION >= 10010
return cudaErrorInvalidSource;
#else
return cudaErrorUnknown;
#endif
case hipErrorFileNotFound:
#if CUDA_VERSION >= 10010
return cudaErrorFileNotFound;
#else
return cudaErrorUnknown;
#endif
case hipErrorSharedObjectSymbolNotFound:
return cudaErrorSharedObjectSymbolNotFound;
case hipErrorSharedObjectInitFailed:
return cudaErrorSharedObjectInitFailed;
case hipErrorOperatingSystem:
return cudaErrorOperatingSystem;
case hipErrorNotFound:
#if CUDA_VERSION >= 10010
return cudaErrorSymbolNotFound;
#else
return cudaErrorUnknown;
#endif
case hipErrorIllegalAddress:
return cudaErrorIllegalAddress;
case hipErrorLaunchTimeOut:
return cudaErrorLaunchTimeout;
case hipErrorSetOnActiveProcess:
return cudaErrorSetOnActiveProcess;
case hipErrorLaunchFailure:
return cudaErrorLaunchFailure;
case hipErrorNotSupported:
return cudaErrorNotSupported;
// HSA: does not exist in CUDA
case hipErrorRuntimeMemory:
// HSA: does not exist in CUDA
case hipErrorRuntimeOther:
case hipErrorUnknown:
case hipErrorTbd:
return cudaErrorUnknown; // Note - translated error.
default:
return cudaErrorUnknown; // Note - translated error.
}