@@ -320,17 +320,52 @@ class __SYCL_EXPORT queue {
320
320
321
321
// / Fills the specified memory with the specified pattern.
322
322
// /
323
- // / \param Ptr is the pointer to the memory to fill
323
+ // / \param Ptr is the pointer to the memory to fill.
324
324
// / \param Pattern is the pattern to fill into the memory. T should be
325
325
// / trivially copyable.
326
326
// / \param Count is the number of times to fill Pattern into Ptr.
327
+ // / \return an event representing fill operation.
327
328
template <typename T> event fill (void *Ptr, const T &Pattern, size_t Count) {
328
329
return submit ([&](handler &CGH) { CGH.fill <T>(Ptr, Pattern, Count); });
329
330
}
330
331
332
+ // / Fills the specified memory with the specified pattern.
333
+ // /
334
+ // / \param Ptr is the pointer to the memory to fill.
335
+ // / \param Pattern is the pattern to fill into the memory. T should be
336
+ // / trivially copyable.
337
+ // / \param Count is the number of times to fill Pattern into Ptr.
338
+ // / \param DepEvent is an event that specifies the kernel dependencies.
339
+ // / \return an event representing fill operation.
340
+ template <typename T>
341
+ event fill (void *Ptr, const T &Pattern, size_t Count, event DepEvent) {
342
+ return submit ([&](handler &CGH) {
343
+ CGH.depends_on (DepEvent);
344
+ CGH.fill <T>(Ptr, Pattern, Count);
345
+ });
346
+ }
347
+
348
+ // / Fills the specified memory with the specified pattern.
349
+ // /
350
+ // / \param Ptr is the pointer to the memory to fill.
351
+ // / \param Pattern is the pattern to fill into the memory. T should be
352
+ // / trivially copyable.
353
+ // / \param Count is the number of times to fill Pattern into Ptr.
354
+ // / \param DepEvents is a vector of events that specifies the kernel
355
+ // / dependencies.
356
+ // / \return an event representing fill operation.
357
+ template <typename T>
358
+ event fill (void *Ptr, const T &Pattern, size_t Count,
359
+ const vector_class<event> &DepEvents) {
360
+ return submit ([&](handler &CGH) {
361
+ CGH.depends_on (DepEvents);
362
+ CGH.fill <T>(Ptr, Pattern, Count);
363
+ });
364
+ }
365
+
331
366
// / Fills the memory pointed by a USM pointer with the value specified.
332
367
// / No operations is done if \param Count is zero. An exception is thrown
333
- // / if \param Dest is nullptr. The behavior is undefined if \param Ptr
368
+ // / if \param Ptr is nullptr. The behavior is undefined if \param Ptr
334
369
// / is invalid.
335
370
// /
336
371
// / \param Ptr is a USM pointer to the memory to fill.
@@ -339,6 +374,32 @@ class __SYCL_EXPORT queue {
339
374
// / \return an event representing fill operation.
340
375
event memset (void *Ptr, int Value, size_t Count);
341
376
377
+ // / Fills the memory pointed by a USM pointer with the value specified.
378
+ // / No operations is done if \param Count is zero. An exception is thrown
379
+ // / if \param Ptr is nullptr. The behavior is undefined if \param Ptr
380
+ // / is invalid.
381
+ // /
382
+ // / \param Ptr is a USM pointer to the memory to fill.
383
+ // / \param Value is a value to be set. Value is cast as an unsigned char.
384
+ // / \param Count is a number of bytes to fill.
385
+ // / \param DepEvent is an event that specifies the kernel dependencies.
386
+ // / \return an event representing fill operation.
387
+ event memset (void *Ptr, int Value, size_t Count, event DepEvent);
388
+
389
+ // / Fills the memory pointed by a USM pointer with the value specified.
390
+ // / No operations is done if \param Count is zero. An exception is thrown
391
+ // / if \param Ptr is nullptr. The behavior is undefined if \param Ptr
392
+ // / is invalid.
393
+ // /
394
+ // / \param Ptr is a USM pointer to the memory to fill.
395
+ // / \param Value is a value to be set. Value is cast as an unsigned char.
396
+ // / \param Count is a number of bytes to fill.
397
+ // / \param DepEvents is a vector of events that specifies the kernel
398
+ // / dependencies.
399
+ // / \return an event representing fill operation.
400
+ event memset (void *Ptr, int Value, size_t Count,
401
+ const vector_class<event> &DepEvents);
402
+
342
403
// / Copies data from one memory region to another, both pointed by
343
404
// / USM pointers.
344
405
// / No operations is done if \param Count is zero. An exception is thrown
@@ -351,6 +412,81 @@ class __SYCL_EXPORT queue {
351
412
// / \return an event representing copy operation.
352
413
event memcpy (void *Dest, const void *Src, size_t Count);
353
414
415
+ // / Copies data from one memory region to another, both pointed by
416
+ // / USM pointers.
417
+ // / No operations is done if \param Count is zero. An exception is thrown
418
+ // / if either \param Dest or \param Src is nullptr. The behavior is undefined
419
+ // / if any of the pointer parameters is invalid.
420
+ // /
421
+ // / \param Dest is a USM pointer to the destination memory.
422
+ // / \param Src is a USM pointer to the source memory.
423
+ // / \param Count is a number of bytes to copy.
424
+ // / \param DepEvent is an event that specifies the kernel dependencies.
425
+ // / \return an event representing copy operation.
426
+ event memcpy (void *Dest, const void *Src, size_t Count, event DepEvent);
427
+
428
+ // / Copies data from one memory region to another, both pointed by
429
+ // / USM pointers.
430
+ // / No operations is done if \param Count is zero. An exception is thrown
431
+ // / if either \param Dest or \param Src is nullptr. The behavior is undefined
432
+ // / if any of the pointer parameters is invalid.
433
+ // /
434
+ // / \param Dest is a USM pointer to the destination memory.
435
+ // / \param Src is a USM pointer to the source memory.
436
+ // / \param Count is a number of bytes to copy.
437
+ // / \param DepEvents is a vector of events that specifies the kernel
438
+ // / dependencies.
439
+ // / \return an event representing copy operation.
440
+ event memcpy (void *Dest, const void *Src, size_t Count,
441
+ const vector_class<event> &DepEvents);
442
+
443
+ // / Copies data from one memory region to another, both pointed by
444
+ // / USM pointers.
445
+ // / No operations is done if \param Count is zero. An exception is thrown
446
+ // / if either \param Dest or \param Src is nullptr. The behavior is undefined
447
+ // / if any of the pointer parameters is invalid.
448
+ // /
449
+ // / \param Dest is a USM pointer to the destination memory.
450
+ // / \param Src is a USM pointer to the source memory.
451
+ // / \param Count is a number of elements of type T to copy.
452
+ // / \return an event representing copy operation.
453
+ template <typename T> event copy (T *Dest, const T *Src, size_t Count) {
454
+ return this ->memcpy (Dest, Src, Count * sizeof (T));
455
+ }
456
+
457
+ // / Copies data from one memory region to another, both pointed by
458
+ // / USM pointers.
459
+ // / No operations is done if \param Count is zero. An exception is thrown
460
+ // / if either \param Dest or \param Src is nullptr. The behavior is undefined
461
+ // / if any of the pointer parameters is invalid.
462
+ // /
463
+ // / \param Dest is a USM pointer to the destination memory.
464
+ // / \param Src is a USM pointer to the source memory.
465
+ // / \param Count is a number of elements of type T to copy.
466
+ // / \param DepEvent is an event that specifies the kernel dependencies.
467
+ // / \return an event representing copy operation.
468
+ template <typename T>
469
+ event copy (T *Dest, const T *Src, size_t Count, event DepEvent) {
470
+ return this ->memcpy (Dest, Src, Count * sizeof (T), DepEvent);
471
+ }
472
+
473
+ // / Copies data from one memory region to another, both pointed by
474
+ // / USM pointers.
475
+ // / No operations is done if \param Count is zero. An exception is thrown
476
+ // / if either \param Dest or \param Src is nullptr. The behavior is undefined
477
+ // / if any of the pointer parameters is invalid.
478
+ // /
479
+ // / \param Dest is a USM pointer to the destination memory.
480
+ // / \param Src is a USM pointer to the source memory.
481
+ // / \param Count is a number of elements of type T to copy.
482
+ // / \param DepEvents is a vector of events that specifies the kernel
483
+ // / \return an event representing copy operation.
484
+ template <typename T>
485
+ event copy (T *Dest, const T *Src, size_t Count,
486
+ const vector_class<event> &DepEvents) {
487
+ return this ->memcpy (Dest, Src, Count * sizeof (T), DepEvents);
488
+ }
489
+
354
490
// / Provides additional information to the underlying runtime about how
355
491
// / different allocations are used.
356
492
// /
@@ -360,16 +496,72 @@ class __SYCL_EXPORT queue {
360
496
// / \return an event representing advice operation.
361
497
event mem_advise (const void *Ptr, size_t Length, pi_mem_advice Advice);
362
498
499
+ // / Provides additional information to the underlying runtime about how
500
+ // / different allocations are used.
501
+ // /
502
+ // / \param Ptr is a USM pointer to the allocation.
503
+ // / \param Length is a number of bytes in the allocation.
504
+ // / \param Advice is a device-defined advice for the specified allocation.
505
+ // / \param DepEvent is an event that specifies the kernel dependencies.
506
+ // / \return an event representing advice operation.
507
+ event mem_advise (const void *Ptr, size_t Length, pi_mem_advice Advice,
508
+ event DepEvent);
509
+
510
+ // / Provides additional information to the underlying runtime about how
511
+ // / different allocations are used.
512
+ // /
513
+ // / \param Ptr is a USM pointer to the allocation.
514
+ // / \param Length is a number of bytes in the allocation.
515
+ // / \param Advice is a device-defined advice for the specified allocation.
516
+ // / \param DepEvents is a vector of events that specifies the kernel
517
+ // / dependencies.
518
+ // / \return an event representing advice operation.
519
+ event mem_advise (const void *Ptr, size_t Length, pi_mem_advice Advice,
520
+ const vector_class<event> &DepEvents);
521
+
363
522
// / Provides hints to the runtime library that data should be made available
364
523
// / on a device earlier than Unified Shared Memory would normally require it
365
524
// / to be available.
366
525
// /
367
526
// / \param Ptr is a USM pointer to the memory to be prefetched to the device.
368
527
// / \param Count is a number of bytes to be prefetched.
528
+ // / \return an event representing prefetch operation.
369
529
event prefetch (const void *Ptr, size_t Count) {
370
530
return submit ([=](handler &CGH) { CGH.prefetch (Ptr, Count); });
371
531
}
372
532
533
+ // / Provides hints to the runtime library that data should be made available
534
+ // / on a device earlier than Unified Shared Memory would normally require it
535
+ // / to be available.
536
+ // /
537
+ // / \param Ptr is a USM pointer to the memory to be prefetched to the device.
538
+ // / \param Count is a number of bytes to be prefetched.
539
+ // / \param DepEvent is an event that specifies the kernel dependencies.
540
+ // / \return an event representing prefetch operation.
541
+ event prefetch (const void *Ptr, size_t Count, event DepEvent) {
542
+ return submit ([=](handler &CGH) {
543
+ CGH.depends_on (DepEvent);
544
+ CGH.prefetch (Ptr, Count);
545
+ });
546
+ }
547
+
548
+ // / Provides hints to the runtime library that data should be made available
549
+ // / on a device earlier than Unified Shared Memory would normally require it
550
+ // / to be available.
551
+ // /
552
+ // / \param Ptr is a USM pointer to the memory to be prefetched to the device.
553
+ // / \param Count is a number of bytes to be prefetched.
554
+ // / \param DepEvents is a vector of events that specifies the kernel
555
+ // / dependencies.
556
+ // / \return an event representing prefetch operation.
557
+ event prefetch (const void *Ptr, size_t Count,
558
+ const vector_class<event> &DepEvents) {
559
+ return submit ([=](handler &CGH) {
560
+ CGH.depends_on (DepEvents);
561
+ CGH.prefetch (Ptr, Count);
562
+ });
563
+ }
564
+
373
565
// / single_task version with a kernel represented as a lambda.
374
566
// /
375
567
// / \param KernelFunc is the Kernel functor or lambda
0 commit comments