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

EC/CUDA: remove if constexpr #718

Merged

Conversation

samnordmann
Copy link
Collaborator

@samnordmann samnordmann commented Jan 25, 2023

What

remove "if constexpr" statements
No perf degradation, see graphs below

Why ?

causes a linter warning

warning #2912-D: constexpr if statements are a C++17 feature

reducedt_float32_a100_plot
reducedt_float32-T_a100_plot
reducedt_float64_a100_plot
reducedt_float64-T_a100_plot
reducedt_int32_a100_plot
reducedt_int32-T_a100_plot
reducedt_strided_float32_a100_plot
reducedt_strided_float32-T_a100_plot
reducedt_strided_float64_a100_plot
reducedt_strided_float64-T_a100_plot
reducedt_strided_int32_a100_plot
reducedt_strided_int32-T_a100_plot

@@ -84,7 +84,7 @@ cuFloatComplex operator* (const cuFloatComplex & first,
} \
_Pragma("unroll") for (i = 0; i < unroll; i++) \
{ \
if constexpr (strided) { \
if (strided) { \
Copy link
Contributor

Choose a reason for hiding this comment

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

can we use function template specialiation to get same behaviour as if constexp?

template<bool strided>
void * get_tmp2(s, s2) {return nullptr}

template<>
void * get_tmp2(....)<true> {return s2[line + warp_size * i + j * ld]}

template<>
void * get_tmp2(....)<false> {return s[1 + j][line + warp_size * i]]}

@samnordmann samnordmann force-pushed the ec/cuda/refactor_remove_const_expr branch from 638d845 to 2aa43c7 Compare January 26, 2023 18:16
@Sergei-Lebedev Sergei-Lebedev enabled auto-merge (squash) January 26, 2023 18:22
@Sergei-Lebedev Sergei-Lebedev merged commit 2f869b4 into openucx:master Jan 26, 2023
janjust pushed a commit to janjust/ucc that referenced this pull request Jan 31, 2024
* EC/CUDA: remove if constexpr

* EC/CUDA: remove constexpr specifiers
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