Skip to content

Commit ae8df6c

Browse files
committed
Change enumeration name and test options
1 parent 29c9054 commit ae8df6c

File tree

7 files changed

+48
-47
lines changed

7 files changed

+48
-47
lines changed

sycl/include/CL/sycl/detail/cg.hpp

Lines changed: 16 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -149,7 +149,7 @@ class CG {
149149
};
150150

151151
/// Type of the command group.
152-
enum CGTYPE : unsigned int {
152+
enum CGType : unsigned int {
153153
None = 0,
154154
Kernel = 1,
155155
CopyAccToPtr = 2,
@@ -168,7 +168,7 @@ class CG {
168168
AdviseUSM = 15,
169169
};
170170

171-
CG(CGTYPE Type, std::vector<std::vector<char>> ArgsStorage,
171+
CG(CGType Type, std::vector<std::vector<char>> ArgsStorage,
172172
std::vector<detail::AccessorImplPtr> AccStorage,
173173
std::vector<std::shared_ptr<const void>> SharedPtrStorage,
174174
std::vector<Requirement *> Requirements,
@@ -190,7 +190,7 @@ class CG {
190190

191191
CG(CG &&CommandGroup) = default;
192192

193-
CGTYPE getType() { return static_cast<CGTYPE>(getUnversionedCGType(MType)); }
193+
CGType getType() { return static_cast<CGType>(getUnversionedCGType(MType)); }
194194

195195
CG_VERSION getVersion() {
196196
return static_cast<CG_VERSION>(getCGTypeVersion(MType));
@@ -209,7 +209,7 @@ class CG {
209209
virtual ~CG() = default;
210210

211211
private:
212-
CGTYPE MType;
212+
CGType MType;
213213
// The following storages are needed to ensure that arguments won't die while
214214
// we are using them.
215215
/// Storage for standard layout arguments.
@@ -255,7 +255,7 @@ class CGExecKernel : public CG {
255255
std::vector<ArgDesc> Args, std::string KernelName,
256256
detail::OSModuleHandle OSModuleHandle,
257257
std::vector<std::shared_ptr<detail::stream_impl>> Streams,
258-
CGTYPE Type, detail::code_location loc = {})
258+
CGType Type, detail::code_location loc = {})
259259
: CG(Type, std::move(ArgsStorage), std::move(AccStorage),
260260
std::move(SharedPtrStorage), std::move(Requirements),
261261
std::move(Events), std::move(loc)),
@@ -264,7 +264,7 @@ class CGExecKernel : public CG {
264264
MKernelName(std::move(KernelName)), MOSModuleHandle(OSModuleHandle),
265265
MStreams(std::move(Streams)) {
266266
assert(
267-
(getType() == CGTYPE::RunOnHostIntel || getType() == CGTYPE::Kernel) &&
267+
(getType() == CGType::RunOnHostIntel || getType() == CGType::Kernel) &&
268268
"Wrong type of exec kernel CG.");
269269
}
270270

@@ -295,7 +295,7 @@ class CGCopy : public CG {
295295
void *MDst;
296296

297297
public:
298-
CGCopy(CGTYPE CopyType, void *Src, void *Dst,
298+
CGCopy(CGType CopyType, void *Src, void *Dst,
299299
std::vector<std::vector<char>> ArgsStorage,
300300
std::vector<detail::AccessorImplPtr> AccStorage,
301301
std::vector<std::shared_ptr<const void>> SharedPtrStorage,
@@ -323,7 +323,7 @@ class CGFill : public CG {
323323
std::vector<Requirement *> Requirements,
324324
std::vector<detail::EventImplPtr> Events,
325325
detail::code_location loc = {})
326-
: CG(CGTYPE::Fill, std::move(ArgsStorage), std::move(AccStorage),
326+
: CG(CGType::Fill, std::move(ArgsStorage), std::move(AccStorage),
327327
std::move(SharedPtrStorage), std::move(Requirements),
328328
std::move(Events), std::move(loc)),
329329
MPattern(std::move(Pattern)), MPtr((Requirement *)Ptr) {}
@@ -341,7 +341,7 @@ class CGUpdateHost : public CG {
341341
std::vector<Requirement *> Requirements,
342342
std::vector<detail::EventImplPtr> Events,
343343
detail::code_location loc = {})
344-
: CG(CGTYPE::UpdateHost, std::move(ArgsStorage), std::move(AccStorage),
344+
: CG(CGType::UpdateHost, std::move(ArgsStorage), std::move(AccStorage),
345345
std::move(SharedPtrStorage), std::move(Requirements),
346346
std::move(Events), std::move(loc)),
347347
MPtr((Requirement *)Ptr) {}
@@ -363,7 +363,7 @@ class CGCopyUSM : public CG {
363363
std::vector<Requirement *> Requirements,
364364
std::vector<detail::EventImplPtr> Events,
365365
detail::code_location loc = {})
366-
: CG(CGTYPE::CopyUSM, std::move(ArgsStorage), std::move(AccStorage),
366+
: CG(CGType::CopyUSM, std::move(ArgsStorage), std::move(AccStorage),
367367
std::move(SharedPtrStorage), std::move(Requirements),
368368
std::move(Events), std::move(loc)),
369369
MSrc(Src), MDst(Dst), MLength(Length) {}
@@ -387,7 +387,7 @@ class CGFillUSM : public CG {
387387
std::vector<Requirement *> Requirements,
388388
std::vector<detail::EventImplPtr> Events,
389389
detail::code_location loc = {})
390-
: CG(CGTYPE::FillUSM, std::move(ArgsStorage), std::move(AccStorage),
390+
: CG(CGType::FillUSM, std::move(ArgsStorage), std::move(AccStorage),
391391
std::move(SharedPtrStorage), std::move(Requirements),
392392
std::move(Events), std::move(loc)),
393393
MPattern(std::move(Pattern)), MDst(DstPtr), MLength(Length) {}
@@ -409,7 +409,7 @@ class CGPrefetchUSM : public CG {
409409
std::vector<Requirement *> Requirements,
410410
std::vector<detail::EventImplPtr> Events,
411411
detail::code_location loc = {})
412-
: CG(CGTYPE::PrefetchUSM, std::move(ArgsStorage), std::move(AccStorage),
412+
: CG(CGType::PrefetchUSM, std::move(ArgsStorage), std::move(AccStorage),
413413
std::move(SharedPtrStorage), std::move(Requirements),
414414
std::move(Events), std::move(loc)),
415415
MDst(DstPtr), MLength(Length) {}
@@ -428,7 +428,7 @@ class CGAdviseUSM : public CG {
428428
std::vector<detail::AccessorImplPtr> AccStorage,
429429
std::vector<std::shared_ptr<const void>> SharedPtrStorage,
430430
std::vector<Requirement *> Requirements,
431-
std::vector<detail::EventImplPtr> Events, CGTYPE Type,
431+
std::vector<detail::EventImplPtr> Events, CGType Type,
432432
detail::code_location loc = {})
433433
: CG(Type, std::move(ArgsStorage), std::move(AccStorage),
434434
std::move(SharedPtrStorage), std::move(Requirements),
@@ -457,7 +457,7 @@ class CGInteropTask : public CG {
457457
std::vector<detail::AccessorImplPtr> AccStorage,
458458
std::vector<std::shared_ptr<const void>> SharedPtrStorage,
459459
std::vector<Requirement *> Requirements,
460-
std::vector<detail::EventImplPtr> Events, CGTYPE Type,
460+
std::vector<detail::EventImplPtr> Events, CGType Type,
461461
detail::code_location loc = {})
462462
: CG(Type, std::move(ArgsStorage), std::move(AccStorage),
463463
std::move(SharedPtrStorage), std::move(Requirements),
@@ -482,7 +482,7 @@ class CGHostTask : public CG {
482482
std::vector<detail::AccessorImplPtr> AccStorage,
483483
std::vector<std::shared_ptr<const void>> SharedPtrStorage,
484484
std::vector<Requirement *> Requirements,
485-
std::vector<detail::EventImplPtr> Events, CGTYPE Type,
485+
std::vector<detail::EventImplPtr> Events, CGType Type,
486486
detail::code_location loc = {})
487487
: CG(Type, std::move(ArgsStorage), std::move(AccStorage),
488488
std::move(SharedPtrStorage), std::move(Requirements),
@@ -500,7 +500,7 @@ class CGBarrier : public CG {
500500
std::vector<detail::AccessorImplPtr> AccStorage,
501501
std::vector<std::shared_ptr<const void>> SharedPtrStorage,
502502
std::vector<Requirement *> Requirements,
503-
std::vector<detail::EventImplPtr> Events, CGTYPE Type,
503+
std::vector<detail::EventImplPtr> Events, CGType Type,
504504
detail::code_location loc = {})
505505
: CG(Type, std::move(ArgsStorage), std::move(AccStorage),
506506
std::move(SharedPtrStorage), std::move(Requirements),

sycl/include/CL/sycl/handler.hpp

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -343,14 +343,14 @@ class __SYCL_EXPORT handler {
343343
return Storage;
344344
}
345345

346-
void setType(detail::CG::CGTYPE Type) {
346+
void setType(detail::CG::CGType Type) {
347347
constexpr detail::CG::CG_VERSION Version = detail::CG::CG_VERSION::V1;
348-
MCGType = static_cast<detail::CG::CGTYPE>(
348+
MCGType = static_cast<detail::CG::CGType>(
349349
getVersionedCGType(Type, static_cast<int>(Version)));
350350
}
351351

352-
detail::CG::CGTYPE getType() {
353-
return static_cast<detail::CG::CGTYPE>(getUnversionedCGType(MCGType));
352+
detail::CG::CGType getType() {
353+
return static_cast<detail::CG::CGType>(getUnversionedCGType(MCGType));
354354
}
355355

356356
void throwIfActionIsCreated() {
@@ -2368,7 +2368,7 @@ class __SYCL_EXPORT handler {
23682368
/// Type of the command group, e.g. kernel, fill. Can also encode version.
23692369
/// Use getType and setType methods to access this variable unless
23702370
/// manipulations with version are required
2371-
detail::CG::CGTYPE MCGType = detail::CG::None;
2371+
detail::CG::CGType MCGType = detail::CG::None;
23722372
/// Pointer to the source host memory or accessor(depending on command type).
23732373
void *MSrcPtr = nullptr;
23742374
/// Pointer to the dest host memory or accessor(depends on command type).

sycl/source/detail/scheduler/commands.cpp

Lines changed: 20 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -203,7 +203,7 @@ class DispatchHostTask {
203203
void operator()() const {
204204
waitForEvents();
205205

206-
assert(MThisCmd->getCG().getType() == CG::CGTYPE::CodeplayHostTask);
206+
assert(MThisCmd->getCG().getType() == CG::CGType::CodeplayHostTask);
207207

208208
CGHostTask &HostTask = static_cast<CGHostTask &>(MThisCmd->getCG());
209209

@@ -1449,7 +1449,7 @@ void UpdateHostRequirementCommand::emitInstrumentationData() {
14491449
#endif
14501450
}
14511451

1452-
static std::string cgTypeToString(detail::CG::CGTYPE Type) {
1452+
static std::string cgTypeToString(detail::CG::CGType Type) {
14531453
switch (Type) {
14541454
case detail::CG::Kernel:
14551455
return "Kernel";
@@ -1798,7 +1798,7 @@ void DispatchNativeKernel(void *Blob) {
17981798
}
17991799

18001800
cl_int ExecCGCommand::enqueueImp() {
1801-
if (getCG().getType() != CG::CGTYPE::CodeplayHostTask)
1801+
if (getCG().getType() != CG::CGType::CodeplayHostTask)
18021802
waitForPreparedHostEvents();
18031803
std::vector<EventImplPtr> EventImpls = MPreparedDepsEvents;
18041804
auto RawEvents = getPiEvents(EventImpls);
@@ -1807,11 +1807,11 @@ cl_int ExecCGCommand::enqueueImp() {
18071807

18081808
switch (MCommandGroup->getType()) {
18091809

1810-
case CG::CGTYPE::UpdateHost: {
1810+
case CG::CGType::UpdateHost: {
18111811
throw runtime_error("Update host should be handled by the Scheduler.",
18121812
PI_INVALID_OPERATION);
18131813
}
1814-
case CG::CGTYPE::CopyAccToPtr: {
1814+
case CG::CGType::CopyAccToPtr: {
18151815
CGCopy *Copy = (CGCopy *)MCommandGroup.get();
18161816
Requirement *Req = (Requirement *)Copy->getSrc();
18171817
AllocaCommandBase *AllocaCmd = getAllocaForReq(Req);
@@ -1826,7 +1826,7 @@ cl_int ExecCGCommand::enqueueImp() {
18261826

18271827
return CL_SUCCESS;
18281828
}
1829-
case CG::CGTYPE::CopyPtrToAcc: {
1829+
case CG::CGType::CopyPtrToAcc: {
18301830
CGCopy *Copy = (CGCopy *)MCommandGroup.get();
18311831
Requirement *Req = (Requirement *)(Copy->getDst());
18321832
AllocaCommandBase *AllocaCmd = getAllocaForReq(Req);
@@ -1843,7 +1843,7 @@ cl_int ExecCGCommand::enqueueImp() {
18431843

18441844
return CL_SUCCESS;
18451845
}
1846-
case CG::CGTYPE::CopyAccToAcc: {
1846+
case CG::CGType::CopyAccToAcc: {
18471847
CGCopy *Copy = (CGCopy *)MCommandGroup.get();
18481848
Requirement *ReqSrc = (Requirement *)(Copy->getSrc());
18491849
Requirement *ReqDst = (Requirement *)(Copy->getDst());
@@ -1860,7 +1860,7 @@ cl_int ExecCGCommand::enqueueImp() {
18601860

18611861
return CL_SUCCESS;
18621862
}
1863-
case CG::CGTYPE::Fill: {
1863+
case CG::CGType::Fill: {
18641864
CGFill *Fill = (CGFill *)MCommandGroup.get();
18651865
Requirement *Req = (Requirement *)(Fill->getReqToFill());
18661866
AllocaCommandBase *AllocaCmd = getAllocaForReq(Req);
@@ -1873,7 +1873,7 @@ cl_int ExecCGCommand::enqueueImp() {
18731873

18741874
return CL_SUCCESS;
18751875
}
1876-
case CG::CGTYPE::RunOnHostIntel: {
1876+
case CG::CGType::RunOnHostIntel: {
18771877
CGExecKernel *HostTask = (CGExecKernel *)MCommandGroup.get();
18781878

18791879
// piEnqueueNativeKernel takes arguments blob which is passes to user
@@ -1944,7 +1944,7 @@ cl_int ExecCGCommand::enqueueImp() {
19441944
"Enqueueing run_on_host_intel task has failed.", Error);
19451945
}
19461946
}
1947-
case CG::CGTYPE::Kernel: {
1947+
case CG::CGType::Kernel: {
19481948
CGExecKernel *ExecKernel = (CGExecKernel *)MCommandGroup.get();
19491949

19501950
NDRDescT &NDRDesc = ExecKernel->MNDRDesc;
@@ -2061,36 +2061,36 @@ cl_int ExecCGCommand::enqueueImp() {
20612061

20622062
return PI_SUCCESS;
20632063
}
2064-
case CG::CGTYPE::CopyUSM: {
2064+
case CG::CGType::CopyUSM: {
20652065
CGCopyUSM *Copy = (CGCopyUSM *)MCommandGroup.get();
20662066
MemoryManager::copy_usm(Copy->getSrc(), MQueue, Copy->getLength(),
20672067
Copy->getDst(), std::move(RawEvents), Event);
20682068

20692069
return CL_SUCCESS;
20702070
}
2071-
case CG::CGTYPE::FillUSM: {
2071+
case CG::CGType::FillUSM: {
20722072
CGFillUSM *Fill = (CGFillUSM *)MCommandGroup.get();
20732073
MemoryManager::fill_usm(Fill->getDst(), MQueue, Fill->getLength(),
20742074
Fill->getFill(), std::move(RawEvents), Event);
20752075

20762076
return CL_SUCCESS;
20772077
}
2078-
case CG::CGTYPE::PrefetchUSM: {
2078+
case CG::CGType::PrefetchUSM: {
20792079
CGPrefetchUSM *Prefetch = (CGPrefetchUSM *)MCommandGroup.get();
20802080
MemoryManager::prefetch_usm(Prefetch->getDst(), MQueue,
20812081
Prefetch->getLength(), std::move(RawEvents),
20822082
Event);
20832083

20842084
return CL_SUCCESS;
20852085
}
2086-
case CG::CGTYPE::AdviseUSM: {
2086+
case CG::CGType::AdviseUSM: {
20872087
CGAdviseUSM *Advise = (CGAdviseUSM *)MCommandGroup.get();
20882088
MemoryManager::advise_usm(Advise->getDst(), MQueue, Advise->getLength(),
20892089
Advise->getAdvice(), std::move(RawEvents), Event);
20902090

20912091
return CL_SUCCESS;
20922092
}
2093-
case CG::CGTYPE::CodeplayInteropTask: {
2093+
case CG::CGType::CodeplayInteropTask: {
20942094
const detail::plugin &Plugin = MQueue->getPlugin();
20952095
CGInteropTask *ExecInterop = (CGInteropTask *)MCommandGroup.get();
20962096
// Wait for dependencies to complete before dispatching work on the host
@@ -2118,7 +2118,7 @@ cl_int ExecCGCommand::enqueueImp() {
21182118

21192119
return CL_SUCCESS;
21202120
}
2121-
case CG::CGTYPE::CodeplayHostTask: {
2121+
case CG::CGType::CodeplayHostTask: {
21222122
CGHostTask *HostTask = static_cast<CGHostTask *>(MCommandGroup.get());
21232123

21242124
for (ArgDesc &Arg : HostTask->MArgs) {
@@ -2173,7 +2173,7 @@ cl_int ExecCGCommand::enqueueImp() {
21732173

21742174
return CL_SUCCESS;
21752175
}
2176-
case CG::CGTYPE::Barrier: {
2176+
case CG::CGType::Barrier: {
21772177
if (MQueue->get_device().is_host()) {
21782178
// NOP for host device.
21792179
return PI_SUCCESS;
@@ -2184,7 +2184,7 @@ cl_int ExecCGCommand::enqueueImp() {
21842184

21852185
return PI_SUCCESS;
21862186
}
2187-
case CG::CGTYPE::BarrierWaitlist: {
2187+
case CG::CGType::BarrierWaitlist: {
21882188
CGBarrier *Barrier = static_cast<CGBarrier *>(MCommandGroup.get());
21892189
std::vector<detail::EventImplPtr> Events = Barrier->MEventsWaitWithBarrier;
21902190
if (MQueue->get_device().is_host() || Events.empty()) {
@@ -2199,14 +2199,14 @@ cl_int ExecCGCommand::enqueueImp() {
21992199

22002200
return PI_SUCCESS;
22012201
}
2202-
case CG::CGTYPE::None:
2202+
case CG::CGType::None:
22032203
throw runtime_error("CG type not implemented.", PI_INVALID_OPERATION);
22042204
}
22052205
return PI_INVALID_OPERATION;
22062206
}
22072207

22082208
bool ExecCGCommand::producesPiEvent() const {
2209-
return MCommandGroup->getType() != CG::CGTYPE::CodeplayHostTask;
2209+
return MCommandGroup->getType() != CG::CGType::CodeplayHostTask;
22102210
}
22112211

22122212
} // namespace detail

sycl/source/detail/scheduler/graph_builder.cpp

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -849,7 +849,7 @@ Scheduler::GraphBuilder::addEmptyCmd(Command *Cmd, const std::vector<T *> &Reqs,
849849
}
850850

851851
static bool isInteropHostTask(const std::unique_ptr<ExecCGCommand> &Cmd) {
852-
if (Cmd->getCG().getType() != CG::CGTYPE::CodeplayHostTask)
852+
if (Cmd->getCG().getType() != CG::CGType::CodeplayHostTask)
853853
return false;
854854

855855
const detail::CGHostTask &HT =
@@ -884,7 +884,7 @@ Scheduler::GraphBuilder::addCG(std::unique_ptr<detail::CG> CommandGroup,
884884
std::vector<Command *> &ToEnqueue) {
885885
std::vector<Requirement *> &Reqs = CommandGroup->MRequirements;
886886
const std::vector<detail::EventImplPtr> &Events = CommandGroup->MEvents;
887-
const CG::CGTYPE CGType = CommandGroup->getType();
887+
const CG::CGType CGType = CommandGroup->getType();
888888

889889
std::unique_ptr<ExecCGCommand> NewCmd(
890890
new ExecCGCommand(std::move(CommandGroup), Queue));
@@ -978,7 +978,7 @@ Scheduler::GraphBuilder::addCG(std::unique_ptr<detail::CG> CommandGroup,
978978
ToEnqueue.push_back(ConnCmd);
979979
}
980980

981-
if (CGType == CG::CGTYPE::CodeplayHostTask)
981+
if (CGType == CG::CGType::CodeplayHostTask)
982982
NewCmd->MEmptyCmd =
983983
addEmptyCmd(NewCmd.get(), NewCmd->getCG().MRequirements, Queue,
984984
Command::BlockReason::HostTask, ToEnqueue);

sycl/test/abi/layout_handler.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -116,7 +116,7 @@ void foo() {
116116
// CHECK-NEXT: 344 | std::__shared_ptr<class sycl::detail::kernel_impl, __gnu_cxx::_S_atomic>::element_type * _M_ptr
117117
// CHECK-NEXT: 352 | class std::__shared_count<__gnu_cxx::_S_atomic> _M_refcount
118118
// CHECK-NEXT: 352 | _Sp_counted_base<(enum __gnu_cxx::_Lock_policy)2U> * _M_pi
119-
// CHECK-NEXT: 360 | detail::class CG::CGTYPE MCGType
119+
// CHECK-NEXT: 360 | detail::class CG::CGType MCGType
120120
// CHECK-NEXT: 368 | void * MSrcPtr
121121
// CHECK-NEXT: 376 | void * MDstPtr
122122
// CHECK-NEXT: 384 | size_t MLength

sycl/test/regression/check_simple_name_collisions.cpp

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,5 @@
1-
// RUN: %clangxx -fsycl -fsycl-targets=%sycl_triple %s -o %t.out
1+
// RUN: %clangxx -fsycl -fsyntax-only -Xclang -verify %s
2+
// expected-no-diagnostics
23

34
#define NONE
45
#define KERNEL

sycl/unittests/scheduler/StreamInitDependencyOnHost.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,7 @@ class MockHandler : public sycl::handler {
1818
MockHandler(shared_ptr_class<detail::queue_impl> Queue, bool IsHost)
1919
: sycl::handler(Queue, IsHost) {}
2020

21-
void setType(detail::CG::CGTYPE Type) {
21+
void setType(detail::CG::CGType Type) {
2222
static_cast<sycl::handler *>(this)->MCGType = Type;
2323
}
2424

0 commit comments

Comments
 (0)