enum CUresult was merged with enum cudaError_t into single hipError_t.
Thus a majority of HIP error codes has a reflection to Driver's and RT's corresponding error code at the same time. For instance:
cuda2hipRename["CUDA_SUCCESS"] = {"hipSuccess", CONV_ERR, API_DRIVER};
cuda2hipRename["cudaSuccess"] = {"hipSuccess", CONV_ERR, API_RUNTIME};
There are a few CUDA return error codes which are RT or Driver specific. For instance:
cuda2hipRename["CUDA_ERROR_INVALID_CONTEXT"] = {"hipErrorInvalidContext", CONV_ERR, API_DRIVER};
cuda2hipRename["cudaErrorInvalidMemcpyDirection"] = {"hipErrorInvalidMemcpyDirection", CONV_ERR, API_RUNTIME};
Matchers were changed from "cuda.* | cublas.*" to "cu.*" as CUDA API functions/types starts with 'cu'.
Fixes bug “HIPIFY: nested macro is not hipified”
https://github.com/GPUOpen-ProfessionalCompute-Tools/HIP/issues/33
Example:
#include "cuda_runtime.h"
#define MY_MACRO(func, flags) (func, flags)
...
cudaEvent_t *event = NULL;
MY_MACRO(cudaEventCreateWithFlags(event, cudaEventDisableTiming), NULL);
where cudaEventDisableTiming is a defined numeric literal and thus a nested MACRO:
#define cudaEventDisableTiming 0x02 /**< Event will not record timing data */
After hipifying now:
MY_MACRO(hipEventCreateWithFlags(event, cudaEventDisableTiming), NULL);
Should be:
MY_MACRO(hipEventCreateWithFlags(event, hipEventDisableTiming), NULL);
To run clang-hipify with hipblas support please specify corresponding hipblas include directory, for example:
./hipify-clang --print-stats matrixMult.cpp.cuda -- -I/srv/git/HIP/HIP-Examples/hipblas/include
Additionally:
+ typedef translation support is added (cudaEvent_t and cudaStream_t are converted now).
+ anonymous typedef enum translation support.
+ function name macro expansion support.
+ clang options propagation is restored.
P.S. In order to avoid the following error message:
“Could not auto-detect compilation database for file "… .cu"
No compilation database found in /srv/git/HIP/build/clang-hipify or any parent directory
json-compilation-database: Error while opening JSON database: No such file or directory
Running without flags.”
please append “--“ to the end of clang-hipify’s command line.
Squashed commit of the following:
commit bc44bcee461e46b0cf5cb9fe09213dca450b081a
Author: Daniil Fukalov <daniil.fukalov@amd.com>
Date: Mon May 16 20:50:05 2016 +0300
added note about errors without CUDA sdk installed
commit 5fd73ba90c0940bdc977737894362a99f4232b56
Author: Daniil Fukalov <daniil.fukalov@amd.com>
Date: Mon May 16 20:31:47 2016 +0300
move clang-hipify info to its own README
commit 21d81a6d5acd3f093d77ac4d584e6f5bbe48f8cc
Author: Daniil Fukalov <daniil.fukalov@amd.com>
Date: Mon May 16 20:30:00 2016 +0300
initial version
Change-Id: I157294699a7be3d0bb38b2ee4a137a94280529c9