KEMBAR78
-x hip Should have same C++ std as -x c++ · Issue #2278 · ROCm/hip · GitHub
Skip to content

-x hip Should have same C++ std as -x c++ #2278

@ax3l

Description

@ax3l

Does this repo change the default of -std=c++<...> for clang++?
I am trying to transition to the clang++ + hip::device target logic (#2275) with ECP AMReX & ECP WarpX.

The compiler identifies as Clang 12 but it builds by default in C++11.

My targets set

target_compile_features(${tgt} PUBLIC cxx_std_14)

and only with this clang++ in hip 4.1.0 I see no flags getting added to the command line.

Note that Clang 6+ already default to C++14: https://gist.github.com/ax3l/53db9fa8a4f4c21ecc5c4100c0d93c94

But -xhip does not it seems:

rocm-4.1.0/llvm/bin/clang++ -dM -E -xhip  /dev/null | grep -F __cplusplus
#define __cplusplus 201103L
#define __cplusplus 201103L

Vs.:

rocm-4.1.0/llvm/bin/clang++ -dM -E -x c++  /dev/null | grep -F __cplusplus
#define __cplusplus 201402L

My Workaround

export CXXFLAGS="-std=c++14"

before all CMake builds, because the target compile feature cxx_std_14 is currently ignored for -xhip objects.

Alternative work-around: CXX_STANDARD always adds -std=c++XX, even if the compiler default fulfills it

set_property(TARGET mytarget PROPERTY CXX_STANDARD 14)

The reason for that is that cxx_std_14 asks for feature support (at least a minimal version) while CXX_STANDARD is an exact request for a version.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions