PrgEnv-nvidia 22.5 misparses serialization.hpp

Issue #562 resolved
Dan Bonachea created an issue

Building upcxx-extras/examples/kokkos_3dhalo on Perlmutter using PrgEnv-nvidia/8.3.3 and nvidia/22.5, the compiler misparses serialization.hpp and generates errors like the following:

"/global/common/software/m2878/perlmutter/upcxx-cuda-native/bleeding-edge/nvidia/PrgEnv-nvidia-8.3.3-22.5/include/upcxx/serialization.hpp", line 1532: error: nontype "<unnamed>::static_size" is not a template
  constexpr std::size_t static_storage_size = ((__decltype(ub)::static_size < 512) ? __decltype(ub)::static_size : 512); 
                                                                ^
          detected during:
            instantiation of "upcxx::detail::copy_traits<Cxs>::deserialized_cxs_remote_bound_t upcxx::detail::copy_traits<Cxs>::cxs_remote_deserialized_value(const upcxx::detail::copy_traits<Cxs>::cxs_remote_bound_t &) [with Cxs=upcxx::detail::completions<upcxx::detail::promise_cx<upcxx::operation_cx_event, true>>]" at line 256 of "/global/common/software/m2878/perlmutter/upcxx-cuda-native/bleeding-edge/nvidia/PrgEnv-nvidia-8.3.3-22.5/include/upcxx/copy.hpp"
            instantiation of "upcxx::detail::copy_traits<Cxs>::return_t upcxx::detail::copy_as_rget(upcxx::intrank_t, void *, void *, std::size_t, Cxs &&) [with Cxs=upcxx::detail::completions<upcxx::detail::promise_cx<upcxx::operation_cx_event, true>>]" at line 860 of "/global/common/software/m2878/perlmutter/upcxx-cuda-native/bleeding-edge/nvidia/PrgEnv-nvidia-8.3.3-22.5/include/upcxx/copy.hpp"
            instantiation of "upcxx::detail::copy_traits<Cxs>::return_t upcxx::copy(upcxx::global_ptr<const T, Ks>, upcxx::global_ptr<T, Kd>, std::size_t, Cxs &&) [with T=double, Ks=upcxx::memory_kind::cuda_device, Kd=upcxx::memory_kind::cuda_device, Cxs=upcxx::detail::completions<upcxx::detail::promise_cx<upcxx::operation_cx_event, true>>]" at line 565 of "upcxx_heat_conduction.cpp"

"/global/common/software/m2878/perlmutter/upcxx-cuda-native/bleeding-edge/nvidia/PrgEnv-nvidia-8.3.3-22.5/include/upcxx/serialization.hpp", line 1532: error: expected a ">"
  constexpr std::size_t static_storage_size = ((__decltype(ub)::static_size < 512) ? __decltype(ub)::static_size : 512); 
                                                                                 ^
          detected during:
            instantiation of "upcxx::detail::copy_traits<Cxs>::deserialized_cxs_remote_bound_t upcxx::detail::copy_traits<Cxs>::cxs_remote_deserialized_value(const upcxx::detail::copy_traits<Cxs>::cxs_remote_bound_t &) [with Cxs=upcxx::detail::completions<upcxx::detail::promise_cx<upcxx::operation_cx_event, true>>]" at line 256 of "/global/common/software/m2878/perlmutter/upcxx-cuda-native/bleeding-edge/nvidia/PrgEnv-nvidia-8.3.3-22.5/include/upcxx/copy.hpp"
            instantiation of "upcxx::detail::copy_traits<Cxs>::return_t upcxx::detail::copy_as_rget(upcxx::intrank_t, void *, void *, std::size_t, Cxs &&) [with Cxs=upcxx::detail::completions<upcxx::detail::promise_cx<upcxx::operation_cx_event, true>>]" at line 860 of "/global/common/software/m2878/perlmutter/upcxx-cuda-native/bleeding-edge/nvidia/PrgEnv-nvidia-8.3.3-22.5/include/upcxx/copy.hpp"
            instantiation of "upcxx::detail::copy_traits<Cxs>::return_t upcxx::copy(upcxx::global_ptr<const T, Ks>, upcxx::global_ptr<T, Kd>, std::size_t, Cxs &&) [with T=double, Ks=upcxx::memory_kind::cuda_device, Kd=upcxx::memory_kind::cuda_device, Cxs=upcxx::detail::completions<upcxx::detail::promise_cx<upcxx::operation_cx_event, true>>]" at line 565 of "upcxx_heat_conduction.cpp"

"/global/common/software/m2878/perlmutter/upcxx-cuda-native/bleeding-edge/nvidia/PrgEnv-nvidia-8.3.3-22.5/include/upcxx/serialization.hpp", line 1532: error: expected an expression
  constexpr std::size_t static_storage_size = ((__decltype(ub)::static_size < 512) ? __decltype(ub)::static_size : 512); 
                                                                                   ^
          detected during:
            instantiation of "upcxx::detail::copy_traits<Cxs>::deserialized_cxs_remote_bound_t upcxx::detail::copy_traits<Cxs>::cxs_remote_deserialized_value(const upcxx::detail::copy_traits<Cxs>::cxs_remote_bound_t &) [with Cxs=upcxx::detail::completions<upcxx::detail::promise_cx<upcxx::operation_cx_event, true>>]" at line 256 of "/global/common/software/m2878/perlmutter/upcxx-cuda-native/bleeding-edge/nvidia/PrgEnv-nvidia-8.3.3-22.5/include/upcxx/copy.hpp"
            instantiation of "upcxx::detail::copy_traits<Cxs>::return_t upcxx::detail::copy_as_rget(upcxx::intrank_t, void *, void *, std::size_t, Cxs &&) [with Cxs=upcxx::detail::completions<upcxx::detail::promise_cx<upcxx::operation_cx_event, true>>]" at line 860 of "/global/common/software/m2878/perlmutter/upcxx-cuda-native/bleeding-edge/nvidia/PrgEnv-nvidia-8.3.3-22.5/include/upcxx/copy.hpp"
            instantiation of "upcxx::detail::copy_traits<Cxs>::return_t upcxx::copy(upcxx::global_ptr<const T, Ks>, upcxx::global_ptr<T, Kd>, std::size_t, Cxs &&) [with T=double, Ks=upcxx::memory_kind::cuda_device, Kd=upcxx::memory_kind::cuda_device, Cxs=upcxx::detail::completions<upcxx::detail::promise_cx<upcxx::operation_cx_event, true>>]" at line 565 of "upcxx_heat_conduction.cpp"
...

The error message clearly indicates the compiler incorrectly parsed serialization.hpp:1532:

constexpr std::size_t static_storage_size = (decltype(ub)::static_size) < 512 ? decltype(ub)::static_size : 512;

Note the original source line already includes a redundant set of parentheses around (decltype(ub)::static_size), presumably added to prevent similar parse errors seen elsewhere, but the frontend is apparently discarding the parens and stubbornly still trying to incorrectly parse this as a template instantiation (/facepalm).

This parse error was seen in both debug or opt codemode, with multiple conduits, using Kokkos 3.6 or 3.7.

Comments (3)

  1. Dan Bonachea reporter

    issue 562: Workaround nvcc 22.5 parser defect on serialization.hpp

    Insert an extraneous but harmless temporary variable to prevent nvcc's parser from losing its little mind trying to misparse this less-than expression as a template instantiation.

    Resolves issue #562

    → <<cset 0d881e0dd2ac>>

  2. Log in to comment