MCPcopy Create free account
hub / github.com/alibaba/MNN / copyBufferToImage

Function copyBufferToImage

source/backend/opencl/core/OpenCLRunningUtils.cpp:707–722  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

705}
706
707void copyBufferToImage(OpenCLRuntime *runtime, const cl::Buffer &buffer, const cl::Image &image, int w, int h, int precision) {
708 std::set<std::string> buildOptions;
709 buildOptions.emplace("-DBUFFER_INP_FP32");
710 auto kernelW = runtime->buildKernelWithCache("copy_buffer_to_image2d", "copy_buffer_to_image2d", buildOptions, precision);
711 auto kernel = kernelW->get();
712 auto status = kernel.setArg(0, buffer);
713 MNN_ASSERT(status == CL_SUCCESS);
714 status = kernel.setArg(1, image);
715 MNN_ASSERT(status == CL_SUCCESS);
716 status = kernel.setArg(2, w);
717 MNN_ASSERT(status == CL_SUCCESS);
718 status = kernel.setArg(3, h);
719 MNN_ASSERT(status == CL_SUCCESS);
720 auto comandQueue = runtime->commandQueue();
721 comandQueue.enqueueNDRangeKernel(kernel, cl::NullRange, cl::NDRange(w, h, 1));
722}
723
724bool localWSTune(const std::map<std::string, std::vector<TuneInfo>>& tuneMap, const std::vector<uint32_t>& gws,
725 const std::string& kernelName, std::pair<std::vector<uint32_t>, uint32_t>& res, int tuneLevel) {

Callers 4

ConvWinogradMethod · 0.85
ScaleExecutionMethod · 0.85
ConvCommonExecutionMethod · 0.85
ReluExecutionMethod · 0.85

Calls 5

buildKernelWithCacheMethod · 0.80
NDRangeClass · 0.50
getMethod · 0.45
setArgMethod · 0.45
enqueueNDRangeKernelMethod · 0.45

Tested by

no test coverage detected