Clang-tidy on ci Vs deviceRTL

Basically none of the deviceRTL will pass clang tidy checks. This lights up diffs in red. I’ve appended an example failure report.

This could be time to do the tedious project wide renaming ToThisStyle, but that will be insufficient as clang-tidy, as invoked by CI at least, doesn’t know what hip/cuda are. Unknown attributes, doesn’t parse device code as amdgcn/nvptx etc.

What shall we do about this? Vaguely interesting that openmp isn’t part of the CI build step, but still gets hit by clang-tidy.

Jon

/mnt/disks/ssd0/agent/workspace/amd64_debian_testing_clang8/openmp/libomptarget/deviceRTLs/amdgcn/src/hip_atomics.h:21:23: warning: 'device' attribute ignored [clang-diagnostic-ignored-attributes]
template <typename T> DEVICE T atomicAdd(T *address, T val) {
                      ^
/mnt/disks/ssd0/agent/workspace/amd64_debian_testing_clang8/openmp/libomptarget/deviceRTLs/amdgcn/src/target_impl.h:24:31: note: expanded from macro 'DEVICE'
#define DEVICE __attribute__((device))
                              ^
/mnt/disks/ssd0/agent/workspace/amd64_debian_testing_clang8/openmp/libomptarget/deviceRTLs/amdgcn/src/hip_atomics.h:21:45: warning: invalid case style for parameter 'address' [readability-identifier-naming]
template <typename T> DEVICE T atomicAdd(T *address, T val) {
                                            ^~~~~~~
                                            Address
/mnt/disks/ssd0/agent/workspace/amd64_debian_testing_clang8/openmp/libomptarget/deviceRTLs/amdgcn/src/hip_atomics.h:21:56: warning: invalid case style for parameter 'val' [readability-identifier-naming]
template <typename T> DEVICE T atomicAdd(T *address, T val) {
                                                       ^~~
                                                       Val
/mnt/disks/ssd0/agent/workspace/amd64_debian_testing_clang8/openmp/libomptarget/deviceRTLs/amdgcn/src/hip_atomics.h:25:23: warning: 'device' attribute ignored [clang-diagnostic-ignored-attributes]
template <typename T> DEVICE T atomicMax(T *address, T val) {
                      ^
/mnt/disks/ssd0/agent/workspace/amd64_debian_testing_clang8/openmp/libomptarget/deviceRTLs/amdgcn/src/target_impl.h:24:31: note: expanded from macro 'DEVICE'
#define DEVICE __attribute__((device))
                              ^
/mnt/disks/ssd0/agent/workspace/amd64_debian_testing_clang8/openmp/libomptarget/deviceRTLs/amdgcn/src/hip_atomics.h:25:45: warning: invalid case style for parameter 'address' [readability-identifier-naming]
template <typename T> DEVICE T atomicMax(T *address, T val) {
                                            ^~~~~~~
                                            Address
/mnt/disks/ssd0/agent/workspace/amd64_debian_testing_clang8/openmp/libomptarget/deviceRTLs/amdgcn/src/hip_atomics.h:25:56: warning: invalid case style for parameter 'val' [readability-identifier-naming]
template <typename T> DEVICE T atomicMax(T *address, T val) {
                                                       ^~~
                                                       Val
/mnt/disks/ssd0/agent/workspace/amd64_debian_testing_clang8/openmp/libomptarget/deviceRTLs/amdgcn/src/hip_atomics.h:29:23: warning: 'device' attribute ignored [clang-diagnostic-ignored-attributes]
template <typename T> DEVICE T atomicExch(T *address, T val) {
                      ^
/mnt/disks/ssd0/agent/workspace/amd64_debian_testing_clang8/openmp/libomptarget/deviceRTLs/amdgcn/src/target_impl.h:24:31: note: expanded from macro 'DEVICE'
#define DEVICE __attribute__((device))
                              ^
/mnt/disks/ssd0/agent/workspace/amd64_debian_testing_clang8/openmp/libomptarget/deviceRTLs/amdgcn/src/hip_atomics.h:29:46: warning: invalid case style for parameter 'address' [readability-identifier-naming]
template <typename T> DEVICE T atomicExch(T *address, T val) {
                                             ^~~~~~~
                                             Address
/mnt/disks/ssd0/agent/workspace/amd64_debian_testing_clang8/openmp/libomptarget/deviceRTLs/amdgcn/src/hip_atomics.h:29:57: warning: invalid case style for parameter 'val' [readability-identifier-naming]
template <typename T> DEVICE T atomicExch(T *address, T val) {
                                                        ^~~
                                                        Val
/mnt/disks/ssd0/agent/workspace/amd64_debian_testing_clang8/openmp/libomptarget/deviceRTLs/amdgcn/src/hip_atomics.h:30:5: warning: invalid case style for variable 'r' [readability-identifier-naming]
  T r;
    ^
    R
/mnt/disks/ssd0/agent/workspace/amd64_debian_testing_clang8/openmp/libomptarget/deviceRTLs/amdgcn/src/hip_atomics.h:35:23: warning: 'device' attribute ignored [clang-diagnostic-ignored-attributes]
template <typename T> DEVICE T atomicCAS(T *address, T compare, T val) {
                      ^
/mnt/disks/ssd0/agent/workspace/amd64_debian_testing_clang8/openmp/libomptarget/deviceRTLs/amdgcn/src/target_impl.h:24:31: note: expanded from macro 'DEVICE'
#define DEVICE __attribute__((device))
                              ^
/mnt/disks/ssd0/agent/workspace/amd64_debian_testing_clang8/openmp/libomptarget/deviceRTLs/amdgcn/src/hip_atomics.h:35:45: warning: invalid case style for parameter 'address' [readability-identifier-naming]
template <typename T> DEVICE T atomicCAS(T *address, T compare, T val) {
                                            ^~~~~~~
                                            Address
/mnt/disks/ssd0/agent/workspace/amd64_debian_testing_clang8/openmp/libomptarget/deviceRTLs/amdgcn/src/hip_atomics.h:35:56: warning: invalid case style for parameter 'compare' [readability-identifier-naming]
template <typename T> DEVICE T atomicCAS(T *address, T compare, T val) {
                                                       ^~~~~~~
                                                       Compare
/mnt/disks/ssd0/agent/workspace/amd64_debian_testing_clang8/openmp/libomptarget/deviceRTLs/amdgcn/src/hip_atomics.h:35:67: warning: invalid case style for parameter 'val' [readability-identifier-naming]
template <typename T> DEVICE T atomicCAS(T *address, T compare, T val) {
                                                                  ^~~
                                                                  Val
/mnt/disks/ssd0/agent/workspace/amd64_debian_testing_clang8/openmp/libomptarget/deviceRTLs/amdgcn/src/target_impl.h:16:2: error: "amdgcn target_impl.h expects to be compiled under __AMDGCN__" [clang-diagnostic-error]
#error "amdgcn target_impl.h expects to be compiled under __AMDGCN__"
 ^
/mnt/disks/ssd0/agent/workspace/amd64_debian_testing_clang8/openmp/libomptarget/deviceRTLs/amdgcn/src/target_impl.h:108:41: error: use of undeclared identifier '__builtin_amdgcn_s_barrier' [clang-diagnostic-error]
INLINE void __kmpc_impl_syncthreads() { __builtin_amdgcn_s_barrier(); }
                                        ^
/mnt/disks/ssd0/agent/workspace/amd64_debian_testing_clang8/openmp/libomptarget/deviceRTLs/amdgcn/src/target_impl.h:118:3: error: use of undeclared identifier '__builtin_amdgcn_s_barrier' [clang-diagnostic-error]
  __builtin_amdgcn_s_barrier();
  ^
/mnt/disks/ssd0/agent/workspace/amd64_debian_testing_clang8/openmp/libomptarget/deviceRTLs/amdgcn/src/target_impl.h:126:42: error: use of undeclared identifier '__builtin_amdgcn_workitem_id_x' [clang-diagnostic-error]
INLINE int GetThreadIdInBlock() { return __builtin_amdgcn_workitem_id_x(); }
                                         ^
/mnt/disks/ssd0/agent/workspace/amd64_debian_testing_clang8/openmp/libomptarget/deviceRTLs/amdgcn/src/target_impl.h:127:42: error: use of undeclared identifier '__builtin_amdgcn_workgroup_id_x' [clang-diagnostic-error]
INLINE int GetBlockIdInKernel() { return __builtin_amdgcn_workgroup_id_x(); }
                                         ^