I have followed the instructions to setup my environment for development with version 6.4.2 in Visual Studio 2022 on AMD, but I'm finding difficulty in starting. I also attempted in the new Visual Studio 2026 after copying over some relevant files, hoping to see some kind of change. With a "main.hip" file containing only
#include <hip/hip_runtime.h>
and attempting to build the solution, I get 950+ errors. They derive from:
- amd_hip_runtime.h
- amd_device_functions.h
- amd_hip_vector_types.h
- amd_math_functions.h
- amd_warp_functions.h
- device_library_decls.h
- hip_assert.h
- hip_fp16_math_fwd.h
- hip_ldg.h
- math_fwd.h
- ockl_image.h
- texture_fetch_functions.h
- texture_types.h
- compare
- concepts
- AMD.HIP.Clang.Common.targets
The first among these build errors are several of code E1696 (cannot open source file) within "amd_hip_runtime.h" for attempting to include:
- "__clang_cuda_math_forward_declares.h" at line 388
- "__clang_cuda_complex_builtins.h" at line 389
- "include/cuda_wrappers/algorithm" at line 395
- "include/cuda_wrappers/complex" at line 396
- "include/cuda_wrappers/new" at line 397
I cannot locate any of these files through my HIP_PATH nor my CUDA_PATH. I am also unsure why these CUDA-related files would be necessary, given that I am currently developing for AMD.
Despite being listed first among the errors, they are not the first errors in the file. There are errors on and around every usage of:
__host__
__device__
__HIP_DEVICE_BUILTIN
The vast majority of the errors across all the files appear to be associated with the macros that use __attribute__. I already ensured that my project is a "HIP clang 6.4" project with a platform toolset of "AMD HIP for clang Compiler 6.4" and a C++ language standard of "ISO C++20 Standard (std=c++20)".
Here are some example errors:
- amd_device_functions.h, line 38:
extern "C" __device__ int printf(const char *fmt, ...)
E0260 on __device__: explicit type is missing ('int' assumed)
E0065 on int: expected a ';'
- amd_device_functions.h, line 117:
else
E0169 on else: expected a declaration
- amd_device_functions.h, line 119:
}
E0169 on }: expected a declaration
- amd_device_functions.h, line 239:
} __attribute__((aligned(4)))
E0020 on aligned: identifier "aligned" is undefined
- amd_hip_runtime.h, line 180:
__host__ inline void* __get_dynamicgroupbaseptr() { return nullptr; }
E0077 on __host__: this declaration has no storage class or type specifier
E0065 on inline: expected a ';'
- amd_hip_runtime.h, line 264:
extern "C" __device__ __attribute__((const)) size_t __ockl_get_local_id(unsigned int);
E0260 on __device__: explicit type is missing ('int' assumed)
E0065 on __attribute__: expected a ';'
- amd_hip_runtime.h, line 265:
__DEVICE__ unsigned int __hip_get_thread_idx_x() { return __ockl_get_local_id(0); }
E0260 on __DEVICE__: explicit type is missing ('int' assumed)
- amd_hip_runtime.h, line 300:
__HIP_DEVICE_BUILTIN(x,__hip_get_thread_idx_x());
E0079 on __HIP_DEVICE_BUILTIN: expected a type specifier
- amd_hip_vector_types.h, line 719:
__HOST_DEVICE__
E0077 on __HOST_DEVICE__: this declaration has no storage class or type specifier
- amd_hip_vector_types.h, line 1120:
__forceinline__ __HOST_DEVICE__ typename std::enable_if<(rankT == 1 && rankU >= 1),
E0260 on __forceinline__: explicit type is missing ('int' assumed)
- amd_hip_vector_types.h, line 2166:
DECLOP_MAKE_ONE_COMPONENT(unsigned char, uchar1);
E0260 on DECLOP_MAKE_ONE_COMPONENT: explicit type is missing ('int' assumed)
- compare, line 76:
return _Val > 0;
E0349 on >: no operator ">" matches these operands
- concepts, line 28:
__is_same(_Ty1, _Ty2);
E0254 on _Ty1: type name is not allowed
E0254 on _Ty2: type name is not allowed
I encounter all of the above errors in both Visual Studio 2022 and Visual Studio 2026. The only distinctly new error I have encountered when attempting to build the project in Visual Studio 2026 is MSB4062 from AMD.HIP.Clang.Common.targets, where the "HipClangCompile" task could not be loaded from the AMD.Build.HIPTasks.Clang.Common6.4.dll assembly since it sought old version 17 dependencies, instead of the new version 18 ones. This final problem is less significant, as I am fine with using Visual Studio 2022, if necessary.
Based on all this information, what could be happening here? What am I missing? Does anyone else use the Visual Studio extension?
I have followed the instructions to setup my environment for development with version 6.4.2 in Visual Studio 2022 on AMD, but I'm finding difficulty in starting. I also attempted in the new Visual Studio 2026 after copying over some relevant files, hoping to see some kind of change. With a "main.hip" file containing only
#include <hip/hip_runtime.h>and attempting to build the solution, I get 950+ errors. They derive from:
The first among these build errors are several of code E1696 (cannot open source file) within "amd_hip_runtime.h" for attempting to include:
I cannot locate any of these files through my HIP_PATH nor my CUDA_PATH. I am also unsure why these CUDA-related files would be necessary, given that I am currently developing for AMD.
Despite being listed first among the errors, they are not the first errors in the file. There are errors on and around every usage of:
__host____device____HIP_DEVICE_BUILTINThe vast majority of the errors across all the files appear to be associated with the macros that use
__attribute__. I already ensured that my project is a "HIP clang 6.4" project with a platform toolset of "AMD HIP for clang Compiler 6.4" and a C++ language standard of "ISO C++20 Standard (std=c++20)".Here are some example errors:
extern "C" __device__ int printf(const char *fmt, ...)E0260 on
__device__: explicit type is missing ('int' assumed)E0065 on
int: expected a ';'elseE0169 on
else: expected a declaration}E0169 on
}: expected a declaration} __attribute__((aligned(4)))E0020 on
aligned: identifier "aligned" is undefined__host__ inline void* __get_dynamicgroupbaseptr() { return nullptr; }E0077 on
__host__: this declaration has no storage class or type specifierE0065 on
inline: expected a ';'extern "C" __device__ __attribute__((const)) size_t __ockl_get_local_id(unsigned int);E0260 on
__device__: explicit type is missing ('int' assumed)E0065 on
__attribute__: expected a ';'__DEVICE__ unsigned int __hip_get_thread_idx_x() { return __ockl_get_local_id(0); }E0260 on
__DEVICE__: explicit type is missing ('int' assumed)__HIP_DEVICE_BUILTIN(x,__hip_get_thread_idx_x());E0079 on
__HIP_DEVICE_BUILTIN: expected a type specifier__HOST_DEVICE__E0077 on
__HOST_DEVICE__: this declaration has no storage class or type specifier__forceinline__ __HOST_DEVICE__ typename std::enable_if<(rankT == 1 && rankU >= 1),E0260 on
__forceinline__: explicit type is missing ('int' assumed)DECLOP_MAKE_ONE_COMPONENT(unsigned char, uchar1);E0260 on
DECLOP_MAKE_ONE_COMPONENT: explicit type is missing ('int' assumed)return _Val > 0;E0349 on
>: no operator ">" matches these operands__is_same(_Ty1, _Ty2);E0254 on
_Ty1: type name is not allowedE0254 on
_Ty2: type name is not allowedI encounter all of the above errors in both Visual Studio 2022 and Visual Studio 2026. The only distinctly new error I have encountered when attempting to build the project in Visual Studio 2026 is MSB4062 from AMD.HIP.Clang.Common.targets, where the "HipClangCompile" task could not be loaded from the AMD.Build.HIPTasks.Clang.Common6.4.dll assembly since it sought old version 17 dependencies, instead of the new version 18 ones. This final problem is less significant, as I am fine with using Visual Studio 2022, if necessary.
Based on all this information, what could be happening here? What am I missing? Does anyone else use the Visual Studio extension?