Skip to content

Commit

Permalink
[HIPIFY] CUDA 10.1 Runtime API support
Browse files Browse the repository at this point in the history
  • Loading branch information
emankov committed Apr 10, 2019
1 parent 472f7df commit d2d2889
Show file tree
Hide file tree
Showing 3 changed files with 32 additions and 0 deletions.
10 changes: 10 additions & 0 deletions docs/markdown/CUDA_Runtime_API_functions_supported_by_HIP.md
Expand Up @@ -60,6 +60,7 @@
| `cudaStreamBeginCapture` | |
| `cudaStreamEndCapture` | |
| `cudaStreamIsCapturing` | |
| `cudaStreamGetCaptureInfo` | |
| `cudaStreamCreate` | `hipStreamCreate` |
| `cudaStreamCreateWithFlags` | `hipStreamCreateWithFlags` |
| `cudaStreamCreateWithPriority` | `hipStreamCreateWithPriority` |
Expand All @@ -69,6 +70,7 @@
| `cudaStreamQuery` | `hipStreamQuery` |
| `cudaStreamSynchronize` | `hipStreamSynchronize` |
| `cudaStreamWaitEvent` | `hipStreamWaitEvent` |
| `cudaThreadExchangeStreamCaptureMode` | |

## **5. Event Management**

Expand Down Expand Up @@ -396,6 +398,7 @@
| `cudaGraphHostNodeGetParams` | |
| `cudaGraphHostNodeSetParams` | |
| `cudaGraphInstantiate` | |
| `cudaGraphExecKernelNodeSetParams` | |
| `cudaGraphKernelNodeGetParams` | |
| `cudaGraphKernelNodeSetParams` | |
| `cudaGraphLaunch` | |
Expand Down Expand Up @@ -784,6 +787,8 @@
| 83 |*`cudaErrorSystemNotReady`* | |
| 84 |*`cudaErrorIllegalState`* | |
| 127 |*`cudaErrorStartupFailure`* | |
| 803 |*`cudaErrorSystemDriverMismatch`* | |
| 804 |*`cudaErrorCompatNotSupportedOnDevice`* | |
| 900 |*`cudaErrorStreamCaptureUnsupported`* | |
| 901 |*`cudaErrorStreamCaptureInvalidated`* | |
| 902 |*`cudaErrorStreamCaptureMerge`* | |
Expand All @@ -792,6 +797,7 @@
| 905 |*`cudaErrorStreamCaptureIsolation`* | |
| 906 |*`cudaErrorStreamCaptureImplicit`* | |
| 907 |*`cudaErrorCapturedEvent`* | |
| 908 |*`cudaErrorStreamCaptureWrongThread`* | |
| 10000 |*`cudaErrorApiFailureBase`* | |
| enum |***`cudaFuncCache`*** |***`hipFuncCache_t`*** |
| 0 |*`cudaFuncCachePreferNone`* |*`hipFuncCachePreferNone`* |
Expand Down Expand Up @@ -906,6 +912,10 @@
| 0 |*`cudaStreamCaptureStatusNone`* | |
| 1 |*`cudaStreamCaptureStatusActive`* | |
| 2 |*`cudaStreamCaptureStatusInvalidated`* | |
| enum |***`cudaStreamCaptureMode`*** | |
| 0 |*`cudaStreamCaptureModeGlobal`* | |
| 1 |*`cudaStreamCaptureModeThreadLocal`* | |
| 2 |*`cudaStreamCaptureModeRelaxed`* | |
| enum |***`cudaSurfaceBoundaryMode`*** |***`hipSurfaceBoundaryMode`*** |
| 0 |*`cudaBoundaryModeZero`* |*`hipBoundaryModeZero`* |
| 1 |*`cudaBoundaryModeClamp`* |*`hipBoundaryModeClamp`* |
Expand Down
6 changes: 6 additions & 0 deletions hipify-clang/src/CUDA2HIP_Runtime_API_functions.cpp
Expand Up @@ -131,12 +131,16 @@ const std::map<llvm::StringRef, hipCounter> CUDA_RUNTIME_FUNCTION_MAP{
{"cudaStreamGetPriority", {"hipStreamGetPriority", "", CONV_STREAM, API_RUNTIME}},
// cuStreamIsCapturing
{"cudaStreamIsCapturing", {"hipStreamIsCapturing", "", CONV_STREAM, API_RUNTIME, HIP_UNSUPPORTED}},
// cuStreamGetCaptureInfo
{"cudaStreamGetCaptureInfo", {"hipStreamGetCaptureInfo", "", CONV_STREAM, API_RUNTIME, HIP_UNSUPPORTED}},
// cuStreamQuery
{"cudaStreamQuery", {"hipStreamQuery", "", CONV_STREAM, API_RUNTIME}},
// cuStreamSynchronize
{"cudaStreamSynchronize", {"hipStreamSynchronize", "", CONV_STREAM, API_RUNTIME}},
// cuStreamWaitEvent
{"cudaStreamWaitEvent", {"hipStreamWaitEvent", "", CONV_STREAM, API_RUNTIME}},
// cuThreadExchangeStreamCaptureMode
{"cudaThreadExchangeStreamCaptureMode", {"hipThreadExchangeStreamCaptureMode", "", CONV_STREAM, API_RUNTIME, HIP_UNSUPPORTED}},

// 5.5.Event Management
// no analogue
Expand Down Expand Up @@ -640,6 +644,8 @@ const std::map<llvm::StringRef, hipCounter> CUDA_RUNTIME_FUNCTION_MAP{
{"cudaGraphHostNodeSetParams", {"hipGraphHostNodeSetParams", "", CONV_GRAPH, API_RUNTIME, HIP_UNSUPPORTED}},
// cuGraphInstantiate
{"cudaGraphInstantiate", {"hipGraphInstantiate", "", CONV_GRAPH, API_RUNTIME, HIP_UNSUPPORTED}},
// cuGraphExecKernelNodeSetParams
{"cudaGraphExecKernelNodeSetParams", {"hipGraphExecKernelNodeSetParams", "", CONV_GRAPH, API_RUNTIME, HIP_UNSUPPORTED}},
// cuGraphKernelNodeGetParams
{"cudaGraphKernelNodeGetParams", {"hipGraphKernelNodeGetParams", "", CONV_GRAPH, API_RUNTIME, HIP_UNSUPPORTED}},
// cuGraphKernelNodeSetParams
Expand Down
16 changes: 16 additions & 0 deletions hipify-clang/src/CUDA2HIP_Runtime_API_types.cpp
Expand Up @@ -770,6 +770,10 @@ const std::map<llvm::StringRef, hipCounter> CUDA_RUNTIME_TYPE_NAME_MAP {
{"cudaErrorSystemNotReady", {"hipErrorSystemNotReady", "", CONV_NUMERIC_LITERAL, API_RUNTIME, HIP_UNSUPPORTED}}, // 83
// CUDA_ERROR_ILLEGAL_STATE = 401
{"cudaErrorIllegalState", {"hipErrorIllegalState", "", CONV_NUMERIC_LITERAL, API_RUNTIME, HIP_UNSUPPORTED}}, // 84
// CUDA_ERROR_SYSTEM_DRIVER_MISMATCH
{"cudaErrorSystemDriverMismatch", {"hipErrorSystemDriverMismatch", "", CONV_NUMERIC_LITERAL, API_RUNTIME, HIP_UNSUPPORTED}}, // 803
// CUDA_ERROR_COMPAT_NOT_SUPPORTED_ON_DEVICE
{"cudaErrorCompatNotSupportedOnDevice", {"hipErrorCompatNotSupportedOnDevice", "", CONV_NUMERIC_LITERAL, API_RUNTIME, HIP_UNSUPPORTED}}, // 804
// no analogue
{"cudaErrorStartupFailure", {"hipErrorStartupFailure", "", CONV_NUMERIC_LITERAL, API_RUNTIME, HIP_UNSUPPORTED}}, // 127
// CUDA_ERROR_STREAM_CAPTURE_UNSUPPORTED = 900
Expand All @@ -788,6 +792,8 @@ const std::map<llvm::StringRef, hipCounter> CUDA_RUNTIME_TYPE_NAME_MAP {
{"cudaErrorStreamCaptureImplicit", {"hipErrorStreamCaptureImplicit", "", CONV_NUMERIC_LITERAL, API_RUNTIME, HIP_UNSUPPORTED}}, // 906
// CUDA_ERROR_CAPTURED_EVENT = 907
{"cudaErrorCapturedEvent", {"hipErrorCapturedEvent", "", CONV_NUMERIC_LITERAL, API_RUNTIME, HIP_UNSUPPORTED}}, // 907
// CUDA_ERROR_STREAM_CAPTURE_WRONG_THREAD = 908
{"cudaErrorStreamCaptureWrongThread", {"hipErrorStreamCaptureWrongThread", "", CONV_NUMERIC_LITERAL, API_RUNTIME, HIP_UNSUPPORTED}}, // 908
// Deprecated since CUDA 4.1
{"cudaErrorApiFailureBase", {"hipErrorApiFailureBase", "", CONV_NUMERIC_LITERAL, API_RUNTIME, HIP_UNSUPPORTED}}, // 10000

Expand Down Expand Up @@ -1083,6 +1089,16 @@ const std::map<llvm::StringRef, hipCounter> CUDA_RUNTIME_TYPE_NAME_MAP {
// CU_STREAM_CAPTURE_STATUS_INVALIDATED
{"cudaStreamCaptureStatusInvalidated", {"hipStreamCaptureStatusInvalidated", "", CONV_NUMERIC_LITERAL, API_RUNTIME, HIP_UNSUPPORTED}}, // 2

// CUstreamCaptureMode
{"cudaStreamCaptureMode", {"hipStreamCaptureMode", "", CONV_TYPE, API_RUNTIME, HIP_UNSUPPORTED}},
// cudaStreamCaptureMode enum values
// CU_STREAM_CAPTURE_MODE_GLOBAL
{"cudaStreamCaptureModeGlobal", {"hipStreamCaptureModeGlobal", "", CONV_NUMERIC_LITERAL, API_RUNTIME, HIP_UNSUPPORTED}}, // 0
// CU_STREAM_CAPTURE_MODE_THREAD_LOCAL
{"cudaStreamCaptureModeThreadLocal", {"hipStreamCaptureModeThreadLocal", "", CONV_NUMERIC_LITERAL, API_RUNTIME, HIP_UNSUPPORTED}}, // 1
// CU_STREAM_CAPTURE_MODE_RELAXED
{"cudaStreamCaptureModeRelaxed", {"hipStreamCaptureModeRelaxed", "", CONV_NUMERIC_LITERAL, API_RUNTIME, HIP_UNSUPPORTED}}, // 2

// no analogue
{"cudaSurfaceBoundaryMode", {"hipSurfaceBoundaryMode", "", CONV_TYPE, API_RUNTIME}},
// cudaSurfaceBoundaryMode enum values
Expand Down

0 comments on commit d2d2889

Please sign in to comment.