diff --git a/docs/markdown/CUDA_Runtime_API_functions_supported_by_HIP.md b/docs/markdown/CUDA_Runtime_API_functions_supported_by_HIP.md index 350ddd4e32..2df95177a0 100644 --- a/docs/markdown/CUDA_Runtime_API_functions_supported_by_HIP.md +++ b/docs/markdown/CUDA_Runtime_API_functions_supported_by_HIP.md @@ -1,32 +1,34 @@ +# CUDA Runtime API functions supported by HIP + **1. Device Management** | **CUDA** | **HIP** | **CUDA description** | |-----------------------------------------------------------|-------------------------------|--------------------------------------------------------------------------------------------------------------------------------| -| `cudaChooseDevice` | `hipChooseDevice` | Select compute-device which best matches criteria. | +| `cudaChooseDevice` | `hipChooseDevice` | Select compute-device which best matches criteria. | | `cudaDeviceGetAttribute` | `hipDeviceGetAttribute` | Returns information about the device. | -| `cudaDeviceGetByPCIBusId` | | Returns a handle to a compute device. | +| `cudaDeviceGetByPCIBusId` | `hipDeviceGetByPCIBusId` | Returns a handle to a compute device. | | `cudaDeviceGetCacheConfig` | `hipDeviceGetCacheConfig` | Returns the preferred cache configuration for the current device. | -| `cudaDeviceGetLimit` | `hipDeviceGetLimit` | Returns resource limits. | +| `cudaDeviceGetLimit` | `hipDeviceGetLimit` | Returns resource limits. | | `cudaDeviceGetPCIBusId` | | Returns a PCI Bus Id string for the device. | | `cudaDeviceGetSharedMemConfig` | `hipDeviceGetSharedMemConfig` | Returns the shared memory configuration for the current device. | | `cudaDeviceGetStreamPriorityRange` | | Returns numerical values that correspond to the least and greatest stream priorities. | | `cudaDeviceReset` | `hipDeviceReset` | Destroy all allocations and reset all state on the current device in the current process. | | `cudaDeviceSetCacheConfig` | `hipDeviceSetCacheConfig` | Sets the preferred cache configuration for the current device. | -| `cudaDeviceSetLimit` | `hipDeviceSetLimit` | Set resource limits. | +| `cudaDeviceSetLimit` | `hipDeviceSetLimit` | Set resource limits. | | `cudaDeviceSetSharedMemConfig` | `hipDeviceSetSharedMemConfig` | Sets the shared memory configuration for the current device. | | `cudaDeviceSynchronize` | `hipDeviceSynchronize` | Wait for compute device to finish. | | `cudaGetDevice` | `hipGetDevice` | Returns which device is currently being used. | | `cudaGetDeviceCount` | `hipGetDeviceCount` | Returns the number of compute-capable devices. | | `cudaGetDeviceFlags` | | Gets the flags for the current device. | | `cudaGetDeviceProperties` | `hipGetDeviceProperties` | Returns information about the compute-device. | -| `cudaIpcCloseMemHandle` | | Close memory mapped with cudaIpcOpenMemHandle. | -| `cudaIpcGetEventHandle` | | Gets an interprocess handle for a previously allocated event. | -| `cudaIpcGetMemHandle` | | Gets an interprocess memory handle for an existing device memory allocation. | -| `cudaIpcOpenEventHandle` | | Opens an interprocess event handle for use in the current process. | -| `cudaIpcOpenMemHandle` | | Opens an interprocess memory handle exported from another process and returns a device pointer usable in the local process. | +| `cudaIpcCloseMemHandle` | `hipIpcCloseMemHandle` | Close memory mapped with cudaIpcOpenMemHandle. | +| `cudaIpcGetEventHandle` | `hipIpcGetEventHandle` | Gets an interprocess handle for a previously allocated event. | +| `cudaIpcGetMemHandle` | `hipIpcGetMemHandle` | Gets an interprocess memory handle for an existing device memory allocation. | +| `cudaIpcOpenEventHandle` | `hipIpcOpenEventHandle` | Opens an interprocess event handle for use in the current process. | +| `cudaIpcOpenMemHandle` | `hipIpcOpenMemHandle` | Opens an interprocess memory handle exported from another process and returns a device pointer usable in the local process. | | `cudaSetDevice` | `hipSetDevice` | Set device to be used for GPU executions. | | `cudaSetDeviceFlags` | `hipSetDeviceFlags` | Sets flags to be used for device executions. | -| `cudaSetValidDevices` | | Set a list of devices that can be used for CUDA. |` +| `cudaSetValidDevices` | | Set a list of devices that can be used for CUDA. | **2. Error Handling** @@ -41,8 +43,8 @@ | **CUDA** | **HIP** | **CUDA description** | |-----------------------------------------------------------|-------------------------------|--------------------------------------------------------------------------------------------------------------------------------| -| `cudaStreamAddCallback` | | Add a callback to a compute stream. | -| `cudaStreamAttachMemAsync` | | Attach managed memory to a stream asynchronously. | +| `cudaStreamAddCallback` | `hipStreamAddCallback` | Add a callback to a compute stream. | +| `cudaStreamAttachMemAsync` | | Attach managed memory to a stream asynchronously. | | `cudaStreamCreate` | `hipStreamCreate` | Create an asynchronous stream. | | `cudaStreamCreateWithFlags` | `hipStreamCreateWithFlags` | Create an asynchronous stream. | | `cudaStreamCreateWithPriority` | | Create an asynchronous stream with the specified priority. | @@ -82,42 +84,50 @@ | **CUDA** | **HIP** | **CUDA description** | |-----------------------------------------------------------|-------------------------------|--------------------------------------------------------------------------------------------------------------------------------| -| `cudaOccupancyMaxActiveBlocksPerMultiprocessor` | | Returns occupancy for a device function. | +| `cudaOccupancyMaxActiveBlocksPerMultiprocessor` | `hipOccupancyMaxActiveBlocksPerMultiprocessor`| Returns occupancy for a device function. | | `cudaOccupancyMaxActiveBlocksPerMultiprocessorWithFlags` | | Returns occupancy for a device function with the specified flags. | -**7. Memory Management** +**7. Execution Control [deprecated since 7.0]** + +| **CUDA** | **HIP** | **CUDA description** | +|-----------------------------------------------------------|-------------------------------|--------------------------------------------------------------------------------------------------------------------------------| +| `cudaConfigureCall` | | Configure a device-launch. | +| `cudaLaunch` | | Launches a device function. | +| `cudaSetupArgument` | | Configure a device launch. | + +**8. Memory Management** | **CUDA** | **HIP** | **CUDA description** | |-----------------------------------------------------------|-------------------------------|--------------------------------------------------------------------------------------------------------------------------------| | `cudaArrayGetInfo` | | Gets info about the specified cudaArray. | | `cudaFree` | `hipFree` | Frees memory on the device. | -| `cudaFreeArray` | | Frees an array on the device. | +| `cudaFreeArray` | `hipFreeArray` | Frees an array on the device. | | `cudaFreeHost` | `hipHostFree` | Frees page-locked memory. | | `cudaFreeMipmappedArray` | | Frees a mipmapped array on the device. | | `cudaGetMipmappedArrayLevel` | | Gets a mipmap level of a CUDA mipmapped array. | | `cudaGetSymbolAddress` | | Finds the address associated with a CUDA symbol. | | `cudaGetSymbolSize` | | Finds the size of the object associated with a CUDA symbol. | -| `cudaHostAlloc` | `hipHostMalloc` | Allocates page-locked memory on the host. | -| `cudaHostGetDevicePointer` | `hipHostGetDevicePointer` | Passes back device pointer of mapped host memory allocated by cudaHostAlloc or registered by cudaHostRegister. | -| `cudaHostGetFlags` | `hipHostGetFlags` | Passes back flags used to allocate pinned host memory allocated by cudaHostAlloc. | +| `cudaHostAlloc` | `hipHostMalloc` | Allocates page-locked memory on the host. | +| `cudaHostGetDevicePointer` | `hipHostGetDevicePointer` | Passes back device pointer of mapped host memory allocated by cudaHostAlloc or registered by cudaHostRegister. | +| `cudaHostGetFlags` | `hipHostGetFlags` | Passes back flags used to allocate pinned host memory allocated by cudaHostAlloc. | | `cudaHostRegister` | `hipHostRegister` | Registers an existing host memory range for use by CUDA. | | `cudaHostUnregister` | `hipHostUnregister` | Unregisters a memory range that was registered with cudaHostRegister. | | `cudaMalloc` | `hipMalloc` | Allocate memory on the device. | | `cudaMalloc3D` | | Allocates logical 1D, 2D, or 3D memory objects on the device. | | `cudaMalloc3DArray` | | Allocate an array on the device. | -| `cudaMallocArray` | | Allocate an array on the device. | -| `cudaMallocHost` | `hipHostMalloc` | Allocates page-locked memory on the host. | +| `cudaMallocArray` | `hipMallocArray` | Allocate an array on the device. | +| `cudaMallocHost` | `hipHostMalloc` | Allocates page-locked memory on the host. | | `cudaMallocManaged` | | Allocates memory that will be automatically managed by the Unified Memory system. | | `cudaMallocMipmappedArray` | | Allocate a mipmapped array on the device. | | `cudaMallocPitch` | | Allocates pitched memory on the device. | -| `cudaMemGetInfo` | | Gets free and total device memory. | +| `cudaMemGetInfo` | `hipMemGetInfo` | Gets free and total device memory. | | `cudaMemcpy` | `hipMemcpy` | Copies data between host and device. | -| `cudaMemcpy2D` | | Copies data between host and device. | +| `cudaMemcpy2D` | `hipMemcpy2D` | Copies data between host and device. | | `cudaMemcpy2DArrayToArray` | | Copies data between host and device. | | `cudaMemcpy2DAsync` | | Copies data between host and device. | | `cudaMemcpy2DFromArray` | | Copies data between host and device. | | `cudaMemcpy2DFromArrayAsync` | | Copies data between host and device. | -| `cudaMemcpy2DToArray` | | Copies data between host and device. | +| `cudaMemcpy2DToArray` | `hipMemcpy2DToArray` | Copies data between host and device. | | `cudaMemcpy2DToArrayAsync` | | Copies data between host and device. | | `cudaMemcpy3D` | | Copies data between 3D objects. | | `cudaMemcpy3DAsync` | | Copies data between 3D objects. | @@ -131,10 +141,10 @@ | `cudaMemcpyFromSymbolAsync` | | Copies data from the given symbol on the device. | | `cudaMemcpyPeer` | `hipMemcpyPeer` | Copies memory between two devices. | | `cudaMemcpyPeerAsync` | `hipMemcpyPeerAsync` | Copies memory between two devices asynchronously. | -| `cudaMemcpyToArray` | | Copies data between host and device. | +| `cudaMemcpyToArray` | `hipMemcpyToArray` | Copies data between host and device. | | `cudaMemcpyToArrayAsync` | | Copies data between host and device. | | `cudaMemcpyToSymbol` | `hipMemcpyToSymbol` | Copies data to the given symbol on the device. | -| `cudaMemcpyToSymbolAsync` | | Copies data to the given symbol on the device. | +| `cudaMemcpyToSymbolAsync` | `hipMemcpyToSymbolAsync` | Copies data to the given symbol on the device. | | `cudaMemset` | `hipMemset` | Initializes or sets device memory to a value. | | `cudaMemset2D` | | Initializes or sets device memory to a value. | | `cudaMemset2DAsync` | | Initializes or sets device memory to a value. | @@ -145,13 +155,13 @@ | `make\_cudaPitchedPtr` | | Returns a cudaPitchedPtr based on input parameters. | | `make\_cudaPos` | | Returns a cudaPos based on input parameters. | -**8. Unified Addressing** +**9. Unified Addressing** | **CUDA** | **HIP** | **CUDA description** | |-----------------------------------------------------------|-------------------------------|--------------------------------------------------------------------------------------------------------------------------------| | `cudaPointerGetAttributes` | `hipPointerGetAttributes` | Returns attributes about a specified pointer. | -**9. Peer Device Memory Access** +**10. Peer Device Memory Access** | **CUDA** | **HIP** | **CUDA description** | |-----------------------------------------------------------|-------------------------------|--------------------------------------------------------------------------------------------------------------------------------| @@ -159,7 +169,7 @@ | `cudaDeviceDisablePeerAccess` | `hipDeviceDisablePeerAccess` | Disables direct access to memory allocations on a peer device. | | `cudaDeviceEnablePeerAccess` | `hipDeviceEnablePeerAccess` | Enables direct access to memory allocations on a peer device. | -**10. OpenGL Interoperability** +**11. OpenGL Interoperability** | **CUDA** | **HIP** | **CUDA description** | |-----------------------------------------------------------|-------------------------------|--------------------------------------------------------------------------------------------------------------------------------| @@ -168,7 +178,7 @@ | `cudaGraphicsGLRegisterImage` | | Register an OpenGL texture or renderbuffer object. | | `cudaWGLGetDevice` | | Gets the CUDA device associated with hGpu. | -**11. Graphics Interoperability** +**12. Graphics Interoperability** | **CUDA** | **HIP** | **CUDA description** | |-----------------------------------------------------------|-------------------------------|--------------------------------------------------------------------------------------------------------------------------------| @@ -180,11 +190,11 @@ | `cudaGraphicsUnmapResources` | | Unmap graphics resources. | | `cudaGraphicsUnregisterResource` | | Unregisters a graphics resource for access by CUDA. | -**12. Texture Reference Management** +**13. Texture Reference Management** | **CUDA** | **HIP** | **CUDA description** | |-----------------------------------------------------------|-------------------------------|--------------------------------------------------------------------------------------------------------------------------------| -| `cudaBindTexture` | | Binds a memory area to a texture. | +| `cudaBindTexture` | `hipBindTexture` | Binds a memory area to a texture. | | `cudaBindTexture2D` | | Binds a 2D memory area to a texture. | | `cudaBindTextureToArray` | | Binds an array to a texture. | | `cudaBindTextureToMipmappedArray` | | Binds a mipmapped array to a texture. | @@ -192,16 +202,16 @@ | `cudaGetChannelDesc` | | Get the channel descriptor of an array. | | `cudaGetTextureAlignmentOffset` | | Get the alignment offset of a texture. | | `cudaGetTextureReference` | | Get the texture reference associated with a symbol. | -| `cudaUnbindTexture` | | Unbinds a texture. | +| `cudaUnbindTexture` | `hipUnbindTexture` | Unbinds a texture. | -**13. Surface Reference Management** +**14. Surface Reference Management** | **CUDA** | **HIP** | **CUDA description** | |-----------------------------------------------------------|-------------------------------|--------------------------------------------------------------------------------------------------------------------------------| | `cudaBindSurfaceToArray` | | Binds an array to a surface. | | `cudaGetSurfaceReference` | | Get the surface reference associated with a symbol. | -**14. Texture Object Management** +**15. Texture Object Management** | **CUDA** | **HIP** | **CUDA description** | |-----------------------------------------------------------|-------------------------------|--------------------------------------------------------------------------------------------------------------------------------| @@ -211,7 +221,7 @@ | `cudaGetTextureObjectResourceViewDesc` | | Returns a texture object's resource view descriptor. | | `cudaGetTextureObjectTextureDesc` | | Returns a texture object's texture descriptor. | -**15. Surface Object Management** +**16. Surface Object Management** | **CUDA** | **HIP** | **CUDA description** | |-----------------------------------------------------------|-------------------------------|--------------------------------------------------------------------------------------------------------------------------------| @@ -219,15 +229,14 @@ | `cudaDestroySurfaceObject` | | Destroys a surface object. | | `cudaGetSurfaceObjectResourceDesc` | | Returns a surface object's resource descriptor Returns the resource descriptor for the surface object specified by surfObject. | -**16. Version Management** +**17. Version Management** | **CUDA** | **HIP** | **CUDA description** | |-----------------------------------------------------------|-------------------------------|--------------------------------------------------------------------------------------------------------------------------------| | `cudaDriverGetVersion` | `hipDriverGetVersion` | Returns the CUDA driver version. | -| `cudaRuntimeGetVersion` | | Returns the CUDA Runtime version. | +| `cudaRuntimeGetVersion` | `hipRuntimeGetVersion` | Returns the CUDA Runtime version. | -**17. C++ API Routines (7.0 contains, 7.5 doesn’t)** -> Will not support for HIP (probably) +**18. C++ API Routines (7.0 contains, 7.5 doesn’t)** | **CUDA** | **HIP** | **CUDA description** | |-----------------------------------------------------------|-------------------------------|--------------------------------------------------------------------------------------------------------------------------------| @@ -236,8 +245,7 @@ | `cudaBindTexture2D` | | Binds a 2D memory area to a texture. | | `cudaBindTextureToArray` | | Binds an array to a texture. | | `cudaBindTextureToMipmappedArray` | | Binds a mipmapped array to a texture. | -| `cudaCreateChannelDesc` | | Returns a channel descriptor using the specified format. | -| `cudaEventCreate` | | Creates an event object with the specified flags. | +| `cudaCreateChannelDesc` | `hipCreateChannelDesc` | Returns a channel descriptor using the specified format. | | `cudaFuncGetAttributes` | | Find out attributes for a given function. | | `cudaFuncSetCacheConfig` | | Sets the preferred cache configuration for a device function. | | `cudaGetSymbolAddress` | | Finds the address associated with a CUDA symbol | @@ -251,9 +259,9 @@ | `cudaMemcpyFromSymbolAsync` | | Copies data from the given symbol on the device. | | `cudaMemcpyToSymbol` | | Copies data to the given symbol on the device. | | `cudaMemcpyToSymbolAsync` | | Async copies data to the given symbol on the device. | -| `cudaOccupancyMaxActiveBlocksPerMultiprocessor` | | Returns occupancy for a device function. | +| `cudaOccupancyMaxActiveBlocksPerMultiprocessor` | `hipOccupancyMaxActiveBlocksPerMultiprocessor` | Returns occupancy for a device function. | | `cudaOccupancyMaxActiveBlocksPerMultiprocessorWithFlags` | | Returns occupancy for a device function with the specified flags. | -| `cudaOccupancyMaxPotentialBlockSize` | | Returns grid and block size that achieves maximum potential occupancy for a device function. | +| `cudaOccupancyMaxPotentialBlockSize` | `hipOccupancyMaxPotentialBlockSize` | Returns grid and block size that achieves maximum potential occupancy for a device function. | | `cudaOccupancyMaxPotentialBlockSizeVariableSMem` | | Returns grid and block size that achieves maximum potential occupancy for a device function. | | `cudaOccupancyMaxPotentialBlockSizeVariableSMemWithFlags` | | Returns grid and block size that achieves maximum potential occupancy for a device function. | | `cudaOccupancyMaxPotentialBlockSizeWithFlags` | | Returns grid and block size that achived maximum potential occupancy for a device function with the specified flags. | @@ -261,7 +269,7 @@ | `cudaStreamAttachMemAsync` | | Attach memory to a stream asynchronously. | | `cudaUnbindTexture` | | Unbinds a texture. | -**18. Profiler Control** +**19. Profiler Control** | **CUDA** | **HIP** | **CUDA description** | |-----------------------------------------------------------|-------------------------------|--------------------------------------------------------------------------------------------------------------------------------|