Skip to content

Commit f6ac45f

Browse files
authored
[SYCL] Allow user control over range rounding, and disable for older SYCL spec. (#3082)
This change lets users choose at compile-time whether to do range-rounding. Rounding is always disabled when using older SYCL specs because the implementation creates const lambdas, which are incompatible with the mutable lambdas allowed in the old spec. Signed-off-by: rdeodhar <[email protected]>
1 parent 4109213 commit f6ac45f

File tree

1 file changed

+9
-4
lines changed

1 file changed

+9
-4
lines changed

sycl/include/CL/sycl/handler.hpp

Lines changed: 9 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -748,9 +748,13 @@ class __SYCL_EXPORT handler {
748748
using NameT =
749749
typename detail::get_kernel_name_t<KernelName, KernelType>::name;
750750

751-
// FIXME Remove this ifndef once rounding of execution range works well with
752-
// ESIMD compilation flow.
753-
#ifndef __SYCL_EXPLICIT_SIMD__
751+
// FIXME Remove the ESIMD check once rounding of execution range works well
752+
// with ESIMD compilation flow.
753+
// Range rounding is supported only for newer SYCL standards.
754+
// Range rounding can also be disabled by the user.
755+
#if !defined(__SYCL_EXPLICIT_SIMD__) && \
756+
!defined(SYCL_DISABLE_PARALLEL_FOR_RANGE_ROUNDING) && \
757+
SYCL_LANGUAGE_VERSION >= 202001
754758
// The work group size preferred by this device.
755759
// A reasonable choice for rounding up the range is 32.
756760
constexpr size_t GoodLocalSizeX = 32;
@@ -816,7 +820,8 @@ class __SYCL_EXPORT handler {
816820
MCGType = detail::CG::KERNEL;
817821
#endif
818822
} else
819-
#endif // __SYCL_EXPLICIT_SIMD__
823+
#endif // !__SYCL_EXPLICIT_SIMD__ && !SYCL_DISABLE_PARALLEL_FOR_RANGE_ROUNDING
824+
// && SYCL_LANGUAGE_VERSION > 202001
820825
{
821826
#ifdef __SYCL_DEVICE_ONLY__
822827
(void)NumWorkItems;

0 commit comments

Comments
 (0)