oneapi-src / oneDPL

oneAPI DPC++ Library (oneDPL) https://software.intel.com/content/www/us/en/develop/tools/oneapi/components/dpc-library.html
Apache License 2.0
716 stars 113 forks source link

Fix accessor usage in `__usm_or_buffer_accessor` class #1595

Closed SergeyKopienko closed 2 months ago

SergeyKopienko commented 2 months ago

In this PR we fixing compile error from tests:

In file included from /test/general/header_inclusion_order_async_1.pass.cpp:15:
In file included from /include/oneapi/dpl/execution:60:
In file included from /include/oneapi/dpl/internal/async_impl/glue_async_impl.h:20:
In file included from /include/oneapi/dpl/internal/async_impl/async_impl_hetero.h:20:
In file included from /include/oneapi/dpl/pstl/hetero/algorithm_impl_hetero.h:22:
In file included from /include/oneapi/dpl/pstl/parallel_backend.h:32:
In file included from /include/oneapi/dpl/pstl/hetero/dpcpp/parallel_backend_sycl.h:32:
/include/oneapi/dpl/pstl/hetero/dpcpp/parallel_backend_sycl_utils.h:490:5: error: constructor for 'oneapi::dpl::__par_backend_hetero::__usm_host_or_buffer_accessor<float>' must explicitly initialize the member '__acc' which does not have a default constructor
    __usm_host_or_buffer_accessor(sycl::handler& __cgh, _T* __usm_buf) : __ptr(__usm_buf), __usm(true) {}
    ^
/include/oneapi/dpl/pstl/hetero/dpcpp/parallel_backend_sycl_utils.h:546:24: note: in instantiation of member function 'oneapi::dpl::__par_backend_hetero::__usm_host_or_buffer_accessor<float>::__usm_host_or_buffer_accessor' requested here
        return __usm ? __usm_host_or_buffer_accessor<_T>(__cgh, __usm_buf.get())
                       ^
/include/oneapi/dpl/pstl/hetero/dpcpp/parallel_backend_sycl_utils.h:478:18: note: member is declared here
    __accessor_t __acc;
                 ^
/../include/sycl/CL/sycl/accessor.hpp:788:28: note: 'sycl::accessor<float, 1, sycl::access::mode::read_write, sycl::access::target::global_buffer, sycl::access::placeholder::false_t>' declared here
class __SYCL_SPECIAL_CLASS accessor :
                           ^
1 error generated.

Due Table 62. Constructors of the deprecated constant accessor from https://registry.khronos.org/SYCL/specs/sycl-2020/html/sycl-2020.html#_deprecated_features_of_the_accessor_class, the sycl::accessor class doesn't has default constructor.