From f1d56b7722399dce93a1fc337db8f9523754c92e Mon Sep 17 00:00:00 2001 From: Chen Weihang Date: Sun, 26 Dec 2021 20:35:02 -0600 Subject: [PATCH] remove npu related impl (#38428) --- cmake/pten_kernel.cmake | 22 +++++----------------- paddle/pten/backends/all_context.h | 1 - paddle/pten/backends/npu/npu_context.h | 26 -------------------------- paddle/pten/core/kernel_utils.h | 3 --- paddle/pten/kernels/CMakeLists.txt | 3 --- paddle/pten/kernels/npu/CMakeLists.txt | 0 6 files changed, 5 insertions(+), 50 deletions(-) delete mode 100644 paddle/pten/backends/npu/npu_context.h delete mode 100644 paddle/pten/kernels/npu/CMakeLists.txt diff --git a/cmake/pten_kernel.cmake b/cmake/pten_kernel.cmake index 23d8ca7dff..947defcea4 100644 --- a/cmake/pten_kernel.cmake +++ b/cmake/pten_kernel.cmake @@ -33,8 +33,6 @@ function(kernel_declare TARGET_LIST) file(APPEND ${kernel_declare_file} "PT_DECLARE_KERNEL(${kernel_name}, GPU, ALL_LAYOUT);\n") elseif (${kernel_path} MATCHES "./xpu\/") file(APPEND ${kernel_declare_file} "PT_DECLARE_KERNEL(${kernel_name}, XPU, ALL_LAYOUT);\n") - elseif (${kernel_path} MATCHES "./npu\/*") - file(APPEND ${kernel_declare_file} "PT_DECLARE_KERNEL(${kernel_name}, NPU, ALL_LAYOUT);\n") else () # deal with device independent kernel, now we use CPU temporaary file(APPEND ${kernel_declare_file} "PT_DECLARE_KERNEL(${kernel_name}, CPU, ALL_LAYOUT);\n") @@ -48,7 +46,6 @@ function(kernel_library TARGET) set(cpu_srcs) set(gpu_srcs) set(xpu_srcs) - set(npu_srcs) # parse and save the deps kerenl targets set(all_srcs) set(kernel_deps) @@ -77,11 +74,6 @@ function(kernel_library TARGET) list(APPEND xpu_srcs ${CMAKE_CURRENT_SOURCE_DIR}/xpu/${TARGET}.cc) endif() endif() - if (WITH_ASCEND_CL) - if (EXISTS ${CMAKE_CURRENT_SOURCE_DIR}/npu/${TARGET}.cc) - list(APPEND npu_srcs ${CMAKE_CURRENT_SOURCE_DIR}/npu/${TARGET}.cc) - endif() - endif() else() # TODO(chenweihang): impl compile by source later endif() @@ -107,7 +99,6 @@ function(kernel_library TARGET) list(LENGTH cpu_srcs cpu_srcs_len) list(LENGTH gpu_srcs gpu_srcs_len) list(LENGTH xpu_srcs xpu_srcs_len) - list(LENGTH npu_srcs npu_srcs_len) if (${common_srcs_len} GREATER 0) # If the kernel has a device independent public implementation, @@ -124,7 +115,7 @@ function(kernel_library TARGET) # If the kernel has a header file declaration, but no corresponding # implementation can be found, this is not allowed if (${cpu_srcs_len} EQUAL 0 AND ${gpu_srcs_len} EQUAL 0 AND - ${xpu_srcs_len} EQUAL 0 AND ${npu_srcs_len} EQUAL 0) + ${xpu_srcs_len} EQUAL 0) message(FATAL_ERROR "Cannot find any implementation for ${TARGET}") else() if (WITH_GPU) @@ -136,15 +127,15 @@ function(kernel_library TARGET) hip_library(${TARGET} SRCS ${cpu_srcs} ${gpu_srcs} DEPS ${kernel_library_DEPS} ${kernel_deps}) endif() else() - if (${cpu_srcs_len} GREATER 0 OR ${xpu_srcs_len} GREATER 0 OR ${npu_srcs_len} GREATER 0) - cc_library(${TARGET} SRCS ${cpu_srcs} ${xpu_srcs} ${npu_srcs} DEPS ${kernel_library_DEPS} ${kernel_deps}) + if (${cpu_srcs_len} GREATER 0 OR ${xpu_srcs_len} GREATER 0) + cc_library(${TARGET} SRCS ${cpu_srcs} ${xpu_srcs} DEPS ${kernel_library_DEPS} ${kernel_deps}) endif() endif() endif() endif() - if (${common_srcs_len} GREATER 0 OR ${cpu_srcs_len} GREATER 0 OR ${gpu_srcs_len} GREATER 0 OR - ${xpu_srcs_len} GREATER 0 OR ${npu_srcs_len} GREATER 0) + if (${common_srcs_len} GREATER 0 OR ${cpu_srcs_len} GREATER 0 OR + ${gpu_srcs_len} GREATER 0 OR ${xpu_srcs_len} GREATER 0) # append target into PTEN_KERNELS property get_property(pten_kernels GLOBAL PROPERTY PTEN_KERNELS) set(pten_kernels ${pten_kernels} ${TARGET}) @@ -166,9 +157,6 @@ function(kernel_library TARGET) if (${xpu_srcs_len} GREATER 0) kernel_declare(${xpu_srcs}) endif() - if (${npu_srcs_len} GREATER 0) - kernel_declare(${npu_srcs}) - endif() endfunction() function(register_kernels) diff --git a/paddle/pten/backends/all_context.h b/paddle/pten/backends/all_context.h index a7cb4abc2f..8cc07d216c 100644 --- a/paddle/pten/backends/all_context.h +++ b/paddle/pten/backends/all_context.h @@ -22,7 +22,6 @@ limitations under the License. */ #include "paddle/pten/backends/cpu/cpu_context.h" #include "paddle/pten/backends/gpu/gpu_context.h" -#include "paddle/pten/backends/npu/npu_context.h" #include "paddle/pten/backends/xpu/xpu_context.h" namespace pten { diff --git a/paddle/pten/backends/npu/npu_context.h b/paddle/pten/backends/npu/npu_context.h deleted file mode 100644 index bb17a1bea6..0000000000 --- a/paddle/pten/backends/npu/npu_context.h +++ /dev/null @@ -1,26 +0,0 @@ -/* Copyright (c) 2021 PaddlePaddle Authors. All Rights Reserved. - -Licensed under the Apache License, Version 2.0 (the "License"); -you may not use this file except in compliance with the License. -You may obtain a copy of the License at - - http://www.apache.org/licenses/LICENSE-2.0 - -Unless required by applicable law or agreed to in writing, software -distributed under the License is distributed on an "AS IS" BASIS, -WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -See the License for the specific language governing permissions and -limitations under the License. */ - -#pragma once - -#ifdef PADDLE_WITH_ASCEND_CL - -// See Note [ Why still include the fluid headers? ] -#include "paddle/fluid/platform/device_context.h" - -namespace pten { -using NPUContext = paddle::platform::NPUDeviceContext; -} // namespace pten - -#endif // PADDLE_WITH_ASCEND_CL diff --git a/paddle/pten/core/kernel_utils.h b/paddle/pten/core/kernel_utils.h index 7a7ae28330..5087d912ed 100644 --- a/paddle/pten/core/kernel_utils.h +++ b/paddle/pten/core/kernel_utils.h @@ -183,9 +183,6 @@ struct KernelImpl { #if defined(PADDLE_WITH_CUDA) || defined(PADDLE_WITH_HIP) PT_SPECIALIZE_KernelCallHelper_FOR_DEVICE_CONTEXT(GPUContext); #endif -#ifdef PADDLE_WITH_ASCEND_CL - PT_SPECIALIZE_KernelCallHelper_FOR_DEVICE_CONTEXT(NPUContext); -#endif #ifdef PADDLE_WITH_XPU PT_SPECIALIZE_KernelCallHelper_FOR_DEVICE_CONTEXT(XPUContext); #endif diff --git a/paddle/pten/kernels/CMakeLists.txt b/paddle/pten/kernels/CMakeLists.txt index 27d274a5b3..4d72d00a40 100644 --- a/paddle/pten/kernels/CMakeLists.txt +++ b/paddle/pten/kernels/CMakeLists.txt @@ -17,9 +17,6 @@ if(WITH_MKLDNN) # mkldnn will be deprecated and use the new name dnnl add_subdirectory(dnnl) endif() -if(WITH_ASCEND_CL) - add_subdirectory(npu) -endif() if(WITH_XPU) add_subdirectory(xpu) endif() diff --git a/paddle/pten/kernels/npu/CMakeLists.txt b/paddle/pten/kernels/npu/CMakeLists.txt deleted file mode 100644 index e69de29bb2..0000000000 -- GitLab