nvcc with MSVC as host compiler (Windows) can't compile stdexec: compiler detection takes the nvcc branch and skips the MSVC settings
Los mantenedores suelen responder en 2 días
Nadie ha tomado este issue todavía.
Evaluación
- Dificultad
- 4/5
- Tiempo estimado
- 3-5 días
- Aptitud para principiantes
- 18/100
- Tipo de issue
- Error
- Claridad
- Bastante claro
- Estado de actividad
- Activo
- Área
- build-system, devtools
Línea de trabajo
The detection logic is in include/stdexec/__detail/__config.hpp, where the NVCC branch runs before the MSVC checks, so STDEXEC_MSVC() and STDEXEC_MSVC_HEADERS() are never set under nvcc with an MSVC host. Related spots are __spin_loop_pause.hpp, __meta.hpp (__mk_indices) and __connect.hpp (__connect_declfn_v). Done would mean the minimal nvcc_msvc.cu example compiles with nvcc on Windows, or the header fails early with a clear #error; the maintainers have not yet decided which, so confirm the direction first.
Escrito por el modelo de indexación a partir del texto del issue.
Descripción
With nvcc on Windows (MSVC as host compiler), even a minimal program fails to compile at current main (1d58877ad898fa3422658d47b28f67deb9c10e80). We ran into this while building HPX with CUDA on Windows.
Versions: CUDA 13.0 (nvcc V13.0.88), MSVC 19.44.35229 (VS 2022 17.14, x64), Windows 11. CUDA 13.0 doesn't accept MSVC 19.52 (VS 18) as host compiler.
// nvcc_msvc.cu
#include <stdexec/execution.hpp>
int main()
{
auto s = stdexec::just(41) | stdexec::then([](int i) { return i + 1; });
auto [v] = stdexec::sync_wait(std::move(s)).value();
return v == 42 ? 0 : 1;
}
nvcc -std=c++20 -Xcompiler=-Zc:__cplusplus -Xcompiler=-Zc:preprocessor -Xcompiler=/EHsc --extended-lambda --expt-relaxed-constexpr -arch=sm_89 -I stdexec/include nvcc_msvc.cu
(-Zc:__cplusplus and -Zc:preprocessor are needed to get past the C++20 check and the preprocessor check in __config.hpp.)
Output (paths shortened, repeated lines removed):
include/stdexec/__detail/__meta.hpp(168): error: declaration is incompatible with variable template "stdexec::__pack::__mk_indices" (declared at line 163)
include/stdexec/__detail/__connect.hpp(83): error: declaration is incompatible with variable template "stdexec::__connect::__connect_declfn_v" (declared at line 77)
include/stdexec/__detail/__connect.hpp(90): error: declaration is incompatible with variable template "stdexec::__connect::__connect_declfn_v" (declared at line 77)
include/stdexec/__detail/__connect.hpp(103): error: declaration is incompatible with variable template "stdexec::__connect::__connect_declfn_v" (declared at line 97)
include/stdexec/__detail/__connect.hpp(110): error: declaration is incompatible with variable template "stdexec::__connect::__connect_declfn_v" (declared at line 97)
include/stdexec/__detail/__spin_loop_pause.hpp(48): error: identifier "__builtin_ia32_pause" is undefined
include/stdexec/__detail/__transform_completion_signatures.hpp(360): error: type name is not allowed
include/stdexec/__detail/__transform_completion_signatures.hpp(360): error: too many initializer values
include/stdexec/__detail/__transform_completion_signatures.hpp(400): error: type name is not allowed
include/stdexec/__detail/__transform_completion_signatures.hpp(400): error: too many initializer values
include/stdexec/__detail/__sync_wait.hpp(353): error: no instance of function template "stdexec::connect_t::operator()" matches the argument list
include/stdexec/__detail/__sync_wait.hpp(355): error: static assertion failed with "..."
nvcc_msvc.cu(6): error: expression must have class type but it has type "void"
15 errors detected in the compilation of "nvcc_msvc.cu".
The cause seems to be the compiler detection in __config.hpp: the __NVCC__ branch comes first, so with an MSVC host neither STDEXEC_MSVC() nor STDEXEC_MSVC_HEADERS() is ever set, although _MSC_VER is defined and the MSVC standard library is used. As a result:
__spin_loop_pause()takes the GCC branch (__builtin_ia32_pause()) instead of_mm_pause()from<intrin.h>.__make_indicesfalls back to theexternvariable template partial specializations (__mk_indices), and__connect.hppuses the__connect_declfn_vspecializations instead of the function-based version it already has for MSVC. nvcc's front end in MSVC mode rejects both ("declaration is incompatible with variable template").- After the front end,
clcompiles nvcc's preprocessed output (.cudafe1.cpp). The macros were already expanded with__NVCC__defined, so the MSVC workarounds keyed onSTDEXEC_MSVC()are missing there too.
What we tried in a local copy of 04de75de58 (the revision HPX uses today, which fails with the same __mk_indices and __builtin_ia32_pause errors): setting STDEXEC_MSVC_HEADERS() to 1 in the nvcc branch when _MSC_VER is defined fixes the __builtin_ia32_pause error, and using std::make_index_sequence for __make_indices fixes the __mk_indices error. With HPX's CUDA test files, and with the MSVC __msplice_helper variant enabled for nvcc as well, the front end then gets through, but cl fails on the .cudafe1.cpp file: first an internal compiler error (C1001) at __typeinfo.hpp(289), then errors such as C7571 (enable_sender: variable template has already been initialized) at __execution_fwd.hpp(287) and C7608 (atomic constraint should be a constant expression) at __sender_concepts.hpp(131) and __sender_introspection.hpp(259). So it takes more than a few local fixes, and the MSVC code paths would have to apply to both nvcc's front end and the host compilation.
Is nvcc with an MSVC host meant to be supported? If yes, would a separate STDEXEC_NVCC_MSVC_HOST() (or setting STDEXEC_MSVC_HEADERS() and the MSVC workarounds whenever _MSC_VER is defined) be the direction you'd want? If not, it would help to say so in the README and to fail early with an #error, so users don't get errors from deep inside the library.
- Lenguaje dominante
- C++
- Estrellas
- 2.5k
- Forks
- 285
- Merge medio
- 2 d 5 h
- PR fusionados (30 d)
- 81
Preparar el entorno
Este proyecto no incluye contenedor de desarrollo, Dockerfile ni guía de contribución, así que la configuración corre por tu cuenta: empieza por su README y consulta nuestra guía para la primera contribución para los pasos generales.
Primeros pasos
- Lee el issue completo y luego la guía de contribución del proyecto.
- Comenta en el issue que vas a ocuparte — evita que dos personas hagan lo mismo.
- Haz un fork del repositorio y trabaja en una rama.
- Abre un pull request que haga referencia al número del issue.
Más de NVIDIA/stdexec
-
Dificultad 2/5 1-3 horas Aptitud para principiantes 68/100
NVIDIA/stdexec#1751 · 3 comentarios ·
Los mantenedores suelen responder en 2 días
-
Dificultad 4/5 3-5 días Aptitud para principiantes 25/100
Los mantenedores suelen responder en 2 días
-
Dificultad 4/5 Más de una semana Aptitud para principiantes 18/100
Los mantenedores suelen responder en 2 días
-
Dificultad 3/5 1-3 horas Aptitud para principiantes 25/100
NVIDIA/stdexec#2400 · 1 comentario ·
Los mantenedores suelen responder en 2 días
-
sequence: missing transition (?)Abierto
Dificultad 5/5 Más de una semana Aptitud para principiantes 12/100
NVIDIA/stdexec#2344 · 4 comentarios ·
Los mantenedores suelen responder en 2 días
Todos los issues de NVIDIA/stdexec
Issues similares
-
documentation
Dificultad 2/5 1-3 horas Aptitud para principiantes 70/100
EchoTools/nevr-runtime#2042 ·
Los mantenedores suelen responder en 1 día
-
Download size and speed show scientific notation between 1000 and 1023 unitsPosiblemente ocupada @RaphaelFakhri la tomó hoy. Abierto
Dificultad 2/5 Menos de una hora Aptitud para principiantes 88/100
kiwix/kiwix-desktop#1570 ·
Los mantenedores suelen responder en 1 día
-
Device Request
Dificultad 2/5 Medio día Aptitud para principiantes 62/100
dresden-elektronik/deconz-rest-plugin#8686 ·
Los mantenedores suelen responder en 1 día
-
nixos/noctalia-greeter: greeter finds no sessions (session dirs not passed via XDG_DATA_DIRS)Abierto
Dificultad 2/5 1-3 horas Aptitud para principiantes 70/100
Los mantenedores suelen responder en 1 día
-
Dificultad 2/5 1-3 horas Aptitud para principiantes 72/100
aminya/project_options#303 ·