Skip to content

Commit 4236bbb

Browse files
authored
[SYCL] Changed USM copy src and dst parameter order (#4037)
As noted in #3897 (comment), a spec bug was identified. The USM `copy` member functions take the `src` and `dst` parameters in the wrong order. The order should be `(src, dst)`, which matches the standard C++ `copy` function and matches the existing SYCL `copy` functions that take accessor parameters.
1 parent 9d8e94d commit 4236bbb

File tree

2 files changed

+8
-8
lines changed

2 files changed

+8
-8
lines changed

sycl/include/CL/sycl/handler.hpp

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2261,10 +2261,10 @@ class __SYCL_EXPORT handler {
22612261
/// if either \param Dest or \param Src is nullptr. The behavior is undefined
22622262
/// if any of the pointer parameters is invalid.
22632263
///
2264-
/// \param Dest is a USM pointer to the destination memory.
22652264
/// \param Src is a USM pointer to the source memory.
2265+
/// \param Dest is a USM pointer to the destination memory.
22662266
/// \param Count is a number of elements of type T to copy.
2267-
template <typename T> void copy(T *Dest, const T *Src, size_t Count) {
2267+
template <typename T> void copy(const T *Src, T *Dest, size_t Count) {
22682268
this->memcpy(Dest, Src, Count * sizeof(T));
22692269
}
22702270

sycl/include/CL/sycl/queue.hpp

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -446,11 +446,11 @@ class __SYCL_EXPORT queue {
446446
/// if either \param Dest or \param Src is nullptr. The behavior is undefined
447447
/// if any of the pointer parameters is invalid.
448448
///
449-
/// \param Dest is a USM pointer to the destination memory.
450449
/// \param Src is a USM pointer to the source memory.
450+
/// \param Dest is a USM pointer to the destination memory.
451451
/// \param Count is a number of elements of type T to copy.
452452
/// \return an event representing copy operation.
453-
template <typename T> event copy(T *Dest, const T *Src, size_t Count) {
453+
template <typename T> event copy(const T *Src, T *Dest, size_t Count) {
454454
return this->memcpy(Dest, Src, Count * sizeof(T));
455455
}
456456

@@ -460,13 +460,13 @@ class __SYCL_EXPORT queue {
460460
/// if either \param Dest or \param Src is nullptr. The behavior is undefined
461461
/// if any of the pointer parameters is invalid.
462462
///
463-
/// \param Dest is a USM pointer to the destination memory.
464463
/// \param Src is a USM pointer to the source memory.
464+
/// \param Dest is a USM pointer to the destination memory.
465465
/// \param Count is a number of elements of type T to copy.
466466
/// \param DepEvent is an event that specifies the kernel dependencies.
467467
/// \return an event representing copy operation.
468468
template <typename T>
469-
event copy(T *Dest, const T *Src, size_t Count, event DepEvent) {
469+
event copy(const T *Src, T *Dest, size_t Count, event DepEvent) {
470470
return this->memcpy(Dest, Src, Count * sizeof(T), DepEvent);
471471
}
472472

@@ -476,13 +476,13 @@ class __SYCL_EXPORT queue {
476476
/// if either \param Dest or \param Src is nullptr. The behavior is undefined
477477
/// if any of the pointer parameters is invalid.
478478
///
479-
/// \param Dest is a USM pointer to the destination memory.
480479
/// \param Src is a USM pointer to the source memory.
480+
/// \param Dest is a USM pointer to the destination memory.
481481
/// \param Count is a number of elements of type T to copy.
482482
/// \param DepEvents is a vector of events that specifies the kernel
483483
/// \return an event representing copy operation.
484484
template <typename T>
485-
event copy(T *Dest, const T *Src, size_t Count,
485+
event copy(const T *Src, T *Dest, size_t Count,
486486
const vector_class<event> &DepEvents) {
487487
return this->memcpy(Dest, Src, Count * sizeof(T), DepEvents);
488488
}

0 commit comments

Comments
 (0)