Commit Graph

28 Commits

Author SHA1 Message Date
Evgeny Mankov d1ea9d9d97 [HIPIFY][RAND] revise
+ add missing functions
+ add minimum rocRAND support
+ updated CURAND_API_supported_by_HIP.md
2019-02-08 17:54:28 +03:00
Evgeny Mankov 6160cff6ff [HIPIFY][BLAS] Restrict hipification to 'ROC' to BLAS library only
+ Add utility functions isToRoc, isHipUnsupported, isRocUnsupported, isUnsupported
2019-02-07 13:17:05 +03:00
emankov 340550cc56 [HIPIFY] Add the legal right comment to all the sources 2018-12-20 18:47:57 +03:00
Evgeny Mankov 747eb2c11c [HIPIFY] Initial support of translation to ROCm
+ Option '-roc' is added to translate to ROCm instead of HIP
+ Update hipification mechanism accordingly
+ Populate all translation maps with additional field for ROCm identifiers
+ There are 4 degrees of CUDA support now: full support, only by HIP, only by ROCm, unsupported
2018-12-06 21:52:54 +03:00
emankov f66388bd05 [HIPIFY][SPARSE] Initial support 2018-11-20 17:58:05 +03:00
Evgeny Mankov b087a7f275 [HIPIFY][LLVMCompat] support of upcoming LLVM 8.0
+ StringRef issue, which is finally moved to LLVM from Clang
+ Renamed getBeginLoc() and getEndLoc() resolution for Expr and TypeLoc classes
+ Support all the previous LLVM versions via LLVCompat
2018-11-16 01:23:25 +03:00
Evgeny Mankov 2ab8e92195 [HIPIFY][fix][#739] Fix garbage after replacements
[Issue] https://github.com/ROCm-Developer-Tools/HIP/issues/739
[Resolution] Always use an std::string not a clang::StringRef for replacement

P.S. Occurred only on Linux, on Windows works fine.
2018-10-30 19:35:59 +03:00
Evgeny Mankov 2af2827a05 [HIPIFY] Modify HIP types to conform to CUDA's ones 2018-10-29 20:51:25 +03:00
Evgeny Mankov 75972cb51d [HIPIFY] Split CUDA2HIP map into a number of maps based on API type
[Reasons]
+ Simplify the support
+ Optimize compilation and code generation time

[Additionally]
+ Update minimum required version of cmake
+ Fix MSVC compile options force update
2018-10-23 00:00:10 +03:00
Evgeny Mankov 9a1a511c84 [HIPIFY] Code cleanup and formatting 2018-10-15 15:27:37 +03:00
Evgeny Mankov ce57b99f9d [HIPIFY][Complex] Add cuComplex support
+ Add API_COMPLEX support (data types and functions)
+ Add cuComplex_API_supported_by_HIP.md
+ Add cuComplex_Julia.cu test
+ Update README.md
2018-08-08 18:34:57 +03:00
Evgeny Mankov c57bfd50e3 [HIPIFY][FFT] Add cuFFT support
+ Add API_FFT support (data types and functions)
+ Add CUFFT_API_supported_by_HIP.md
+ Add simple_cufft.cu test
+ Update README.md
2018-07-31 22:25:48 +03:00
Evgeny Mankov b9c15702d2 [HIPIFY] Current trunk LLVM 7.0 initial support
Tested with CUDA 8.0, 9.0, 9.1 and 9.2.

Only 8.0 works with LLVM 7.0, due to the changes in LLVM trunc since released 6.0, which works fine with CUDA 8.0 and 9.0.

So, nothing to do in hipify-clang, hope that all the CUDA 9.x related issues will be fixed in 7.0 release.
2018-07-11 20:15:49 +03:00
Evgeny Mankov 4d19bd1da5 [HIPIFY] Initial cuDNN support
- based on https://github.com/ROCmSoftwarePlatform/hipDNN.
- lit testing was supplemented with CUDA_DNN_ROOT_DIR for cuDNN testing.
- single cuDNN test was added.
2018-05-03 11:33:40 +03:00
Evgeny Mankov ad28f72ca9 [HIPIFY] undo apply .clangformat to HIPIFY source files 2018-04-23 20:22:15 +03:00
Maneesh Gupta 9e47fccc89 Apply .clangformat to all repo source files
Change-Id: I7e79c6058f0303f9a98911e3b7dd2e8596079344
2018-03-12 11:29:03 +05:30
Evgeny Mankov 58f2d3c93f [HIPIFY] InclusionDirective refactoring
Due to support of cuRAND headers.

+ compound test on all headers is added;
+ missing entities are added with updating the doc;
+ a couple cuRAND tests are added (https://github.com/ROCmSoftwarePlatform/rocRAND/tree/master/benchmark):
  - the following CUDA entities are still unsupported by hipRAND:
      curandMakeMTGP32Constants
      curandMakeMTGP32KernelState
      curandGetDirectionVectors32
      curandDirectionVectorSet_t
      CURAND_DIRECTION_VECTORS_32_JOEKUO6
      curandStateSobol64_t
      curandStateScrambledSobol64_t
      curandGenerateLongLong
  - and the following - by HIP:
      cudaRuntimeGetVersion
  - those entities are handled by CHECK-NOT directive for now.
2018-01-29 18:33:47 +03:00
Evgeny Mankov 657be80c29 Merge pull request #340 from emankov/master
[HIPIFY][fix] Fix PragmaDirective
2018-01-24 18:09:54 +03:00
Evgeny Mankov aaa9559768 [HIPIFY][fix] CUDA and cuBLAS main headers correct handling 2018-01-23 23:43:36 +03:00
Evgeny Mankov b9fc653b08 [HIPIFY][fix] Fix PragmaDirective
File location have to be verified, otherwise location of the first found '#pragma once' in any included header even system will be erroneously handled, which might lead to attempt to including hip_runtime.h in it.
2018-01-23 23:06:55 +03:00
Evgeny Mankov a26e323612 Update HipifyAction.cpp
dead code eliminate
2018-01-16 15:08:08 +03:00
Evgeny Mankov e90a76a1ef [HIPIFY][fix][#211] Algorithm for explicit insert of hip include directive
If in source CUDA file main header (cuda_runtime.h or cuda.h) is not presented, corresponding HIP main header (hip_runtime.h) should be explicitly included in output hipified file.

[Algorithm]
1. If #pragma once is presented, HIP main header should be placed just after it;
2. Otherwise if any other (not CUDA main) header is presented, HIP main header should be placed just before it;
3. Otherwise HIP main header should be placed in the beginning of output file.

P.S.
There might be one more situation when #ifndef #define ... #endif guard for the entire file is presented (make sense for *.h, *.hpp, *.cuh files). In this case HIP main include should be placed just after such #ifdef, or after #pragma once, if it is also presented. This situation will be handled in a separate change.
2018-01-15 21:05:05 +03:00
Evgeny Mankov cc133b09aa [HIPIFY][fix][#306] Code improve 2018-01-10 21:26:05 +03:00
Evgeny Mankov 5a45d3ca84 [HIPIFY][FIX][#306] Eliminate second cuda main include directive
// hipified to #include<hip/hip_runtime.h>
#include<cuda.h> // 1st cuda main include (Driver API)
// to eliminate
#include<cuda_runtime.h> // 2nd cuda main include (Runtime API)

HIP has one header hip_runtime.h for both CUDA APIs, thus second cuda main include directive is eliminated entirely.
2017-12-26 20:54:54 +03:00
Evgeny Mankov 45befb73d3 [HIPIFY] Remove cudaBuiltin matcher 2017-12-06 20:22:14 +03:00
Evgeny Mankov ccc959fdc9 [HIPIFY] Disable cudaBuiltin matcher.
As HIP has started to support vanilla CUDA syntax for threadIdx, blockIdx, blockDim and gridDim.
Other CUDA builtins are not tracked for now.
2017-12-05 20:28:51 +03:00
Chris Kitching 506deca07f Use proper clang diagnostics for printing warnings
Much pretty. Very wow

This gives users all the usual power when it comes to manipulating
clang diagnostics. People can pass -Werror can have hipify fail if
it doesn't completely translate a file, for example. Much nicer
than reinventing the wheel.
2017-11-13 20:58:55 +00:00
Chris Kitching 7a441aef10 Use a custom FrontendAction to simplify identifier translation
Most of what hipify does is really just replacing CUDA idenitifers
with HIP ones. CUDA function calls, preprocessor macro calls,
enum references, types, etc.

This is problematic: calls/types/enum-refs require name resolution
for the AST matcher to work. This fails in the presence of code
deleted by the preprocessor, and in two-pass template compilation.

Instead, we can simply hook the lexer and have it rewrite the
identifiers for us.

This approach means identifier transformations will work correctly
regardless of where they appear (and we get to delete lots of code)

- Fixes #260
- Helps a bit with #207 - it will still fail to translate kernel
calls in preprocessor-ignored code, but everything except kerel
launches should translate correctly now, even in
preprocessor-deleted code.
2017-11-13 20:58:54 +00:00