-
Notifications
You must be signed in to change notification settings - Fork 741
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
[SYCL] Check for nan/inf in stream class #522
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
@@ -83,7 +83,7 @@ static inline std::string codeToString(cl_int code){ | |||
#endif | |||
|
|||
#if __has_attribute(always_inline) | |||
#define ALWAYS_INLINE __attribute__((always_inline)) | |||
#define ALWAYS_INLINE __attribute__((always_inline)) inline |
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.
How this modification related to the adding check for nan values?
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.
I use sycl builtins to check for nan/inf values. Usage of these builtins causes warnings. Purpose of this change is to fix these warnings.
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.
You are changing the define semantics w/o updating the name!
Can you just apply inline
keyword to specific built-ins you are using?
Also I'm not sure I follow what warning is emitted, so it's hard to say what is the right fix.
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.
Moved inline keyword from macro to builtin declaration.
Short description of the problem:
According to always_inline attribute description in gcc's documentation https://gcc.gnu.org/onlinedocs/gcc/Common-Function-Attributes.html:
For functions *declared inline*, this attribute inlines the function independent of any restrictions that otherwise apply to inlining.
This means that if declaration is not marked inline then warning will be generated.
Problem could be reproduced in the following test case:
#include <CL/sycl.hpp>
int main() {
return 0;
}
When compiling with gcc 5.4.0:
g++ -std=c++11 -I$PATH_TO_SYCL/sycl/include test.cpp -c
gives the bunch of warnings:
"sycl/include/CL/sycl/detail/builtins.hpp:32:19: warning: always_inline function might not be inlinable [-Wattributes]"
If you think that I shouldn't fix this in this patch or my fix doesn't look good then I can create issue and assign it to the author.
if (Exp16 == 0x1f) { | ||
if (Sign) | ||
return append(Buf, "-inf"); | ||
else |
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.
Please, do not put else
after return
.
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.
Thx, fixed.
else if (isinf(Val)) { | ||
if (signbit(Val)) | ||
return append(Buf, "-inf"); | ||
else |
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.
Please, do not put else
after return
.
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.
Thx, fixed.
84de49c
to
a61f068
Compare
checkForInfNan(char *Buf, T Val) { | ||
if (isnan(Val)) | ||
return append(Buf, "nan"); | ||
else if (isinf(Val)) { |
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.
No else
after return
, please.
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.
Sorry, fixed.
Signed-off-by: Artur Gainullin <artur.gainullin@intel.com>
a61f068
to
1371320
Compare
intel#522 removed the propagation of the ImportedHostPtr argument from _pi_buffer to the _pi_mem superclass. This seems like an unintended change and this commit re-adds the propagation. Signed-off-by: Larsen, Steffen <steffen.larsen@intel.com>
#522 removed the propagation of the ImportedHostPtr argument from _pi_buffer to the _pi_mem superclass. This seems like an unintended change and this commit re-adds the propagation. Signed-off-by: Larsen, Steffen <steffen.larsen@intel.com>
Signed-off-by: Artur Gainullin artur.gainullin@intel.com