Skip to content

Commit

Permalink
SWDEV-434170 /SWDEV-432684 /SWDEV-433437 - Fix test_gpu_jit MIGraphx …
Browse files Browse the repository at this point in the history
…test failure

Add clang pragma push and pop diagnostics for ignoring "-Weverything"
in the hiprtc builtins header. Otherwise this will ignore even the
geniune errors occurring in the hiprtc kernels.

Change-Id: I8c3dacf902732b2ea495d83e797369f8aebd75d6
(cherry picked from commit 912cc40)
  • Loading branch information
satyanveshd authored and gargrahul committed Jan 5, 2024
1 parent a75072c commit 204d35d
Showing 1 changed file with 11 additions and 11 deletions.
22 changes: 11 additions & 11 deletions hipamd/src/hiprtc/cmake/HIPRTC.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -27,12 +27,7 @@

function(get_hiprtc_macros HIPRTC_DEFINES)
set(${HIPRTC_DEFINES}
"#pragma clang diagnostic push\n\
#pragma clang diagnostic ignored \"-Wreserved-id-macro\"\n\
#pragma clang diagnostic ignored \"-Wc++98-compat-pedantic\"\n\
#pragma clang diagnostic ignored \"-Wreserved-macro-identifier\"\n\
#pragma clang diagnostic ignored \"-Wundef\"\n\
#define __device__ __attribute__((device))\n\
"#define __device__ __attribute__((device))\n\
#define __host__ __attribute__((host))\n\
#define __global__ __attribute__((global))\n\
#define __constant__ __attribute__((constant))\n\
Expand Down Expand Up @@ -70,30 +65,35 @@ namespace std {\n\
using ::ptrdiff_t;\n\
using ::clock_t;\n\
}\n\
#endif // __HIP_NO_STD_DEFS__\n\
#pragma clang diagnostic pop"
#endif // __HIP_NO_STD_DEFS__\n"
PARENT_SCOPE)
endfunction(get_hiprtc_macros)

# To allow concatenating above macros during build time, call this file in script mode.
if(HIPRTC_ADD_MACROS)
# Read the existing content of the preprocessed file into a temporary variable
FILE(READ "${HIPRTC_PREPROCESSED_FILE}" ORIGINAL_PREPROCESSED_FILE)
# Prepend the pragma to the original content
set(MODIFIED_PREPROCESSED_FILE "#pragma clang diagnostic ignored \"-Weverything\"
# Prepend the push and ignore pragmas to the original preprocessed file
set(PRAGMA_PUSH "#pragma clang diagnostic push")
set(PRAGMA_EVERYTHING "#pragma clang diagnostic ignored \"-Weverything\"")
set(MODIFIED_PREPROCESSED_FILE "${PRAGMA_PUSH}\n${PRAGMA_EVERYTHING}
\n${ORIGINAL_PREPROCESSED_FILE}")
# Write the modified preprocessed content back to the original file
FILE(WRITE ${HIPRTC_PREPROCESSED_FILE} "${MODIFIED_PREPROCESSED_FILE}")

message(STATUS "Appending hiprtc macros to ${HIPRTC_PREPROCESSED_FILE}.")
get_hiprtc_macros(HIPRTC_DEFINES)
FILE(APPEND ${HIPRTC_PREPROCESSED_FILE} "${HIPRTC_DEFINES}")
set(HIPRTC_HEADER_LIST ${HIPRTC_HEADERS})
separate_arguments(HIPRTC_HEADER_LIST)
# appends all the headers from the list to the hiprtc preprocessed file
# Appends all the headers from the list to the hiprtc preprocessed file
foreach(header ${HIPRTC_HEADER_LIST})
FILE(READ "${header}" HEADER_FILE)
FILE(APPEND ${HIPRTC_PREPROCESSED_FILE} "${HEADER_FILE}")
endforeach()
# Append the pop pragma to the preprocessed file
set(PRAGMA_POP "#pragma clang diagnostic pop\n")
FILE(APPEND ${HIPRTC_PREPROCESSED_FILE} "${PRAGMA_POP}")
endif()

macro(generate_hiprtc_header HiprtcHeader)
Expand Down

0 comments on commit 204d35d

Please sign in to comment.