Skip to content

Commit da5ad11

Browse files
committed
[SYCL][NFC] Fix formatting after handler member changes
intel#14460 appears to have introduced clang formatting violations, despite pre-commit not reporting these. This commit makes the formatting changes that should have been part of that patch. Signed-off-by: Larsen, Steffen <[email protected]>
1 parent 17d2e2d commit da5ad11

File tree

7 files changed

+79
-77
lines changed

7 files changed

+79
-77
lines changed

sycl/include/sycl/handler.hpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1428,7 +1428,7 @@ class __SYCL_EXPORT handler {
14281428
processProperties<NameT, PropertiesT>(Props);
14291429
StoreLambda<NameT, KernelType, Dims, TransformedArgType>(
14301430
std::move(KernelFunc));
1431-
setType(detail::CGType::Kernel);
1431+
setType(detail::CGType::Kernel);
14321432
setNDRangeUsed(true);
14331433
#endif
14341434
}

sycl/source/detail/cg.hpp

Lines changed: 19 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -73,8 +73,7 @@ class NDRDescT {
7373
}
7474
}
7575

76-
template <int Dims>
77-
static sycl::range<3> padRange(sycl::range<Dims> Range) {
76+
template <int Dims> static sycl::range<3> padRange(sycl::range<Dims> Range) {
7877
if constexpr (Dims == 3) {
7978
return Range;
8079
} else {
@@ -108,21 +107,23 @@ class NDRDescT {
108107
setNDRangeLeftover();
109108
}
110109

111-
NDRDescT(sycl::range<3> NumWorkItems, sycl::id<3> Offset, int DimsArg)
110+
NDRDescT(sycl::range<3> NumWorkItems, sycl::id<3> Offset, int DimsArg)
112111
: GlobalSize{NumWorkItems}, GlobalOffset{Offset}, Dims{size_t(DimsArg)} {}
113112

114113
NDRDescT(sycl::range<3> NumWorkItems, sycl::range<3> LocalSize,
115114
sycl::id<3> Offset, int DimsArg)
116115
: GlobalSize{NumWorkItems}, LocalSize{LocalSize}, GlobalOffset{Offset},
117116
Dims{size_t(DimsArg)} {
118-
setNDRangeLeftover();}
117+
setNDRangeLeftover();
118+
}
119119

120120
template <int Dims_>
121121
NDRDescT(sycl::nd_range<Dims_> ExecutionRange, int DimsArg)
122122
: NDRDescT(padRange(ExecutionRange.get_global_range()),
123123
padRange(ExecutionRange.get_local_range()),
124124
padId(ExecutionRange.get_offset()), size_t(DimsArg)) {
125-
setNDRangeLeftover();}
125+
setNDRangeLeftover();
126+
}
126127

127128
template <int Dims_>
128129
NDRDescT(sycl::nd_range<Dims_> ExecutionRange)
@@ -360,8 +361,8 @@ class CGCopyUSM : public CG {
360361
public:
361362
CGCopyUSM(void *Src, void *Dst, size_t Length, CG::StorageInitHelper CGData,
362363
detail::code_location loc = {})
363-
: CG(CGType::CopyUSM, std::move(CGData), std::move(loc)), MSrc(Src), MDst(Dst),
364-
MLength(Length) {}
364+
: CG(CGType::CopyUSM, std::move(CGData), std::move(loc)), MSrc(Src),
365+
MDst(Dst), MLength(Length) {}
365366

366367
void *getSrc() { return MSrc; }
367368
void *getDst() { return MDst; }
@@ -392,8 +393,8 @@ class CGPrefetchUSM : public CG {
392393
public:
393394
CGPrefetchUSM(void *DstPtr, size_t Length, CG::StorageInitHelper CGData,
394395
detail::code_location loc = {})
395-
: CG(CGType::PrefetchUSM, std::move(CGData), std::move(loc)), MDst(DstPtr),
396-
MLength(Length) {}
396+
: CG(CGType::PrefetchUSM, std::move(CGData), std::move(loc)),
397+
MDst(DstPtr), MLength(Length) {}
397398
void *getDst() { return MDst; }
398399
size_t getLength() { return MLength; }
399400
};
@@ -445,8 +446,8 @@ class CGCopy2DUSM : public CG {
445446
CGCopy2DUSM(void *Src, void *Dst, size_t SrcPitch, size_t DstPitch,
446447
size_t Width, size_t Height, CG::StorageInitHelper CGData,
447448
detail::code_location loc = {})
448-
: CG(CGType::Copy2DUSM, std::move(CGData), std::move(loc)), MSrc(Src), MDst(Dst),
449-
MSrcPitch(SrcPitch), MDstPitch(DstPitch), MWidth(Width),
449+
: CG(CGType::Copy2DUSM, std::move(CGData), std::move(loc)), MSrc(Src),
450+
MDst(Dst), MSrcPitch(SrcPitch), MDstPitch(DstPitch), MWidth(Width),
450451
MHeight(Height) {}
451452

452453
void *getSrc() const { return MSrc; }
@@ -491,8 +492,9 @@ class CGMemset2DUSM : public CG {
491492
CGMemset2DUSM(char Value, void *DstPtr, size_t Pitch, size_t Width,
492493
size_t Height, CG::StorageInitHelper CGData,
493494
detail::code_location loc = {})
494-
: CG(CGType::Memset2DUSM, std::move(CGData), std::move(loc)), MValue(Value),
495-
MDst(DstPtr), MPitch(Pitch), MWidth(Width), MHeight(Height) {}
495+
: CG(CGType::Memset2DUSM, std::move(CGData), std::move(loc)),
496+
MValue(Value), MDst(DstPtr), MPitch(Pitch), MWidth(Width),
497+
MHeight(Height) {}
496498
void *getDst() const { return MDst; }
497499
size_t getPitch() const { return MPitch; }
498500
size_t getWidth() const { return MWidth; }
@@ -536,8 +538,8 @@ class CGCopyToDeviceGlobal : public CG {
536538
bool IsDeviceImageScoped, size_t NumBytes, size_t Offset,
537539
CG::StorageInitHelper CGData,
538540
detail::code_location loc = {})
539-
: CG(CGType::CopyToDeviceGlobal, std::move(CGData), std::move(loc)), MSrc(Src),
540-
MDeviceGlobalPtr(DeviceGlobalPtr),
541+
: CG(CGType::CopyToDeviceGlobal, std::move(CGData), std::move(loc)),
542+
MSrc(Src), MDeviceGlobalPtr(DeviceGlobalPtr),
541543
MIsDeviceImageScoped(IsDeviceImageScoped), MNumBytes(NumBytes),
542544
MOffset(Offset) {}
543545

@@ -593,8 +595,8 @@ class CGCopyImage : public CG {
593595
sycl::detail::pi::PiImageRegion HostExtent,
594596
sycl::detail::pi::PiImageRegion CopyExtent,
595597
CG::StorageInitHelper CGData, detail::code_location loc = {})
596-
: CG(CGType::CopyImage, std::move(CGData), std::move(loc)), MSrc(Src), MDst(Dst),
597-
MImageDesc(ImageDesc), MImageFormat(ImageFormat),
598+
: CG(CGType::CopyImage, std::move(CGData), std::move(loc)), MSrc(Src),
599+
MDst(Dst), MImageDesc(ImageDesc), MImageFormat(ImageFormat),
598600
MImageCopyFlags(ImageCopyFlags), MSrcOffset(SrcOffset),
599601
MDstOffset(DstOffset), MHostExtent(HostExtent),
600602
MCopyExtent(CopyExtent) {}

sycl/source/detail/handler_impl.hpp

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -9,8 +9,8 @@
99
#pragma once
1010

1111
#include "sycl/handler.hpp"
12-
#include <detail/kernel_bundle_impl.hpp>
1312
#include <detail/cg.hpp>
13+
#include <detail/kernel_bundle_impl.hpp>
1414
#include <memory>
1515
#include <sycl/ext/oneapi/experimental/graph.hpp>
1616

@@ -155,7 +155,7 @@ class handler_impl {
155155
// Track whether an NDRange was used when submitting a kernel (as opposed to a
156156
// range), needed for graph update
157157
bool MNDRangeUsed = false;
158-
158+
159159
/// The storage for the arguments passed.
160160
/// We need to store a copy of values that are passed explicitly through
161161
/// set_arg, require and so on, because we need them to be alive after
@@ -188,7 +188,7 @@ class handler_impl {
188188
std::shared_ptr<ext::oneapi::experimental::detail::node_impl> MSubgraphNode;
189189
/// Storage for the CG created when handling graph nodes added explicitly.
190190
std::unique_ptr<detail::CG> MGraphNodeCG;
191-
191+
192192
/// Storage for lambda/function when using HostTask
193193
std::shared_ptr<detail::HostTask> MHostTask;
194194
/// The list of valid SYCL events that need to complete

sycl/source/handler.cpp

Lines changed: 51 additions & 46 deletions
Original file line numberDiff line numberDiff line change
@@ -12,13 +12,13 @@
1212
#include <detail/global_handler.hpp>
1313
#include <detail/graph_impl.hpp>
1414
#include <detail/handler_impl.hpp>
15+
#include <detail/host_task.hpp>
1516
#include <detail/image_impl.hpp>
1617
#include <detail/kernel_bundle_impl.hpp>
1718
#include <detail/kernel_impl.hpp>
1819
#include <detail/queue_impl.hpp>
1920
#include <detail/scheduler/commands.hpp>
2021
#include <detail/scheduler/scheduler.hpp>
21-
#include <detail/host_task.hpp>
2222
#include <detail/usm/usm_impl.hpp>
2323
#include <sycl/detail/common.hpp>
2424
#include <sycl/detail/helpers.hpp>
@@ -90,8 +90,8 @@ handler::handler(std::shared_ptr<detail::queue_impl> Queue,
9090
std::shared_ptr<detail::queue_impl> SecondaryQueue,
9191
bool CallerNeedsEvent)
9292
: impl(std::make_shared<detail::handler_impl>(std::move(PrimaryQueue),
93-
std::move(SecondaryQueue),
94-
CallerNeedsEvent)),
93+
std::move(SecondaryQueue),
94+
CallerNeedsEvent)),
9595
MQueue(std::move(Queue)) {}
9696

9797
handler::handler(
@@ -123,7 +123,8 @@ bool handler::isStateExplicitKernelBundle() const {
123123
std::shared_ptr<detail::kernel_bundle_impl>
124124
handler::getOrInsertHandlerKernelBundle(bool Insert) const {
125125
if (!impl->MKernelBundle && Insert) {
126-
auto Ctx = impl->MGraph ? impl->MGraph->getContext() : MQueue->get_context();
126+
auto Ctx =
127+
impl->MGraph ? impl->MGraph->getContext() : MQueue->get_context();
127128
auto Dev = impl->MGraph ? impl->MGraph->getDevice() : MQueue->get_device();
128129
impl->MKernelBundle = detail::getSyclObjImpl(
129130
get_kernel_bundle<bundle_state::input>(Ctx, {Dev}, {}));
@@ -199,7 +200,8 @@ event handler::finalize() {
199200
// Make sure implicit non-interop kernel bundles have the kernel
200201
if (!KernelBundleImpPtr->isInterop() &&
201202
!impl->isStateExplicitKernelBundle()) {
202-
auto Dev = impl->MGraph ? impl->MGraph->getDevice() : MQueue->get_device();
203+
auto Dev =
204+
impl->MGraph ? impl->MGraph->getDevice() : MQueue->get_device();
203205
kernel_id KernelID =
204206
detail::ProgramManager::getInstance().getSYCLKernelID(
205207
MKernelName.c_str());
@@ -356,21 +358,22 @@ event handler::finalize() {
356358
new detail::CGUpdateHost(MDstPtr, std::move(impl->CGData), MCodeLoc));
357359
break;
358360
case detail::CGType::CopyUSM:
359-
CommandGroup.reset(new detail::CGCopyUSM(MSrcPtr, MDstPtr, MLength,
360-
std::move(impl->CGData), MCodeLoc));
361+
CommandGroup.reset(new detail::CGCopyUSM(
362+
MSrcPtr, MDstPtr, MLength, std::move(impl->CGData), MCodeLoc));
361363
break;
362364
case detail::CGType::FillUSM:
363-
CommandGroup.reset(new detail::CGFillUSM(
364-
std::move(MPattern), MDstPtr, MLength, std::move(impl->CGData), MCodeLoc));
365+
CommandGroup.reset(new detail::CGFillUSM(std::move(MPattern), MDstPtr,
366+
MLength, std::move(impl->CGData),
367+
MCodeLoc));
365368
break;
366369
case detail::CGType::PrefetchUSM:
367-
CommandGroup.reset(new detail::CGPrefetchUSM(MDstPtr, MLength,
368-
std::move(impl->CGData), MCodeLoc));
370+
CommandGroup.reset(new detail::CGPrefetchUSM(
371+
MDstPtr, MLength, std::move(impl->CGData), MCodeLoc));
369372
break;
370373
case detail::CGType::AdviseUSM:
371374
CommandGroup.reset(new detail::CGAdviseUSM(MDstPtr, MLength, impl->MAdvice,
372-
std::move(impl->CGData), getType(),
373-
MCodeLoc));
375+
std::move(impl->CGData),
376+
getType(), MCodeLoc));
374377
break;
375378
case detail::CGType::Copy2DUSM:
376379
CommandGroup.reset(new detail::CGCopy2DUSM(
@@ -388,8 +391,9 @@ event handler::finalize() {
388391
std::move(impl->CGData), MCodeLoc));
389392
break;
390393
case detail::CGType::CodeplayHostTask: {
391-
auto context = impl->MGraph ? detail::getSyclObjImpl(impl->MGraph->getContext())
392-
: MQueue->getContextImplPtr();
394+
auto context = impl->MGraph
395+
? detail::getSyclObjImpl(impl->MGraph->getContext())
396+
: MQueue->getContextImplPtr();
393397
CommandGroup.reset(new detail::CGHostTask(
394398
std::move(impl->MHostTask), MQueue, context, std::move(impl->MArgs),
395399
std::move(impl->CGData), getType(), MCodeLoc));
@@ -399,13 +403,13 @@ event handler::finalize() {
399403
case detail::CGType::BarrierWaitlist: {
400404
if (auto GraphImpl = getCommandGraph(); GraphImpl != nullptr) {
401405
impl->CGData.MEvents.insert(std::end(impl->CGData.MEvents),
402-
std::begin(impl->MEventsWaitWithBarrier),
403-
std::end(impl->MEventsWaitWithBarrier));
406+
std::begin(impl->MEventsWaitWithBarrier),
407+
std::end(impl->MEventsWaitWithBarrier));
404408
// Barrier node is implemented as an empty node in Graph
405409
// but keep the barrier type to help managing dependencies
406410
setType(detail::CGType::Barrier);
407-
CommandGroup.reset(
408-
new detail::CG(detail::CGType::Barrier, std::move(impl->CGData), MCodeLoc));
411+
CommandGroup.reset(new detail::CG(detail::CGType::Barrier,
412+
std::move(impl->CGData), MCodeLoc));
409413
} else {
410414
CommandGroup.reset(
411415
new detail::CGBarrier(std::move(impl->MEventsWaitWithBarrier),
@@ -414,7 +418,8 @@ event handler::finalize() {
414418
break;
415419
}
416420
case detail::CGType::ProfilingTag: {
417-
CommandGroup.reset(new detail::CGProfilingTag(std::move(impl->CGData), MCodeLoc));
421+
CommandGroup.reset(
422+
new detail::CGProfilingTag(std::move(impl->CGData), MCodeLoc));
418423
break;
419424
}
420425
case detail::CGType::CopyToDeviceGlobal: {
@@ -466,17 +471,18 @@ event handler::finalize() {
466471
CommandGroup.reset(new detail::CGCopyImage(
467472
MSrcPtr, MDstPtr, impl->MImageDesc, impl->MImageFormat,
468473
impl->MImageCopyFlags, impl->MSrcOffset, impl->MDestOffset,
469-
impl->MHostExtent, impl->MCopyExtent, std::move(impl->CGData), MCodeLoc));
474+
impl->MHostExtent, impl->MCopyExtent, std::move(impl->CGData),
475+
MCodeLoc));
470476
break;
471477
case detail::CGType::SemaphoreWait:
472478
CommandGroup.reset(new detail::CGSemaphoreWait(
473-
impl->MInteropSemaphoreHandle, impl->MWaitValue, std::move(impl->CGData),
474-
MCodeLoc));
479+
impl->MInteropSemaphoreHandle, impl->MWaitValue,
480+
std::move(impl->CGData), MCodeLoc));
475481
break;
476482
case detail::CGType::SemaphoreSignal:
477483
CommandGroup.reset(new detail::CGSemaphoreSignal(
478-
impl->MInteropSemaphoreHandle, impl->MSignalValue, std::move(impl->CGData),
479-
MCodeLoc));
484+
impl->MInteropSemaphoreHandle, impl->MSignalValue,
485+
std::move(impl->CGData), MCodeLoc));
480486
break;
481487
case detail::CGType::None:
482488
if (detail::pi::trace(detail::pi::TraceLevel::PI_TRACE_ALL)) {
@@ -487,8 +493,8 @@ event handler::finalize() {
487493
// For Standard mode (non-graph),
488494
// empty nodes are not sent to the scheduler to save time
489495
if (impl->MGraph || (MQueue && MQueue->getCommandGraph())) {
490-
CommandGroup.reset(
491-
new detail::CG(detail::CGType::None, std::move(impl->CGData), MCodeLoc));
496+
CommandGroup.reset(new detail::CG(detail::CGType::None,
497+
std::move(impl->CGData), MCodeLoc));
492498
} else {
493499
detail::EventImplPtr Event = std::make_shared<sycl::detail::event_impl>();
494500
MLastEvent = detail::createSyclObjFromImpl<event>(Event);
@@ -524,8 +530,7 @@ event handler::finalize() {
524530
GraphImpl->MMutex);
525531

526532
ext::oneapi::experimental::node_type NodeType =
527-
impl->MUserFacingNodeType !=
528-
ext::oneapi::experimental::node_type::empty
533+
impl->MUserFacingNodeType != ext::oneapi::experimental::node_type::empty
529534
? impl->MUserFacingNodeType
530535
: ext::oneapi::experimental::detail::getNodeTypeFromCG(getType());
531536

@@ -675,17 +680,17 @@ void handler::processArg(void *Ptr, const detail::kernel_param_kind_t &Kind,
675680
static_cast<detail::AccessorBaseHost *>(&S->GlobalBuf);
676681
detail::AccessorImplPtr GBufImpl = detail::getSyclObjImpl(*GBufBase);
677682
detail::Requirement *GBufReq = GBufImpl.get();
678-
addArgsForGlobalAccessor(GBufReq, Index, IndexShift, Size,
679-
IsKernelCreatedFromSource,
680-
impl->MNDRDesc.GlobalSize.size(), impl->MArgs, IsESIMD);
683+
addArgsForGlobalAccessor(
684+
GBufReq, Index, IndexShift, Size, IsKernelCreatedFromSource,
685+
impl->MNDRDesc.GlobalSize.size(), impl->MArgs, IsESIMD);
681686
++IndexShift;
682687
detail::AccessorBaseHost *GOffsetBase =
683688
static_cast<detail::AccessorBaseHost *>(&S->GlobalOffset);
684689
detail::AccessorImplPtr GOfssetImpl = detail::getSyclObjImpl(*GOffsetBase);
685690
detail::Requirement *GOffsetReq = GOfssetImpl.get();
686-
addArgsForGlobalAccessor(GOffsetReq, Index, IndexShift, Size,
687-
IsKernelCreatedFromSource,
688-
impl->MNDRDesc.GlobalSize.size(), impl->MArgs, IsESIMD);
691+
addArgsForGlobalAccessor(
692+
GOffsetReq, Index, IndexShift, Size, IsKernelCreatedFromSource,
693+
impl->MNDRDesc.GlobalSize.size(), impl->MArgs, IsESIMD);
689694
++IndexShift;
690695
detail::AccessorBaseHost *GFlushBase =
691696
static_cast<detail::AccessorBaseHost *>(&S->GlobalFlushBuf);
@@ -738,7 +743,7 @@ void handler::processArg(void *Ptr, const detail::kernel_param_kind_t &Kind,
738743
// make it a minimum allocation of 1 byte.
739744
SizeInBytes = std::max(SizeInBytes, 1);
740745
impl->MArgs.emplace_back(kernel_param_kind_t::kind_std_layout, nullptr,
741-
SizeInBytes, Index + IndexShift);
746+
SizeInBytes, Index + IndexShift);
742747
// TODO ESIMD currently does not suport MSize field passing yet
743748
// accessor::init for ESIMD-mode accessor has a single field, translated
744749
// to a single kernel argument set above.
@@ -880,8 +885,8 @@ void handler::verifyUsedKernelBundleInternal(detail::string_view KernelName) {
880885
return;
881886

882887
kernel_id KernelID = detail::get_kernel_id_impl(KernelName);
883-
device Dev =
884-
impl->MGraph ? impl->MGraph->getDevice() : detail::getDeviceFromHandler(*this);
888+
device Dev = impl->MGraph ? impl->MGraph->getDevice()
889+
: detail::getDeviceFromHandler(*this);
885890
if (!UsedKernelBundleImplPtr->has_kernel(KernelID, Dev))
886891
throw sycl::exception(
887892
make_error_code(errc::kernel_not_supported),
@@ -1459,8 +1464,10 @@ void handler::use_kernel_bundle(
14591464
const kernel_bundle<bundle_state::executable> &ExecBundle) {
14601465
std::shared_ptr<detail::queue_impl> PrimaryQueue =
14611466
impl->MSubmissionPrimaryQueue;
1462-
if ((!impl->MGraph && (PrimaryQueue->get_context() != ExecBundle.get_context())) ||
1463-
(impl->MGraph && (impl->MGraph->getContext() != ExecBundle.get_context())))
1467+
if ((!impl->MGraph &&
1468+
(PrimaryQueue->get_context() != ExecBundle.get_context())) ||
1469+
(impl->MGraph &&
1470+
(impl->MGraph->getContext() != ExecBundle.get_context())))
14641471
throw sycl::exception(
14651472
make_error_code(errc::invalid),
14661473
"Context associated with the primary queue is different from the "
@@ -1834,16 +1841,14 @@ void handler::addArg(detail::kernel_param_kind_t ArgKind, void *Req,
18341841
impl->MArgs.emplace_back(ArgKind, Req, AccessTarget, ArgIndex);
18351842
}
18361843

1837-
void handler::clearArgs() {
1838-
impl->MArgs.clear();
1839-
}
1844+
void handler::clearArgs() { impl->MArgs.clear(); }
18401845

18411846
void handler::setArgsToAssociatedAccessors() {
18421847
impl->MArgs = impl->MAssociatedAccesors;
18431848
}
18441849

18451850
bool handler::HasAssociatedAccessor(detail::AccessorImplHost *Req,
1846-
access::target AccessTarget) const {
1851+
access::target AccessTarget) const {
18471852
return std::find_if(
18481853
impl->MAssociatedAccesors.cbegin(),
18491854
impl->MAssociatedAccesors.cend(), [&](const detail::ArgDesc &AD) {
@@ -1865,8 +1870,8 @@ void handler::setNDRangeDescriptorPadded(sycl::range<3> NumWorkItems,
18651870
impl->MNDRDesc = NDRDescT{NumWorkItems, Offset, Dims};
18661871
}
18671872
void handler::setNDRangeDescriptorPadded(sycl::range<3> NumWorkItems,
1868-
sycl::range<3> LocalSize, sycl::id<3> Offset,
1869-
int Dims) {
1873+
sycl::range<3> LocalSize,
1874+
sycl::id<3> Offset, int Dims) {
18701875
impl->MNDRDesc = NDRDescT{NumWorkItems, LocalSize, Offset, Dims};
18711876
}
18721877

sycl/unittests/program_manager/arg_mask/EliminatedArgMask.cpp

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -137,7 +137,6 @@ class MockHandler : public sycl::handler {
137137

138138
return CommandGroup;
139139
}
140-
141140
};
142141

143142
const sycl::detail::KernelArgMask *getKernelArgMaskFromBundle(

0 commit comments

Comments
 (0)