From 88df143060ebefab6c3b554121a3b3e3fa909bef Mon Sep 17 00:00:00 2001 From: gregory Date: Thu, 2 Jun 2022 23:28:56 -0700 Subject: [PATCH 1/4] Make esimd implementation of fmod compatible with std::fmod --- .../ext/intel/experimental/esimd/math.hpp | 28 ++++++++++++++----- 1 file changed, 21 insertions(+), 7 deletions(-) diff --git a/sycl/include/sycl/ext/intel/experimental/esimd/math.hpp b/sycl/include/sycl/ext/intel/experimental/esimd/math.hpp index ce3054dd88672..639a452ad93af 100644 --- a/sycl/include/sycl/ext/intel/experimental/esimd/math.hpp +++ b/sycl/include/sycl/ext/intel/experimental/esimd/math.hpp @@ -1371,21 +1371,35 @@ template <> ESIMD_INLINE float atan2(float y, float x) { template ESIMD_INLINE __ESIMD_NS::simd fmod(__ESIMD_NS::simd y, __ESIMD_NS::simd x) { - __ESIMD_NS::simd v_quot; __ESIMD_NS::simd fmod; + __ESIMD_NS::simd abs_x; + __ESIMD_NS::simd reminder; + __ESIMD_NS::simd reminder_sign_mask; + __ESIMD_NS::simd y_sign_mask; - v_quot = convert(y / x); - fmod = y - x * convert(v_quot); - return fmod; + y_sign_mask.merge(-1.0f, 1.0f, y < 0); + abs_x = __ESIMD_NS::abs(x); + reminder = y - abs_x * __ESIMD_NS::trunc(__ESIMD_NS::abs(y) / abs_x); + reminder_sign_mask.merge(1.0f, 0.0f, reminder < 0); + + fmod = reminder + abs_x * reminder_sign_mask; + return __ESIMD_NS::abs(fmod) * y_sign_mask; } // For Scalar Input template <> ESIMD_INLINE float fmod(float y, float x) { - int v_quot; __ESIMD_NS::simd fmod; + __ESIMD_NS::simd abs_x; + __ESIMD_NS::simd reminder; + __ESIMD_NS::simd reminder_sign_mask; + __ESIMD_NS::simd y_sign_mask; + + y_sign_mask.merge(-1.0f, 1.0f, y < 0); + abs_x = __ESIMD_NS::abs(x); + reminder = y - abs_x * __ESIMD_NS::trunc(__ESIMD_NS::abs(y) / abs_x); + reminder_sign_mask.merge(1.0f, 0.0f, reminder < 0); - v_quot = (int)(y / x); - fmod = y - x * v_quot; + fmod = __ESIMD_NS::abs(reminder + abs_x * reminder_sign_mask) * y_sign_mask; return fmod[0]; } From 84313795861a66f50445bea7ed7efe54942a06e7 Mon Sep 17 00:00:00 2001 From: gregory Date: Fri, 10 Jun 2022 09:45:32 -0700 Subject: [PATCH 2/4] Correct version of Python that is required for LLVM build --- sycl/doc/GetStartedGuide.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/sycl/doc/GetStartedGuide.md b/sycl/doc/GetStartedGuide.md index 7b22f782eb74b..3daf68f58e105 100644 --- a/sycl/doc/GetStartedGuide.md +++ b/sycl/doc/GetStartedGuide.md @@ -37,7 +37,7 @@ and a wide range of compute accelerators such as GPU and FPGA. * `git` - [Download](https://git-scm.com/downloads) * `cmake` version 3.14 or later - [Download](http://www.cmake.org/download/) -* `python` - [Download](https://www.python.org/downloads/release/python-2716/) +* `python` - [Download](https://www.python.org/downloads/release/python-3105/) * `ninja` - [Download](https://github.com/ninja-build/ninja/wiki/Pre-built-Ninja-packages) * C++ compiler From 72e03d7567f450996f697686d3089320e12120c4 Mon Sep 17 00:00:00 2001 From: gregory Date: Fri, 10 Jun 2022 11:04:51 -0700 Subject: [PATCH 3/4] Fix several additional issues on the page --- sycl/doc/GetStartedGuide.md | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/sycl/doc/GetStartedGuide.md b/sycl/doc/GetStartedGuide.md index 3daf68f58e105..849f27af00ff3 100644 --- a/sycl/doc/GetStartedGuide.md +++ b/sycl/doc/GetStartedGuide.md @@ -37,7 +37,7 @@ and a wide range of compute accelerators such as GPU and FPGA. * `git` - [Download](https://git-scm.com/downloads) * `cmake` version 3.14 or later - [Download](http://www.cmake.org/download/) -* `python` - [Download](https://www.python.org/downloads/release/python-3105/) +* `python` - [Download](https://www.python.org/downloads/) * `ninja` - [Download](https://github.com/ninja-build/ninja/wiki/Pre-built-Ninja-packages) * C++ compiler @@ -46,7 +46,7 @@ and a wide range of compute accelerators such as GPU and FPGA. * Windows: `Visual Studio` version 15.7 preview 4 or later - [Download](https://visualstudio.microsoft.com/downloads/) -Alternatively, you can use Docker image, that has everything you need +Alternatively, you can use Docker image, that has everything you need for building pre-installed: ``` @@ -316,6 +316,7 @@ the following tools need to be installed: * doxygen * graphviz +* sphinx Then you'll need to add the following options to your CMake configuration command: @@ -520,7 +521,7 @@ python $DPCPP_HOME/llvm/buildbot/check.py ```bat python %DPCPP_HOME%\llvm\buildbot\check.py ``` - +Make sure that psutil package is installed. If no OpenCL GPU/CPU runtimes are available, the corresponding tests are skipped. From b043ee7adcfe60e85ce0abd672f9ac6c7aa036ab Mon Sep 17 00:00:00 2001 From: gregory Date: Fri, 10 Jun 2022 14:26:59 -0700 Subject: [PATCH 4/4] Remove leftover file from different PR --- .../ext/intel/experimental/esimd/math.hpp | 28 +++++-------------- 1 file changed, 7 insertions(+), 21 deletions(-) diff --git a/sycl/include/sycl/ext/intel/experimental/esimd/math.hpp b/sycl/include/sycl/ext/intel/experimental/esimd/math.hpp index 639a452ad93af..ce3054dd88672 100644 --- a/sycl/include/sycl/ext/intel/experimental/esimd/math.hpp +++ b/sycl/include/sycl/ext/intel/experimental/esimd/math.hpp @@ -1371,35 +1371,21 @@ template <> ESIMD_INLINE float atan2(float y, float x) { template ESIMD_INLINE __ESIMD_NS::simd fmod(__ESIMD_NS::simd y, __ESIMD_NS::simd x) { + __ESIMD_NS::simd v_quot; __ESIMD_NS::simd fmod; - __ESIMD_NS::simd abs_x; - __ESIMD_NS::simd reminder; - __ESIMD_NS::simd reminder_sign_mask; - __ESIMD_NS::simd y_sign_mask; - y_sign_mask.merge(-1.0f, 1.0f, y < 0); - abs_x = __ESIMD_NS::abs(x); - reminder = y - abs_x * __ESIMD_NS::trunc(__ESIMD_NS::abs(y) / abs_x); - reminder_sign_mask.merge(1.0f, 0.0f, reminder < 0); - - fmod = reminder + abs_x * reminder_sign_mask; - return __ESIMD_NS::abs(fmod) * y_sign_mask; + v_quot = convert(y / x); + fmod = y - x * convert(v_quot); + return fmod; } // For Scalar Input template <> ESIMD_INLINE float fmod(float y, float x) { + int v_quot; __ESIMD_NS::simd fmod; - __ESIMD_NS::simd abs_x; - __ESIMD_NS::simd reminder; - __ESIMD_NS::simd reminder_sign_mask; - __ESIMD_NS::simd y_sign_mask; - - y_sign_mask.merge(-1.0f, 1.0f, y < 0); - abs_x = __ESIMD_NS::abs(x); - reminder = y - abs_x * __ESIMD_NS::trunc(__ESIMD_NS::abs(y) / abs_x); - reminder_sign_mask.merge(1.0f, 0.0f, reminder < 0); - fmod = __ESIMD_NS::abs(reminder + abs_x * reminder_sign_mask) * y_sign_mask; + v_quot = (int)(y / x); + fmod = y - x * v_quot; return fmod[0]; }