-
Notifications
You must be signed in to change notification settings - Fork 933
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
Simplify trailing return types in AST operators. #18185
base: branch-25.04
Are you sure you want to change the base?
Conversation
template <typename InputT> | ||
__device__ inline auto operator()(InputT input) -> decltype(!input) | ||
__device__ inline auto operator()(InputT input) -> bool | ||
{ | ||
return !input; | ||
} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
🙀
template <typename From> | ||
__device__ inline auto operator()(From f) -> To | ||
{ | ||
if constexpr (cuda::std::is_floating_point_v<To>) { | ||
if constexpr (is_fixed_point<From> && cuda::std::is_floating_point_v<To>) { | ||
return convert_fixed_to_floating<To>(f); | ||
} else { | ||
return static_cast<To>(f); | ||
} | ||
} | ||
|
||
template <typename From, typename cuda::std::enable_if_t<!is_fixed_point<From>()>* = nullptr> | ||
__device__ inline auto operator()(From f) -> decltype(static_cast<To>(f)) | ||
{ | ||
return static_cast<To>(f); | ||
} | ||
}; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
lets drop this one for now?
I’m seeing compilation errors for a bunch of these, including |
Description
Currently AST operators use
decltype
aggressively to determine their trailing return types.In #17793 we found that CUDA 11 didn't work well with one such
decltype
trailing return type definition, resulting in a bug (root cause unknown).This PR simplifies our definitions of trailing return types when the output type is known and does not depend on the input type.
We assume that comparison and logical operators (
==
,!=
,<
,>
,<=
,>=
,&&
,||
,!
) are always acting on regular-enough types to givebool
, as expected by the C++ standard when those operators are not overloaded by the user.Checklist