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

Introduce a virtual buffer pointer mapping mechanism for OCL memory obj #4421

Closed
wants to merge 1 commit into from
Closed
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
6 changes: 0 additions & 6 deletions include/caffe/blob.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -10,13 +10,7 @@
#include "caffe/proto/caffe.pb.h"
#include "caffe/syncedmem.hpp"

#ifdef USE_CUDA
#include "caffe/util/math_functions.hpp"
#endif

#ifdef USE_GREENTEA
#include "caffe/greentea/greentea_math_functions.hpp"
#endif

const int_tp kMaxBlobAxes = 32;

Expand Down
6 changes: 6 additions & 0 deletions include/caffe/common.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -152,6 +152,9 @@ class Caffe {
return Get().curand_generator64_;
}
#endif // USE_CUDA
#ifdef USE_GREENTEA
inline static ClState& cl_state() { return Get().cl_state_; }
#endif
#if defined(USE_GREENTEA) && defined(USE_FFT)
inline static ClFFTState& cl_fft_state() { return Get().cl_fft_state_; }
#endif // USE_GREENTEA
Expand Down Expand Up @@ -210,6 +213,9 @@ class Caffe {
curandGenerator_t curand_generator_;
curandGenerator_t curand_generator64_;
#endif // USE_CUDA
#ifdef USE_GREENTEA
static ClState cl_state_;
#endif
#if defined(USE_GREENTEA) && defined(USE_FFT)
ClFFTState cl_fft_state_;
#endif
Expand Down
64 changes: 0 additions & 64 deletions include/caffe/greentea/greentea_im2col.hpp

This file was deleted.

163 changes: 0 additions & 163 deletions include/caffe/greentea/greentea_math_functions.hpp

This file was deleted.

37 changes: 9 additions & 28 deletions include/caffe/layer.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -521,35 +521,16 @@ inline Dtype Layer<Dtype>::Forward(const vector<Blob<Dtype>*>& bottom,
case Caffe::GPU:
Forward_gpu(bottom, top);
#ifndef CPU_ONLY
if (device_->backend() == BACKEND_CUDA) {
#ifdef USE_CUDA
for (int_tp top_id = 0; top_id < top.size(); ++top_id) {
if (!this->loss(top_id)) {
continue;
}
const int_tp count = top[top_id]->count();
const Dtype* data = top[top_id]->gpu_data();
const Dtype* loss_weights = top[top_id]->gpu_diff();
Dtype blob_loss = 0;
caffe_gpu_dot(count, data, loss_weights, &blob_loss);
loss += blob_loss;
}
#endif // USE_CUDA
} else {
#ifdef USE_GREENTEA
for (int_tp top_id = 0; top_id < top.size(); ++top_id) {
if (!this->loss(top_id)) {
continue;
}
const int_tp count = top[top_id]->count();
cl_mem data = (cl_mem) (top[top_id]->gpu_data());
cl_mem loss_weights = (cl_mem) (top[top_id]->gpu_diff());
Dtype blob_loss = 0;
greentea_gpu_dot(this->device_->id(), count, data, 0,
loss_weights, 0, &blob_loss);
loss += blob_loss;
for (int_tp top_id = 0; top_id < top.size(); ++top_id) {
if (!this->loss(top_id)) {
continue;
}
#endif // USE_GREENTEA
const int_tp count = top[top_id]->count();
const Dtype* data = top[top_id]->gpu_data();
const Dtype* loss_weights = top[top_id]->gpu_diff();
Dtype blob_loss = 0;
caffe_gpu_dot(count, data, loss_weights, &blob_loss);
loss += blob_loss;
}
#endif
break;
Expand Down
Loading