Restructure contents in order to have separated same-level information about hipify-clang and hipify-perl.
Этот коммит содержится в:
Evgeny Mankov
2020-01-27 17:21:32 +03:00
родитель a422e2dc36
Коммит e561d0edfe
+86 -85
Просмотреть файл
@@ -5,16 +5,16 @@
<!-- toc -->
- [hipify-clang](#clang)
* [Dependencies](#dependencies)
* [Usage](#hipify-clang-usage)
- [hipify-perl](#perl)
* [Usage](#hipify-perl-usage)
- [Supported CUDA APIs](#cuda-apis)
- [Dependencies](#dependencies)
- [Build and install](#build-and-install)
* [Building](#building)
* [Testing](#testing)
* [Linux](#linux)
* [Windows](#windows)
- [hipify-perl](#perl)
* [Usage](#hipify-perl-usage)
* [Building](#hipify-perl-building)
- [Supported CUDA APIs](#cuda-apis)
- [Disclaimer](#disclaimer)
<!-- tocstop -->
@@ -38,81 +38,7 @@ After applying all the matchers, the output HIP source is produced.
2. CUDA should be installed and provided in case of multiple installations by --cuda-path option.
3. All the includes and defines should be provided to transform code successfully.
### <a name="hipify-clang-usage"></a> hipify-clang usage
To process a file, `hipify-clang` needs access to the same headers that would be required to compile it with clang.
For example:
```shell
./hipify-clang square.cu --cuda-path=/usr/local/cuda-10.1 -I /usr/local/cuda-10.1/samples/common/inc
```
`hipify-clang` arguments are given first, followed by a separator '--', and then the arguments you'd pass to `clang` if you
were compiling the input file. For example:
```shell
./hipify-clang cpp17.cu --cuda-path=/usr/local/cuda-10.1 -- -std=c++17
```
The [Clang manual for compiling CUDA](https://llvm.org/docs/CompileCudaWithLLVM.html#compiling-cuda-code) may be useful.
For a list of `hipify-clang` options, run `hipify-clang --help`.
## <a name="perl"></a> hipify-perl
`hipify-perl` is autogenerated perl-based script which heavily uses regular expressions.
**Advantages:**
1. Ease in use.
2. It doesn't check the input source CUDA code for correctness.
3. It doesn't have dependencies on 3rd party tools, including CUDA.
**Disadvantages:**
1. Current disability (and difficulty in implementing) of transforming the following constructs:
* macros expansion;
* namespaces:
- redefines of CUDA entities in user namespaces;
- using directive;
* templates (some cases);
* device/host function calls distinguishing;
* header files correct injection;
* complicated argument lists parsing.
2. Difficulties in supporting.
### <a name="hipify-perl-usage"></a> hipify-perl usage
To generate `hipify-perl`, run `hipify-clang --perl`.
```shell
perl hipify-perl square.cu > square.cu.hip
```
## <a name="cuda-apis"></a> Supported CUDA APIs
- [Runtime API](../docs/markdown/CUDA_Runtime_API_functions_supported_by_HIP.md)
- [Driver API](../docs/markdown/CUDA_Driver_API_functions_supported_by_HIP.md)
- [cuComplex API](../docs/markdown/cuComplex_API_supported_by_HIP.md)
- [cuBLAS](../docs/markdown/CUBLAS_API_supported_by_HIP.md)
- [cuRAND](../docs/markdown/CURAND_API_supported_by_HIP.md)
- [cuDNN](../docs/markdown/CUDNN_API_supported_by_HIP.md)
- [cuFFT](../docs/markdown/CUFFT_API_supported_by_HIP.md)
- [cuSPARSE](../docs/markdown/CUSPARSE_API_supported_by_HIP.md)
## <a name="dependencies"></a> Dependencies
### <a name="dependencies"></a> hipify-clang: dependencies
`hipify-clang` requires:
@@ -148,9 +74,28 @@ In most cases, you can get a suitable version of LLVM+CLANG with your package ma
Failing that or having multiple versions of LLVM, you can [download a release archive](http://releases.llvm.org/), build or install it, and set
[CMAKE_PREFIX_PATH](https://cmake.org/cmake/help/v3.5/variable/CMAKE_PREFIX_PATH.html) so `cmake` can find it; for instance: `-DCMAKE_PREFIX_PATH=f:\LLVM\9.0.1\dist`
## <a name="build-and-install"></a> Build and install
### <a name="hipify-clang-usage"></a> hipify-clang: usage
### <a name="building"></a> Build
To process a file, `hipify-clang` needs access to the same headers that would be required to compile it with clang.
For example:
```shell
./hipify-clang square.cu --cuda-path=/usr/local/cuda-10.1 -I /usr/local/cuda-10.1/samples/common/inc
```
`hipify-clang` arguments are given first, followed by a separator '--', and then the arguments you'd pass to `clang` if you
were compiling the input file. For example:
```shell
./hipify-clang cpp17.cu --cuda-path=/usr/local/cuda-10.1 -- -std=c++17
```
The [Clang manual for compiling CUDA](https://llvm.org/docs/CompileCudaWithLLVM.html#compiling-cuda-code) may be useful.
For a list of `hipify-clang` options, run `hipify-clang --help`.
### <a name="building"></a> hipify-clang: building
Assuming this repository is at `./HIP`:
@@ -173,7 +118,7 @@ Debug build type `-DCMAKE_BUILD_TYPE=Debug` is also supported and tested; `LLVM+
The binary can then be found at `./dist/bin/hipify-clang`.
### <a name="testing"></a> Testing
### <a name="testing"></a> hipify-clang: testing
`hipify-clang` has unit tests using LLVM [`lit`](https://llvm.org/docs/CommandGuide/lit.html)/[`FileCheck`](https://llvm.org/docs/CommandGuide/FileCheck.html).
@@ -277,7 +222,7 @@ To run it:
- ***Windows***: run `Visual Studio 16 2019`, open the generated `hipify-clang.sln`, build project `test-hipify`.
### <a name="linux"></a >Linux
### <a name="linux"></a > hipify-clang: Linux
On Linux the following configurations are tested:
@@ -427,7 +372,7 @@ Testing Time: 3.07s
Expected Passes : 67
[100%] Built target test-hipify
```
### <a name="windows"></a >Windows
### <a name="windows"></a > hipify-clang: Windows
On Windows 10 the following configurations are tested:
@@ -473,6 +418,62 @@ cmake
-- Generating done
-- Build files have been written to: f:/HIP/hipify-clang/build
```
## <a name="perl"></a> hipify-perl
`hipify-perl` is autogenerated perl-based script which heavily uses regular expressions.
**Advantages:**
1. Ease in use.
2. It doesn't check the input source CUDA code for correctness.
3. It doesn't have dependencies on 3rd party tools, including CUDA.
**Disadvantages:**
1. Current disability (and difficulty in implementing) of transforming the following constructs:
* macros expansion;
* namespaces:
- redefines of CUDA entities in user namespaces;
- using directive;
* templates (some cases);
* device/host function calls distinguishing;
* header files correct injection;
* complicated argument lists parsing.
2. Difficulties in supporting.
### <a name="hipify-perl-usage"></a> hipify-perl: usage
```shell
perl hipify-perl square.cu > square.cu.hip
```
### <a name="hipify-perl-building"></a> hipify-perl: building
To generate `hipify-perl`, run `hipify-clang --perl`. Output directory for the generated `hipify-perl` file might be specified by `--o-hipify-perl-dir` option.
## <a name="cuda-apis"></a> Supported CUDA APIs
- [Runtime API](../docs/markdown/CUDA_Runtime_API_functions_supported_by_HIP.md)
- [Driver API](../docs/markdown/CUDA_Driver_API_functions_supported_by_HIP.md)
- [cuComplex API](../docs/markdown/cuComplex_API_supported_by_HIP.md)
- [cuBLAS](../docs/markdown/CUBLAS_API_supported_by_HIP.md)
- [cuRAND](../docs/markdown/CURAND_API_supported_by_HIP.md)
- [cuDNN](../docs/markdown/CUDNN_API_supported_by_HIP.md)
- [cuFFT](../docs/markdown/CUFFT_API_supported_by_HIP.md)
- [cuSPARSE](../docs/markdown/CUSPARSE_API_supported_by_HIP.md)
## <a name="disclaimer"></a> Disclaimer
The information contained herein is for informational purposes only, and is subject to change without notice. While every precaution has been taken in the preparation of this document, it may contain technical inaccuracies, omissions and typographical errors, and AMD is under no obligation to update or otherwise correct this information. Advanced Micro Devices, Inc. makes no representations or warranties with respect to the accuracy or completeness of the contents of this document, and assumes no liability of any kind, including the implied warranties of noninfringement, merchantability or fitness for particular purposes, with respect to the operation or use of AMD hardware, software or other products described herein. No license, including implied or arising by estoppel, to any intellectual property rights is granted by this document. Terms and limitations applicable to the purchase or use of AMD's products are as set forth in a signed agreement between the parties or in AMD's Standard Terms and Conditions of Sale.