Skip to content

[SYCL] Fix name collisions in SYCL enums #4154

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 8 commits into from
Jul 23, 2021
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion sycl/include/CL/sycl/detail/buffer_impl.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -147,7 +147,7 @@ class __SYCL_EXPORT buffer_impl final : public SYCLMemObjT {
void *allocateMem(ContextImplPtr Context, bool InitFromUserData,
void *HostPtr, RT::PiEvent &OutEventToWait) override;

MemObjType getType() const override { return MemObjType::BUFFER; }
MemObjType getType() const override { return MemObjType::Buffer; }

~buffer_impl() {
try {
Expand Down
67 changes: 34 additions & 33 deletions sycl/include/CL/sycl/detail/cg.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -149,26 +149,26 @@ class CG {
};

/// Type of the command group.
enum CGTYPE : unsigned int {
NONE = 0,
KERNEL = 1,
COPY_ACC_TO_PTR = 2,
COPY_PTR_TO_ACC = 3,
COPY_ACC_TO_ACC = 4,
BARRIER = 5,
BARRIER_WAITLIST = 6,
FILL = 7,
UPDATE_HOST = 8,
RUN_ON_HOST_INTEL = 9,
COPY_USM = 10,
FILL_USM = 11,
PREFETCH_USM = 12,
CODEPLAY_INTEROP_TASK = 13,
CODEPLAY_HOST_TASK = 14,
ADVISE_USM = 15,
enum CGType : unsigned int {
None = 0,
Kernel = 1,
CopyAccToPtr = 2,
CopyPtrToAcc = 3,
CopyAccToAcc = 4,
Barrier = 5,
BarrierWaitlist = 6,
Fill = 7,
UpdateHost = 8,
RunOnHostIntel = 9,
CopyUSM = 10,
FillUSM = 11,
PrefetchUSM = 12,
CodeplayInteropTask = 13,
CodeplayHostTask = 14,
AdviseUSM = 15,
};

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

CG(CG &&CommandGroup) = default;

CGTYPE getType() { return static_cast<CGTYPE>(getUnversionedCGType(MType)); }
CGType getType() { return static_cast<CGType>(getUnversionedCGType(MType)); }

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

private:
CGTYPE MType;
CGType MType;
// The following storages are needed to ensure that arguments won't die while
// we are using them.
/// Storage for standard layout arguments.
Expand Down Expand Up @@ -255,16 +255,17 @@ class CGExecKernel : public CG {
std::vector<ArgDesc> Args, std::string KernelName,
detail::OSModuleHandle OSModuleHandle,
std::vector<std::shared_ptr<detail::stream_impl>> Streams,
CGTYPE Type, detail::code_location loc = {})
CGType Type, detail::code_location loc = {})
: CG(Type, std::move(ArgsStorage), std::move(AccStorage),
std::move(SharedPtrStorage), std::move(Requirements),
std::move(Events), std::move(loc)),
MNDRDesc(std::move(NDRDesc)), MHostKernel(std::move(HKernel)),
MSyclKernel(std::move(SyclKernel)), MArgs(std::move(Args)),
MKernelName(std::move(KernelName)), MOSModuleHandle(OSModuleHandle),
MStreams(std::move(Streams)) {
assert((getType() == RUN_ON_HOST_INTEL || getType() == KERNEL) &&
"Wrong type of exec kernel CG.");
assert(
(getType() == CGType::RunOnHostIntel || getType() == CGType::Kernel) &&
"Wrong type of exec kernel CG.");
}

std::vector<ArgDesc> getArguments() const { return MArgs; }
Expand Down Expand Up @@ -294,7 +295,7 @@ class CGCopy : public CG {
void *MDst;

public:
CGCopy(CGTYPE CopyType, void *Src, void *Dst,
CGCopy(CGType CopyType, void *Src, void *Dst,
std::vector<std::vector<char>> ArgsStorage,
std::vector<detail::AccessorImplPtr> AccStorage,
std::vector<std::shared_ptr<const void>> SharedPtrStorage,
Expand Down Expand Up @@ -322,7 +323,7 @@ class CGFill : public CG {
std::vector<Requirement *> Requirements,
std::vector<detail::EventImplPtr> Events,
detail::code_location loc = {})
: CG(FILL, std::move(ArgsStorage), std::move(AccStorage),
: CG(CGType::Fill, std::move(ArgsStorage), std::move(AccStorage),
std::move(SharedPtrStorage), std::move(Requirements),
std::move(Events), std::move(loc)),
MPattern(std::move(Pattern)), MPtr((Requirement *)Ptr) {}
Expand All @@ -340,7 +341,7 @@ class CGUpdateHost : public CG {
std::vector<Requirement *> Requirements,
std::vector<detail::EventImplPtr> Events,
detail::code_location loc = {})
: CG(UPDATE_HOST, std::move(ArgsStorage), std::move(AccStorage),
: CG(CGType::UpdateHost, std::move(ArgsStorage), std::move(AccStorage),
std::move(SharedPtrStorage), std::move(Requirements),
std::move(Events), std::move(loc)),
MPtr((Requirement *)Ptr) {}
Expand All @@ -362,7 +363,7 @@ class CGCopyUSM : public CG {
std::vector<Requirement *> Requirements,
std::vector<detail::EventImplPtr> Events,
detail::code_location loc = {})
: CG(COPY_USM, std::move(ArgsStorage), std::move(AccStorage),
: CG(CGType::CopyUSM, std::move(ArgsStorage), std::move(AccStorage),
std::move(SharedPtrStorage), std::move(Requirements),
std::move(Events), std::move(loc)),
MSrc(Src), MDst(Dst), MLength(Length) {}
Expand All @@ -386,7 +387,7 @@ class CGFillUSM : public CG {
std::vector<Requirement *> Requirements,
std::vector<detail::EventImplPtr> Events,
detail::code_location loc = {})
: CG(FILL_USM, std::move(ArgsStorage), std::move(AccStorage),
: CG(CGType::FillUSM, std::move(ArgsStorage), std::move(AccStorage),
std::move(SharedPtrStorage), std::move(Requirements),
std::move(Events), std::move(loc)),
MPattern(std::move(Pattern)), MDst(DstPtr), MLength(Length) {}
Expand All @@ -408,7 +409,7 @@ class CGPrefetchUSM : public CG {
std::vector<Requirement *> Requirements,
std::vector<detail::EventImplPtr> Events,
detail::code_location loc = {})
: CG(PREFETCH_USM, std::move(ArgsStorage), std::move(AccStorage),
: CG(CGType::PrefetchUSM, std::move(ArgsStorage), std::move(AccStorage),
std::move(SharedPtrStorage), std::move(Requirements),
std::move(Events), std::move(loc)),
MDst(DstPtr), MLength(Length) {}
Expand All @@ -427,7 +428,7 @@ class CGAdviseUSM : public CG {
std::vector<detail::AccessorImplPtr> AccStorage,
std::vector<std::shared_ptr<const void>> SharedPtrStorage,
std::vector<Requirement *> Requirements,
std::vector<detail::EventImplPtr> Events, CGTYPE Type,
std::vector<detail::EventImplPtr> Events, CGType Type,
detail::code_location loc = {})
: CG(Type, std::move(ArgsStorage), std::move(AccStorage),
std::move(SharedPtrStorage), std::move(Requirements),
Expand Down Expand Up @@ -456,7 +457,7 @@ class CGInteropTask : public CG {
std::vector<detail::AccessorImplPtr> AccStorage,
std::vector<std::shared_ptr<const void>> SharedPtrStorage,
std::vector<Requirement *> Requirements,
std::vector<detail::EventImplPtr> Events, CGTYPE Type,
std::vector<detail::EventImplPtr> Events, CGType Type,
detail::code_location loc = {})
: CG(Type, std::move(ArgsStorage), std::move(AccStorage),
std::move(SharedPtrStorage), std::move(Requirements),
Expand All @@ -481,7 +482,7 @@ class CGHostTask : public CG {
std::vector<detail::AccessorImplPtr> AccStorage,
std::vector<std::shared_ptr<const void>> SharedPtrStorage,
std::vector<Requirement *> Requirements,
std::vector<detail::EventImplPtr> Events, CGTYPE Type,
std::vector<detail::EventImplPtr> Events, CGType Type,
detail::code_location loc = {})
: CG(Type, std::move(ArgsStorage), std::move(AccStorage),
std::move(SharedPtrStorage), std::move(Requirements),
Expand All @@ -499,7 +500,7 @@ class CGBarrier : public CG {
std::vector<detail::AccessorImplPtr> AccStorage,
std::vector<std::shared_ptr<const void>> SharedPtrStorage,
std::vector<Requirement *> Requirements,
std::vector<detail::EventImplPtr> Events, CGTYPE Type,
std::vector<detail::EventImplPtr> Events, CGType Type,
detail::code_location loc = {})
: CG(Type, std::move(ArgsStorage), std::move(AccStorage),
std::move(SharedPtrStorage), std::move(Requirements),
Expand Down
2 changes: 1 addition & 1 deletion sycl/include/CL/sycl/detail/image_impl.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -211,7 +211,7 @@ class __SYCL_EXPORT image_impl final : public SYCLMemObjT {
void *allocateMem(ContextImplPtr Context, bool InitFromUserData,
void *HostPtr, RT::PiEvent &OutEventToWait) override;

MemObjType getType() const override { return MemObjType::IMAGE; }
MemObjType getType() const override { return MemObjType::Image; }

// This utility api is currently used by accessor to get the element size of
// the image. Element size is dependent on num of channels and channel type.
Expand Down
2 changes: 1 addition & 1 deletion sycl/include/CL/sycl/detail/sycl_mem_obj_i.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@ class SYCLMemObjI {
public:
virtual ~SYCLMemObjI() = default;

enum MemObjType { BUFFER = 0, IMAGE = 1, UNDEFINED = 2 };
enum MemObjType { Buffer = 0, Image = 1, Undefined = 2 };

virtual MemObjType getType() const = 0;

Expand Down
4 changes: 3 additions & 1 deletion sycl/include/CL/sycl/detail/sycl_mem_obj_t.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -294,7 +294,9 @@ class __SYCL_EXPORT SYCLMemObjT : public SYCLMemObjI {
throw runtime_error("Not implemented", PI_INVALID_OPERATION);
}

__SYCL_DLL_LOCAL MemObjType getType() const override { return UNDEFINED; }
__SYCL_DLL_LOCAL MemObjType getType() const override {
return MemObjType::Undefined;
}

ContextImplPtr getInteropContext() const override { return MInteropContext; }

Expand Down
Loading