-
Notifications
You must be signed in to change notification settings - Fork 787
[SYCL][libdevice] Split MSVC specific math functions from cmath devicelib. #6120
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
Conversation
Signed-off-by: jinge90 <[email protected]>
Signed-off-by: jinge90 <[email protected]>
Signed-off-by: jinge90 <[email protected]>
Signed-off-by: jinge90 <[email protected]>
Signed-off-by: jinge90 <[email protected]>
In cmath devicelib, we disabled ldexpf, hypotf, frexpf for Windows, the reason was we included "math.h" in the source and MSVC "math.h" has inlined those 3 functions in header file which would block us to implement those 3 functions, otherwise "multiple definition" error would happen in building cmath devicelib.
Thanks very much. |
Hi, @mdtoguchi Thanks very much. |
Signed-off-by: jinge90 <[email protected]>
…der in device_math.h Signed-off-by: jinge90 <[email protected]>
"crt", "cmath", "cmath-fp64", "complex", "complex-fp64", | ||
#if defined(_WIN32) | ||
"msvc-math", | ||
#endif |
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.
Indentation is off, I would assume that clang-format forced this behavior?
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.
Yes, I ran clang-format before submitting the patch.
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!
…elib. (intel#6120) In cmath devicelib, we disabled ldexpf, hypotf, frexpf for Windows, the reason was we included "math.h" in the source and MSVC "math.h" has inlined those 3 functions in header file which would block us to implement those 3 functions, otherwise "multiple definition" error would happen in building cmath devicelib. The reason why we had to include MSVC "math.h" was we implemented some MSVC internal math functions in cmath devicelib and those internal math functions depended on some constant which are defined in MSVC math header. Now, some users reported that they encountered "undefined symbol" error for "hypotf" on SYCL GPU device when using 3rd-party math headers instead of MSVC math headers. In order to support such use case, we need to provide ldexpf, hypotf, frexpf in SYCL device library for Windows too. And in order to resolve the multiple definition error introduced by inline for hypotf, ldexpf, frexpf in MSVC math header, we have to: * split all MSVC internal function into a new source file msvc-math.cpp and we will include "math.h" in this source. * enable hypotf, ldexpf, frexpf in cmath_wrapper.cpp since there is no "include <math.h>" in the source any more, building it using clang will succeed. * we will build msvc-math.cpp to get a new .obj file libsycl-msvc-math.obj and this devicelib will be added to device link list by default and controlled by fsycl-device-lib=libm-fp32 too. Signed-off-by: jinge90 <[email protected]>
No description provided.