-
Notifications
You must be signed in to change notification settings - Fork 769
Added missing math APIs for devicelib. #2558
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: Vyacheslav Zakharin <[email protected]>
Signed-off-by: Vyacheslav Zakharin <[email protected]>
Signed-off-by: Vyacheslav Zakharin <[email protected]>
Signed-off-by: Vyacheslav Zakharin <[email protected]>
Signed-off-by: Vyacheslav Zakharin <[email protected]>
Signed-off-by: Vyacheslav Zakharin <[email protected]>
Signed-off-by: Vyacheslav Zakharin <[email protected]>
I figured out that FE sets |
@@ -47,6 +47,12 @@ void device_cmath_test(s::queue &deviceQueue) { | |||
auto quo_access = buffer4.template get_access<sycl_write>(cgh); | |||
cgh.single_task<class DeviceMathTest>([=]() { | |||
int i = 0; | |||
T nan = NAN; | |||
T minus_nan = -NAN; | |||
T infinity = INFINITY; |
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.
Do I understand correctly that this test uses C macro instead of std::numeric_limits<T>
methods intentionally to check the compatibility with "C"?
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.
Not really. The C macro is just shorter to write.
Friendly ping... |
|
||
DEVICE_EXTERN_C | ||
double __devicelib_scalbn(double x, int exp) { | ||
return __spirv_ocl_ldexp(x, exp); |
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.
Am I correct that we assume here that FLT_RADIX is always == 2?
Should we make a comment about this?
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, we assume it is 2. Do you suggest mentioning this in the documentation for devicelib
?
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 am not sure if it worth mentioning and how obvious is this that it is 100% equal to 2. If you think that it is obvious I am ok to leave it as is.
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.
According to GCC documentation, it is 2 on the majority of the machines, so I would say it is quite expected to be equal to 2. At the same time, I was not able to find any documentation regarding floating point representation for SPIR-V
devices.
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 see, thx.
* sycl: [SYCL] Fix test failure due to size discrepancy in 32 and 64 bit environment (intel#2594) [BuildBot] Linux GPU driver uplift to 20.39.17972 (intel#2600) [SYCL][NFC] Remove cyclic dependency in headers (intel#2601) [SYCL][Doc] Fix Sphinx docs index (intel#2599) [SYCL][PI][L0] Add an assert to piEnqueueKernelLaunch() when the GlobalWorkOffset!=0 (intel#2593) [SYCL][Driver] Turn on -spirv-allow-extra-diexpressions option (intel#2578) [SYCL] Serialize queue related PI API in the Level-Zero plugin (intel#2588) Added missing math APIs for devicelib. (intel#2558) [SYCL][DOC] Fix path to FPGA device selector (intel#2563) [SYCL][CUDA] Add basic sub-group functionality (intel#2587) [SYCL] Add specialization constant feature design doc. (intel#2572) [SYCL] Expand release lit test to CPU and ACC (intel#2589) [SYCL] Add clang support for FPGA kernel attribute scheduler_target_fmax_mhz (intel#2511) [SYCL][ESIMD] Fixed compiler crash in LowerESIMDVecArg pass (intel#2556)
…arameter_for_tests Add a benchmark scripts parameter for faster testing
…ter_for_tests Add a benchmark scripts parameter for faster testing
The new APIs are mostly for Windows, but I added double-precision
scalbn
for both Linux and Windows.The Microsoft APIs are defined here: https://docs.microsoft.com/en-us/cpp/c-runtime-library/reference/floating-point-primitives?view=vs-2019
There are still some Microsoft APIs missing.
Signed-off-by: Vyacheslav Zakharin [email protected]