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

fix bug of elementwise_add_grad, *test=kunlun #44545

Merged
merged 5 commits into from
Jul 27, 2022
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
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
4 changes: 2 additions & 2 deletions cmake/external/xpu.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ set(XPU_RT_LIB_NAME "libxpurt.so")
if(NOT DEFINED XPU_BASE_URL)
set(XPU_BASE_URL_WITHOUT_DATE
"https://baidu-kunlun-product.cdn.bcebos.com/KL-SDK/klsdk-dev")
set(XPU_BASE_URL "${XPU_BASE_URL_WITHOUT_DATE}/20220719")
set(XPU_BASE_URL "${XPU_BASE_URL_WITHOUT_DATE}/20220722")
else()
set(XPU_BASE_URL "${XPU_BASE_URL}")
endif()
Expand All @@ -19,7 +19,7 @@ endif()
if(NOT DEFINED XPU_XDNN_BASE_URL)
set(XPU_XDNN_BASE_URL_WITHOUT_DATE
"https://klx-sdk-release-public.su.bcebos.com/xdnn/dev")
set(XPU_XDNN_BASE_URL "${XPU_XDNN_BASE_URL_WITHOUT_DATE}/20220719")
set(XPU_XDNN_BASE_URL "${XPU_XDNN_BASE_URL_WITHOUT_DATE}/20220722")
else()
set(XPU_XDNN_BASE_URL "${XPU_XDNN_BASE_URL}")
endif()
Expand Down
7 changes: 2 additions & 5 deletions paddle/fluid/operators/elementwise/elementwise_add_op_xpu.cc
Original file line number Diff line number Diff line change
@@ -1,11 +1,8 @@
/* Copyright (c) 2020 PaddlePaddle Authors. All Rights Reserved.

/* Copyright (c) 2022 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.
Expand Down Expand Up @@ -74,7 +71,7 @@ class ElementwiseAddGradXPUKernel : public ElemwiseGradKernel<T> {
int ret =
xpu::reduce_sum<XPUType>(dev_ctx.x_context(),
reinterpret_cast<const XPUType*>(dz_data),
reinterpret_cast<XPUType*>(dx_data),
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

sub/min之类有类似问题吗?一起修了吧

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

sub、min搜了下,还没有用到add这种ShareBuffer的逻辑,先暂且不修。

reinterpret_cast<XPUType*>(dx->data<T>()),
dz_vector,
reduce_dims);
PADDLE_ENFORCE_XDNN_SUCCESS(ret, "reduce_sum");
Expand Down
17 changes: 0 additions & 17 deletions paddle/fluid/operators/pool_op_xpu.cc
Original file line number Diff line number Diff line change
Expand Up @@ -21,23 +21,6 @@ namespace operators {

using framework::Tensor;

xpu::Pooling_t XPUPoolingType(const std::string& pooltype,
bool exclusive,
bool is_test) {
if (pooltype == "max") {
return xpu::Pooling_t::MAX_WITHOUT_INDEX;
} else if (pooltype == "avg") {
if (exclusive) {
return xpu::Pooling_t::AVG_WITHOUT_PAD;
} else {
return xpu::Pooling_t::AVG_WITH_PAD;
}
} else {
PADDLE_THROW(platform::errors::InvalidArgument(
"Pool op only supports 2D and 3D input."));
}
}

template <typename DeviceContext, typename T>
class PoolXPUKernel : public framework::OpKernel<T> {
using XPUType = typename XPUTypeTrait<T>::Type;
Expand Down