From 204d35d16ef5c2c1ea1a4bb25442908a306c857a Mon Sep 17 00:00:00 2001 From: Satyanvesh Dittakavi Date: Thu, 7 Dec 2023 14:40:00 +0000 Subject: [PATCH] SWDEV-434170 /SWDEV-432684 /SWDEV-433437 - Fix test_gpu_jit MIGraphx 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 912cc407a4e0d8363ff8c7230bb00d9aea8f44da) --- hipamd/src/hiprtc/cmake/HIPRTC.cmake | 22 +++++++++++----------- 1 file changed, 11 insertions(+), 11 deletions(-) diff --git a/hipamd/src/hiprtc/cmake/HIPRTC.cmake b/hipamd/src/hiprtc/cmake/HIPRTC.cmake index ef9e559d1..02bd604e4 100644 --- a/hipamd/src/hiprtc/cmake/HIPRTC.cmake +++ b/hipamd/src/hiprtc/cmake/HIPRTC.cmake @@ -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\ @@ -70,8 +65,7 @@ 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) @@ -79,21 +73,27 @@ endfunction(get_hiprtc_macros) 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)