提交 e99ced10 编写于 作者: R Ray Liu 提交者: GitHub

Merge pull request #1029 from codeWorm2015/opencl

update cl image
...@@ -47,6 +47,9 @@ class CLHelper { ...@@ -47,6 +47,9 @@ class CLHelper {
return scope_->Context(); return scope_->Context();
} }
private: private:
CLScope *scope_; CLScope *scope_;
std::vector<std::unique_ptr<_cl_kernel, CLKernelDeleter>> kernels; std::vector<std::unique_ptr<_cl_kernel, CLKernelDeleter>> kernels;
......
...@@ -23,13 +23,23 @@ namespace framework { ...@@ -23,13 +23,23 @@ namespace framework {
class CLImage { class CLImage {
public: public:
CLImage(cl_context context, float *tensorInput, DDim ddim) : tensorDims_(ddim), context_(context) { CLImage() = default;
void Init(cl_context context, float *tensorInput, DDim ddim) {
}
void Init(cl_context context, DDim ddim) {
} }
const DDim &TensorDim(); const DDim &TensorDim();
std::vector<size_t> DefaultWorkSize() {
return {};
}
private: private:
bool initialized_ = false;
cl_mem cl_image_; cl_mem cl_image_;
DDim tensorDims_; DDim tensorDims_;
cl_context context_; cl_context context_;
......
...@@ -151,11 +151,9 @@ class OpKernelBase { ...@@ -151,11 +151,9 @@ class OpKernelBase {
OpKernelBase() = default; OpKernelBase() = default;
#ifdef PADDLE_MOBILE_CL #ifdef PADDLE_MOBILE_CL
virtual void InitCLHelper(CLScope *clScope) { virtual void InitCLHelper(CLScope *clScope) {
cl_helper_ = CLHelper(clScope); cl_helper_ = CLHelper(clScope);
} }
#endif #endif
/* /*
......
///* Copyright (c) 2018 PaddlePaddle Authors. All Rights Reserved. /* Copyright (c) 2018 PaddlePaddle Authors. All Rights Reserved.
//
//Licensed under the Apache License, Version 2.0 (the "License"); Licensed under the Apache License, Version 2.0 (the "License");
//you may not use this file except in compliance with the License. you may not use this file except in compliance with the License.
//You may obtain a copy of the License at You may obtain a copy of the License at
//
// http://www.apache.org/licenses/LICENSE-2.0 http://www.apache.org/licenses/LICENSE-2.0
//
//Unless required by applicable law or agreed to in writing, software Unless required by applicable law or agreed to in writing, software
//distributed under the License is distributed on an "AS IS" BASIS, distributed under the License is distributed on an "AS IS" BASIS,
//WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
//See the License for the specific language governing permissions and See the License for the specific language governing permissions and
//limitations under the License. */ limitations under the License. */
//
//#ifdef CONV_OP #ifdef CONV_OP
//
//#include "operators/kernel/conv_kernel.h" #include "operators/kernel/conv_kernel.h"
//#include "operators/kernel/central-arm-func/conv_arm_func.h" #include "operators/kernel/central-arm-func/conv_arm_func.h"
//
//namespace paddle_mobile { namespace paddle_mobile {
//namespace operators { namespace operators {
//
//template <> template <>
//bool ConvKernel<GPU_CL, float>::Init(ConvParam<GPU_CL> *param) { bool ConvKernel<GPU_CL, float>::Init(ConvParam<GPU_CL> *param) {
// this->cl_helper_.AddKernel("conv_3x3", "conv_kernel.cl"); this->cl_helper_.AddKernel("conv_3x3", "conv_kernel.cl");
// return true; return true;
//} }
//
//template <> template <>
//void ConvKernel<GPU_CL, float>::Compute(const ConvParam<GPU_CL> &param) { void ConvKernel<GPU_CL, float>::Compute(const ConvParam<GPU_CL> &param) {
// auto kernel = this->cl_helper_.KernelAt(0); auto kernel = this->cl_helper_.KernelAt(0);
// size_t global_work_size[3] = {1, 2, 3};
// clEnqueueNDRangeKernel(this->cl_helper_.CLCommandQueue(), kernel, 3, NULL, global_work_size, NULL, 0, NULL, NULL);
//}
// }
//template class ConvKernel<GPU_CL, float>;
// template class ConvKernel<GPU_CL, float>;
//} // namespace operators
//} // namespace paddle_mobile } // namespace operators
// } // namespace paddle_mobile
//#endif
#endif
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册