DPCT1011#

Message#

The tool detected overloaded operators for built-in vector types, which may conflict with the SYCL 2020 standard operators (see 4.14.2.1 Vec interface). The tool inserted a namespace to avoid the conflict. Use SYCL 2020 standard operators instead.

Detailed Help#

You may have overloaded operators for vector types such as double2. This resulted in a conflict because overloaded operators with the same signature are also defined in the SYCL* standard. SYCLomatic adds the namespace for overloaded operators to differentiate them from the ones defined in SYCL. You may need to rewrite the code.

Suggestions to Fix#

You may need to rewrite this code.

For example, this original CUDA* code:

1__host__ __device__ double2 &operator+=(double2 &a, const double2 &b) {
2  a.x += b.x;
3  a.y += b.y;
4  return a;
5}
6
7void foo(double2 &a, double2 &b) {
8  a += b;
9}

results in the following migrated SYCL code:

 1/*
 2DPCT1011:0: The tool detected overloaded operators for built-in vector types,
 3which may conflict with the SYCL 2020 standard operators (see 4.14.2.1 Vec
 4interface). The tool inserted a namespace to avoid the conflict. Use SYCL 2020
 5standard operators instead.
 6*/
 7namespace dpct_operator_overloading {
 8  sycl::double2 &operator+=(sycl::double2 &a, const sycl::double2 &b) {
 9    a.x() += b.x();
10    a.y() += b.y();
11    return a;
12  }
13} // namespace dpct_operator_overloading
14
15void foo(sycl::double2 &a, sycl::double2 &b) {
16  dpct_operator_overloading::operator+=(a, b);
17}

which is rewritten to:

1void foo(sycl::double2 &a, sycl::double2 &b) {
2  // In this case, the user-defined overloading of `+=` has been supported by sycl::double2, so we can use the operator `+=` directly.
3  a += b;
4}