From 2132a69072cb1409ee94a3af238498fde787cd09 Mon Sep 17 00:00:00 2001 From: Sergey Kanaev Date: Thu, 24 Dec 2020 11:50:18 +0300 Subject: [PATCH 1/3] [SYCL] Disable execution range rounding for ESIMD kernel in runtime Signed-off-by: Sergey Kanaev --- sycl/include/CL/sycl/handler.hpp | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/sycl/include/CL/sycl/handler.hpp b/sycl/include/CL/sycl/handler.hpp index 117d700596072..aa368212efe56 100644 --- a/sycl/include/CL/sycl/handler.hpp +++ b/sycl/include/CL/sycl/handler.hpp @@ -774,6 +774,7 @@ class __SYCL_EXPORT handler { // 3. The kernel is provided via an interoperability method. // 4. The API "this_item" is used inside the kernel. // 5. The range is already a multiple of the rounding factor. + // 6. We have an ESIMD kernel // // Cases 3 and 4 could be supported with extra effort. // As an optimization for the common case it is an @@ -793,7 +794,8 @@ class __SYCL_EXPORT handler { (KName.find("SYCL_DISABLE_PARALLEL_FOR_RANGE_ROUNDING") != std::string::npos) || (KI::getName() == nullptr || KI::getName()[0] == '\0') || - (KI::callsThisItem()); + (KI::callsThisItem()) || + (KI::isESIMD()); // Perform range rounding if rounding-up is enabled // and the user-specified range is not a multiple of a "good" value. From 072fd8219bfdfc4bc96b13c33820fab774ccb28e Mon Sep 17 00:00:00 2001 From: Sergey Kanaev Date: Thu, 24 Dec 2020 18:03:46 +0300 Subject: [PATCH 2/3] [SYCL] Reworked workaround solution Signed-off-by: Sergey Kanaev --- sycl/include/CL/sycl/handler.hpp | 10 ++++++---- 1 file changed, 6 insertions(+), 4 deletions(-) diff --git a/sycl/include/CL/sycl/handler.hpp b/sycl/include/CL/sycl/handler.hpp index aa368212efe56..cf17c6406ae41 100644 --- a/sycl/include/CL/sycl/handler.hpp +++ b/sycl/include/CL/sycl/handler.hpp @@ -760,9 +760,11 @@ class __SYCL_EXPORT handler { typename std::conditional::value && Dims == 1, item, LambdaArgType>::type; + using NameT = typename detail::get_kernel_name_t::name; +#ifndef __SYCL_EXPLICIT_SIMD__ // The work group size preferred by this device. // A reasonable choice for rounding up the range is 32. constexpr size_t GoodLocalSizeX = 32; @@ -774,7 +776,6 @@ class __SYCL_EXPORT handler { // 3. The kernel is provided via an interoperability method. // 4. The API "this_item" is used inside the kernel. // 5. The range is already a multiple of the rounding factor. - // 6. We have an ESIMD kernel // // Cases 3 and 4 could be supported with extra effort. // As an optimization for the common case it is an @@ -794,8 +795,7 @@ class __SYCL_EXPORT handler { (KName.find("SYCL_DISABLE_PARALLEL_FOR_RANGE_ROUNDING") != std::string::npos) || (KI::getName() == nullptr || KI::getName()[0] == '\0') || - (KI::callsThisItem()) || - (KI::isESIMD()); + (KI::callsThisItem()); // Perform range rounding if rounding-up is enabled // and the user-specified range is not a multiple of a "good" value. @@ -829,7 +829,9 @@ class __SYCL_EXPORT handler { std::move(Wrapper)); MCGType = detail::CG::KERNEL; #endif - } else { + } else +#endif // __SYCL_EXPLICIT_SIMD__ + { #ifdef __SYCL_DEVICE_ONLY__ (void)NumWorkItems; kernel_parallel_for(KernelFunc); From 27ac70529bdb849e70403ef2ee6bd3aac5cb4a48 Mon Sep 17 00:00:00 2001 From: Sergey Kanaev Date: Fri, 25 Dec 2020 11:21:35 +0300 Subject: [PATCH 3/3] [SYCL] Apply comments Signed-off-by: Sergey Kanaev --- sycl/include/CL/sycl/handler.hpp | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/sycl/include/CL/sycl/handler.hpp b/sycl/include/CL/sycl/handler.hpp index cf17c6406ae41..25f83c613a440 100644 --- a/sycl/include/CL/sycl/handler.hpp +++ b/sycl/include/CL/sycl/handler.hpp @@ -760,10 +760,11 @@ class __SYCL_EXPORT handler { typename std::conditional::value && Dims == 1, item, LambdaArgType>::type; - using NameT = typename detail::get_kernel_name_t::name; + // FIXME Remove this ifndef once rounding of execution range works well with + // ESIMD compilation flow. #ifndef __SYCL_EXPLICIT_SIMD__ // The work group size preferred by this device. // A reasonable choice for rounding up the range is 32.