diff --git a/paddle/phi/kernels/kps/elementwise_add_kernel.cu b/paddle/phi/kernels/kps/elementwise_add_kernel.cu index 31d1e4e32cf54be2b4e469cab35ada7890e763e6..b3fe46a1cd310075fcb422285e08604e56539bd9 100644 --- a/paddle/phi/kernels/kps/elementwise_add_kernel.cu +++ b/paddle/phi/kernels/kps/elementwise_add_kernel.cu @@ -72,14 +72,18 @@ void AddKernel(const Context& dev_ctx, const DenseTensor& x, const DenseTensor& y, DenseTensor* out) { +#ifdef PADDLE_WITH_CUDA if (x.dtype() == phi::DataType::FLOAT32 && (y.dtype() == phi::DataType::BFLOAT16 || y.dtype() == phi::DataType::FLOAT16)) { using Type = DataTypeToCppType::type; Float32Bfloat16OrFloat16AddCudaFunctor(dev_ctx, x, y, out); } else { +#endif AddCudaFunctor(dev_ctx, x, y, -1, out); +#ifdef PADDLE_WITH_CUDA } +#endif } template