From af0eaf7a30efe1b3c4bee0a880dafd5351b709ba Mon Sep 17 00:00:00 2001 From: Peter Heywood Date: Thu, 15 Feb 2024 15:42:33 +0000 Subject: [PATCH 1/3] failed attempt to suppress aarch c++17 gcc10.1 note with pragma ignored --- examples/cpp/diffusion/src/main.cu | 7 +++++++ include/flamegpu/runtime/agent/HostAgentAPI.cuh | 16 ++++++++++++++++ 2 files changed, 23 insertions(+) diff --git a/examples/cpp/diffusion/src/main.cu b/examples/cpp/diffusion/src/main.cu index 089a00212..807540666 100644 --- a/examples/cpp/diffusion/src/main.cu +++ b/examples/cpp/diffusion/src/main.cu @@ -35,12 +35,19 @@ FLAMEGPU_AGENT_FUNCTION(update, flamegpu::MessageArray2D, flamegpu::MessageNone) FLAMEGPU->setVariable("value", new_value); return flamegpu::ALIVE; } +#if defined(__GNUC__) && (( __GNUC__ == 10 && defined(__GNUC_MINOR__) && __GNUC_MINOR__ >= 1) || __GNUC__ > 10) + #pragma GCC diagnostic push + #pragma GCC diagnostic ignored "-Wpsabi" +#endif FLAMEGPU_EXIT_CONDITION(stable_temperature) { // Exit when standard deviation of temperature across agents goes below 0.006 // (At this point it looks kind of uniform to the eye) const double sd = FLAMEGPU->agent("cell").meanStandardDeviation("value").second; return sd < 0.006 ? flamegpu::EXIT : flamegpu::CONTINUE; } +#if defined(__GNUC__) && (( __GNUC__ == 10 && defined(__GNUC_MINOR__) && __GNUC_MINOR__ >= 1) || __GNUC__ > 10) + #pragma GCC diagnostic pop +#endif int main(int argc, const char ** argv) { const unsigned int SQRT_AGENT_COUNT = 200; const unsigned int AGENT_COUNT = SQRT_AGENT_COUNT * SQRT_AGENT_COUNT; diff --git a/include/flamegpu/runtime/agent/HostAgentAPI.cuh b/include/flamegpu/runtime/agent/HostAgentAPI.cuh index e31231579..cbe36b923 100644 --- a/include/flamegpu/runtime/agent/HostAgentAPI.cuh +++ b/include/flamegpu/runtime/agent/HostAgentAPI.cuh @@ -192,6 +192,11 @@ class HostAgentAPI { * @throws exception::InvalidVarType If the passed variable type does not match that specified in the model description hierarchy * @note If you only require the mean, it is more efficient to use sum()/count() */ + // Suppress GCC >= 10.1 diagnostic due to ABI change in C++17 mode on aarch64 for parameter passing of std::pair +#if defined(__GNUC__) && (( __GNUC__ == 10 && defined(__GNUC_MINOR__) && __GNUC_MINOR__ >= 1) || __GNUC__ > 10) + #pragma GCC diagnostic push + #pragma GCC diagnostic ignored "-Wpsabi" +#endif template std::pair meanStandardDeviation(const std::string& variable) const; /** @@ -202,6 +207,9 @@ class HostAgentAPI { * @throws exception::InvalidAgentVar If the agent does not contain a variable of the same name * @throws exception::InvalidVarType If the passed variable type does not match that specified in the model description hierarchy */ +#if defined(__GNUC__) && (( __GNUC__ == 10 && defined(__GNUC_MINOR__) && __GNUC_MINOR__ >= 1) || __GNUC__ > 10) + #pragma GCC diagnostic pop +#endif template InT min(const std::string &variable) const; /** @@ -557,6 +565,11 @@ void HostAgentAPI::sum_async(const std::string &variable, OutT &result, const cu gpuErrchkLaunch(); gpuErrchk(cudaMemcpyAsync(&result, api.d_output_space, sizeof(OutT), cudaMemcpyDeviceToHost, stream)); } +// Suppress GCC >= 10.1 diagnostic due to ABI change in C++17 mode on aarch64 for parameter passing of std::pair +#if defined(__GNUC__) && (( __GNUC__ == 10 && defined(__GNUC_MINOR__) && __GNUC_MINOR__ >= 1) || __GNUC__ > 10) + #pragma GCC diagnostic push + #pragma GCC diagnostic ignored "-Wpsabi" +#endif template std::pair HostAgentAPI::meanStandardDeviation(const std::string& variable) const { std::pair rtn; @@ -564,6 +577,9 @@ std::pair HostAgentAPI::meanStandardDeviation(const std::string& gpuErrchk(cudaStreamSynchronize(this->api.stream)); // Redundant, meanStandardDeviation_async() is not truly async return rtn; } +#if defined(__GNUC__) && (( __GNUC__ == 10 && defined(__GNUC_MINOR__) && __GNUC_MINOR__ >= 1) || __GNUC__ > 10) + #pragma GCC diagnostic pop +#endif template void HostAgentAPI::meanStandardDeviation_async(const std::string& variable, std::pair &result, const cudaStream_t stream, const unsigned int streamId) const { std::shared_ptr population = agent.getPopulationVec(stateName); From 580084c3be5809d493c632a1fc4375a7ab5c483f Mon Sep 17 00:00:00 2001 From: Peter Heywood Date: Thu, 15 Feb 2024 17:01:59 +0000 Subject: [PATCH 2/3] Revert "failed attempt to suppress aarch c++16 gcc10.1 note with pragma ignored" This reverts commit af0eaf7a30efe1b3c4bee0a880dafd5351b709ba. --- examples/cpp/diffusion/src/main.cu | 7 ------- include/flamegpu/runtime/agent/HostAgentAPI.cuh | 16 ---------------- 2 files changed, 23 deletions(-) diff --git a/examples/cpp/diffusion/src/main.cu b/examples/cpp/diffusion/src/main.cu index 807540666..089a00212 100644 --- a/examples/cpp/diffusion/src/main.cu +++ b/examples/cpp/diffusion/src/main.cu @@ -35,19 +35,12 @@ FLAMEGPU_AGENT_FUNCTION(update, flamegpu::MessageArray2D, flamegpu::MessageNone) FLAMEGPU->setVariable("value", new_value); return flamegpu::ALIVE; } -#if defined(__GNUC__) && (( __GNUC__ == 10 && defined(__GNUC_MINOR__) && __GNUC_MINOR__ >= 1) || __GNUC__ > 10) - #pragma GCC diagnostic push - #pragma GCC diagnostic ignored "-Wpsabi" -#endif FLAMEGPU_EXIT_CONDITION(stable_temperature) { // Exit when standard deviation of temperature across agents goes below 0.006 // (At this point it looks kind of uniform to the eye) const double sd = FLAMEGPU->agent("cell").meanStandardDeviation("value").second; return sd < 0.006 ? flamegpu::EXIT : flamegpu::CONTINUE; } -#if defined(__GNUC__) && (( __GNUC__ == 10 && defined(__GNUC_MINOR__) && __GNUC_MINOR__ >= 1) || __GNUC__ > 10) - #pragma GCC diagnostic pop -#endif int main(int argc, const char ** argv) { const unsigned int SQRT_AGENT_COUNT = 200; const unsigned int AGENT_COUNT = SQRT_AGENT_COUNT * SQRT_AGENT_COUNT; diff --git a/include/flamegpu/runtime/agent/HostAgentAPI.cuh b/include/flamegpu/runtime/agent/HostAgentAPI.cuh index cbe36b923..e31231579 100644 --- a/include/flamegpu/runtime/agent/HostAgentAPI.cuh +++ b/include/flamegpu/runtime/agent/HostAgentAPI.cuh @@ -192,11 +192,6 @@ class HostAgentAPI { * @throws exception::InvalidVarType If the passed variable type does not match that specified in the model description hierarchy * @note If you only require the mean, it is more efficient to use sum()/count() */ - // Suppress GCC >= 10.1 diagnostic due to ABI change in C++17 mode on aarch64 for parameter passing of std::pair -#if defined(__GNUC__) && (( __GNUC__ == 10 && defined(__GNUC_MINOR__) && __GNUC_MINOR__ >= 1) || __GNUC__ > 10) - #pragma GCC diagnostic push - #pragma GCC diagnostic ignored "-Wpsabi" -#endif template std::pair meanStandardDeviation(const std::string& variable) const; /** @@ -207,9 +202,6 @@ class HostAgentAPI { * @throws exception::InvalidAgentVar If the agent does not contain a variable of the same name * @throws exception::InvalidVarType If the passed variable type does not match that specified in the model description hierarchy */ -#if defined(__GNUC__) && (( __GNUC__ == 10 && defined(__GNUC_MINOR__) && __GNUC_MINOR__ >= 1) || __GNUC__ > 10) - #pragma GCC diagnostic pop -#endif template InT min(const std::string &variable) const; /** @@ -565,11 +557,6 @@ void HostAgentAPI::sum_async(const std::string &variable, OutT &result, const cu gpuErrchkLaunch(); gpuErrchk(cudaMemcpyAsync(&result, api.d_output_space, sizeof(OutT), cudaMemcpyDeviceToHost, stream)); } -// Suppress GCC >= 10.1 diagnostic due to ABI change in C++17 mode on aarch64 for parameter passing of std::pair -#if defined(__GNUC__) && (( __GNUC__ == 10 && defined(__GNUC_MINOR__) && __GNUC_MINOR__ >= 1) || __GNUC__ > 10) - #pragma GCC diagnostic push - #pragma GCC diagnostic ignored "-Wpsabi" -#endif template std::pair HostAgentAPI::meanStandardDeviation(const std::string& variable) const { std::pair rtn; @@ -577,9 +564,6 @@ std::pair HostAgentAPI::meanStandardDeviation(const std::string& gpuErrchk(cudaStreamSynchronize(this->api.stream)); // Redundant, meanStandardDeviation_async() is not truly async return rtn; } -#if defined(__GNUC__) && (( __GNUC__ == 10 && defined(__GNUC_MINOR__) && __GNUC_MINOR__ >= 1) || __GNUC__ > 10) - #pragma GCC diagnostic pop -#endif template void HostAgentAPI::meanStandardDeviation_async(const std::string& variable, std::pair &result, const cudaStream_t stream, const unsigned int streamId) const { std::shared_ptr population = agent.getPopulationVec(stateName); From ee9ffe71920dd632dbd6448a6f0070565aea92fa Mon Sep 17 00:00:00 2001 From: Peter Heywood Date: Thu, 15 Feb 2024 16:59:20 +0000 Subject: [PATCH 3/3] Suppress psABI warnings in GCC >= 10.1 on aarch64 Unfortunatley supressing this via pragmas around the effected code was unsuccessful --- cmake/warnings.cmake | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) diff --git a/cmake/warnings.cmake b/cmake/warnings.cmake index cddae999f..32b193381 100644 --- a/cmake/warnings.cmake +++ b/cmake/warnings.cmake @@ -115,8 +115,13 @@ if(NOT COMMAND flamegpu_suppress_some_compiler_warnings) if(CMAKE_CUDA_COMPILER_VERSION VERSION_GREATER_EQUAL 11.6.0) target_compile_definitions(${SSCW_TARGET} PRIVATE "__CDPRT_SUPPRESS_SYNC_DEPRECATION_WARNING") endif() - else() - # Linux specific warning suppressions + elseif(CMAKE_CXX_COMPILER_ID STREQUAL "GNU") + # GCC specific warning suppressions + # GCC 10.1 AARCH specific ps ABI warnings in C++17 mode. See https://github.com/FLAMEGPU/FLAMEGPU2/issues/1176 + if(CMAKE_SYSTEM_PROCESSOR STREQUAL "aarch64" AND CMAKE_CUDA_COMPILER_VERSION VERSION_GREATER_EQUAL 10.1.0) + target_compile_options(${SSCW_TARGET} PRIVATE "$<$:SHELL:-Xcompiler -Wno-psabi>") + target_compile_options(${SSCW_TARGET} PRIVATE "$<$:-Wno-psabi>") + endif() endif() # Generic OS/host compiler warning suppressions # Ensure NVCC outputs warning numbers