Граф коммитов

73 Коммитов

Автор SHA1 Сообщение Дата
Evgeny Mankov d614f53ad7 Update Cuda2Hip.cpp 2017-07-28 01:45:24 +03:00
Evgeny Mankov ffcf5d32a0 [HIPIFY] CUDA RT Textures support 2017-07-27 18:39:40 +03:00
Evgeny Mankov 368aebc4bc [HIPIFY] CUDA Stream Callback support 2017-07-26 19:29:50 +03:00
Evgeny Mankov 85e6593a1b [HIPIFY] Finally finished syncing with CUDA 8.0.61 Driver and Runtime… (#105)
[hipify-clang] Finally finished syncing with CUDA 8.0.61 Driver and Runtime API (including missing data types, D3D, OpenGL, VDPAU and EGL interop).

    + All the Modules are supported now:
	1) 4.1 – 4.31 from CUDA 8.0.61 Driver API
	2) CUDA_Driver_API_functions_supported_by_HIP.md updated accordingly
	3) 4.1 – 4.31 from CUDA 8.0.61 Runtime API
	4) CUDA_Runtime_API_functions_supported_by_HIP.md updated accordingly
    + Typos fixing
    + Annotating
2017-07-26 09:38:03 +05:30
Evgeny Mankov b4a39664f0 [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.
2017-06-22 21:53:32 +03:00
Evgeny Mankov 0208fa4e70 [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.
2017-06-14 19:55:55 +03:00
Evgeny Mankov f805bd0c1d [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.
2017-06-13 20:25:11 +03:00
Evgeny Mankov 4a5484c616 [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
2017-06-01 21:08:33 +03:00
Evgeny Mankov 6e99e388ea [HIP] [HIPIFY] CUDA Driver API 8.0.44 JIT options support. 2017-05-31 18:55:29 +03:00
Evgeny Mankov 063539308e [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.
2017-05-30 19:45:59 +03:00
Evgeny Mankov 1cc5f42e34 [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.
2017-05-30 18:29:14 +03:00
Evgeny Mankov 3e99bc23e7 [HIPIFY] Add more CUDA Driver API 8.0.44 Data structures. 2017-05-30 17:58:13 +03:00
Evgeny Mankov c863215611 [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> &)
2017-05-24 18:25:40 +03:00
Evgeny Mankov 3d973dc4da [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];
2017-05-23 19:45:38 +03:00
Evgeny Mankov b5a1d47e68 [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.
2017-05-19 17:39:09 +03:00
Evgeny Mankov 270f643c9c [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.
2017-05-19 17:22:14 +03:00
Evgeny Mankov 12d8c53c90 [HIPIFY] cudaMallocPitch -> hipMallocPitch 2017-05-16 18:21:25 +03:00
Evgeny Mankov a97cb6810c [HIPIFY] CUDA Driver API: Primary Context Management support. 2017-05-15 15:35:52 +03:00
Evgeny Mankov 25d470c380 [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.
2017-05-11 21:50:36 +03:00
Evgeny Mankov 05be936fd6 [HIPIFY] LLVM 3.9 support
3.8 and 3.9 are both supported. 3.8 is stable, 3.9 needs more testing.
2017-05-05 21:28:02 +03:00
Evgeny Mankov 9b65358c68 [HIPIFY] CUDA RT memcpy functions update.
cudaMemcpyFromSymbol -> hipMemcpyFromSymbol
cudaMemcpyFromSymbolAsync -> hipMemcpyFromSymbolAsync
cudaMemcpy2DAsync -> hipMemcpy2DAsync
2017-05-03 23:05:44 +03:00
Evgeny Mankov 1269897606 [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
2017-05-03 22:45:56 +03:00
Evgeny Mankov 70c94d7b83 [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.
2017-05-03 21:59:48 +03:00
Evgeny Mankov c7958cbb8b [HIPIFY] Rename enumConstantDecl -> enumDecl
Reason: not to mix up with clang's enumConstantDecl, used for enum DeclRefExpr (enum constant).
2017-04-28 21:59:33 +03:00
Evgeny Mankov eddd021996 * [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).
2017-04-28 21:45:36 +03:00
Evgeny Mankov 3d88932c8d [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.
2017-04-28 21:03:03 +03:00
Evgeny Mankov 3c1dd246d6 [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.
2017-04-21 21:46:30 +03:00
Evgeny Mankov 143e0af716 [HIPIFY] GGL support
+ hipLaunchKernel -> hipLaunchKernelGGL
+ macro HIP_KERNEL_NAME is no longer used
2017-04-03 22:05:01 +03:00
Evgeny Mankov 449d21b3c6 [HIPIFY] Remove hipLaunchParm in HIP kernel declaration. 2017-04-03 20:32:50 +03:00
Evgeny Mankov e34e5ef885 [HIP] [FIX] Fix GCC build. 2017-03-20 21:03:18 +03:00
Evgeny Mankov 749803c849 [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.
2017-03-03 21:59:05 +03:00
Evgeny Mankov 6e611aa574 [HIPIFY] sync with HIP by HIP_UNSUPPORTED Runtime functions. 2017-02-20 21:19:34 +03:00
Evgeny Mankov 0cbe335c8f [HIPIFY] Sync HIPIFY with HIP by data types. 2017-02-20 18:28:59 +03:00
Evgeny Mankov dc8e8caf41 [HIPIFY] Add more Stream and Occupancy functions. 2017-02-17 15:04:15 +03:00
Evgeny Mankov 3b6990c8d6 [HIPIFY] Add missing Memcpy functions.
+ cudaChooseDevice
2017-02-16 23:03:01 +03:00
Evgeny Mankov 7b44dbbe37 [HIPIFY] Add more Memory Management functions 2017-02-16 21:26:44 +03:00
Evgeny Mankov b135b24200 [HIPIFY] Add Channel (Textures) support. 2017-02-16 21:10:10 +03:00
Evgeny Mankov ea95f3166a [HIPIFY] Add Inter-Process Communications (IPC) support. 2017-02-16 20:24:53 +03:00
Evgeny Mankov bbbe5814c1 [HIPIFY] Add CUDA Driver LAUNCH_PARAM defines. 2017-02-16 20:00:36 +03:00
Evgeny Mankov 93c1e31b36 [HIPIFY] Add safe type check for cudaChooseDevice matcher. 2017-02-16 19:38:35 +03:00
Evgeny Mankov 950434f4af [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.
2017-02-15 19:48:31 +03:00
Evgeny Mankov e39ed24a50 [HIPIFY] Add file:line:col info to [HIPIFY] warnings/errors. 2017-02-14 21:36:49 +03:00
Evgeny Mankov b3941dd546 [HIPIFY] Add more unhandled refs for opaque pointers.
CUfunc_st -> hipFunction_t *
CUctx_st -> hipCtx_t *
CUmod_st -> hipModule_t *
2017-02-14 17:34:10 +03:00
Evgeny Mankov a6db38c337 [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)
2017-02-14 17:23:09 +03:00
Evgeny Mankov d1cfcf55f1 [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>).
2017-02-14 16:28:05 +03:00
Evgeny Mankov c3ab4d5c5e [HIPIFY] Minor refactoring
+ insertHipHeaders function is added to Cuda2Hip class;
+ fix replacement ending for hip header.
2017-02-13 18:13:49 +03:00
Evgeny Mankov 751db030c2 [HIPIFY] 'CHANGED LOC', 'TOTAL LOC' and 'CODE CHANGED (in lines)' are added to statistics. 2017-02-10 22:02:41 +03:00
Evgeny Mankov b7992fa252 [HIPIFY] Formatting, no functional changes. 2017-01-13 14:59:15 +03:00
Evgeny Mankov 9a0780001b [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).
2017-01-10 20:24:27 +03:00
Evgeny Mankov 3a99536ed5 [HIPIFY] cudaDeviceAttr (RT API) support up to CUDA 8.0.44
Attributes, which are not yet supported by HIP, are marked as HIP_UNSUPPORTED.
2017-01-10 19:29:33 +03:00