Skip to content

Commit e612834

Browse files
authored
[SYCL] Store version in CGAdviseUSM to enable extended members (#4057)
- In CGAdviseUSM, accept versioned type instead of hard-coding non-versioned ADVISE_USM. - In handler, use setType to encode version and pass the versioned type to CGAdviseUSM.
1 parent 033ff5e commit e612834

File tree

2 files changed

+11
-11
lines changed

2 files changed

+11
-11
lines changed

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

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -423,13 +423,13 @@ class CGAdviseUSM : public CG {
423423

424424
public:
425425
CGAdviseUSM(void *DstPtr, size_t Length,
426-
vector_class<vector_class<char>> ArgsStorage,
427-
vector_class<detail::AccessorImplPtr> AccStorage,
428-
vector_class<shared_ptr_class<const void>> SharedPtrStorage,
429-
vector_class<Requirement *> Requirements,
430-
vector_class<detail::EventImplPtr> Events,
426+
std::vector<std::vector<char>> ArgsStorage,
427+
std::vector<detail::AccessorImplPtr> AccStorage,
428+
std::vector<std::shared_ptr<const void>> SharedPtrStorage,
429+
std::vector<Requirement *> Requirements,
430+
std::vector<detail::EventImplPtr> Events, CGTYPE Type,
431431
detail::code_location loc = {})
432-
: CG(ADVISE_USM, std::move(ArgsStorage), std::move(AccStorage),
432+
: CG(Type, std::move(ArgsStorage), std::move(AccStorage),
433433
std::move(SharedPtrStorage), std::move(Requirements),
434434
std::move(Events), std::move(loc)),
435435
MDst(DstPtr), MLength(Length) {}

sycl/source/handler.cpp

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -192,7 +192,7 @@ event handler::finalize() {
192192
CommandGroup.reset(new detail::CGAdviseUSM(
193193
MDstPtr, MLength, std::move(MArgsStorage), std::move(MAccStorage),
194194
std::move(MSharedPtrStorage), std::move(MRequirements),
195-
std::move(MEvents), MCodeLoc));
195+
std::move(MEvents), MCGType, MCodeLoc));
196196
break;
197197
case detail::CG::CODEPLAY_HOST_TASK:
198198
CommandGroup.reset(new detail::CGHostTask(
@@ -488,29 +488,29 @@ void handler::memcpy(void *Dest, const void *Src, size_t Count) {
488488
MSrcPtr = const_cast<void *>(Src);
489489
MDstPtr = Dest;
490490
MLength = Count;
491-
MCGType = detail::CG::COPY_USM;
491+
setType(detail::CG::COPY_USM);
492492
}
493493

494494
void handler::memset(void *Dest, int Value, size_t Count) {
495495
throwIfActionIsCreated();
496496
MDstPtr = Dest;
497497
MPattern.push_back(static_cast<char>(Value));
498498
MLength = Count;
499-
MCGType = detail::CG::FILL_USM;
499+
setType(detail::CG::FILL_USM);
500500
}
501501

502502
void handler::prefetch(const void *Ptr, size_t Count) {
503503
throwIfActionIsCreated();
504504
MDstPtr = const_cast<void *>(Ptr);
505505
MLength = Count;
506-
MCGType = detail::CG::PREFETCH_USM;
506+
setType(detail::CG::PREFETCH_USM);
507507
}
508508

509509
void handler::mem_advise(const void *Ptr, size_t Count, pi_mem_advice Advice) {
510510
throwIfActionIsCreated();
511511
MDstPtr = const_cast<void *>(Ptr);
512512
MLength = Count;
513-
MCGType = detail::CG::ADVISE_USM;
513+
setType(detail::CG::ADVISE_USM);
514514

515515
assert(!MSharedPtrStorage.empty());
516516

0 commit comments

Comments
 (0)