From 42ca5d615fc47446d63e1e51c31db176794968d9 Mon Sep 17 00:00:00 2001 From: limingshu <61349199+JamesLim-sy@users.noreply.github.com> Date: Thu, 11 May 2023 16:16:18 +0800 Subject: [PATCH] [cherry-pick]fix windows static_assert error (#53694) Fix static_assert bug in Windows CUDA 11.6 compilation. This may be the bug of msvc. --- paddle/phi/kernels/funcs/fused_gemm_epilogue.h | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/paddle/phi/kernels/funcs/fused_gemm_epilogue.h b/paddle/phi/kernels/funcs/fused_gemm_epilogue.h index 4f1a1c6f0bd..9b827b574f5 100644 --- a/paddle/phi/kernels/funcs/fused_gemm_epilogue.h +++ b/paddle/phi/kernels/funcs/fused_gemm_epilogue.h @@ -535,8 +535,10 @@ void ComputeFusedGemmEpilogueBackwardImpl(const phi::GPUContext& dev_ctx, bool use_addto_dx, bool use_addto_dy) { using MT = typename phi::dtype::MPTypeTrait::Type; - static_assert(std::is_same::value || std::is_same::value); - static_assert(std::is_same::value || std::is_same::value); + constexpr bool kIsValidDataType = + (std::is_same::value || std::is_same::value) && + (std::is_same::value || std::is_same::value); + static_assert(kIsValidDataType, "Invalid data type"); using Trait = FusedGEMMGradTrait; if (dx) { -- GitLab