Convert diag pragmas to nv_diag.

This commit is contained in:
Nathan Luehr 2021-08-26 11:34:31 -05:00 committed by Antonio Sánchez
parent 532cc73f39
commit da79095923
2 changed files with 45 additions and 28 deletions

View File

@ -75,38 +75,47 @@
#endif
#if defined __NVCC__
#pragma diag_suppress boolean_controlling_expr_is_constant
#define EIGEN_MAKE_PRAGMA(X) _Pragma(#X)
#if defined __NVCC_DIAG_PRAGMA_SUPPORT__
#define EIGEN_NV_DIAG_SUPPRESS(X) EIGEN_MAKE_PRAGMA(nv_diag_suppress X)
#else
#define EIGEN_NV_DIAG_SUPPRESS(X) EIGEN_MAKE_PRAGMA(diag_suppress X)
#endif
EIGEN_NV_DIAG_SUPPRESS(boolean_controlling_expr_is_constant)
// Disable the "statement is unreachable" message
#pragma diag_suppress code_is_unreachable
EIGEN_NV_DIAG_SUPPRESS(code_is_unreachable)
// Disable the "dynamic initialization in unreachable code" message
#pragma diag_suppress initialization_not_reachable
EIGEN_NV_DIAG_SUPPRESS(initialization_not_reachable)
// Disable the "invalid error number" message that we get with older versions of nvcc
#pragma diag_suppress 1222
EIGEN_NV_DIAG_SUPPRESS(1222)
// Disable the "calling a __host__ function from a __host__ __device__ function is not allowed" messages (yes, there are many of them and they seem to change with every version of the compiler)
#pragma diag_suppress 2527
#pragma diag_suppress 2529
#pragma diag_suppress 2651
#pragma diag_suppress 2653
#pragma diag_suppress 2668
#pragma diag_suppress 2669
#pragma diag_suppress 2670
#pragma diag_suppress 2671
#pragma diag_suppress 2735
#pragma diag_suppress 2737
#pragma diag_suppress 2739
#pragma diag_suppress 2885
#pragma diag_suppress 2888
#pragma diag_suppress 2976
#pragma diag_suppress 2979
#pragma diag_suppress 20011
#pragma diag_suppress 20014
EIGEN_NV_DIAG_SUPPRESS(2527)
EIGEN_NV_DIAG_SUPPRESS(2529)
EIGEN_NV_DIAG_SUPPRESS(2651)
EIGEN_NV_DIAG_SUPPRESS(2653)
EIGEN_NV_DIAG_SUPPRESS(2668)
EIGEN_NV_DIAG_SUPPRESS(2669)
EIGEN_NV_DIAG_SUPPRESS(2670)
EIGEN_NV_DIAG_SUPPRESS(2671)
EIGEN_NV_DIAG_SUPPRESS(2735)
EIGEN_NV_DIAG_SUPPRESS(2737)
EIGEN_NV_DIAG_SUPPRESS(2739)
EIGEN_NV_DIAG_SUPPRESS(2885)
EIGEN_NV_DIAG_SUPPRESS(2888)
EIGEN_NV_DIAG_SUPPRESS(2976)
EIGEN_NV_DIAG_SUPPRESS(2979)
EIGEN_NV_DIAG_SUPPRESS(20011)
EIGEN_NV_DIAG_SUPPRESS(20014)
// Disable the "// __device__ annotation is ignored on a function(...) that is
// explicitly defaulted on its first declaration" message.
// The __device__ annotation seems to actually be needed in some cases,
// otherwise resulting in kernel runtime errors.
#pragma diag_suppress 2886
#pragma diag_suppress 2977
#pragma diag_suppress 20012
EIGEN_NV_DIAG_SUPPRESS(2886)
EIGEN_NV_DIAG_SUPPRESS(2977)
EIGEN_NV_DIAG_SUPPRESS(20012)
#undef EIGEN_NV_DIAG_SUPPRESS
#undef EIGEN_MAKE_PRAGMA
#endif
#else

View File

@ -20,10 +20,18 @@
// Don't re-enable the diagnostic messages, as it turns out these messages need
// to be disabled at the point of the template instantiation (i.e the user code)
// otherwise they'll be triggered by nvcc.
// #pragma diag_default code_is_unreachable
// #pragma diag_default initialization_not_reachable
// #pragma diag_default 2651
// #pragma diag_default 2653
// #define EIGEN_MAKE_PRAGMA(X) _Pragma(#X)
// #if __NVCC_DIAG_PRAGMA_SUPPORT__
// #define EIGEN_NV_DIAG_DEFAULT(X) EIGEN_MAKE_PRAGMA(nv_diag_default X)
// #else
// #define EIGEN_NV_DIAG_DEFAULT(X) EIGEN_MAKE_PRAGMA(diag_default X)
// #endif
// EIGEN_NV_DIAG_DEFAULT(code_is_unreachable)
// EIGEN_NV_DIAG_DEFAULT(initialization_not_reachable)
// EIGEN_NV_DIAG_DEFAULT(2651)
// EIGEN_NV_DIAG_DEFAULT(2653)
// #undef EIGEN_NV_DIAG_DEFAULT
// #undef EIGEN_MAKE_PRAGMA
#endif
#endif