Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[HIPIFY][feature] New hipification strategy: Single source file for CUDA/HIP code #536

Open
emankov opened this issue Apr 29, 2022 · 0 comments
Assignees
Labels
feature Feature request or implementation

Comments

@emankov
Copy link
Collaborator

emankov commented Apr 29, 2022

The idea is to introduce yet another hipification approach: instead of a new hipified file or hipification in-place perform hipification in the source CUDA file by keeping both CUDA and HIP code in it.

[Example]

#if GPU_PLATFORM == NVIDIA
  #include <cuda_runtime_api.h>
  #include <cublas_v2.h>
#elif GPU_PLATFORM == AMD
  #include <hip/hip_runtime.h>
  #include <hip/hip_runtime_api.h>
  #include <hipblas.h>
  #define cudaError_t hipError_t
  #define cudaFree hipFree
  #define cudaMalloc hipMalloc
  #define cudaMemcpy hipMemcpy
  #define cublasHandle_t hipblasHandle_t
  #define cublasIdamin hipblasIdamin
  #define cublasStatus_t hipblasStatus_t
#endif

[on deliberation]
For compiling such a single-source hipified code the following defines should be provided:
for AMD: -DNVIDIA=0 -DAMD=1 -DGPU_PLATFORM=AMD
for NVIDIA: -DNVIDIA=0 -DAMD=1 -DGPU_PLATFORM=NVIDIA

[IMP]
Both approaches should be available in hipify-clang first under corresponding options.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
feature Feature request or implementation
Projects
None yet
Development

No branches or pull requests

1 participant