Using std::simd with NVC++

Hello,

I wonder whether there are plans to support std::simd, part of C++'s Extensions for Parallelism V2 (Extensions for parallelism, version 2 - cppreference.com).

Code that uses std::simd compiles OK with GCC 12.3.0 and Intel LLVM 2023.2.0.20230721.

However, NVC++ (NVHPC 23.9) issues errors regarding missing vector types and functions (e.g. __v8df and _mm512_andnot_ps, respectively) when targeting an architecture which is not AVX512.

Minimum program:

// program.cpp
#include <experimental/simd>
int main() {
  return 0;
}

When I compile the above program with nvc++ -std=c++20 program.cpp -o program I get errors like the following:

"/usr/include/c++/12/experimental/bits/simd.h", line 1949: error: identifier "__v16sf" is undefined
    _GLIBCXX_SIMD_INTRINSIC __v16sf

"/usr/include/c++/12/experimental/bits/simd.h", line 1957: error: identifier "__v8di" is undefined
                            reinterpret_cast<__v8di>(__b)));
                                             ^
"/usr/include/c++/12/experimental/bits/simd.h", line 1956: error: identifier "_mm512_andnot_si512" is undefined
        _mm512_andnot_si512(reinterpret_cast<__v8di>(__a),
        ^

Using -tp=native makes no difference.

nvc++ --version returns:

nvc++ 23.9-0 64-bit target on x86-64 Linux -tp alderlake
NVIDIA Compilers and Tools
Copyright (c) 2023, NVIDIA CORPORATION & AFFILIATES.  All rights reserved.

Thanks,
Christos

Hi Christos,

I talked with engineering and support for “std::simd” will be something we add, but not until it gets adopted by the standard, which is likely C++26.

-Mat

1 Like

Hi Mat,

Perfect, thanks!

Christos