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

Use cuDNN routine FindEx to find the best algorithm. #158

Merged
merged 1 commit into from
Jun 8, 2016
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
21 changes: 19 additions & 2 deletions include/caffe/layers/cudnn_conv_layer.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,7 @@ class CuDNNConvolutionLayer : public ConvolutionLayer<Dtype> {
public:
explicit CuDNNConvolutionLayer(const LayerParameter& param)
: ConvolutionLayer<Dtype>(param), handles_setup_(false),
backward_passed_ctr_(0) {}
use_algo_seeker_(true), use_modest_workspace_(true) {}

Choose a reason for hiding this comment

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

Is this too late to add use_no_workspace mode as per our discussion? If so, no problem, we'll add it in next release.

virtual void LayerSetUp(const vector<Blob<Dtype>*>& bottom,
const vector<Blob<Dtype>*>& top);
virtual void Reshape(const vector<Blob<Dtype>*>& bottom,
Expand Down Expand Up @@ -65,7 +65,24 @@ class CuDNNConvolutionLayer : public ConvolutionLayer<Dtype> {
size_t *workspace_bwd_data_sizes_;
size_t *workspace_bwd_filter_sizes_;
GPUMemory::Workspace workspace;
int backward_passed_ctr_;

private:
bool use_algo_seeker_;
bool use_modest_workspace_;
void FindExConvAlgo(const vector<Blob<Dtype>*>& bottom,
const vector<Blob<Dtype>*>& top,
const size_t workspace_bytes);
void GetConvAlgo(const vector<Blob<Dtype>*>& bottom,
const vector<Blob<Dtype>*>& top,
const size_t workspace_bytes);

vector<cudnnTensorDescriptor_t> cached_bottom_descs_;
vector<cudnnConvolutionDescriptor_t> cached_conv_descs_;
bool IsBottomDescChanged(const vector<Blob<Dtype>*>& bottom);
bool IsConvDescChanged(const vector<Blob<Dtype>*>& bottom);

bool use_reshape_;
bool initialized_cached_descs_;
};

Choose a reason for hiding this comment

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

IMHO Better:
void FindExConvAlgo(const vector<Blob>& bottom,
const vector<Blob
>& top, const size_t workspace_bytes);

Choose a reason for hiding this comment

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

I disagree actually, I like 1 argument / line when they're this long. They should be aligned on the const though ;)

Choose a reason for hiding this comment

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

Understood. But I'll need to sell this to BVLC somehow... :)

Copy link
Author

Choose a reason for hiding this comment

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

Done in 89028c4

#endif

Expand Down
Loading