Skip to content

[SYCL] Use int instead of pi_mem_advice in (queue|handler)::mem_advise #4100

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 1 commit into from
Jul 15, 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/handler.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -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<detail::queue_impl> MQueue;
Expand Down
15 changes: 12 additions & 3 deletions sycl/include/CL/sycl/queue.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -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.
///
Expand All @@ -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.
Expand All @@ -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<event> &DepEvents);

/// Provides hints to the runtime library that data should be made available
Expand Down
4 changes: 2 additions & 2 deletions sycl/source/handler.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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<void *>(Ptr);
MLength = Count;
Expand All @@ -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<pi_mem_advice>(Advice)};
std::make_shared<pi_mem_advice>(pi_mem_advice(Advice))};

ExtendedMembersVec->push_back(EMember);
}
Expand Down
14 changes: 9 additions & 5 deletions sycl/source/queue.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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<event> &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<void(handler &)> CGH,
Expand Down
7 changes: 4 additions & 3 deletions sycl/test/abi/sycl_symbols_linux.dump
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down Expand Up @@ -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
Expand Down