Skip to content

Commit 5df0bf6

Browse files
Added DPPLQueue_Prefetch and DPPLQueue_MemAdvise
1 parent ec742a0 commit 5df0bf6

File tree

2 files changed

+44
-0
lines changed

2 files changed

+44
-0
lines changed

backends/include/dppl_sycl_queue_interface.h

Lines changed: 26 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -199,4 +199,30 @@ DPPL_API
199199
void DPPLQueue_Memcpy (__dppl_keep const DPPLSyclQueueRef QRef,
200200
void *Dest, const void *Src, size_t Count);
201201

202+
/*!
203+
* @brief C-API wrapper for sycl::queue::prefetch, the function waits on an event
204+
* till the prefetch operation completes.
205+
*
206+
* @param QRef An opaque pointer to the sycl queue.
207+
* @param Ptr An USM pointer to memory.
208+
* @param Count A number of bytes to prefetch.
209+
*/
210+
DPPL_API
211+
void DPPLQueue_Prefetch (__dppl_keep DPPLSyclQueueRef QRef,
212+
const void *Ptr, size_t Count);
213+
214+
/*!
215+
* @brief C-API wrapper for sycl::queue::mem_advise, the function waits on an event
216+
* till the operation completes.
217+
*
218+
* @param QRef An opaque pointer to the sycl queue.
219+
* @param Ptr An USM pointer to memory.
220+
* @param Count A number of bytes to prefetch.
221+
* @param Advice Device-defined advice for the specified allocation.
222+
* A value of 0 reverts the advice for Ptr to the default behavior.
223+
*/
224+
DPPL_API
225+
void DPPLQueue_MemAdvise (__dppl_keep DPPLSyclQueueRef QRef,
226+
const void *Ptr, size_t Count, int Advice);
227+
202228
DPPL_C_EXTERN_C_END

backends/source/dppl_sycl_queue_interface.cpp

Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -297,3 +297,21 @@ void DPPLQueue_Memcpy (__dppl_take const DPPLSyclQueueRef QRef,
297297
auto event = Q->memcpy(Dest, Src, Count);
298298
event.wait();
299299
}
300+
301+
void
302+
DPPLQueue_Prefetch (__dppl_keep DPPLSyclQueueRef QRef,
303+
const void *Ptr, size_t Count)
304+
{
305+
auto Q = unwrap(QRef);
306+
auto event = Q->prefetch(Ptr, Count);
307+
event.wait();
308+
}
309+
310+
void
311+
DPPLQueue_MemAdvise (__dppl_keep DPPLSyclQueueRef QRef,
312+
const void *Ptr, size_t Count, int Advice)
313+
{
314+
auto Q = unwrap(QRef);
315+
auto event = Q->mem_advise(Ptr, Count, static_cast<pi_mem_advice>(Advice));
316+
event.wait();
317+
}

0 commit comments

Comments
 (0)