diff --git a/sycl/include/CL/sycl/handler.hpp b/sycl/include/CL/sycl/handler.hpp index 1fd0bfe122453..35ecff6c1c0a7 100644 --- a/sycl/include/CL/sycl/handler.hpp +++ b/sycl/include/CL/sycl/handler.hpp @@ -2295,7 +2295,7 @@ class __SYCL_EXPORT handler { /// \param Ptr is a USM pointer to the allocation. /// \param Length is a number of bytes in the allocation. /// \param Advice is a device-defined advice for the specified allocation. - void mem_advise(const void *Ptr, size_t Length, pi_mem_advice Advice); + void mem_advise(const void *Ptr, size_t Length, int Advice); private: std::shared_ptr MQueue; diff --git a/sycl/include/CL/sycl/queue.hpp b/sycl/include/CL/sycl/queue.hpp index 848a6b78cab96..413bc49f29186 100644 --- a/sycl/include/CL/sycl/queue.hpp +++ b/sycl/include/CL/sycl/queue.hpp @@ -494,8 +494,18 @@ class __SYCL_EXPORT queue { /// \param Length is a number of bytes in the allocation. /// \param Advice is a device-defined advice for the specified allocation. /// \return an event representing advice operation. + __SYCL2020_DEPRECATED("use the overload with int Advice instead") event mem_advise(const void *Ptr, size_t Length, pi_mem_advice Advice); + /// Provides additional information to the underlying runtime about how + /// different allocations are used. + /// + /// \param Ptr is a USM pointer to the allocation. + /// \param Length is a number of bytes in the allocation. + /// \param Advice is a device-defined advice for the specified allocation. + /// \return an event representing advice operation. + event mem_advise(const void *Ptr, size_t Length, int Advice); + /// Provides additional information to the underlying runtime about how /// different allocations are used. /// @@ -504,8 +514,7 @@ class __SYCL_EXPORT queue { /// \param Advice is a device-defined advice for the specified allocation. /// \param DepEvent is an event that specifies the kernel dependencies. /// \return an event representing advice operation. - event mem_advise(const void *Ptr, size_t Length, pi_mem_advice Advice, - event DepEvent); + event mem_advise(const void *Ptr, size_t Length, int Advice, event DepEvent); /// Provides additional information to the underlying runtime about how /// different allocations are used. @@ -516,7 +525,7 @@ class __SYCL_EXPORT queue { /// \param DepEvents is a vector of events that specifies the kernel /// dependencies. /// \return an event representing advice operation. - event mem_advise(const void *Ptr, size_t Length, pi_mem_advice Advice, + event mem_advise(const void *Ptr, size_t Length, int Advice, const vector_class &DepEvents); /// Provides hints to the runtime library that data should be made available diff --git a/sycl/source/handler.cpp b/sycl/source/handler.cpp index 027fbce609d49..b3bb8911b3aa7 100644 --- a/sycl/source/handler.cpp +++ b/sycl/source/handler.cpp @@ -506,7 +506,7 @@ void handler::prefetch(const void *Ptr, size_t Count) { setType(detail::CG::PREFETCH_USM); } -void handler::mem_advise(const void *Ptr, size_t Count, pi_mem_advice Advice) { +void handler::mem_advise(const void *Ptr, size_t Count, int Advice) { throwIfActionIsCreated(); MDstPtr = const_cast(Ptr); MLength = Count; @@ -522,7 +522,7 @@ void handler::mem_advise(const void *Ptr, size_t Count, pi_mem_advice Advice) { detail::ExtendedMemberT EMember = { detail::ExtendedMembersType::HANDLER_MEM_ADVICE, - std::make_shared(Advice)}; + std::make_shared(pi_mem_advice(Advice))}; ExtendedMembersVec->push_back(EMember); } diff --git a/sycl/source/queue.cpp b/sycl/source/queue.cpp index 3ce12409cc63f..298068ee45201 100644 --- a/sycl/source/queue.cpp +++ b/sycl/source/queue.cpp @@ -105,17 +105,21 @@ event queue::memcpy(void *Dest, const void *Src, size_t Count, } event queue::mem_advise(const void *Ptr, size_t Length, pi_mem_advice Advice) { - return impl->mem_advise(impl, Ptr, Length, Advice, {}); + return mem_advise(Ptr, Length, int(Advice)); } -event queue::mem_advise(const void *Ptr, size_t Length, pi_mem_advice Advice, +event queue::mem_advise(const void *Ptr, size_t Length, int Advice) { + return impl->mem_advise(impl, Ptr, Length, pi_mem_advice(Advice), {}); +} + +event queue::mem_advise(const void *Ptr, size_t Length, int Advice, event DepEvent) { - return impl->mem_advise(impl, Ptr, Length, Advice, {DepEvent}); + return impl->mem_advise(impl, Ptr, Length, pi_mem_advice(Advice), {DepEvent}); } -event queue::mem_advise(const void *Ptr, size_t Length, pi_mem_advice Advice, +event queue::mem_advise(const void *Ptr, size_t Length, int Advice, const vector_class &DepEvents) { - return impl->mem_advise(impl, Ptr, Length, Advice, DepEvents); + return impl->mem_advise(impl, Ptr, Length, pi_mem_advice(Advice), DepEvents); } event queue::submit_impl(std::function CGH, diff --git a/sycl/test/abi/sycl_symbols_linux.dump b/sycl/test/abi/sycl_symbols_linux.dump index 0683df8dcc193..9ae52dfacb00b 100644 --- a/sycl/test/abi/sycl_symbols_linux.dump +++ b/sycl/test/abi/sycl_symbols_linux.dump @@ -3647,8 +3647,9 @@ _ZN2cl4sycl5eventC2EP9_cl_eventRKNS0_7contextE _ZN2cl4sycl5eventC2ESt10shared_ptrINS0_6detail10event_implEE _ZN2cl4sycl5eventC2Ev _ZN2cl4sycl5queue10mem_adviseEPKvm14_pi_mem_advice -_ZN2cl4sycl5queue10mem_adviseEPKvm14_pi_mem_adviceNS0_5eventE -_ZN2cl4sycl5queue10mem_adviseEPKvm14_pi_mem_adviceRKSt6vectorINS0_5eventESaIS6_EE +_ZN2cl4sycl5queue10mem_adviseEPKvmi +_ZN2cl4sycl5queue10mem_adviseEPKvmiNS0_5eventE +_ZN2cl4sycl5queue10mem_adviseEPKvmiRKSt6vectorINS0_5eventESaIS5_EE _ZN2cl4sycl5queue10wait_proxyERKNS0_6detail13code_locationE _ZN2cl4sycl5queue11submit_implESt8functionIFvRNS0_7handlerEEERKNS0_6detail13code_locationE _ZN2cl4sycl5queue11submit_implESt8functionIFvRNS0_7handlerEEES1_RKNS0_6detail13code_locationE @@ -3883,7 +3884,7 @@ _ZN2cl4sycl7contextC2ERKSt6vectorINS0_6deviceESaIS3_EERKNS0_13property_listE _ZN2cl4sycl7contextC2ERKSt6vectorINS0_6deviceESaIS3_EESt8functionIFvNS0_14exception_listEEERKNS0_13property_listE _ZN2cl4sycl7contextC2ERKSt8functionIFvNS0_14exception_listEEERKNS0_13property_listE _ZN2cl4sycl7contextC2ESt10shared_ptrINS0_6detail12context_implEE -_ZN2cl4sycl7handler10mem_adviseEPKvm14_pi_mem_advice +_ZN2cl4sycl7handler10mem_adviseEPKvmi _ZN2cl4sycl7handler10processArgEPvRKNS0_6detail19kernel_param_kind_tEimRmb _ZN2cl4sycl7handler10processArgEPvRKNS0_6detail19kernel_param_kind_tEimRmbb _ZN2cl4sycl7handler13getKernelNameB5cxx11Ev