Community
cancel
Showing results for 
Search instead for 
Did you mean: 
giltirn
Novice
144 Views

Unusual compile errors when building using dpcpp with -std=c++11

Hi All,

Building on JLSE with dpc++ version "Intel(R) oneAPI DPC++/C++ Compiler 2021.2.0 (2021.x.0.20210323)",  installed at /soft/restricted/CNDA/sdk/2021.04.30.001/oneapi/compiler/20210323/linux/bin, compiling with the flag -std=c++11 produces some very unusual compile errors that I did not come across when building with earlier versions:

Spoiler
dpcpp test_container.C -o test_container -fsycl-device-code-split=per_kernel -fsycl-device-lib=all -std=c++11
In file included from test_container.C:1:
In file included from /soft/restricted/CNDA/sdk/2021.04.30.001/oneapi/compiler/20210323/linux/bin/../include/sycl/CL/sycl.hpp:11:
In file included from /soft/restricted/CNDA/sdk/2021.04.30.001/oneapi/compiler/20210323/linux/bin/../include/sycl/CL/sycl/ONEAPI/atomic.hpp:11:
In file included from /soft/restricted/CNDA/sdk/2021.04.30.001/oneapi/compiler/20210323/linux/bin/../include/sycl/CL/sycl/ONEAPI/atomic_accessor.hpp:12:
In file included from /soft/restricted/CNDA/sdk/2021.04.30.001/oneapi/compiler/20210323/linux/bin/../include/sycl/CL/sycl/ONEAPI/atomic_ref.hpp:16:
In file included from /soft/restricted/CNDA/sdk/2021.04.30.001/oneapi/compiler/20210323/linux/bin/../include/sycl/CL/sycl/detail/spirv.hpp:14:
In file included from /soft/restricted/CNDA/sdk/2021.04.30.001/oneapi/compiler/20210323/linux/bin/../include/sycl/CL/sycl/detail/generic_type_traits.hpp:16:
/soft/restricted/CNDA/sdk/2021.04.30.001/oneapi/compiler/20210323/linux/bin/../include/sycl/CL/sycl/half_type.hpp:79:9: error: cannot assign to non-static data member within const member function 'operator-'
Buf ^= 0x8000;
~~~ ^
/soft/restricted/CNDA/sdk/2021.04.30.001/oneapi/compiler/20210323/linux/bin/../include/sycl/CL/sycl/half_type.hpp:78:19: note: member function 'sycl::detail::host_half_impl::half::operator-' is declared const here
constexpr half &operator-() {
~~~~~~~~~~~~~~~~^~~~~~~~~~~
/soft/restricted/CNDA/sdk/2021.04.30.001/oneapi/compiler/20210323/linux/bin/../include/sycl/CL/sycl/half_type.hpp:80:12: error: binding reference of type 'sycl::detail::host_half_impl::half' to value of type 'const sycl::detail::host_half_impl::half' drops 'const' qualifier
return *this;
^~~~~
/soft/restricted/CNDA/sdk/2021.04.30.001/oneapi/compiler/20210323/linux/bin/../include/sycl/CL/sycl/half_type.hpp:78:19: error: no return statement in constexpr function
constexpr half &operator-() {
^
/soft/restricted/CNDA/sdk/2021.04.30.001/oneapi/compiler/20210323/linux/bin/../include/sycl/CL/sycl/half_type.hpp:209:18: error: functions that differ only in their return type cannot be overloaded
constexpr half operator-() const {
~~~~ ^
/soft/restricted/CNDA/sdk/2021.04.30.001/oneapi/compiler/20210323/linux/bin/../include/sycl/CL/sycl/half_type.hpp:205:19: note: previous definition is here
constexpr half &operator-() {
~~~~~~^
/soft/restricted/CNDA/sdk/2021.04.30.001/oneapi/compiler/20210323/linux/bin/../include/sycl/CL/sycl/half_type.hpp:206:10: error: cannot assign to non-static data member within const member function 'operator-'
Data = -Data;
~~~~ ^
/soft/restricted/CNDA/sdk/2021.04.30.001/oneapi/compiler/20210323/linux/bin/../include/sycl/CL/sycl/half_type.hpp:205:19: note: member function 'sycl::detail::half_impl::half::operator-' is declared const here
constexpr half &operator-() {
~~~~~~~~~~~~~~~~^~~~~~~~~~~
/soft/restricted/CNDA/sdk/2021.04.30.001/oneapi/compiler/20210323/linux/bin/../include/sycl/CL/sycl/half_type.hpp:207:12: error: binding reference of type 'sycl::detail::half_impl::half' to value of type 'const sycl::detail::half_impl::half' drops 'const' qualifier
return *this;
^~~~~
/soft/restricted/CNDA/sdk/2021.04.30.001/oneapi/compiler/20210323/linux/bin/../include/sycl/CL/sycl/half_type.hpp:205:19: error: no return statement in constexpr function
constexpr half &operator-() {
^
In file included from test_container.C:1:
In file included from /soft/restricted/CNDA/sdk/2021.04.30.001/oneapi/compiler/20210323/linux/bin/../include/sycl/CL/sycl.hpp:15:
In file included from /soft/restricted/CNDA/sdk/2021.04.30.001/oneapi/compiler/20210323/linux/bin/../include/sycl/CL/sycl/ONEAPI/group_algorithm.hpp:14:
/soft/restricted/CNDA/sdk/2021.04.30.001/oneapi/compiler/20210323/linux/bin/../include/sycl/CL/sycl/ONEAPI/functional.hpp:27:17: error: too few template arguments for class template 'less'
return std::less<>()(std::forward<const T>(lhs), std::forward<const U>(rhs))
^
/soft/packaging/spack-builds/linux-opensuse_leap15-x86_64/gcc-10.2.0/gcc-10.2.0-yudlyezca7twgd5o3wkkraur7wdbngdn/lib/gcc/x86_64-pc-linux-gnu/10.2.0/../../../../include/c++/10.2.0/bits/stl_function.h:381:12: note: template is declared here
struct less : public binary_function<_Tp, _Tp, bool>
^
In file included from test_container.C:1:
In file included from /soft/restricted/CNDA/sdk/2021.04.30.001/oneapi/compiler/20210323/linux/bin/../include/sycl/CL/sycl.hpp:15:
In file included from /soft/restricted/CNDA/sdk/2021.04.30.001/oneapi/compiler/20210323/linux/bin/../include/sycl/CL/sycl/ONEAPI/group_algorithm.hpp:14:
/soft/restricted/CNDA/sdk/2021.04.30.001/oneapi/compiler/20210323/linux/bin/../include/sycl/CL/sycl/ONEAPI/functional.hpp:44:17: error: too few template arguments for class template 'greater'
return std::greater<>()(std::forward<const T>(lhs),
^
/soft/packaging/spack-builds/linux-opensuse_leap15-x86_64/gcc-10.2.0/gcc-10.2.0-yudlyezca7twgd5o3wkkraur7wdbngdn/lib/gcc/x86_64-pc-linux-gnu/10.2.0/../../../../include/c++/10.2.0/bits/stl_function.h:371:12: note: template is declared here
struct greater : public binary_function<_Tp, _Tp, bool>
^
In file included from test_container.C:1:
In file included from /soft/restricted/CNDA/sdk/2021.04.30.001/oneapi/compiler/20210323/linux/bin/../include/sycl/CL/sycl.hpp:16:
In file included from /soft/restricted/CNDA/sdk/2021.04.30.001/oneapi/compiler/20210323/linux/bin/../include/sycl/CL/sycl/ONEAPI/reduction.hpp:14:
/soft/restricted/CNDA/sdk/2021.04.30.001/oneapi/compiler/20210323/linux/bin/../include/sycl/CL/sycl/handler.hpp:253:17: error: no template named 'index_sequence' in namespace 'std'; did you mean simply 'index_sequence'?
std::index_sequence<Is...>);
^~~~~
/soft/restricted/CNDA/sdk/2021.04.30.001/oneapi/compiler/20210323/linux/bin/../include/sycl/CL/sycl/detail/kernel_desc.hpp:80:1: note: 'index_sequence' declared here
using index_sequence = integer_sequence<unsigned long long, I...>;
^
In file included from test_container.C:1:
In file included from /soft/restricted/CNDA/sdk/2021.04.30.001/oneapi/compiler/20210323/linux/bin/../include/sycl/CL/sycl.hpp:16:
In file included from /soft/restricted/CNDA/sdk/2021.04.30.001/oneapi/compiler/20210323/linux/bin/../include/sycl/CL/sycl/ONEAPI/reduction.hpp:14:
/soft/restricted/CNDA/sdk/2021.04.30.001/oneapi/compiler/20210323/linux/bin/../include/sycl/CL/sycl/handler.hpp:259:22: error: no template named 'index_sequence' in namespace 'std'; did you mean simply 'index_sequence'?
std::index_sequence<Is...>);
^~~~~
/soft/restricted/CNDA/sdk/2021.04.30.001/oneapi/compiler/20210323/linux/bin/../include/sycl/CL/sycl/detail/kernel_desc.hpp:80:1: note: 'index_sequence' declared here
using index_sequence = integer_sequence<unsigned long long, I...>;
^
In file included from test_container.C:1:
In file included from /soft/restricted/CNDA/sdk/2021.04.30.001/oneapi/compiler/20210323/linux/bin/../include/sycl/CL/sycl.hpp:16:
In file included from /soft/restricted/CNDA/sdk/2021.04.30.001/oneapi/compiler/20210323/linux/bin/../include/sycl/CL/sycl/ONEAPI/reduction.hpp:14:
/soft/restricted/CNDA/sdk/2021.04.30.001/oneapi/compiler/20210323/linux/bin/../include/sycl/CL/sycl/handler.hpp:266:30: error: no template named 'index_sequence' in namespace 'std'; did you mean simply 'index_sequence'?
std::index_sequence<Is...>);
^~~~~
/soft/restricted/CNDA/sdk/2021.04.30.001/oneapi/compiler/20210323/linux/bin/../include/sycl/CL/sycl/detail/kernel_desc.hpp:80:1: note: 'index_sequence' declared here
using index_sequence = integer_sequence<unsigned long long, I...>;
^
In file included from test_container.C:1:
In file included from /soft/restricted/CNDA/sdk/2021.04.30.001/oneapi/compiler/20210323/linux/bin/../include/sycl/CL/sycl.hpp:16:
In file included from /soft/restricted/CNDA/sdk/2021.04.30.001/oneapi/compiler/20210323/linux/bin/../include/sycl/CL/sycl/ONEAPI/reduction.hpp:14:
/soft/restricted/CNDA/sdk/2021.04.30.001/oneapi/compiler/20210323/linux/bin/../include/sycl/CL/sycl/handler.hpp:269:17: error: no member named 'tuple_element_t' in namespace 'std'
std::tuple<std::tuple_element_t<Is, TupleT>...>
~~~~~^
/soft/restricted/CNDA/sdk/2021.04.30.001/oneapi/compiler/20210323/linux/bin/../include/sycl/CL/sycl/handler.hpp:269:47: error: expected unqualified-id
std::tuple<std::tuple_element_t<Is, TupleT>...>
^
/soft/restricted/CNDA/sdk/2021.04.30.001/oneapi/compiler/20210323/linux/bin/../include/sycl/CL/sycl/handler.hpp:1290:3: error: no template named 'enable_if_t' in namespace 'std'; did you mean 'detail::enable_if_t'?
std::enable_if_t<(sizeof...(RestT) >= 3 &&
^~~~~
/soft/restricted/CNDA/sdk/2021.04.30.001/oneapi/compiler/20210323/linux/bin/../include/sycl/CL/sycl/detail/stl_type_traits.hpp:24:1: note: 'detail::enable_if_t' declared here
using enable_if_t = typename std::enable_if<B, T>::type;
^
In file included from test_container.C:1:
In file included from /soft/restricted/CNDA/sdk/2021.04.30.001/oneapi/compiler/20210323/linux/bin/../include/sycl/CL/sycl.hpp:16:
In file included from /soft/restricted/CNDA/sdk/2021.04.30.001/oneapi/compiler/20210323/linux/bin/../include/sycl/CL/sycl/ONEAPI/reduction.hpp:14:
/soft/restricted/CNDA/sdk/2021.04.30.001/oneapi/compiler/20210323/linux/bin/../include/sycl/CL/sycl/handler.hpp:1296:24: error: no template named 'make_index_sequence' in namespace 'std'; did you mean 'detail::make_index_sequence'?
auto ReduIndices = std::make_index_sequence<NumArgs - 1>();
^~~~~
/soft/restricted/CNDA/sdk/2021.04.30.001/oneapi/compiler/20210323/linux/bin/../include/sycl/CL/sycl/detail/kernel_desc.hpp:82:1: note: 'detail::make_index_sequence' declared here
using make_index_sequence =
^
In file included from test_container.C:1:
In file included from /soft/restricted/CNDA/sdk/2021.04.30.001/oneapi/compiler/20210323/linux/bin/../include/sycl/CL/sycl.hpp:16:
In file included from /soft/restricted/CNDA/sdk/2021.04.30.001/oneapi/compiler/20210323/linux/bin/../include/sycl/CL/sycl/ONEAPI/reduction.hpp:14:
/soft/restricted/CNDA/sdk/2021.04.30.001/oneapi/compiler/20210323/linux/bin/../include/sycl/CL/sycl/handler.hpp:1298:25: error: no member named 'tuple_select_elements' in namespace 'sycl::ONEAPI::detail'
ONEAPI::detail::tuple_select_elements(ArgsTuple, ReduIndices);
~~~~~~~~~~~~~~~~^
In file included from test_container.C:1:
In file included from /soft/restricted/CNDA/sdk/2021.04.30.001/oneapi/compiler/20210323/linux/bin/../include/sycl/CL/sycl.hpp:16:
/soft/restricted/CNDA/sdk/2021.04.30.001/oneapi/compiler/20210323/linux/bin/../include/sycl/CL/sycl/ONEAPI/reduction.hpp:579:3: error: no template named 'enable_if_t' in namespace 'std'; did you mean simply 'enable_if_t'?
std::enable_if_t<IsOneWG && _IsUSM, result_type *>
^~~~~
/soft/restricted/CNDA/sdk/2021.04.30.001/oneapi/compiler/20210323/linux/bin/../include/sycl/CL/sycl/ONEAPI/reduction.hpp:33:25: note: 'enable_if_t' declared here
using cl::sycl::detail::enable_if_t;
^
/soft/restricted/CNDA/sdk/2021.04.30.001/oneapi/compiler/20210323/linux/bin/../include/sycl/CL/sycl/ONEAPI/reduction.hpp:586:3: error: no template named 'enable_if_t' in namespace 'std'; did you mean simply 'enable_if_t'?
std::enable_if_t<IsOneWG && !_IsUSM, accessor_type>
^~~~~
/soft/restricted/CNDA/sdk/2021.04.30.001/oneapi/compiler/20210323/linux/bin/../include/sycl/CL/sycl/ONEAPI/reduction.hpp:33:25: note: 'enable_if_t' declared here
using cl::sycl::detail::enable_if_t;
^
fatal error: too many errors emitted, stopping now [-ferror-limit=]

The error vanishes when the -std=c++11 flag is removed. To reproduce,

> module load oneapi mpi
> make broken    <---- doesn't work
> make working   <---- works

using the attached source and Makefile.

0 Kudos
4 Replies
RahulV_intel
Moderator
120 Views

Hi,


Thanks for reporting this issue. I'm unable to reproduce this issue in my current environment (Intel(R) oneAPI DPC++ Compiler 2021.2.0 (2021.2.0.20210317).


We will try this with the version specified by you and let you know.


Thanks,

Rahul


Khalik_K_Intel
Employee
96 Views

Hello,

Thanks you for contacting Intel support.


dpcpp is designed for DPC++ application and should not be used for C++ applications.

The code you attached is DPC++. However, I have to point to oneAPI specification, where it is stated that

"C++. Every DPC++ program is also a C++ program. A compliant DPC++ implementation must support the C++17 Core Language (as specified in Sections 1-19 of ISO/IEC 14882:2017) or newer."

https://spec.oneapi.com/versions/latest/elements/dpcpp/source/index.html


Therefore, it is not unexpected that you are getting various errors, when using C++11 standard for DPC++ application as it is not supported.


Moreover, please also note, that version of DPC++ you point to uses latest SYCL standard also, which is SYCL2020.

SYCL2020 Specification states:

"The documents in the following list are referred to within this SYCL specification, and their content is a requirement for this document.

  1. C++17: ISO/IEC 14882:2017 Clauses 1-19, referred to in this specification as the C++ core language. The SYCL specification refers to language in the following C++ defect reports and assumes a compiler that implements them: DR2325.
  2. C++20: ISO/IEC 14882:2020 Programming languages — C++, referred to in this specification as the next C++ specification.

"

https://www.khronos.org/registry/SYCL/specs/sycl-2020/html/sycl-2020.html#sec:normativerefs


Hope this helps.

Regards,

Khalik.


giltirn
Novice
91 Views

Hi Khalik,

I understand, thankyou. However would you consider adding an error when requesting a standard <c++17? The test case I sent is a minimal example, the actual use case is a monolithic codebase with a very long history (some code in there is over 20 years old) and a custom build process and so it cost me an entire afternoon to locate the source of this error. It was especially difficult because this same code compiled perfectly in the previous oneAPI revision.

Best,
Chris

Khalik_K_Intel
Employee
49 Views

Hello,


Thank you for your response. I see your point and understand it. I have created a request for our development team to implement this change.


Regards,

Khalik.


Reply