Skip to content

Commit 6f70116

Browse files
authored
clean custom_device_common_op_registry (#72338)
1 parent 181e2e3 commit 6f70116

8 files changed

+1
-1402
lines changed

paddle/fluid/eager/auto_code_generator/CMakeLists.txt

Lines changed: 0 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -16,11 +16,6 @@ if(WITH_CINN)
1616
list(REMOVE_ITEM EAGER_GENERATOR_DEPS imperative_flag)
1717
endif()
1818

19-
if(WITH_CUSTOM_DEVICE)
20-
set(EAGER_GENERATOR_DEPS ${EAGER_GENERATOR_DEPS}
21-
custom_device_common_op_registry)
22-
endif()
23-
2419
get_property(os_dependency_modules GLOBAL PROPERTY OS_DEPENDENCY_MODULES)
2520

2621
# Prepare file structure

paddle/fluid/operators/CMakeLists.txt

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -139,10 +139,6 @@ endif()
139139

140140
copy_if_different(${pybind_file} ${pybind_file_final})
141141

142-
if (WITH_CUSTOM_DEVICE)
143-
cc_library(custom_device_common_op_registry SRCS custom_device_common_op_registry.cc DEPS operator phi common type_info)
144-
endif()
145-
146142
if(NOT "${OP_LIST}" STREQUAL "")
147143
prune_pybind_h()
148144
endif()

paddle/fluid/operators/custom_device_common_op_registry.cc

Lines changed: 0 additions & 1327 deletions
This file was deleted.

paddle/fluid/operators/custom_device_common_op_registry.h

Lines changed: 0 additions & 29 deletions
This file was deleted.

paddle/fluid/pybind/CMakeLists.txt

Lines changed: 0 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -171,10 +171,6 @@ else()
171171
set(PYBIND_DEPS ${PYBIND_DEPS} pir)
172172
endif()
173173

174-
if(WITH_CUSTOM_DEVICE)
175-
set(PYBIND_DEPS ${PYBIND_DEPS} custom_device_common_op_registry)
176-
endif()
177-
178174
if(WITH_PYTHON)
179175
set(PYBIND_DEPS ${PYBIND_DEPS} process_group eager_reducer)
180176
if(WITH_NCCL OR WITH_RCCL)
@@ -299,11 +295,6 @@ if(WITH_PYTHON)
299295
list(APPEND OP_FUNCTION_GENERATOR_DEPS ${PYTHON_LIBRARIES})
300296
endif()
301297

302-
if(WITH_CUSTOM_DEVICE)
303-
set(OP_FUNCTION_GENERATOR_DEPS ${OP_FUNCTION_GENERATOR_DEPS}
304-
custom_device_common_op_registry)
305-
endif()
306-
307298
set(GENERATOR_DEPS ${PYBIND_DEPS})
308299
list(REMOVE_DUPLICATES GENERATOR_DEPS)
309300
if(WIN32)
@@ -341,11 +332,6 @@ if(WITH_PYTHON)
341332
list(REMOVE_ITEM EAGER_GENERATOR_DEPS imperative_flag)
342333
endif()
343334

344-
if(WITH_CUSTOM_DEVICE)
345-
set(EAGER_GENERATOR_DEPS ${EAGER_GENERATOR_DEPS}
346-
custom_device_common_op_registry)
347-
endif()
348-
349335
add_executable(
350336
eager_generator generator.cc eager_legacy_op_function_generator.cc
351337
eager_generator.cc)

paddle/fluid/pybind/eager_generator.cc

Lines changed: 0 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,6 @@
2323
#include "paddle/fluid/framework/operator.h"
2424
#include "paddle/fluid/framework/program_desc.h"
2525
#include "paddle/fluid/framework/variable.h"
26-
#include "paddle/fluid/operators/custom_device_common_op_registry.h"
2726
#include "paddle/fluid/pybind/eager_generator.h"
2827
#include "paddle/fluid/pybind/pybind.h"
2928
#include "paddle/utils/string/string_helper.h"
@@ -3786,12 +3785,6 @@ std::set<std::string> special_no_need_buffer_op_set = {
37863785
};
37873786

37883787
int run_generator(int argc, char* argv[]) {
3789-
#ifdef PADDLE_WITH_CUSTOM_DEVICE
3790-
// We need a fake device to trigger the registration of the common kernel and
3791-
// generate api
3792-
paddle::operators::RegisterCustomDeviceCommonKernel("fake_device");
3793-
#endif
3794-
37953788
std::string eager_root = argv[1];
37963789
int split_count = atoi(argv[2]);
37973790

paddle/fluid/pybind/eager_legacy_op_function_generator.cc

Lines changed: 0 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -26,7 +26,6 @@
2626
#include "paddle/fluid/framework/op_registry.h"
2727
#include "paddle/fluid/framework/operator.h"
2828
#include "paddle/fluid/framework/variable.h"
29-
#include "paddle/fluid/operators/custom_device_common_op_registry.h"
3029
#include "paddle/fluid/pybind/eager_generator.h"
3130
#include "paddle/fluid/pybind/eager_legacy_op_function_generator.h"
3231
#include "paddle/fluid/pybind/pybind.h"
@@ -474,12 +473,6 @@ GenerateOpFunctions() {
474473
}
475474

476475
int run_legacy_generator(int argc, char* argv[]) {
477-
#ifdef PADDLE_WITH_CUSTOM_DEVICE
478-
// We need a fake device to trigger the registration of the common kernel and
479-
// generate api
480-
paddle::operators::RegisterCustomDeviceCommonKernel("fake_device");
481-
#endif
482-
483476
const std::string str = "\"paddle/fluid/eager/api/generated/fluid_generated/";
484477
std::vector<std::string> headers{
485478
"<Python.h>",

paddle/fluid/pybind/pybind.cc

Lines changed: 1 addition & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -175,7 +175,6 @@ limitations under the License. */
175175
#endif
176176

177177
#ifdef PADDLE_WITH_CUSTOM_DEVICE
178-
#include "paddle/fluid/operators/custom_device_common_op_registry.h"
179178
#include "paddle/fluid/platform/profiler/custom_device/custom_tracer.h"
180179
#include "paddle/phi/capi/capi.h"
181180
#include "paddle/phi/core/platform/collective_helper.h"
@@ -2570,14 +2569,7 @@ All parameter, weight, gradient are variables in Paddle.
25702569
egr::Controller::Instance().MergeOpMetaInfoMap(
25712570
framework::LoadOpMetaInfoAndRegisterOp(dso_name));
25722571
});
2573-
m.def("init_devices", []() {
2574-
framework::InitDevices();
2575-
#ifdef PADDLE_WITH_CUSTOM_DEVICE
2576-
for (auto &dev_type : phi::DeviceManager::GetAllCustomDeviceTypes()) {
2577-
paddle::operators::RegisterCustomDeviceCommonKernel(dev_type);
2578-
}
2579-
#endif
2580-
});
2572+
m.def("init_devices", []() { framework::InitDevices(); });
25812573
m.def("init_default_kernel_signatures",
25822574
[]() { framework::InitDefaultKernelSignatureMap(); });
25832575
m.def("init_tensor_operants", []() {

0 commit comments

Comments
 (0)