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

unify CUDA/HIP function calls/types #940

Merged

Conversation

psychocoderHPC
Copy link
Member

@psychocoderHPC psychocoderHPC commented Mar 2, 2020

This PR is a follow up of #928 to remove most code duplication between CUDA/HIP.

  • add macro ALPAKA_API_PREFIX() to refix functions and types
  • add helper ALPAKA_PP_CONCAT() to construct make_cudaPitched()
  • reduce duplicated runtime error checks for CUDA/HIP

I discussed with @sbastrakov if it is better to use a predefined list of function pointer/function objects or a macro to prefix the functions and types. Using a macro was at the end prepared by us to avoid that we need to maintain a global list of functions and types we are using.
It is also not clear about runtime overhead or compatibility when we use function objects. Function objects avoid inlining and the side effect to separable compile for CUDA and HIP is not clear.

@psychocoderHPC psychocoderHPC force-pushed the topic-unifyCudaHipFunctions branch 2 times, most recently from 03153be to e5d3819 Compare March 2, 2020 10:49
include/alpaka/core/Cuda.hpp Outdated Show resolved Hide resolved
include/alpaka/core/Cuda.hpp Show resolved Hide resolved
include/alpaka/core/UniformCudaHip.hpp Outdated Show resolved Hide resolved
include/alpaka/mem/view/ViewPlainPtr.hpp Show resolved Hide resolved
include/alpaka/pltf/PltfUniformCudaHipRt.hpp Show resolved Hide resolved
sbastrakov
sbastrakov previously approved these changes Mar 3, 2020
Copy link
Member

@sbastrakov sbastrakov left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Great!

- add macro `ALPAKA_API_PREFIX()` to refix functions and types
- add helper `ALPAKA_PP_CONCAT()` to construct `make_cudaPitched()`
- reduce duplicated runtime error checks for CUDA/HIP
@psychocoderHPC
Copy link
Member Author

ready to merge

@sbastrakov
Copy link
Member

@BenjaminW3 should we wait for your review of this PR? To me looks good to be merged.

@BenjaminW3 BenjaminW3 merged commit d651b5c into alpaka-group:develop Mar 6, 2020
@psychocoderHPC psychocoderHPC deleted the topic-unifyCudaHipFunctions branch March 6, 2020 10:56
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants