Skip to content

Commit 01e0f9f

Browse files
committed
Fix formatting
1 parent 2980531 commit 01e0f9f

File tree

5 files changed

+106
-110
lines changed

5 files changed

+106
-110
lines changed

sycl/include/sycl/ext/oneapi/experimental/enqueue_functions.hpp

Lines changed: 12 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -114,20 +114,22 @@ event submit_with_event_impl(const queue &Q, PropertiesT Props,
114114

115115
template <typename KernelName, typename PropertiesT, typename KernelType,
116116
int Dims>
117-
void submit_kernel_direct_impl(const queue &Q, PropertiesT Props, nd_range<Dims> Range,
118-
const KernelType &KernelFunc,
119-
const sycl::detail::code_location &CodeLoc) {
120-
Q.submit_kernel_direct_without_event<KernelName, PropertiesT, KernelType, Dims>(
121-
Props, Range, KernelFunc, CodeLoc);
117+
void submit_kernel_direct_impl(const queue &Q, PropertiesT Props,
118+
nd_range<Dims> Range,
119+
const KernelType &KernelFunc,
120+
const sycl::detail::code_location &CodeLoc) {
121+
Q.submit_kernel_direct_without_event<KernelName, PropertiesT, KernelType,
122+
Dims>(Props, Range, KernelFunc, CodeLoc);
122123
}
123124

124125
template <typename KernelName, typename PropertiesT, typename KernelType,
125126
int Dims>
126127
event submit_kernel_direct_with_event_impl(
127128
const queue &Q, PropertiesT Props, nd_range<Dims> Range,
128129
const KernelType &KernelFunc, const sycl::detail::code_location &CodeLoc) {
129-
return Q.submit_kernel_direct_with_event<KernelName, PropertiesT, KernelType, Dims>(
130-
Props, Range, KernelFunc, CodeLoc);
130+
return Q.submit_kernel_direct_with_event<KernelName, PropertiesT, KernelType,
131+
Dims>(Props, Range, KernelFunc,
132+
CodeLoc);
131133
}
132134
} // namespace detail
133135

@@ -180,8 +182,9 @@ event submit_with_event(const queue &Q, PropertiesT Props, nd_range<Dims> Range,
180182
const KernelType &KernelFunc,
181183
const sycl::detail::code_location &CodeLoc =
182184
sycl::detail::code_location::current()) {
183-
return sycl::ext::oneapi::experimental::detail::submit_kernel_direct_with_event_impl<
184-
KernelName, PropertiesT, KernelType, Dims>(Q, Props, Range, KernelFunc,
185+
return sycl::ext::oneapi::experimental::detail::
186+
submit_kernel_direct_with_event_impl<KernelName, PropertiesT, KernelType,
187+
Dims>(Q, Props, Range, KernelFunc,
185188
CodeLoc);
186189
}
187190

sycl/include/sycl/queue.hpp

Lines changed: 32 additions & 35 deletions
Original file line numberDiff line numberDiff line change
@@ -214,16 +214,16 @@ event submit_with_event_impl(const queue &Q, PropertiesT Props,
214214

215215
template <typename KernelName, typename PropertiesT, typename KernelType,
216216
int Dims>
217-
void submit_kernel_direct_impl(const queue &Q, PropertiesT Props, nd_range<Dims> Range,
218-
const KernelType &KernelFunc,
219-
const sycl::detail::code_location &CodeLoc);
217+
void submit_kernel_direct_impl(const queue &Q, PropertiesT Props,
218+
nd_range<Dims> Range,
219+
const KernelType &KernelFunc,
220+
const sycl::detail::code_location &CodeLoc);
220221

221222
template <typename KernelName, typename PropertiesT, typename KernelType,
222223
int Dims>
223-
event submit_kernel_direct_with_event_impl(const queue &Q, PropertiesT Props,
224-
nd_range<Dims> Range,
225-
const KernelType &KernelFunc,
226-
const sycl::detail::code_location &CodeLoc);
224+
event submit_kernel_direct_with_event_impl(
225+
const queue &Q, PropertiesT Props, nd_range<Dims> Range,
226+
const KernelType &KernelFunc, const sycl::detail::code_location &CodeLoc);
227227
} // namespace detail
228228
} // namespace ext::oneapi::experimental
229229

@@ -2718,7 +2718,8 @@ class __SYCL_EXPORT queue : public detail::OwnerLessBase<queue> {
27182718
detail::tls_code_loc_t TlsCodeLocCapture(CodeLoc);
27192719

27202720
#ifdef __DPCPP_ENABLE_UNFINISHED_NO_CGH_SUBMIT
2721-
return submit_kernel_direct_with_event<detail::WrapAs::single_task, KernelName>(
2721+
return submit_kernel_direct_with_event<detail::WrapAs::single_task,
2722+
KernelName>(
27222723
ext::oneapi::experimental::empty_properties_t{}, nd_range<1>{1, 1},
27232724
KernelFunc);
27242725

@@ -3279,8 +3280,8 @@ class __SYCL_EXPORT queue : public detail::OwnerLessBase<queue> {
32793280
detail::tls_code_loc_t TlsCodeLocCapture(CodeLoc);
32803281
#ifdef __DPCPP_ENABLE_UNFINISHED_NO_CGH_SUBMIT
32813282
if constexpr (sizeof...(RestT) == 1) {
3282-
return submit_kernel_direct_with_event<detail::WrapAs::parallel_for, KernelName,
3283-
sycl::nd_item<Dims>>(
3283+
return submit_kernel_direct_with_event<detail::WrapAs::parallel_for,
3284+
KernelName, sycl::nd_item<Dims>>(
32843285
ext::oneapi::experimental::empty_properties_t{}, Range, Rest...);
32853286
} else {
32863287
return submit(
@@ -3680,7 +3681,8 @@ class __SYCL_EXPORT queue : public detail::OwnerLessBase<queue> {
36803681

36813682
template <typename KernelName, typename PropertiesT, typename KernelType,
36823683
int Dims>
3683-
friend event ext::oneapi::experimental::detail::submit_kernel_direct_with_event_impl(
3684+
friend event
3685+
ext::oneapi::experimental::detail::submit_kernel_direct_with_event_impl(
36843686
const queue &Q, PropertiesT Props, nd_range<Dims> Range,
36853687
const KernelType &KernelFunc, const sycl::detail::code_location &CodeLoc);
36863688

@@ -3797,33 +3799,27 @@ class __SYCL_EXPORT queue : public detail::OwnerLessBase<queue> {
37973799
bool IsTopCodeLoc) const;
37983800

37993801
event submit_kernel_direct_with_event_impl(
3800-
nd_range<1> Range,
3801-
const detail::v1::KernelRuntimeInfo &KRInfo,
3802+
nd_range<1> Range, const detail::v1::KernelRuntimeInfo &KRInfo,
38023803
const detail::code_location &CodeLoc, bool IsTopCodeLoc) const;
38033804

38043805
event submit_kernel_direct_with_event_impl(
3805-
nd_range<2> Range,
3806-
const detail::v1::KernelRuntimeInfo &KRInfo,
3806+
nd_range<2> Range, const detail::v1::KernelRuntimeInfo &KRInfo,
38073807
const detail::code_location &CodeLoc, bool IsTopCodeLoc) const;
38083808

38093809
event submit_kernel_direct_with_event_impl(
3810-
nd_range<3> Range,
3811-
const detail::v1::KernelRuntimeInfo &KRInfo,
3810+
nd_range<3> Range, const detail::v1::KernelRuntimeInfo &KRInfo,
38123811
const detail::code_location &CodeLoc, bool IsTopCodeLoc) const;
38133812

38143813
void submit_kernel_direct_without_event_impl(
3815-
nd_range<1> Range,
3816-
const detail::v1::KernelRuntimeInfo &KRInfo,
3814+
nd_range<1> Range, const detail::v1::KernelRuntimeInfo &KRInfo,
38173815
const detail::code_location &CodeLoc, bool IsTopCodeLoc) const;
38183816

38193817
void submit_kernel_direct_without_event_impl(
3820-
nd_range<2> Range,
3821-
const detail::v1::KernelRuntimeInfo &KRInfo,
3818+
nd_range<2> Range, const detail::v1::KernelRuntimeInfo &KRInfo,
38223819
const detail::code_location &CodeLoc, bool IsTopCodeLoc) const;
38233820

38243821
void submit_kernel_direct_without_event_impl(
3825-
nd_range<3> Range,
3826-
const detail::v1::KernelRuntimeInfo &KRInfo,
3822+
nd_range<3> Range, const detail::v1::KernelRuntimeInfo &KRInfo,
38273823
const detail::code_location &CodeLoc, bool IsTopCodeLoc) const;
38283824

38293825
/// A template-free version of submit_without_event as const member function.
@@ -3871,10 +3867,11 @@ class __SYCL_EXPORT queue : public detail::OwnerLessBase<queue> {
38713867
template <detail::WrapAs WrapAsVal, typename KernelName = detail::auto_name,
38723868
typename ElementType = void, typename PropertiesT,
38733869
typename KernelType, int Dims>
3874-
event submit_kernel_direct_with_event(PropertiesT Props, nd_range<Dims> Range,
3875-
const KernelType &KernelFunc,
3876-
const detail::code_location &CodeLoc =
3877-
detail::code_location::current()) const {
3870+
event
3871+
submit_kernel_direct_with_event(PropertiesT Props, nd_range<Dims> Range,
3872+
const KernelType &KernelFunc,
3873+
const detail::code_location &CodeLoc =
3874+
detail::code_location::current()) const {
38783875
detail::tls_code_loc_t TlsCodeLocCapture(CodeLoc);
38793876
detail::v1::KernelRuntimeInfo KRInfo{};
38803877

@@ -3888,16 +3885,16 @@ class __SYCL_EXPORT queue : public detail::OwnerLessBase<queue> {
38883885
PropertiesT>::wrap(KernelFunc);
38893886

38903887
return submit_kernel_direct_with_event_impl(Range, KRInfo,
3891-
TlsCodeLocCapture.query(),
3892-
TlsCodeLocCapture.isToplevel());
3888+
TlsCodeLocCapture.query(),
3889+
TlsCodeLocCapture.isToplevel());
38933890
}
38943891

38953892
template <typename KernelName = detail::auto_name, typename PropertiesT,
38963893
typename KernelType, int Dims>
3897-
void submit_kernel_direct_without_event(PropertiesT Props, nd_range<Dims> Range,
3898-
const KernelType &KernelFunc,
3899-
const detail::code_location &CodeLoc =
3900-
detail::code_location::current()) const {
3894+
void submit_kernel_direct_without_event(
3895+
PropertiesT Props, nd_range<Dims> Range, const KernelType &KernelFunc,
3896+
const detail::code_location &CodeLoc =
3897+
detail::code_location::current()) const {
39013898
detail::tls_code_loc_t TlsCodeLocCapture(CodeLoc);
39023899
detail::v1::KernelRuntimeInfo KRInfo{};
39033900

@@ -3911,8 +3908,8 @@ class __SYCL_EXPORT queue : public detail::OwnerLessBase<queue> {
39113908
sycl::nd_item<Dims>, PropertiesT>::wrap(KernelFunc);
39123909

39133910
submit_kernel_direct_without_event_impl(Range, KRInfo,
3914-
TlsCodeLocCapture.query(),
3915-
TlsCodeLocCapture.isToplevel());
3911+
TlsCodeLocCapture.query(),
3912+
TlsCodeLocCapture.isToplevel());
39163913
}
39173914

39183915
/// Submits a command group function object to the queue, in order to be

sycl/source/detail/queue_impl.cpp

Lines changed: 20 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -448,47 +448,54 @@ std::vector<ArgDesc> queue_impl::extractArgsAndReqsFromLambda(
448448
}
449449

450450
detail::EventImplPtr queue_impl::submit_kernel_direct_impl(
451-
const NDRDescT &NDRDesc,
452-
const v1::KernelRuntimeInfo &KRInfo, bool CallerNeedsEvent,
453-
const detail::code_location &CodeLoc, bool IsTopCodeLoc) {
451+
const NDRDescT &NDRDesc, const v1::KernelRuntimeInfo &KRInfo,
452+
bool CallerNeedsEvent, const detail::code_location &CodeLoc,
453+
bool IsTopCodeLoc) {
454454

455455
// No special captures supported yet for the no-handler path
456456
assert(!KRInfo.DeviceKernelInfoPtr()->HasSpecialCaptures);
457457

458-
SubmitCommandFuncType SubmitKernelFunc = [&](detail::CG::StorageInitHelper &CGData) -> EventImplPtr {
458+
SubmitCommandFuncType SubmitKernelFunc =
459+
[&](detail::CG::StorageInitHelper &CGData) -> EventImplPtr {
459460
std::unique_ptr<detail::CG> CommandGroup;
460461
std::vector<detail::ArgDesc> Args;
461462
std::vector<std::shared_ptr<detail::stream_impl>> StreamStorage;
462463
std::vector<std::shared_ptr<const void>> AuxiliaryResources;
463464

464465
Args = extractArgsAndReqsFromLambda(
465-
KRInfo.GetKernelFuncPtr(), KRInfo.DeviceKernelInfoPtr()->ParamDescGetter,
466-
KRInfo.DeviceKernelInfoPtr()->NumParams);
466+
KRInfo.GetKernelFuncPtr(),
467+
KRInfo.DeviceKernelInfoPtr()->ParamDescGetter,
468+
KRInfo.DeviceKernelInfoPtr()->NumParams);
467469

468470
CommandGroup.reset(new detail::CGExecKernel(
469471
std::move(NDRDesc), KRInfo.HostKernel(),
470472
nullptr, // MKernel
471473
nullptr, // MKernelBundle
472-
std::move(CGData), std::move(Args), toKernelNameStrT(KRInfo.KernelName()),
473-
*KRInfo.DeviceKernelInfoPtr(), std::move(StreamStorage),
474-
std::move(AuxiliaryResources), detail::CGType::Kernel,
475-
UR_KERNEL_CACHE_CONFIG_DEFAULT,
474+
std::move(CGData), std::move(Args),
475+
toKernelNameStrT(KRInfo.KernelName()), *KRInfo.DeviceKernelInfoPtr(),
476+
std::move(StreamStorage), std::move(AuxiliaryResources),
477+
detail::CGType::Kernel, UR_KERNEL_CACHE_CONFIG_DEFAULT,
476478
false, // MKernelIsCooperative
477479
false, // MKernelUsesClusterLaunch
478480
0, // MKernelWorkGroupMemorySize
479481
CodeLoc));
480482
CommandGroup->MIsTopCodeLoc = IsTopCodeLoc;
481483

484+
// TODO DiscardEvent should include a check for requirements list
485+
// once accessors are implemented
486+
bool DiscardEvent = !CallerNeedsEvent && supportsDiscardingPiEvents();
487+
482488
EventImplPtr EventImpl = detail::Scheduler::getInstance().addCG(
483-
std::move(CommandGroup), *this, CallerNeedsEvent);
489+
std::move(CommandGroup), *this, !DiscardEvent);
484490
return EventImpl;
485491
};
486492

487493
return submit_generic_direct(CallerNeedsEvent, SubmitKernelFunc);
488494
}
489495

490-
detail::EventImplPtr queue_impl::submit_generic_direct(
491-
bool CallerNeedsEvent, SubmitCommandFuncType &SubmitCommandFunc) {
496+
detail::EventImplPtr
497+
queue_impl::submit_generic_direct(bool CallerNeedsEvent,
498+
SubmitCommandFuncType &SubmitCommandFunc) {
492499
detail::CG::StorageInitHelper CGData;
493500
std::unique_lock<std::mutex> Lock(MMutex);
494501

sycl/source/detail/queue_impl.hpp

Lines changed: 30 additions & 35 deletions
Original file line numberDiff line numberDiff line change
@@ -366,55 +366,49 @@ class queue_impl : public std::enable_shared_from_this<queue_impl> {
366366
return createSyclObjFromImpl<event>(ResEvent);
367367
}
368368

369-
event submit_kernel_direct_with_event(nd_range<1> Range,
370-
const detail::v1::KernelRuntimeInfo &KRInfo,
371-
const detail::code_location &CodeLoc,
372-
bool IsTopCodeLoc) {
369+
event submit_kernel_direct_with_event(
370+
nd_range<1> Range, const detail::v1::KernelRuntimeInfo &KRInfo,
371+
const detail::code_location &CodeLoc, bool IsTopCodeLoc) {
373372
detail::EventImplPtr EventImpl = submit_kernel_direct_impl(
374373
NDRDescT{Range}, KRInfo, true, CodeLoc, IsTopCodeLoc);
375374
return createSyclObjFromImpl<event>(EventImpl);
376375
}
377376

378-
event submit_kernel_direct_with_event(nd_range<2> Range,
379-
const detail::v1::KernelRuntimeInfo &KRInfo,
380-
const detail::code_location &CodeLoc,
381-
bool IsTopCodeLoc) {
377+
event submit_kernel_direct_with_event(
378+
nd_range<2> Range, const detail::v1::KernelRuntimeInfo &KRInfo,
379+
const detail::code_location &CodeLoc, bool IsTopCodeLoc) {
382380
detail::EventImplPtr EventImpl = submit_kernel_direct_impl(
383381
NDRDescT{Range}, KRInfo, true, CodeLoc, IsTopCodeLoc);
384382
return createSyclObjFromImpl<event>(EventImpl);
385383
}
386384

387-
event submit_kernel_direct_with_event(nd_range<3> Range,
388-
const detail::v1::KernelRuntimeInfo &KRInfo,
389-
const detail::code_location &CodeLoc,
390-
bool IsTopCodeLoc) {
385+
event submit_kernel_direct_with_event(
386+
nd_range<3> Range, const detail::v1::KernelRuntimeInfo &KRInfo,
387+
const detail::code_location &CodeLoc, bool IsTopCodeLoc) {
391388
detail::EventImplPtr EventImpl = submit_kernel_direct_impl(
392389
NDRDescT{Range}, KRInfo, true, CodeLoc, IsTopCodeLoc);
393390
return createSyclObjFromImpl<event>(EventImpl);
394391
}
395392

396-
void submit_kernel_direct_without_event(nd_range<1> Range,
397-
const detail::v1::KernelRuntimeInfo &KRInfo,
398-
const detail::code_location &CodeLoc,
399-
bool IsTopCodeLoc) {
393+
void submit_kernel_direct_without_event(
394+
nd_range<1> Range, const detail::v1::KernelRuntimeInfo &KRInfo,
395+
const detail::code_location &CodeLoc, bool IsTopCodeLoc) {
400396
submit_kernel_direct_impl(NDRDescT{Range}, KRInfo, false, CodeLoc,
401-
IsTopCodeLoc);
397+
IsTopCodeLoc);
402398
}
403399

404-
void submit_kernel_direct_without_event(nd_range<2> Range,
405-
const detail::v1::KernelRuntimeInfo &KRInfo,
406-
const detail::code_location &CodeLoc,
407-
bool IsTopCodeLoc) {
400+
void submit_kernel_direct_without_event(
401+
nd_range<2> Range, const detail::v1::KernelRuntimeInfo &KRInfo,
402+
const detail::code_location &CodeLoc, bool IsTopCodeLoc) {
408403
submit_kernel_direct_impl(NDRDescT{Range}, KRInfo, false, CodeLoc,
409-
IsTopCodeLoc);
404+
IsTopCodeLoc);
410405
}
411406

412-
void submit_kernel_direct_without_event(nd_range<3> Range,
413-
const detail::v1::KernelRuntimeInfo &KRInfo,
414-
const detail::code_location &CodeLoc,
415-
bool IsTopCodeLoc) {
407+
void submit_kernel_direct_without_event(
408+
nd_range<3> Range, const detail::v1::KernelRuntimeInfo &KRInfo,
409+
const detail::code_location &CodeLoc, bool IsTopCodeLoc) {
416410
submit_kernel_direct_impl(NDRDescT{Range}, KRInfo, false, CodeLoc,
417-
IsTopCodeLoc);
411+
IsTopCodeLoc);
418412
}
419413

420414
void submit_without_event(const detail::type_erased_cgfo_ty &CGF,
@@ -959,16 +953,17 @@ class queue_impl : public std::enable_shared_from_this<queue_impl> {
959953
/// scope or in the top level scope.
960954
///
961955
/// \return a SYCL event representing submitted command group or nullptr.
962-
detail::EventImplPtr submit_kernel_direct_impl(const NDRDescT &NDRDesc,
963-
const v1::KernelRuntimeInfo &KRInfo,
964-
bool CallerNeedsEvent,
965-
const detail::code_location &CodeLoc,
966-
bool IsTopCodeLoc);
956+
detail::EventImplPtr submit_kernel_direct_impl(
957+
const NDRDescT &NDRDesc, const v1::KernelRuntimeInfo &KRInfo,
958+
bool CallerNeedsEvent, const detail::code_location &CodeLoc,
959+
bool IsTopCodeLoc);
967960

968-
using SubmitCommandFuncType = std::function<EventImplPtr(detail::CG::StorageInitHelper &CGData)>;
961+
using SubmitCommandFuncType =
962+
std::function<EventImplPtr(detail::CG::StorageInitHelper &CGData)>;
969963

970-
detail::EventImplPtr submit_generic_direct(bool CallerNeedsEvent,
971-
SubmitCommandFuncType &SubmitCommandFunc);
964+
detail::EventImplPtr
965+
submit_generic_direct(bool CallerNeedsEvent,
966+
SubmitCommandFuncType &SubmitCommandFunc);
972967

973968
/// Helper function for submitting a memory operation with a handler.
974969
/// \param DepEvents is a vector of dependencies of the operation.

0 commit comments

Comments
 (0)