From 0369cd0f0a655a98a7cd6e18a062e8c8fb6fc965 Mon Sep 17 00:00:00 2001 From: zyfncg Date: Wed, 26 Oct 2022 22:41:10 +0800 Subject: [PATCH] Fix inference performance problem caused by selecting cudnn kernel of softmax (#47338) (#47367) * fix inference perfermence problem caused by selecting cudnn kernel for softmax * recover use_cudnn in opmaker of softmax --- paddle/fluid/operators/softmax_op.cc | 5 +++++ paddle/phi/api/yaml/op_compat.yaml | 2 +- 2 files changed, 6 insertions(+), 1 deletion(-) diff --git a/paddle/fluid/operators/softmax_op.cc b/paddle/fluid/operators/softmax_op.cc index 3966b850c7b..b8bc13ef075 100644 --- a/paddle/fluid/operators/softmax_op.cc +++ b/paddle/fluid/operators/softmax_op.cc @@ -92,6 +92,11 @@ class SoftmaxOpMaker : public framework::OpProtoAndCheckerMaker { "Defaults to \"NHWC\". Specify the data format of the output data, " "the input will be transformed automatically. ") .SetDefault("AnyLayout"); + AddAttr( + "use_cudnn", + "(bool, default false) Only used in cudnn kernel, need install cudnn") + .SetDefault(false) + .AsExtra(); AddComment(R"DOC( Softmax Operator. diff --git a/paddle/phi/api/yaml/op_compat.yaml b/paddle/phi/api/yaml/op_compat.yaml index c7a0795dbab..a6360d2ae77 100644 --- a/paddle/phi/api/yaml/op_compat.yaml +++ b/paddle/phi/api/yaml/op_compat.yaml @@ -674,7 +674,7 @@ - op : softmax backward : softmax_grad extra : - attrs : [bool use_cudnn = false, bool use_mkldnn = false, str mkldnn_data_type = "float32", bool is_test = false] + attrs : [bool use_mkldnn = false, str mkldnn_data_type = "float32", bool is_test = false] - op : softplus backward : softplus_grad -- GitLab