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

Optimize the finding of max workspace size. #41741

Merged
merged 1 commit into from
Apr 14, 2022
Merged
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
15 changes: 9 additions & 6 deletions paddle/fluid/operators/conv_cudnn_helper.h
Original file line number Diff line number Diff line change
Expand Up @@ -276,11 +276,12 @@ struct SearchAlgorithm<cudnnConvolutionFwdAlgoPerf_t> {
args.handle, args.idesc.desc(), args.wdesc.desc(),
args.cdesc.desc(), args.odesc.desc(),
static_cast<cudnnConvolutionFwdAlgo_t>(algo), &workspace_size);
if (status == CUDNN_STATUS_SUCCESS) {
if (status == CUDNN_STATUS_SUCCESS &&
workspace_size <= workspace_size_limit) {
max_workspace_size = std::max(workspace_size, max_workspace_size);
}
}
return std::min(max_workspace_size, workspace_size_limit);
return max_workspace_size;
} else {
return workspace_size_limit;
}
Expand Down Expand Up @@ -425,11 +426,12 @@ struct SearchAlgorithm<cudnnConvolutionBwdDataAlgoPerf_t> {
args.cdesc.desc(), args.idesc.desc(),
static_cast<cudnnConvolutionBwdDataAlgo_t>(algo),
&workspace_size);
if (status == CUDNN_STATUS_SUCCESS) {
if (status == CUDNN_STATUS_SUCCESS &&
workspace_size <= workspace_size_limit) {
max_workspace_size = std::max(workspace_size, max_workspace_size);
}
}
return std::min(max_workspace_size, workspace_size_limit);
return max_workspace_size;
} else {
return workspace_size_limit;
}
Expand Down Expand Up @@ -588,11 +590,12 @@ struct SearchAlgorithm<cudnnConvolutionBwdFilterAlgoPerf_t> {
args.cdesc.desc(), args.wdesc.desc(),
static_cast<cudnnConvolutionBwdFilterAlgo_t>(algo),
&workspace_size);
if (status == CUDNN_STATUS_SUCCESS) {
if (status == CUDNN_STATUS_SUCCESS &&
workspace_size <= workspace_size_limit) {
max_workspace_size = std::max(workspace_size, max_workspace_size);
}
}
return std::min(max_workspace_size, workspace_size_limit);
return max_workspace_size;
} else {
return workspace_size_limit;
}
Expand Down