-
Notifications
You must be signed in to change notification settings - Fork 88
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
Remove attributes from math functions #1695
Conversation
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.
LGTM!
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.
LGTM!
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.
It will work with __half, but I think it is somehow by accident or not strict rule from cuda compiler. they might inline it before checking whether it can be constexpr or not.
__half
does not have any constexpr constructor.
zero<__half>
and one<__half>
will not be done in compiled time, and then these functions are not __device__
kernel. Thus, the device kernel should not be able to use these function, right?
Inlining happens much later than any checks for function attributes, so this should not be an issue at all. If |
but even if the function is |
The |
I know constexpr does not always need to be evaluated in compile time. |
To make the terminology a bit clearer: A function is marked |
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.
If the constexpr in the first place does not need to be checked, I am fine with the changes
20f7f32
to
98f29f6
Compare
Quality Gate passedIssues Measures |
Codecov ReportAll modified and coverable lines are covered by tests ✅
Additional details and impacted files@@ Coverage Diff @@
## develop #1695 +/- ##
========================================
Coverage 89.96% 89.96%
========================================
Files 763 763
Lines 62877 62878 +1
========================================
+ Hits 56570 56571 +1
Misses 6307 6307 ☔ View full report in Codecov by Sentry. |
This PR removes
GKO_ATTRIBUTES
from constexpr functions in math.hpp. Since we build cuda with--expt-relaxed-constexpr
theconstexpr
is already enough to allow those functions on the device.Fixes #1693.