Skip to content

Commit b7cd789

Browse files
Apply GitHUB clang format
1 parent 0da408a commit b7cd789

File tree

1 file changed

+35
-35
lines changed

1 file changed

+35
-35
lines changed

include/oneapi/dpl/pstl/hetero/dpcpp/parallel_backend_sycl_utils.h

Lines changed: 35 additions & 35 deletions
Original file line numberDiff line numberDiff line change
@@ -493,12 +493,12 @@ struct __result_and_scratch_storage : __result_and_scratch_storage_base
493493
};
494494

495495
private:
496-
497496
// struct __result_and_scratch_storage_impl - internal implementation of result and scratch storage
498497
// for support of pimpl-implementation pattern
499498
class __result_and_scratch_storage_impl : __result_and_scratch_storage_base
500499
{
501-
static constexpr bool __is_the_same_result_and_scratch_data_types()
500+
static constexpr bool
501+
__is_the_same_result_and_scratch_data_types()
502502
{
503503
#if _ONEDPL_SYCL2020_DEFAULT_ACCESSOR_CONSTRUCTOR_PRESENT
504504
return std::is_same_v<_TResult, _TScratchData>;
@@ -620,7 +620,9 @@ struct __result_and_scratch_storage : __result_and_scratch_storage_base
620620
__get_value_impl(const sycl::queue& __q, std::size_t _Idx, std::size_t __scratch_n) const
621621
{
622622
_TResult __tmp;
623-
const_cast<sycl::queue&>(__q).memcpy(&__tmp, __scratch.get() + __scratch_n + _Idx, 1 * sizeof(_TResult)).wait();
623+
const_cast<sycl::queue&>(__q)
624+
.memcpy(&__tmp, __scratch.get() + __scratch_n + _Idx, 1 * sizeof(_TResult))
625+
.wait();
624626
return __tmp;
625627
}
626628
};
@@ -663,63 +665,64 @@ struct __result_and_scratch_storage : __result_and_scratch_storage_base
663665
return __results->get_host_access(sycl::read_only)[__scratch_n + _Idx];
664666
}
665667
};
666-
using BufferPlacementVariants = std::variant<BufferPlacementInUSMTogether, BufferPlacementInUSMSeparate, BufferPlacementInSyclBufTogether, BufferPlacementInSyclBufSeparate>;
668+
using BufferPlacementVariants =
669+
std::variant<BufferPlacementInUSMTogether, BufferPlacementInUSMSeparate, BufferPlacementInSyclBufTogether,
670+
BufferPlacementInSyclBufSeparate>;
667671

668-
BufferPlacementVariants __buffers; // All internal containers
672+
BufferPlacementVariants __buffers; // All internal containers
669673

670674
private:
671-
672-
static BufferPlacementVariants
675+
static BufferPlacementVariants
673676
__create_buffers(sycl::queue& __q_ref, std::size_t __scratch_n)
674677
{
675678
if (__use_USM_allocations(__q_ref))
676679
{
677680
// Separate scratch (device) and result (host) allocations on performant backends (i.e. L0)
678-
const sycl::usm::alloc __alloc_type_results = __use_USM_host_allocations(__q_ref) ? sycl::usm::alloc::host : sycl::usm::alloc::device;
681+
const sycl::usm::alloc __alloc_type_results =
682+
__use_USM_host_allocations(__q_ref) ? sycl::usm::alloc::host : sycl::usm::alloc::device;
679683
constexpr sycl::usm::alloc __alloc_type_scratch = sycl::usm::alloc::device;
680684

681685
if (__is_the_same_result_and_scratch_data_types() && __alloc_type_scratch == __alloc_type_results)
682686
{
683687
return BufferPlacementVariants(BufferPlacementInUSMTogether{
684-
{ /* empty initialization for wait_and_throw impl */ },
688+
{/* empty initialization for wait_and_throw impl */},
685689
BufferPlacementInUsmMemory::template __create<_TScratchData, sycl::usm::alloc::device>(
686690
&__q_ref, __scratch_n + _NResults)});
687691
}
688692
else
689693
{
690694
return BufferPlacementVariants(BufferPlacementInUSMSeparate{
691-
{ /* empty initialization for wait_and_throw impl */ },
692-
BufferPlacementInUsmMemory::template __create<_TScratchData, sycl::usm::alloc::device>(&__q_ref,
693-
__scratch_n),
695+
{/* empty initialization for wait_and_throw impl */},
696+
BufferPlacementInUsmMemory::template __create<_TScratchData, sycl::usm::alloc::device>(
697+
&__q_ref, __scratch_n),
694698
__alloc_type_results == sycl::usm::alloc::device
695-
? BufferPlacementInUsmMemory::template __create<_TResult, sycl::usm::alloc::device>(&__q_ref, _NResults)
696-
: BufferPlacementInUsmMemory::template __create<_TResult, sycl::usm::alloc::host>(&__q_ref, _NResults)});
699+
? BufferPlacementInUsmMemory::template __create<_TResult, sycl::usm::alloc::device>(
700+
&__q_ref, _NResults)
701+
: BufferPlacementInUsmMemory::template __create<_TResult, sycl::usm::alloc::host>(
702+
&__q_ref, _NResults)});
697703
}
698704
}
699705
else
700706
{
701707
if (__is_the_same_result_and_scratch_data_types())
702708
{
703709
return BufferPlacementVariants(BufferPlacementInSyclBufTogether{
704-
{ /* empty initialization for wait_and_throw impl */ },
710+
{/* empty initialization for wait_and_throw impl */},
705711
BufferPlacementInSyclBuf::template __create<_TScratchData>(__scratch_n + _NResults)});
706712
}
707713
else
708714
{
709715
return BufferPlacementVariants(BufferPlacementInSyclBufSeparate{
710-
{ /* empty initialization for wait_and_throw impl */ },
716+
{/* empty initialization for wait_and_throw impl */},
711717
BufferPlacementInSyclBuf::template __create<_TScratchData>(__scratch_n),
712718
BufferPlacementInSyclBuf::template __create<_TResult>(_NResults)});
713719
}
714720
}
715721
}
716722

717723
public:
718-
719724
__result_and_scratch_storage_impl(sycl::queue& __q_ref, std::size_t __scratch_n)
720-
: __q{__q_ref}
721-
, __scratch_n{__scratch_n}
722-
, __buffers(__create_buffers(__q, __scratch_n))
725+
: __q{__q_ref}, __scratch_n{__scratch_n}, __buffers(__create_buffers(__q, __scratch_n))
723726
{
724727
}
725728

@@ -729,7 +732,8 @@ struct __result_and_scratch_storage : __result_and_scratch_storage_base
729732
{
730733
return std::visit(
731734
[&](auto&& __arg) {
732-
return __get_scratch_acc_impl<_AccessMode>(__cgh, __prop_list, std::forward<decltype(__arg)>(__arg));
735+
return __get_scratch_acc_impl<_AccessMode>(__cgh, __prop_list,
736+
std::forward<decltype(__arg)>(__arg));
733737
},
734738
__buffers);
735739
}
@@ -780,12 +784,12 @@ struct __result_and_scratch_storage : __result_and_scratch_storage_base
780784

781785
const sycl::queue& __q_ref = __q;
782786
const std::size_t __s_n = __scratch_n;
783-
return std::visit([__q_ref, __s_n](auto&& __arg) { return __arg.__get_value_impl(__q_ref, _Idx, __s_n); }, __buffers);
787+
return std::visit([__q_ref, __s_n](auto&& __arg) { return __arg.__get_value_impl(__q_ref, _Idx, __s_n); },
788+
__buffers);
784789
}
785790

786-
// __result_and_scratch_storage_base
787-
public:
788-
791+
// __result_and_scratch_storage_base
792+
public:
789793
virtual std::size_t
790794
__get_data(sycl::event __event, std::size_t* __p_buf) const override
791795
{
@@ -799,17 +803,15 @@ struct __result_and_scratch_storage : __result_and_scratch_storage_base
799803
return 0;
800804
}
801805

802-
private:
803-
806+
private:
804807
// Only use USM host allocations on L0 GPUs. Other devices show significant slowdowns and will use a device allocation instead.
805808
static bool
806809
__use_USM_host_allocations(sycl::queue& __q)
807810
{
808811
#if _ONEDPL_SYCL2020_DEFAULT_ACCESSOR_CONSTRUCTOR_PRESENT && _ONEDPL_SYCL_L0_EXT_PRESENT
809812
const sycl::device& __device = __q.get_device();
810-
if (__device.is_gpu()
811-
&& __device.has(sycl::aspect::usm_host_allocations)
812-
&& __device.get_backend() != __dpl_sycl::__level_zero_backend)
813+
if (__device.is_gpu() && __device.has(sycl::aspect::usm_host_allocations) &&
814+
__device.get_backend() != __dpl_sycl::__level_zero_backend)
813815
{
814816
return true;
815817
}
@@ -883,7 +885,8 @@ struct __result_and_scratch_storage : __result_and_scratch_storage_base
883885
}
884886
}
885887

886-
void __wait_and_throw(sycl::event& __event) const
888+
void
889+
__wait_and_throw(sycl::event& __event) const
887890
{
888891
return std::visit([&](auto&& __arg) { __arg.__wait_and_throw_impl(__event); }, __buffers);
889892
}
@@ -894,7 +897,6 @@ struct __result_and_scratch_storage : __result_and_scratch_storage_base
894897
std::unique_ptr<__result_and_scratch_storage_impl> __impl;
895898

896899
public:
897-
898900
__result_and_scratch_storage(sycl::queue& __q_ref, std::size_t __scratch_n)
899901
: __impl(std::make_unique<__result_and_scratch_storage_impl>(__q_ref, __scratch_n))
900902
{
@@ -936,9 +938,8 @@ struct __result_and_scratch_storage : __result_and_scratch_storage_base
936938
return __impl->template __get_value<_Idx>();
937939
}
938940

939-
// __result_and_scratch_storage_base
941+
// __result_and_scratch_storage_base
940942
public:
941-
942943
virtual std::size_t
943944
__get_data(sycl::event __event, std::size_t* __p_buf) const override
944945
{
@@ -1003,7 +1004,6 @@ class __future : private std::tuple<_Args...>
10031004
}
10041005

10051006
public:
1006-
10071007
template <typename TEvent, typename... TArgs>
10081008
__future(TEvent&& __e, TArgs&&... __args)
10091009
: __base_t(std::forward<TArgs>(__args)...), __my_event(std::forward<TEvent>(__e))

0 commit comments

Comments
 (0)