ROCm / HIP

HIP: C++ Heterogeneous-Compute Interface for Portability
https://rocmdocs.amd.com/projects/HIP/
MIT License
3.71k stars 528 forks source link

Compiler warnings for g++13.1 #3296

Closed torrance closed 3 days ago

torrance commented 1 year ago

When compiling with -Wpendantic, g++ 13.1 emits the following warnings when simply including hip/hip_runtime.h:

g++ --std=c++17 playground.cpp -Wall -Wextra -Wpedantic -o playground -I/opt/rocm/include --D__HIP_PLATFORM_HCC__= -D__HIP_PLATFORM_AMD__=
In file included from /opt/rocm/include/hip/amd_detail/amd_channel_descriptor.h:28,
                 from /opt/rocm/include/hip/channel_descriptor.h:32,
                 from /opt/rocm/include/hip/texture_types.h:38,
                 from /opt/rocm/include/hip/hip_runtime_api.h:489,
                 from /opt/rocm/include/hip/hip_runtime.h:113,
                 from playground.cpp:3:
/opt/rocm/include/hip/amd_detail/amd_hip_vector_types.h:152:20: warning: ISO C++ prohibits anonymous structs [-Wpedantic]
  152 |             struct {
      |                    ^
/opt/rocm/include/hip/amd_detail/amd_hip_vector_types.h:187:20: warning: ISO C++ prohibits anonymous structs [-Wpedantic]
  187 |             struct {
      |                    ^
/opt/rocm/include/hip/amd_detail/amd_hip_vector_types.h:368:20: warning: ISO C++ prohibits anonymous structs [-Wpedantic]
  368 |             struct {
      |                    ^
/opt/rocm/include/hip/amd_detail/amd_hip_vector_types.h:411:20: warning: ISO C++ prohibits anonymous structs [-Wpedantic]
  411 |             struct {
cjatin commented 1 year ago

We want to fix it but it might require a some work and restructuring of code inorder to preserve API/ABI compatibility.

For now can you use something like:

#pragma GCC diagnostic ignored "-Wpedantic"
#include <hip/hip_runtime.h>
#pragma GCC diagnostic pop
ppanchad-amd commented 5 months ago

@torrance Can you please test with latest ROCm 6.1.0 (HIP 6.1)? If resolved, please close ticket. Thanks!

ppanchad-amd commented 3 days ago

@torrance Closing ticket for now. Please feel free to re-open ticket if you still see the issue with the latest ROCm. Thanks!