forked from ROCm/HIPIFY
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Browse files
Browse the repository at this point in the history
…port - Step 1 + [IMP] Everything is experimental + Both implementation are taken into account: `hipSOLVER` and `rocSOLVER` + Added new synthetic tests `cusolver2hipsolver.cu` and `cusolver2rocsolver.cu` + Updated the regenerated hipify-perl + [ToDo] `SOLVER` `CUDA2HIP` documentation generation
- Loading branch information
Showing
9 changed files
with
163 additions
and
2 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,37 @@ | ||
/* | ||
Copyright (c) 2015 - present Advanced Micro Devices, Inc. All rights reserved. | ||
Permission is hereby granted, free of charge, to any person obtaining a copy | ||
of this software and associated documentation files (the "Software"), to deal | ||
in the Software without restriction, including without limitation the rights | ||
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell | ||
copies of the Software, and to permit persons to whom the Software is | ||
furnished to do so, subject to the following conditions: | ||
The above copyright notice and this permission notice shall be included in | ||
all copies or substantial portions of the Software. | ||
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR | ||
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, | ||
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE | ||
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER | ||
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, | ||
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN | ||
THE SOFTWARE. | ||
*/ | ||
|
||
#include "CUDA2HIP.h" | ||
|
||
// Map of all functions | ||
const std::map<llvm::StringRef, hipCounter> CUDA_SOLVER_FUNCTION_MAP { | ||
{"cusolverDnCreate", {"hipsolverDnCreate", "rocblas_create_handle", CONV_LIB_FUNC, API_SOLVER, 2, HIP_EXPERIMENTAL}}, | ||
{"cusolverDnDestroy", {"hipsolverDnDestroy", "rocblas_destroy_handle", CONV_LIB_FUNC, API_SOLVER, 2, HIP_EXPERIMENTAL}}, | ||
}; | ||
|
||
const std::map<llvm::StringRef, cudaAPIversions> CUDA_SOLVER_FUNCTION_VER_MAP { | ||
}; | ||
|
||
const std::map<llvm::StringRef, hipAPIversions> HIP_SOLVER_FUNCTION_VER_MAP { | ||
{"hipsolverDnCreate", {HIP_5010, HIP_0, HIP_0, HIP_LATEST}}, | ||
{"hipsolverDnDestroy", {HIP_5010, HIP_0, HIP_0, HIP_LATEST}}, | ||
}; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,37 @@ | ||
/* | ||
Copyright (c) 2015 - present Advanced Micro Devices, Inc. All rights reserved. | ||
Permission is hereby granted, free of charge, to any person obtaining a copy | ||
of this software and associated documentation files (the "Software"), to deal | ||
in the Software without restriction, including without limitation the rights | ||
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell | ||
copies of the Software, and to permit persons to whom the Software is | ||
furnished to do so, subject to the following conditions: | ||
The above copyright notice and this permission notice shall be included in | ||
all copies or substantial portions of the Software. | ||
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR | ||
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, | ||
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE | ||
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER | ||
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, | ||
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN | ||
THE SOFTWARE. | ||
*/ | ||
|
||
#include "CUDA2HIP.h" | ||
|
||
// Map of all functions | ||
const std::map<llvm::StringRef, hipCounter> CUDA_SOLVER_TYPE_NAME_MAP { | ||
{"cusolverStatus_t", {"hipsolverStatus_t", "rocblas_status", CONV_LIB_FUNC, API_SOLVER, 1, HIP_EXPERIMENTAL}}, | ||
{"cusolverDnHandle_t", {"hipsolverHandle_t", "rocblas_handle", CONV_LIB_FUNC, API_SOLVER, 1, HIP_EXPERIMENTAL}}, | ||
}; | ||
|
||
const std::map<llvm::StringRef, cudaAPIversions> CUDA_SOLVER_TYPE_NAME_VER_MAP { | ||
}; | ||
|
||
const std::map<llvm::StringRef, hipAPIversions> HIP_SOLVER_TYPE_NAME_VER_MAP { | ||
{"hipsolverStatus_t", {HIP_4050, HIP_0, HIP_0, HIP_LATEST}}, | ||
{"hipsolverHandle_t", {HIP_4050, HIP_0, HIP_0, HIP_LATEST}}, | ||
}; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -174,6 +174,7 @@ enum ApiTypes { | |
API_DNN, | ||
API_FFT, | ||
API_SPARSE, | ||
API_SOLVER, | ||
API_CUB, | ||
API_CAFFE2, | ||
API_RTC, | ||
|
29 changes: 29 additions & 0 deletions
29
tests/unit_tests/synthetic/libraries/cusolver2hipsolver.cu
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,29 @@ | ||
// RUN: %run_test hipify "%s" "%t" %hipify_args 2 --skip-excluded-preprocessor-conditional-blocks --experimental %clang_args -D__CUDA_API_VERSION_INTERNAL -ferror-limit=500 | ||
|
||
// CHECK: #include <hip/hip_runtime.h> | ||
#include <cuda_runtime.h> | ||
#include <stdio.h> | ||
// CHECK: #include "hipsolver.h" | ||
#include "cusolverDn.h" | ||
|
||
int main() { | ||
printf("19. cuSOLVER API to hipSOLVER API synthetic test\n"); | ||
|
||
// CHECK: hipsolverHandle_t handle; | ||
cusolverDnHandle_t handle; | ||
|
||
// CHECK: hipsolverStatus_t status; | ||
cusolverStatus_t status; | ||
|
||
// CUDA: cusolverStatus_t CUSOLVERAPI cusolverDnCreate(cusolverDnHandle_t *handle); | ||
// HIP: HIPSOLVER_EXPORT hipsolverStatus_t hipsolverDnCreate(hipsolverHandle_t* handle); | ||
// CHECK: status = hipsolverDnCreate(&handle); | ||
status = cusolverDnCreate(&handle); | ||
|
||
// CUDA: cusolverStatus_t CUSOLVERAPI cusolverDnDestroy(cusolverDnHandle_t handle); | ||
// HIP: HIPSOLVER_EXPORT hipsolverStatus_t hipsolverDnDestroy(hipsolverHandle_t handle); | ||
// CHECK: status = hipsolverDnDestroy(handle); | ||
status = cusolverDnDestroy(handle); | ||
|
||
return 0; | ||
} |
29 changes: 29 additions & 0 deletions
29
tests/unit_tests/synthetic/libraries/cusolver2rocsolver.cu
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,29 @@ | ||
// RUN: %run_test hipify "%s" "%t" %hipify_args 3 --skip-excluded-preprocessor-conditional-blocks --experimental --roc %clang_args -D__CUDA_API_VERSION_INTERNAL -ferror-limit=500 | ||
|
||
// CHECK: #include <hip/hip_runtime.h> | ||
#include <cuda_runtime.h> | ||
#include <stdio.h> | ||
// CHECK: #include "rocsolver.h" | ||
#include "cusolverDn.h" | ||
|
||
int main() { | ||
printf("20. cuSOLVER API to rocSOLVER API synthetic test\n"); | ||
|
||
// CHECK: rocblas_handle handle; | ||
cusolverDnHandle_t handle; | ||
|
||
// CHECK: rocblas_status status; | ||
cusolverStatus_t status; | ||
|
||
// CUDA: cusolverStatus_t CUSOLVERAPI cusolverDnCreate(cusolverDnHandle_t *handle); | ||
// ROC: ROCBLAS_EXPORT rocblas_status rocblas_create_handle(rocblas_handle* handle); | ||
// CHECK: status = rocblas_create_handle(&handle); | ||
status = cusolverDnCreate(&handle); | ||
|
||
// CUDA: cusolverStatus_t CUSOLVERAPI cusolverDnDestroy(cusolverDnHandle_t handle); | ||
// ROC: ROCBLAS_EXPORT rocblas_status rocblas_destroy_handle(rocblas_handle handle); | ||
// CHECK: status = rocblas_destroy_handle(handle); | ||
status = cusolverDnDestroy(handle); | ||
|
||
return 0; | ||
} |