From b0a2f005398fd92fe83ef0a7d83c2c29054379fc Mon Sep 17 00:00:00 2001 From: Leo Chen Date: Thu, 22 Jul 2021 13:21:59 +0800 Subject: [PATCH] enable amp unsupported_fp16_list for npu (#34314) --- paddle/fluid/pybind/pybind.cc | 2 +- python/paddle/fluid/contrib/mixed_precision/fp16_lists.py | 3 +++ 2 files changed, 4 insertions(+), 1 deletion(-) diff --git a/paddle/fluid/pybind/pybind.cc b/paddle/fluid/pybind/pybind.cc index 4286b9092c2..d646e06d8a4 100644 --- a/paddle/fluid/pybind/pybind.cc +++ b/paddle/fluid/pybind/pybind.cc @@ -78,7 +78,6 @@ limitations under the License. */ #include "paddle/fluid/pybind/box_helper_py.h" #include "paddle/fluid/pybind/compatible.h" #include "paddle/fluid/pybind/const_value.h" -#include "paddle/fluid/pybind/cuda_streams_py.h" #include "paddle/fluid/pybind/data_set_py.h" #include "paddle/fluid/pybind/exception.h" #include "paddle/fluid/pybind/fleet_wrapper_py.h" @@ -240,6 +239,7 @@ OpSupportedInfos(const std::string &place, {"GPU", &platform::is_gpu_place}, {"CPU", &platform::is_cpu_place}, {"XPU", &platform::is_xpu_place}, + {"NPU", &platform::is_npu_place}, }; PADDLE_ENFORCE_NE( is_target_place.count(query_place), 0, diff --git a/python/paddle/fluid/contrib/mixed_precision/fp16_lists.py b/python/paddle/fluid/contrib/mixed_precision/fp16_lists.py index efa9caaee88..37fe1e505f0 100644 --- a/python/paddle/fluid/contrib/mixed_precision/fp16_lists.py +++ b/python/paddle/fluid/contrib/mixed_precision/fp16_lists.py @@ -158,6 +158,9 @@ _sys_unsupported_fp16_list = [] if core.is_compiled_with_xpu(): _, _, _sys_unsupported_fp16_list = core.op_supported_infos( 'XPU', core.VarDesc.VarType.FP16) +elif core.is_compiled_with_npu(): + _, _, _sys_unsupported_fp16_list = core.op_supported_infos( + 'NPU', core.VarDesc.VarType.FP16) else: _, _, _sys_unsupported_fp16_list = core.op_supported_infos( 'GPU', core.VarDesc.VarType.FP16) -- GitLab