Commit Graph

24 Commits

Author SHA1 Message Date
Evgeny Mankov 8abdb1dd54 [HIPIFY] CUDA Driver API porting to HIP : Stream functions support. 2016-09-09 11:46:35 +03:00
Evgeny Mankov 3f575ad2b7 [HIPIFY] CUDA Driver API porting to HIP : Module functions support. 2016-09-09 11:31:50 +03:00
Evgeny Mankov 1567733097 [HIPIFY] CUDA Driver API porting to HIP : Event functions support. 2016-09-09 11:15:11 +03:00
Evgeny Mankov 04fccd6189 [HIPIFY] CUDA Driver API porting to HIP : Conversion type Driver and driver functions are added. 2016-09-09 11:10:19 +03:00
Evgeny Mankov 01981af81d [HIPIFY] CUDA Driver API porting to HIP : Conversion types Context and Cache are added. 2016-09-05 20:26:21 +03:00
Evgeny Mankov b1094848a5 [HIPIFY] CUDA Driver API porting to HIP : Device functions support. 2016-09-05 18:05:16 +03:00
Evgeny Mankov 9ec0987aac [HIPIFY] CUDA Driver API porting to HIP : Context functions support. 2016-09-05 13:15:49 +03:00
Evgeny Mankov 7062586103 [HIPIFY] CUDA Driver API porting to HIP : populate Replacer's rules with enum members.
enum members for:
CUdevice_attribute/hipDeviceAttribute_t
CUfunc_cache/hipFuncCache
CUsharedconfig/hipSharedMemConfig
2016-09-02 22:23:13 +03:00
Evgeny Mankov 000f0f8114 [HIPIFY] CUDA Driver API porting to HIP : types are added.
CUdevice           -> hipDevice_t // Yet under discussion
CUdevice_attribute -> hipDeviceAttribute_t
CUdevprop          -> hipDeviceProp_t
CUfunction         -> hipFunction_t
CUfunc_cache       -> hipFuncCache
CUsharedconfig     -> hipSharedMemConfig
CUcontext          -> hipCtx_t
CUmodule           -> hipModule_t
CUevent            -> hipEvent_t
CUstream           -> hipStream_t
2016-09-02 16:31:46 +03:00
Evgeny Mankov 22dca6794d [HIPIFY] CUDA Driver API porting to HIP : CUresult enum.
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'.
2016-09-01 18:54:03 +03:00
Evgeny Mankov 5cca5b3dca clang-hipify: code refactoring - API (Driver/Runtime/Blas) distinguishing is added. 2016-08-25 19:36:37 +03:00
Evgeny Mankov 207eb02736 clang-hipify: code refactoring and performance improvement 2016-08-24 18:51:36 +03:00
Evgeny Mankov 00b9782187 clang-hipify: After translating any symbol forcibly include the hip header file in case it wasn’t.
Fixes https://github.com/GPUOpen-ProfessionalCompute-Tools/HIP/issues/34
2016-08-18 20:59:51 +03:00
Evgeny Mankov aba73d6673 clang-hipify: Add support for nested macro expansion and translation.
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);
2016-08-11 22:29:55 +03:00
Evgeny Mankov b7ac63e202 clang-hipify: Transformation of declarations with external linkage and shared attribute for IncompleteArrayType (aka C array[]) only.
Example:
extern __shared__ uint sRadix1[]; =>  HIP_DYNAMIC_SHARED(unsigned int, sRadix1);
2016-08-05 21:35:58 +03:00
Evgeny Mankov 9f77666802 clang-hipify: Populate replacement rules and fix typos.
+ fix typo in hipStreamWaitEvent.
+ hipHostAlloc -> hipHostMalloc.
+ Memory Types, Pointer Attributes are added.
+ Event, Host Malloc and Register, Device and Stream Flags are added.
+ exclude cudacommon.h.prehip from includes' replacement rules.
2016-07-07 18:01:41 +03:00
Evgeny Mankov 5d04a17a44 clang-hipify: add Replacement Excludes
Excludes are not replaced, for instance, CHECK_CUDA_ERROR and CUDA_SAFE_CALL.
Add check for excludes in MacroExpands and CallExpr routines.
2016-07-01 19:58:14 +03:00
Evgeny Mankov 53401727a8 clang-hipify: fix typos and populate replacement rules
+ typos in cudaDeviceAttr and cudaDeviceAttr
+ Device Attribules are added
+ More error codes are added
2016-06-29 20:32:05 +03:00
Evgeny Mankov f19992760e clang-hipify: Array of elements of typedef type translation support.
Example: cudaStream_t streams[2]
2016-06-28 19:57:08 +03:00
Evgeny Mankov ab2a7f436d cublas to hipblas translation support in clang-hipify
+ CUBLAS V2 functions support
+ annotating, formatting
2016-06-28 15:33:38 +03:00
Evgeny Mankov aa75bff6ee Initial cublas to hipblas translation support in clang-hipify.
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.
2016-06-22 19:15:03 +03:00
Maneesh Gupta 4efabb955b Fix missing JSON database warning from hipify-clang
Change-Id: I4aeff51556678266c1392a031deeb9ffff2386bc
2016-05-20 14:06:27 +05:30
alex-t fb19b58840 Fixed incorrect kernel paramlist replacement length & hipGetDeviceProperties mapping 2016-04-14 13:48:58 +03:00
dfukalov 2a76cb6fc0 Imported clang-hipify as a subtree 2016-04-04 23:18:15 +03:00