[Synopsis]
The problem is that nvcc automatically pre-includes some CUDA header files at the beginning of ANY compilation unit (not only header files, but also .cu files). They are at least (but probably are not all):
- cuda_runtime.h (The top-level injection)
- crt/host_config.h (System check)
- builtin_types.h (Basic types)
- device_types.h (enums and structs)
- host_defines.h (Macro definitions)
Such nvcc behaviour is a design choice by NVIDIA to make writing CUDA device and host code less verbose. It effectively treats CUDA as part of the language environment rather than just an external library, whereas clang reasonably decides that CUDA is a C++ language extension.
nvcc knows which header files are needed for implicit inclusion, and clang doesn't.
[Solution]
- Implicitly pre-include those CUDA header files during each hipification using
hipify-clang.
- Find all the implicitly pre-included CUDA header files.
- Provide tests for all those “missing” header files.
[Synopsis]
The problem is that nvcc automatically pre-includes some CUDA header files at the beginning of ANY compilation unit (not only header files, but also .cu files). They are at least (but probably are not all):
Such
nvccbehaviour is a design choice by NVIDIA to make writing CUDA device and host code less verbose. It effectively treatsCUDA as part of the language environmentrather than just an external library, whereasclangreasonably decides thatCUDA is a C++ language extension.nvccknows which header files are needed for implicit inclusion, andclangdoesn't.[Solution]
hipify-clang.