Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[KP] Solve the problem of unittests not being executed #40397

Merged
merged 21 commits into from
Mar 10, 2022
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
21 commits
Select commit Hold shift + click to select a range
8f532b0
Merge pull request #1 from PaddlePaddle/develop
AshburnLee Sep 8, 2020
5b5804d
Merge pull request #2 from PaddlePaddle/develop
AshburnLee Sep 17, 2020
cee2470
Merge pull request #3 from PaddlePaddle/develop
AshburnLee Sep 30, 2020
5be3a45
Merge pull request #4 from PaddlePaddle/develop
AshburnLee Oct 13, 2020
a1d92b7
Merge pull request #5 from PaddlePaddle/develop
AshburnLee Oct 20, 2020
e674a5d
Merge pull request #6 from PaddlePaddle/develop
AshburnLee Nov 15, 2020
855d00b
Merge pull request #7 from PaddlePaddle/develop
AshburnLee Nov 18, 2020
7cb2c97
Merge pull request #8 from PaddlePaddle/develop
AshburnLee Mar 31, 2021
db9fc91
Merge pull request #9 from PaddlePaddle/develop
AshburnLee Apr 7, 2021
c7b68c8
Merge branch 'develop' of https://github.com/PaddlePaddle/paddle into…
AshburnLee Apr 26, 2021
0fd630e
Merge branch 'PaddlePaddle:develop' into develop
AshburnLee Aug 16, 2021
4bbb33b
Merge branch 'PaddlePaddle:develop' into develop
AshburnLee Sep 28, 2021
30a1a89
Merge branch 'PaddlePaddle:develop' into develop
AshburnLee Nov 22, 2021
d6cb683
Merge branch 'PaddlePaddle:develop' into develop
AshburnLee Nov 29, 2021
b2558a0
Merge branch 'PaddlePaddle:develop' into develop
AshburnLee Dec 21, 2021
06313d8
Merge branch 'PaddlePaddle:develop' into develop
AshburnLee Feb 21, 2022
d6a001b
Merge branch 'develop' of https://github.com/PaddlePaddle/paddle into…
AshburnLee Mar 2, 2022
e9c36e5
Merge branch 'develop' of https://github.com/PaddlePaddle/paddle into…
AshburnLee Mar 4, 2022
cf1712a
Merge branch 'develop' of https://github.com/PaddlePaddle/paddle into…
AshburnLee Mar 8, 2022
71c8a4b
solve unexecuted UT
AshburnLee Mar 10, 2022
9f586f0
Merge branch 'develop' of https://github.com/PaddlePaddle/paddle into…
AshburnLee Mar 10, 2022
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions paddle/fluid/imperative/prepared_operator.cc
Original file line number Diff line number Diff line change
Expand Up @@ -247,6 +247,7 @@ PreparedOp PrepareImpl(const NameVarMap<VarType>& ins,
#endif

#ifdef PADDLE_WITH_XPU_KP
expected_kernel_key.place_ = platform::XPUPlace();
bool use_xpu_kp_kernel_rt =
FLAGS_run_kp_kernel &&
paddle::platform::is_xpu_kp_support_op(op.Type(), expected_kernel_key);
Expand Down
16 changes: 16 additions & 0 deletions paddle/fluid/platform/device/xpu/xpu_op_list.cc
Original file line number Diff line number Diff line change
Expand Up @@ -111,6 +111,22 @@ bool is_in_xpu_kpwhite_list(const std::string& op_name) {
}
#endif

#ifdef PADDLE_WITH_XPU_KP
std::vector<vartype::Type> get_xpu_kp_op_support_type(
const std::string& op_name, phi::backends::xpu::XPUVersion version) {
std::vector<vartype::Type> res;
auto& ops = version == phi::backends::xpu::XPUVersion::XPU1 ? get_kl1_ops()
: get_kp_ops();
if (ops.find(op_name) != ops.end()) {
XPUKernelSet& type_set = ops[op_name];
for (auto& item : type_set) {
res.push_back(item.data_type_);
}
}
return res;
}
#endif

std::vector<vartype::Type> get_xpu_op_support_type(
const std::string& op_name, phi::backends::xpu::XPUVersion version) {
std::vector<vartype::Type> res;
Expand Down
2 changes: 2 additions & 0 deletions paddle/fluid/platform/device/xpu/xpu_op_list.h
Original file line number Diff line number Diff line change
Expand Up @@ -31,6 +31,8 @@ bool is_in_xpu_black_list(const std::string& op_name);
bool is_xpu_kp_support_op(const std::string& op_name,
const pOpKernelType& type);
bool is_in_xpu_kpwhite_list(const std::string& op_name);
std::vector<vartype::Type> get_xpu_kp_op_support_type(
const std::string& op_name, phi::backends::xpu::XPUVersion version);
#endif

std::vector<vartype::Type> get_xpu_op_support_type(
Expand Down
7 changes: 7 additions & 0 deletions paddle/fluid/pybind/pybind.cc
Original file line number Diff line number Diff line change
Expand Up @@ -1957,10 +1957,17 @@ All parameter, weight, gradient are variables in Paddle.
m.def("get_xpu_device_count", platform::GetXPUDeviceCount);
m.def("get_xpu_device_version",
[](int device_id) { return platform::get_xpu_version(device_id); });
#ifdef PADDLE_WITH_XPU_KP
m.def("get_xpu_device_op_support_types",
[](const std::string &op_name, phi::backends::xpu::XPUVersion version) {
return platform::get_xpu_kp_op_support_type(op_name, version);
});
#else
m.def("get_xpu_device_op_support_types",
[](const std::string &op_name, phi::backends::xpu::XPUVersion version) {
return platform::get_xpu_op_support_type(op_name, version);
});
#endif
m.def("get_xpu_device_op_list", [](phi::backends::xpu::XPUVersion version) {
return platform::get_xpu_op_list(version);
});
Expand Down