From 6626c6a6ada197fd8393287d203677414e163486 Mon Sep 17 00:00:00 2001 From: Qi Li Date: Wed, 3 Mar 2021 14:59:51 +0800 Subject: [PATCH] fix bert cu file compiler error, test=develop (#31389) --- paddle/fluid/operators/math/bert_encoder_functor.cu | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/paddle/fluid/operators/math/bert_encoder_functor.cu b/paddle/fluid/operators/math/bert_encoder_functor.cu index bd7f71cd131..512f9c62415 100644 --- a/paddle/fluid/operators/math/bert_encoder_functor.cu +++ b/paddle/fluid/operators/math/bert_encoder_functor.cu @@ -289,7 +289,7 @@ __global__ void SoftmaxKernelWithEltadd2( const int head_num, const int seq_len, const unsigned mask) { // operator "+" of half only suppotted after cuda version 10.0 // HIP defined __HIP_NO_HALF_CONVERSIONS__ in hip.cmake -#if defined(PADDLE_WITH_CUDA) || \ +#if defined(PADDLE_WITH_CUDA) && \ (CUDA_ARCH_FP16_SUPPORTED(__CUDA_ARCH__) && CUDA_VERSION >= 10000) int qk_offset = blockIdx.x * seq_len; int idx = threadIdx.x; @@ -407,7 +407,7 @@ template class MultiHeadGPUComputeFunctor; // device function 'operator()' is not supportted until cuda 10.0 // HIP defined __HIP_NO_HALF_CONVERSIONS__ in hip.cmake -#if defined(PADDLE_WITH_CUDA) || CUDA_VERSION >= 10000 +#if defined(PADDLE_WITH_CUDA) && CUDA_VERSION >= 10000 template class MultiHeadGPUComputeFunctor; #endif @@ -646,7 +646,7 @@ template class SkipLayerNormFunctor; // device function 'operator()' is not supportted until cuda 10.0 // HIP defined __HIP_NO_HALF_CONVERSIONS__ in hip.cmake -#if defined(PADDLE_WITH_CUDA) || CUDA_VERSION >= 10000 +#if defined(PADDLE_WITH_CUDA) && CUDA_VERSION >= 10000 template class SkipLayerNormFunctor; #endif -- GitLab