[PATCH] D79237: [CUDA][HIP] Fix constexpr variables for C++17

Artem Belevich via Phabricator via cfe-commits cfe-commits at lists.llvm.org
Fri May 15 15:14:31 PDT 2020


tra added a comment.

In D79237#2039417 <https://reviews.llvm.org/D79237#2039417>, @tra wrote:

> LGTM in general. Let me check the patch on our tensorflow build.


Bad news -- it breaks the standard C++ library.

Reproducer:

  $ bin/clang++ -x cuda /dev/null -fsyntax-only -include algorithm --cuda-path=$HOME/local/cuda-10.1 --cuda-device-only --cuda-gpu-arch=sm_60 -std=c++17 -stdlib=libc++                                              tra at art3:~/work/llvm/build/release+assert+zapcc
  
  In file included from <built-in>:2:
  In file included from build/release+assert+zapcc/lib/clang/11.0.0/include/cuda_wrappers/algorithm:55:
  In file included from build/release+assert+zapcc/bin/../include/c++/v1/algorithm:642:
  build/release+assert+zapcc/bin/../include/c++/v1/utility:937:51: error: dynamic initialization is not supported for __device__, __constant__, and __shared__ variables.
  _LIBCPP_INLINE_VAR constexpr in_place_type_t<_Tp> in_place_type{};
                                                    ^            ~~
  build/release+assert+zapcc/bin/../include/c++/v1/utility:944:53: error: dynamic initialization is not supported for __device__, __constant__, and __shared__ variables.
  _LIBCPP_INLINE_VAR constexpr in_place_index_t<_Idx> in_place_index{};
                                                      ^             ~~
  2 errors generated when compiling for sm_60.


CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D79237/new/

https://reviews.llvm.org/D79237





More information about the cfe-commits mailing list