Commit Graph

69 Commits

Author SHA1 Message Date
Evgeny Mankov 8c20ecdfde [HIPIFY] Sync more CUDA Driver API functions.
+ 4.14. Event Management
+ 4.15. Execution Control

ToDo: 4.16 - 4.31 modules of CUDA Driver API.


[ROCm/clr commit: cbb5c63dd6]
2017-06-22 21:53:32 +03:00
Evgeny Mankov 1912c9f308 [HIPIFY] Sync HIPIFY with HIP by CUDA Driver API functions.
+ 4.12. Unified Addressing
+ 4.13. Stream Management

ToDo: 4.14 - 4.31 modules of CUDA Driver API.


[ROCm/clr commit: 094f1b1f2f]
2017-06-14 19:55:55 +03:00
Evgeny Mankov cfe2dc9fc0 [HIPIFY] Initial sync HIPIFY with HIP by CUDA Driver API functions.
+ CUDA_Driver_API_functions_supported_by_HIP.md update.
+ Initial update of HIPIFY with CUDA driver API functions:
  1.Error Handling, 2.Initialization, 3.Version Management, 5-6.Device Management, 7.Primary Context, 8-9.Context, 10.Module Management, 11.Memory Management.
+ Sync HIP functions against CUDA Driver and Runtime API functions.
+ Typo fixes.

ToDo: 12-30 modules of CUDA Driver API.


[ROCm/clr commit: 82b37fe481]
2017-06-13 20:25:11 +03:00
Evgeny Mankov b30b1acc5c [HIPIFY] All CUDA 8.0.44 API functions update
(for both Driver and Runtime APIs)

1) P2P
cuDeviceGetP2PAttribute   cudaDeviceGetP2PAttribute

2) Memory Mngmnt
cuMemPrefetchAsync        cudaMemPrefetchAsync
cuMemAdvise               cudaMemAdvise
cuMemRangeGetAttribute    cudaMemRangeGetAttribute
cuMemRangeGetAttributes   cudaMemRangeGetAttributes

3) Streams (Driver API only, no analogues in Runtime API)
cuStreamWaitValue32
cuStreamWaitValue32
cuStreamWriteValue32

4) Texture Reference Mngmnt (Driver API only, no analogues in Runtime API)
cuTexRefSetBorderColor
cuTexRefGetBorderColor


[ROCm/clr commit: ee85243bcd]
2017-06-01 21:08:33 +03:00
Evgeny Mankov afbf55a9dc [HIP] [HIPIFY] CUDA Driver API 8.0.44 JIT options support.
[ROCm/clr commit: 463c026976]
2017-05-31 18:55:29 +03:00
Evgeny Mankov 54b3c90964 [HIPIFY] Add the rest CUDA Runtime API 8.0.44 Data structures.
+ sync with corresponding CUDA Driver API Data structures.

P.S.
There is no any new changes in CUDA Runtime API 8.0.61 Data structures since 8.0.44.


[ROCm/clr commit: 997ed19bb8]
2017-05-30 19:45:59 +03:00
Evgeny Mankov 306dca2c78 [HIPIFY] Add the rest CUDA Driver API 8.0.44 Data structures.
+ Memory advise values
+ Memory Range Attributes
+ P2P Attributes

P.S.
There is no any new changes in CUDA Driver API 8.0.61 Data structures since 8.0.44.


[ROCm/clr commit: a020eb76dd]
2017-05-30 18:29:14 +03:00
Evgeny Mankov ffb0d43b07 [HIPIFY] Add more CUDA Driver API 8.0.44 Data structures.
[ROCm/clr commit: ef86f943ac]
2017-05-30 17:58:13 +03:00
Evgeny Mankov ed54e3d0ee [FIX] [HIPIFY] Add matchers for function return types.
https://github.com/GPUOpen-ProfessionalCompute-Tools/HIP/issues/73

Examples (https://github.com/thrust/thrust/blob/master/thrust/system/cuda/detail/trivial_copy.inl):

template<typename System1,
         typename System2>
cudaStream_t cuda_memcpy_stream(const thrust::cpp::execution_policy<System1> &,
                                const thrust::cuda::execution_policy<System2> &exec)

template<typename System1,
         typename System2>
cudaMemcpyKind cuda_memcpy_kind(const thrust::cuda::execution_policy<System1> &,
                                const thrust::cpp::execution_policy<System2> &)


[ROCm/clr commit: a19ecab3f2]
2017-05-24 18:25:40 +03:00
Evgeny Mankov 9e7a50b1e0 [FIX] [HIPIFY] Matcher for new operator is missing.
https://github.com/GPUOpen-ProfessionalCompute-Tools/HIP/issues/80

Example from CUDA 8.0.44 sample (CUDASamples\0_Simple\matrixMulDrv\matrixMulDrv.cpp):
    CUjit_option *jitOptions = new CUjit_option[jitNumOptions];
where CUjit_option is enum, should be:
    hipJitOption *jitOptions = new hipJitOption[jitNumOptions];


[ROCm/clr commit: 21d74f09b9]
2017-05-23 19:45:38 +03:00
Evgeny Mankov aebc80c8e0 [HIPIFY] [FIX] [HIPIFY] Matcher for pointer to enum var declaration is missing.
https://github.com/GPUOpen-ProfessionalCompute-Tools/HIP/issues/79

Example from CUDA 8.0.44 sample (CUDASamples\0_Simple\matrixMulDrv\matrixMulDrv.cpp):
    CUjit_option *jitOptions = new CUjit_option[jitNumOptions];
where CUjit_option is enum, should be:
    hipJitOption *jitOptions = new hipJitOption[jitNumOptions];

[TODO]
1. new CUjit_option -> new hipJitOption.
   Matcher for new operator is missing:
https://github.com/GPUOpen-ProfessionalCompute-Tools/HIP/issues/79
2. Merge matchers cudaEnumDecl and cudaEnumVarPtr.


[ROCm/clr commit: 51b7420359]
2017-05-19 17:39:09 +03:00
Evgeny Mankov 052f630bd3 [HIP] [HIPIFY] [FIX] cuModuleLoadDataEx -> hipModuleLoadDataEx
https://github.com/GPUOpen-ProfessionalCompute-Tools/HIP/issues/81

1.	Do not use JIT options on HCC path, call hipModuleLoadData instead.
2.	NVCC path is unchanged, to call cuModuleLoadDataEx with all options.
3.	Get rid of manual hipification, based on #ifdef #else for NVCC/HIP.
4.	Update documentation accordingly.


[ROCm/clr commit: ae9f14ef9c]
2017-05-19 17:22:14 +03:00
Evgeny Mankov b2fa897ded [HIPIFY] cudaMallocPitch -> hipMallocPitch
[ROCm/clr commit: 221faeb916]
2017-05-16 18:21:25 +03:00
Evgeny Mankov 37d5a09493 [HIPIFY] CUDA Driver API: Primary Context Management support.
[ROCm/clr commit: 181d3e2bae]
2017-05-15 15:35:52 +03:00
Evgeny Mankov 42292df1a3 [HIPIFY] Fix string routines.
Some Clang tooling functions return std::string, some return StringRef. Assigning of returning std::string to StringRef variables leads to garbage in it.
DEBUG build is always affected.


[ROCm/clr commit: aa52b94be1]
2017-05-11 21:50:36 +03:00
Evgeny Mankov 3028345953 [HIPIFY] LLVM 3.9 support
3.8 and 3.9 are both supported. 3.8 is stable, 3.9 needs more testing.


[ROCm/clr commit: 054bf0859d]
2017-05-05 21:28:02 +03:00
Evgeny Mankov e9ad0f3b00 [HIPIFY] CUDA RT memcpy functions update.
cudaMemcpyFromSymbol -> hipMemcpyFromSymbol
cudaMemcpyFromSymbolAsync -> hipMemcpyFromSymbolAsync
cudaMemcpy2DAsync -> hipMemcpy2DAsync


[ROCm/clr commit: 2636d91ba4]
2017-05-03 23:05:44 +03:00
Evgeny Mankov df05e96760 [HIPIFY] Blas update: add a few functions, supported by HIP.
cublasDaxpy -> hipblasDaxpy
cublasDgemv -> hipblasDgemv
cublasDger  -> hipblasDger
cublasDgemm -> hipblasDgemm
cublasDgemmBatched -> hipblasDgemmBatched
cublasGetStream -> hipblasGetStream
cublasSetStream -> hipblasSetStream
cublasDaxpy -> hipblasDaxpy


[ROCm/clr commit: 72df25a0c7]
2017-05-03 22:45:56 +03:00
Evgeny Mankov 3ca552c669 [HIPIFY] HIPIFY and HIP sync with CUDA Driver API data types.
+ Update CUDA_Driver_API_functions_supported_by_HIP.md.
+ Final update of HIPIFY with CUDA driver data types.

[TODO] Syncing HIPIFY and HIP by CUDA Driver API functions.


[ROCm/clr commit: 3b40776244]
2017-05-03 21:59:48 +03:00
Evgeny Mankov 03595a9883 [HIPIFY] Rename enumConstantDecl -> enumDecl
Reason: not to mix up with clang's enumConstantDecl, used for enum DeclRefExpr (enum constant).


[ROCm/clr commit: 3e89277a9b]
2017-04-28 21:59:33 +03:00
Evgeny Mankov 3252416883 * [HIPIFY] [FIX] Replacement error: enum cudaMemcpyKind kind -> hipMemcpyKindyKind kind
https://github.com/GPUOpen-ProfessionalCompute-Tools/HIP/issues/72

[Solution] [Workaround]
Offset calculation for enum VarDecl as param decl, declared with enum type specifier.

[Result]
enum cudaMemcpyKind kind -> enum hipMemcpyKind kind

[ToDo]
Test on terminal qualifiers (const, etc).


[ROCm/clr commit: 85a32c3987]
2017-04-28 21:45:36 +03:00
Evgeny Mankov 3e06497eaa [HIPIFY] [FIX] replacement error: cudaError_t -> hipError_t_t
https://github.com/GPUOpen-ProfessionalCompute-Tools/HIP/issues/71

[Solution]
getUnqualifiedType for enumConstantDecl's type is added, except ordinary enum declarations (w/o typedef).

[ToDo]
Find more appropriate way of distinguishing redefined enum declarations and ordinary ones.


[ROCm/clr commit: 5f76cf3098]
2017-04-28 21:03:03 +03:00
Evgeny Mankov 8805f2ce66 [HIPIFY] Initial sync HIPIFY with HIP by CUDA Driver API data types.
+ Introduce CUDA_Driver_API_functions_supported_by_HIP.md.
+ Initial update of HIPIFY with CUDA driver data types.
+ Initial sync HIP types against CUDA Driver and Runtime API types.
+ Typo fixes.


[ROCm/clr commit: 342c63d398]
2017-04-21 21:46:30 +03:00
Evgeny Mankov 7eb7ef2d8e [HIPIFY] GGL support
+ hipLaunchKernel -> hipLaunchKernelGGL
+ macro HIP_KERNEL_NAME is no longer used


[ROCm/clr commit: 81415a41b8]
2017-04-03 22:05:01 +03:00
Evgeny Mankov c41cf40c42 [HIPIFY] Remove hipLaunchParm in HIP kernel declaration.
[ROCm/clr commit: a9268008ac]
2017-04-03 20:32:50 +03:00
Evgeny Mankov bd348f5248 [HIP] [FIX] Fix GCC build.
[ROCm/clr commit: 70ed1014ad]
2017-03-20 21:03:18 +03:00
Evgeny Mankov ec3679990d [HIPIFY] Sync HIPIFY with HIP by enum values.
+ all Cuda 7.5 RT API enum values are synced.
+ a few missing functions are added.
+ CONV_EXEC type is added for Execution control functions and data types.


[ROCm/clr commit: 4ba96241b4]
2017-03-03 21:59:05 +03:00
Evgeny Mankov 2d9ccb42e0 [HIPIFY] sync with HIP by HIP_UNSUPPORTED Runtime functions.
[ROCm/clr commit: eae27590d7]
2017-02-20 21:19:34 +03:00
Evgeny Mankov d85bc25d6e [HIPIFY] Sync HIPIFY with HIP by data types.
[ROCm/clr commit: d6c01aabab]
2017-02-20 18:28:59 +03:00
Evgeny Mankov 19397d7e3f [HIPIFY] Add more Stream and Occupancy functions.
[ROCm/clr commit: 77e97627da]
2017-02-17 15:04:15 +03:00
Evgeny Mankov 37591af99d [HIPIFY] Add missing Memcpy functions.
+ cudaChooseDevice


[ROCm/clr commit: 72a9df0250]
2017-02-16 23:03:01 +03:00
Evgeny Mankov d2029c09db [HIPIFY] Add more Memory Management functions
[ROCm/clr commit: f37343267a]
2017-02-16 21:26:44 +03:00
Evgeny Mankov 69825b7771 [HIPIFY] Add Channel (Textures) support.
[ROCm/clr commit: 069bb1389c]
2017-02-16 21:10:10 +03:00
Evgeny Mankov c991d7c41e [HIPIFY] Add Inter-Process Communications (IPC) support.
[ROCm/clr commit: fd5d8c2bb5]
2017-02-16 20:24:53 +03:00
Evgeny Mankov f55a4f487c [HIPIFY] Add CUDA Driver LAUNCH_PARAM defines.
[ROCm/clr commit: 8a2748e8de]
2017-02-16 20:00:36 +03:00
Evgeny Mankov f98dec3bc1 [HIPIFY] Add safe type check for cudaChooseDevice matcher.
[ROCm/clr commit: d713349872]
2017-02-16 19:38:35 +03:00
Evgeny Mankov b979de6ba7 [HIPIFY] [Fix] Crash on thrust example fallback_allocator.cu.
https://github.com/GPUOpen-ProfessionalCompute-Tools/HIP/issues/65

[Bug]
Access violation in cudaStructVar matcher.

      StringRef name = structVar->getType()
        ->getAsStructureType()
        ->getDecl() // <--- Access Violation
        ->getNameAsString();

[Solution]
Add isStructureType() check before getting type as Struct.

[ToDo]
Find case-studies for that StructVar matcher with types other than Struct.


[ROCm/clr commit: 7c1deb6140]
2017-02-15 19:48:31 +03:00
Evgeny Mankov 707099d957 [HIPIFY] Add file:line:col info to [HIPIFY] warnings/errors.
[ROCm/clr commit: 26dc7a0995]
2017-02-14 21:36:49 +03:00
Evgeny Mankov fda8416aff [HIPIFY] Add more unhandled refs for opaque pointers.
CUfunc_st -> hipFunction_t *
CUctx_st -> hipCtx_t *
CUmod_st -> hipModule_t *


[ROCm/clr commit: 353f5b238a]
2017-02-14 17:34:10 +03:00
Evgeny Mankov 275bafea76 [HIPIFY] Fix warnings on unhandled refs.
CUstream_st -> hipStream_t *
CUevent_st -> hipEvent_t * (fixed, was -> hipEvent_t)

Warning:
[HIPIFY] warning: the following reference is not handled: 'CUstream_st' [struct var ptr]. (thrust/examples/cuda/async_reduce.cu)


[ROCm/clr commit: ce2daa53fb]
2017-02-14 17:23:09 +03:00
Evgeny Mankov b40a8f54c5 [HIPIFY] Narrow cudaKernelCallExpr matcher.
[Explanation]
Narrow cudaKernelCallExpr matcher to isExpansionInMainFile() - to the file being actually converted (without system includes).
But as for Thrust, there are *.inl files, which are nevertheless being expanded in main file.
These files contain cuda kernel launches, which are not converted successfully by hipify, for instance:
thrust/system/cuda/detail/detail/launch_closure.inl:98:23.

[ToDo]
File a bug on cudaKernelCallExpr matcher for conversion error (thrust\examples\cuda\<any cu example>).


[ROCm/clr commit: afe6073d3f]
2017-02-14 16:28:05 +03:00
Evgeny Mankov 8c0f19aa7a [HIPIFY] Minor refactoring
+ insertHipHeaders function is added to Cuda2Hip class;
+ fix replacement ending for hip header.


[ROCm/clr commit: e5c601df45]
2017-02-13 18:13:49 +03:00
Evgeny Mankov 7ae02955f7 [HIPIFY] 'CHANGED LOC', 'TOTAL LOC' and 'CODE CHANGED (in lines)' are added to statistics.
[ROCm/clr commit: 25d4de9e95]
2017-02-10 22:02:41 +03:00
Evgeny Mankov 740888f088 [HIPIFY] Formatting, no functional changes.
[ROCm/clr commit: 5200073b4c]
2017-01-13 14:59:15 +03:00
Evgeny Mankov a72a2e84f2 [HIPIFY] cudaDataType_t and libraryPropertyType_t support (CUDA 8.0.44 only)
All are marked as HIP_UNSUPPORTED.
IMPORTANT:
1. libraryPropertyType_t has no cuda prefix. => TO_DO: new matcher is needed.
2. all libraries (cublas, cufft, cusolver, cusparse, nvgraph) have started to use these types (since 8.0).


[ROCm/clr commit: fd0c56a767]
2017-01-10 20:24:27 +03:00
Evgeny Mankov 87d5b745ac [HIPIFY] cudaDeviceAttr (RT API) support up to CUDA 8.0.44
Attributes, which are not yet supported by HIP, are marked as HIP_UNSUPPORTED.


[ROCm/clr commit: 81fd34f236]
2017-01-10 19:29:33 +03:00
Evgeny Mankov a194e1af1f [HIPIFY] CUdevice_attribute support up to CUDA 8.0.44
Attributes, which are not yet supported by HIP, are marked as HIP_UNSUPPORTED.


[ROCm/clr commit: c0c04f34be]
2017-01-10 17:54:22 +03:00
Evgeny Mankov a22a75be44 [HIPIFY] Elapsed time is added to statistics.
[ROCm/clr commit: bbb75fdd8e]
2016-12-28 20:44:05 +03:00
Evgeny Mankov 15d2b5e6e2 [HIPIFY] Added the rest of cuBlas API.
CUBLAS API 7.5 now is supported by hipify;
API calls, which are not yet supported by hcblas/hipblas, are listed as HIP_UNSUPPORTED.


[ROCm/clr commit: ddf51d382c]
2016-12-28 18:08:10 +03:00
Evgeny Mankov a5dac30c2d [HIPIFY] Formatting, no functional changes.
[ROCm/clr commit: 9070d55814]
2016-12-27 19:48:59 +03:00