From 3aff3d6c6a94b2a78eabb8730124e78c44c17976 Mon Sep 17 00:00:00 2001 From: Dmitri Mokhov Date: Tue, 6 Jul 2021 00:49:30 -0500 Subject: [PATCH] [SYCL] Store version in CGAdviseUSM to enable extended members - 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. --- sycl/include/CL/sycl/detail/cg.hpp | 12 ++++++------ sycl/source/handler.cpp | 10 +++++----- 2 files changed, 11 insertions(+), 11 deletions(-) diff --git a/sycl/include/CL/sycl/detail/cg.hpp b/sycl/include/CL/sycl/detail/cg.hpp index 92d5c04669f8e..5ead1e07c8ec1 100644 --- a/sycl/include/CL/sycl/detail/cg.hpp +++ b/sycl/include/CL/sycl/detail/cg.hpp @@ -423,13 +423,13 @@ class CGAdviseUSM : public CG { public: CGAdviseUSM(void *DstPtr, size_t Length, - vector_class> ArgsStorage, - vector_class AccStorage, - vector_class> SharedPtrStorage, - vector_class Requirements, - vector_class Events, + std::vector> ArgsStorage, + std::vector AccStorage, + std::vector> SharedPtrStorage, + std::vector Requirements, + std::vector Events, CGTYPE Type, detail::code_location loc = {}) - : CG(ADVISE_USM, std::move(ArgsStorage), std::move(AccStorage), + : CG(Type, std::move(ArgsStorage), std::move(AccStorage), std::move(SharedPtrStorage), std::move(Requirements), std::move(Events), std::move(loc)), MDst(DstPtr), MLength(Length) {} diff --git a/sycl/source/handler.cpp b/sycl/source/handler.cpp index 1466c8311070c..027fbce609d49 100644 --- a/sycl/source/handler.cpp +++ b/sycl/source/handler.cpp @@ -192,7 +192,7 @@ event handler::finalize() { CommandGroup.reset(new detail::CGAdviseUSM( MDstPtr, MLength, std::move(MArgsStorage), std::move(MAccStorage), std::move(MSharedPtrStorage), std::move(MRequirements), - std::move(MEvents), MCodeLoc)); + std::move(MEvents), MCGType, MCodeLoc)); break; case detail::CG::CODEPLAY_HOST_TASK: CommandGroup.reset(new detail::CGHostTask( @@ -488,7 +488,7 @@ void handler::memcpy(void *Dest, const void *Src, size_t Count) { MSrcPtr = const_cast(Src); MDstPtr = Dest; MLength = Count; - MCGType = detail::CG::COPY_USM; + setType(detail::CG::COPY_USM); } void handler::memset(void *Dest, int Value, size_t Count) { @@ -496,21 +496,21 @@ void handler::memset(void *Dest, int Value, size_t Count) { MDstPtr = Dest; MPattern.push_back(static_cast(Value)); MLength = Count; - MCGType = detail::CG::FILL_USM; + setType(detail::CG::FILL_USM); } void handler::prefetch(const void *Ptr, size_t Count) { throwIfActionIsCreated(); MDstPtr = const_cast(Ptr); MLength = Count; - MCGType = detail::CG::PREFETCH_USM; + setType(detail::CG::PREFETCH_USM); } void handler::mem_advise(const void *Ptr, size_t Count, pi_mem_advice Advice) { throwIfActionIsCreated(); MDstPtr = const_cast(Ptr); MLength = Count; - MCGType = detail::CG::ADVISE_USM; + setType(detail::CG::ADVISE_USM); assert(!MSharedPtrStorage.empty());