Skip to content

Adds __popc and __max - #116

Open
tdd11235813 wants to merge 1 commit into
alpaka-group:devfrom
tdd11235813:pr-fixes
Open

Adds __popc and __max#116
tdd11235813 wants to merge 1 commit into
alpaka-group:devfrom
tdd11235813:pr-fixes

Conversation

@tdd11235813

@tdd11235813 tdd11235813 commented Sep 19, 2019

Copy link
Copy Markdown
Contributor

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
Copy Markdown
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
Copy Markdown
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

@psychocoderHPC psychocoderHPC self-assigned this Sep 26, 2019
@psychocoderHPC
psychocoderHPC self-requested a review September 26, 2019 09:49

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

Copy link
Copy Markdown
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
Copy Markdown
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