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

Adapting device-specific Extra Attributes for the PHI kernel #46342

Merged
merged 43 commits into from
Nov 1, 2022
Merged
Show file tree
Hide file tree
Changes from 34 commits
Commits
Show all changes
43 commits
Select commit Hold shift + click to select a range
00c2aca
add extra attr property set
chenwhql Sep 20, 2022
28e9710
add type_info for all context
chenwhql Sep 21, 2022
cd630f0
add onednn context to all context
chenwhql Sep 21, 2022
d633672
fix context compile error
chenwhql Sep 23, 2022
d651bf9
simplify conv kernel args
chenwhql Sep 23, 2022
84c56fa
pass runtime attr into dev_ctx
chenwhql Sep 26, 2022
24ea5b4
Merge branch 'develop' of https://github.com/PaddlePaddle/Paddle into…
chenwhql Sep 26, 2022
fc67372
fix marco error
chenwhql Sep 26, 2022
ed7b59f
clear conv_grad_kernel extra args
chenwhql Sep 28, 2022
23cab07
merge conv_grad_grad into conv_grad
chenwhql Sep 28, 2022
123edd2
clear conv2d_grad_grad extra attrs
chenwhql Sep 28, 2022
d29a519
Merge branch 'develop' of https://github.com/PaddlePaddle/Paddle into…
chenwhql Sep 28, 2022
853b1db
clear yaml and eager extra attr
chenwhql Sep 30, 2022
62ce48b
Merge branch 'develop' of https://github.com/PaddlePaddle/Paddle into…
chenwhql Sep 30, 2022
de52450
fix conv1d error
chenwhql Oct 10, 2022
2c55350
Merge branch 'develop' of https://github.com/PaddlePaddle/Paddle into…
chenwhql Oct 10, 2022
03f6893
change to thread local
chenwhql Oct 11, 2022
49bcebe
fix npu compile failed
chenwhql Oct 11, 2022
ada7d0c
try to fix windows compile failed
chenwhql Oct 11, 2022
22ccfa9
add conv2d onednn phi kernel
chenwhql Oct 13, 2022
9602334
Merge branch 'develop' of https://github.com/PaddlePaddle/Paddle into…
chenwhql Oct 14, 2022
6331512
fix ci bugs (#36)
YuanRisheng Oct 17, 2022
37afcf6
fix compile bugs (#38)
YuanRisheng Oct 17, 2022
39e2529
fix extra input transform bug (#39)
YuanRisheng Oct 18, 2022
16d595c
support dynamic created attr (#40)
YuanRisheng Oct 21, 2022
0d61412
resolve conflict with develop
chenwhql Oct 23, 2022
722b256
Merge branch 'adapto_extra_attr_in_phi' of https://github.com/chenwhq…
chenwhql Oct 23, 2022
8d59887
resolve conflict with develop
chenwhql Oct 24, 2022
c0cdb15
reset extra info gen code
chenwhql Oct 24, 2022
42bc76b
Merge branch 'develop' of https://github.com/PaddlePaddle/Paddle into…
chenwhql Oct 24, 2022
dafdbcc
rm conv_grad_grad kernel
chenwhql Oct 24, 2022
e6d5312
reimpl pass attr adapting
chenwhql Oct 24, 2022
2b7c43d
resolve conflict with develop
chenwhql Oct 24, 2022
12e18f1
add int attr support
chenwhql Oct 24, 2022
2ea1a2b
remove vector inputnames creating
chenwhql Oct 25, 2022
148eebc
fix map at error
chenwhql Oct 25, 2022
cbc247b
Merge branch 'develop' of https://github.com/PaddlePaddle/Paddle into…
chenwhql Oct 26, 2022
f7d3a66
Update paddle/phi/kernels/onednn/conv_grad_kernel.cc
chenwhql Oct 27, 2022
1d99ce6
remove useless extra attrs
chenwhql Oct 27, 2022
bfe9206
Merge branch 'adapto_extra_attr_in_phi' of https://github.com/chenwhq…
chenwhql Oct 27, 2022
fcb1fa6
Merge branch 'develop' of https://github.com/PaddlePaddle/Paddle into…
chenwhql Oct 27, 2022
60ca750
resolve conflict
chenwhql Oct 27, 2022
64ef9fd
replace mkldnn_engine by onednn_engine
chenwhql Oct 27, 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
Original file line number Diff line number Diff line change
Expand Up @@ -24,10 +24,7 @@ paddle::experimental::Tensor conv2d_ad_func(
const paddle::experimental::Tensor& filter,
std::vector<int> strides,
std::vector<int> paddings,
std::string paddding_algorithm,
int groups,
std::string padding_algorithm,
std::vector<int> dilations,
std::string data_format,
bool use_addto,
int workspace_size_MB,
bool exhaustive_search);
int groups,
std::string data_format);
Original file line number Diff line number Diff line change
Expand Up @@ -29,13 +29,10 @@ paddle::experimental::Tensor conv2d_ad_func(
const paddle::experimental::Tensor& filter,
std::vector<int> strides,
std::vector<int> paddings,
std::string paddding_algorithm,
int groups,
std::string padding_algorithm,
std::vector<int> dilations,
std::string data_format,
bool use_addto,
int workspace_size_MB,
bool exhaustive_search) {
int groups,
std::string data_format) {
// Dygraph Record Event
paddle::platform::RecordEvent dygraph_entrance_record_event(
"conv2d dygraph", paddle::platform::TracerEventType::Operator, 1);
Expand Down Expand Up @@ -64,13 +61,10 @@ paddle::experimental::Tensor conv2d_ad_func(
new_filter,
strides,
paddings,
paddding_algorithm,
groups,
padding_algorithm,
dilations,
data_format,
use_addto,
workspace_size_MB,
exhaustive_search);
groups,
data_format);
}
}

Expand All @@ -92,13 +86,10 @@ paddle::experimental::Tensor conv2d_ad_func(
filter,
strides,
paddings,
paddding_algorithm,
groups,
padding_algorithm,
dilations,
data_format,
use_addto,
workspace_size_MB,
exhaustive_search);
groups,
data_format);
transformer->SetOutTensorLayout(&out);
if (need_tune) {
egr::Controller::Instance().EnableLayoutAutoTune();
Expand All @@ -119,13 +110,10 @@ paddle::experimental::Tensor conv2d_ad_func(
filter,
strides,
paddings,
paddding_algorithm,
groups,
padding_algorithm,
dilations,
data_format,
use_addto,
workspace_size_MB,
exhaustive_search);
groups,
data_format);
// Check NaN and Inf if needed
if (FLAGS_check_nan_inf) {
egr::CheckTensorHasNanOrInf("conv2d", api_result);
Expand Down Expand Up @@ -157,13 +145,10 @@ paddle::experimental::Tensor conv2d_ad_func(
// SetAttributes if needed
grad_node->SetAttributestrides(strides);
grad_node->SetAttributepaddings(paddings);
grad_node->SetAttributepaddding_algorithm(paddding_algorithm);
grad_node->SetAttributepadding_algorithm(padding_algorithm);
grad_node->SetAttributegroups(groups);
grad_node->SetAttributedilations(dilations);
grad_node->SetAttributedata_format(data_format);
grad_node->SetAttributeuse_addto(use_addto);
grad_node->SetAttributeworkspace_size_MB(workspace_size_MB);
grad_node->SetAttributeexhaustive_search(exhaustive_search);
// Set TensorWrappers for Forward Inputs if needed
grad_node->SetTensorWrapperinput(input);
grad_node->SetTensorWrapperfilter(filter);
Expand Down
29 changes: 7 additions & 22 deletions paddle/fluid/eager/api/manual/eager_manual/nodes/conv2d_nodes.cc
Original file line number Diff line number Diff line change
Expand Up @@ -46,13 +46,10 @@ Conv2dGradNodeFinal::operator()(
auto& grad_out = hooked_grads[0][0];
auto& strides = this->strides_;
auto& paddings = this->paddings_;
auto& paddding_algorithm = this->paddding_algorithm_;
auto& padding_algorithm = this->padding_algorithm_;
auto& groups = this->groups_;
auto& dilations = this->dilations_;
auto& data_format = this->data_format_;
auto& use_addto = this->use_addto_;
auto& workspace_size_MB = this->workspace_size_MB_;
auto& exhaustive_search = this->exhaustive_search_;
// Prepare Grad function call

const auto& out_metas = OutputMeta();
Expand Down Expand Up @@ -87,13 +84,10 @@ Conv2dGradNodeFinal::operator()(
grad_out,
strides,
paddings,
paddding_algorithm,
groups,
padding_algorithm,
dilations,
groups,
data_format,
use_addto,
workspace_size_MB,
exhaustive_search,
api_output_0,
api_output_1);
// Check NaN and Inf id needed
Expand Down Expand Up @@ -134,13 +128,10 @@ Conv2dGradNodeFinal::operator()(
// SetAttributes if needed
grad_node->SetAttributestrides(strides);
grad_node->SetAttributepaddings(paddings);
grad_node->SetAttributepaddding_algorithm(paddding_algorithm);
grad_node->SetAttributepadding_algorithm(padding_algorithm);
grad_node->SetAttributegroups(groups);
grad_node->SetAttributedilations(dilations);
grad_node->SetAttributedata_format(data_format);
grad_node->SetAttributeuse_addto(use_addto);
grad_node->SetAttributeworkspace_size_MB(workspace_size_MB);
grad_node->SetAttributeexhaustive_search(exhaustive_search);
// Set TensorWrappers for Forward Inputs if needed
grad_node->SetTensorWrapperinput(input);
grad_node->SetTensorWrapperfilter(filter);
Expand Down Expand Up @@ -215,13 +206,10 @@ Conv2dDoubleGradNodeFinal::operator()(

auto& strides = this->strides_;
auto& paddings = this->paddings_;
auto& paddding_algorithm = this->paddding_algorithm_;
auto& padding_algorithm = this->padding_algorithm_;
auto& groups = this->groups_;
auto& dilations = this->dilations_;
auto& data_format = this->data_format_;
auto& use_addto = this->use_addto_;
auto& workspace_size_MB = this->workspace_size_MB_;
auto& exhaustive_search = this->exhaustive_search_;
// Prepare Grad function call

const auto& out_metas = OutputMeta();
Expand Down Expand Up @@ -261,13 +249,10 @@ Conv2dDoubleGradNodeFinal::operator()(
grad_filter_grad_optional,
strides,
paddings,
paddding_algorithm,
groups,
padding_algorithm,
dilations,
groups,
data_format,
use_addto,
workspace_size_MB,
exhaustive_search,
api_output_0,
api_output_1,
api_output_2);
Expand Down
32 changes: 6 additions & 26 deletions paddle/fluid/eager/api/manual/eager_manual/nodes/nodes.h
Original file line number Diff line number Diff line change
Expand Up @@ -63,8 +63,8 @@ class Conv2dGradNodeFinal : public egr::GradNodeBase {
void SetAttributepaddings(const std::vector<int>& paddings) {
paddings_ = paddings;
}
void SetAttributepaddding_algorithm(const std::string& paddding_algorithm) {
paddding_algorithm_ = paddding_algorithm;
void SetAttributepadding_algorithm(const std::string& padding_algorithm) {
padding_algorithm_ = padding_algorithm;
}
void SetAttributegroups(const int& groups) { groups_ = groups; }
void SetAttributedilations(const std::vector<int>& dilations) {
Expand All @@ -73,13 +73,6 @@ class Conv2dGradNodeFinal : public egr::GradNodeBase {
void SetAttributedata_format(const std::string& data_format) {
data_format_ = data_format;
}
void SetAttributeuse_addto(const bool& use_addto) { use_addto_ = use_addto; }
void SetAttributeworkspace_size_MB(const int& workspace_size_MB) {
workspace_size_MB_ = workspace_size_MB;
}
void SetAttributeexhaustive_search(const bool& exhaustive_search) {
exhaustive_search_ = exhaustive_search;
}

private:
// TensorWrappers
Expand All @@ -89,13 +82,10 @@ class Conv2dGradNodeFinal : public egr::GradNodeBase {
// Attributes
std::vector<int> strides_;
std::vector<int> paddings_;
std::string paddding_algorithm_;
std::string padding_algorithm_;
int groups_;
std::vector<int> dilations_;
std::string data_format_;
bool use_addto_;
int workspace_size_MB_;
bool exhaustive_search_;
};

class Conv2dDoubleGradNodeFinal : public egr::GradNodeBase {
Expand Down Expand Up @@ -146,8 +136,8 @@ class Conv2dDoubleGradNodeFinal : public egr::GradNodeBase {
void SetAttributepaddings(const std::vector<int>& paddings) {
paddings_ = paddings;
}
void SetAttributepaddding_algorithm(const std::string& paddding_algorithm) {
paddding_algorithm_ = paddding_algorithm;
void SetAttributepadding_algorithm(const std::string& padding_algorithm) {
padding_algorithm_ = padding_algorithm;
}
void SetAttributegroups(const int& groups) { groups_ = groups; }
void SetAttributedilations(const std::vector<int>& dilations) {
Expand All @@ -156,13 +146,6 @@ class Conv2dDoubleGradNodeFinal : public egr::GradNodeBase {
void SetAttributedata_format(const std::string& data_format) {
data_format_ = data_format;
}
void SetAttributeuse_addto(const bool& use_addto) { use_addto_ = use_addto; }
void SetAttributeworkspace_size_MB(const int& workspace_size_MB) {
workspace_size_MB_ = workspace_size_MB;
}
void SetAttributeexhaustive_search(const bool& exhaustive_search) {
exhaustive_search_ = exhaustive_search;
}

private:
// TensorWrappers
Expand All @@ -173,13 +156,10 @@ class Conv2dDoubleGradNodeFinal : public egr::GradNodeBase {
// Attributes
std::vector<int> strides_;
std::vector<int> paddings_;
std::string paddding_algorithm_;
std::string padding_algorithm_;
int groups_;
std::vector<int> dilations_;
std::string data_format_;
bool use_addto_;
int workspace_size_MB_;
bool exhaustive_search_;
};

class AddNGradNodeFinal : public egr::GradNodeBase {
Expand Down
2 changes: 1 addition & 1 deletion paddle/fluid/framework/archive.h
Original file line number Diff line number Diff line change
Expand Up @@ -32,8 +32,8 @@
#include <valarray>
#include <vector>

#include "paddle/fluid/framework/expect.h"
#include "paddle/fluid/platform/enforce.h"
#include "paddle/phi/core/expect.h"

namespace paddle {
namespace framework {
Expand Down
2 changes: 1 addition & 1 deletion paddle/fluid/framework/channel.h
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@
#include <utility>
#include <vector>

#include "paddle/fluid/framework/expect.h"
#include "paddle/phi/core/expect.h"

namespace paddle {
namespace framework {
Expand Down
Loading