From dfe6d8faa1d5e87038afc7a1e492b3f6242a17f6 Mon Sep 17 00:00:00 2001 From: zyfncg Date: Wed, 26 Oct 2022 16:15:53 +0800 Subject: [PATCH] Fix inference performance problem caused by selecting cudnn kernel of softmax (#47338) * 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 eac041b634..6393bbc827 100644 --- a/paddle/fluid/operators/softmax_op.cc +++ b/paddle/fluid/operators/softmax_op.cc @@ -83,6 +83,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 6d54ade201..461f0c7bfe 100644 --- a/paddle/phi/api/yaml/op_compat.yaml +++ b/paddle/phi/api/yaml/op_compat.yaml @@ -686,7 +686,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