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

Adds __popc and __max #116

Open
wants to merge 1 commit into
base: dev
Choose a base branch
from
Open

Conversation

tdd11235813
Copy link
Contributor

@tdd11235813 tdd11235813 commented Sep 19, 2019

Change or extend as you like.

Edit there is also __max, which has to be seen as hotfix.
The problem was, that max and min cannot be used as macro, it conflicted user methods with same name. Maybe we use just a global function instead when max and min are not defined respectively, this should be better than this hotfix now.

@tdd11235813 tdd11235813 changed the title Adds __popc. Adds __popc and __max Sep 19, 2019

#if !defined(ALPAKA_ACC_GPU_CUDA_ENABLED) && !defined(ALPAKA_ACC_GPU_HIP_ENABLED)
#if defined(__GNUC__) || defined(__GNUG__)
#define __popc __builtin_popcount
Copy link
Member

Choose a reason for hiding this comment

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

Maybe this is better as a function-style macro (taking an argument explicitly) for consistency with others?

Copy link
Member

Choose a reason for hiding this comment

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

Yes we should use a function style macro!+1 for function style macro


#if !defined(ALPAKA_ACC_GPU_CUDA_ENABLED) && !defined(ALPAKA_ACC_GPU_HIP_ENABLED)
#if defined(__GNUC__) || defined(__GNUG__)
#define __popc __builtin_popcount
Copy link
Member

Choose a reason for hiding this comment

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

Yes we should use a function style macro!+1 for function style macro

@sbastrakov
Copy link
Member

Note: alpaka now has popcount.

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.

4 participants