xdl_int XdevLComputeProgramCL::execute(const XdevLComputeExecuteParameter& parameter) { auto queueCL = static_cast<XdevLComputeDeviceQueueCL*>(parameter.queue); auto kernelCL = static_cast<XdevLComputeKernelCL*>(parameter.kernel); cl_int ret; // ret = clEnqueueTask(queueCL->getCommandQueue(), kernelCL->getKernel(), 0, nullptr, nullptr); // if(CL_SUCCESS != ret) { // XDEVL_MODULEX_ERROR(XdevLComputeProgramCL, "clEnqueueTask failed: " << clErrorAsString(ret) << std::endl); // return RET_FAILED; // } // std::size_t workgroup_size; // ret = clGetKernelWorkGroupInfo(kernelCL->getKernel(), m_deviceId, CL_KERNEL_WORK_GROUP_SIZE, sizeof(std::size_t), &workgroup_size, nullptr); // if(CL_SUCCESS != ret) { // XDEVL_MODULEX_ERROR(XdevLComputeProgramCL, "clGetKernelWorkGroupInfo failed: " << clErrorAsString(ret) << std::endl); // return RET_FAILED; // } ret = clEnqueueNDRangeKernel(queueCL->getCommandQueue(), kernelCL->getKernel(), parameter.global.size(), nullptr, parameter.global.data(), nullptr, 0, nullptr, nullptr); if(CL_SUCCESS != ret) { XDEVL_MODULEX_ERROR(XdevLComputeProgramCL, "clEnqueueNDRangeKernel failed: " << clErrorAsString(ret) << std::endl); return RET_FAILED; } return RET_SUCCESS; }
xdl_int XdevLComputeDeviceBufferCL::download(XdevLComputeDeviceQueue* queue, xdl_uint size, xdl_uint8* data) { auto queueCL = static_cast<XdevLComputeDeviceQueueCL*>(queue); cl_int ret = clEnqueueReadBuffer(queueCL->getCommandQueue(), m_memory, CL_TRUE, 0, size, data, 0, nullptr, nullptr); if(CL_SUCCESS != ret) { XDEVL_MODULEX_ERROR(XdevLComputeDeviceBufferCL,"clEnqueueWriteBuffer failed: " << clErrorAsString(ret) << std::endl); return RET_FAILED; } return RET_SUCCESS; }
void CLMatrixLoader::enqueue() { m_src->waitEndOfEvaluation(); //enqueue transfer execution cl_int error; error = getCommandQueue()->enqueueWriteBuffer ( *(m_result->getValues()), CL_FALSE, 0, sizeof ( cl_float ) * m_src->getWidth() * m_src->getHeight(), m_src->getValues(), 0, &(getEndOfEvaluation()) ); if ( error != CL_SUCCESS ) throw ( CLError ( error, "failed to enqueue memory transfer" ) ); }
static void handleExecuteCommandAlarm (const AsyncAlarmResult *result) { Queue *queue = getCommandQueue(0); if (queue) { int command = dequeueCommand(queue); if (command != EOF) { const CommandHandlerLevel *chl = commandHandlerStack; while (chl) { if (chl->handleCommand(command, chl->handlerData)) break; chl = chl->previousLevel; } } if (getQueueSize(queue) > 0) setExecuteCommandAlarm(result->data); } }
void CLMatrixUnloader::enqueue() { // prepare dependencies ClAlgorithm* dependency = (ClAlgorithm*)(m_src->getParentAlgorithm()); m_dependenciesEvents.push_back(dependency->getEndOfEvaluation()); //enqueue transfer execution cl_int error; error = getCommandQueue()->enqueueReadBuffer( *(m_src->getValues().get()), CL_FALSE, 0, sizeof ( cl_float ) * m_src->getWidth() * m_src->getHeight(), m_result->getValues(), &m_dependenciesEvents, &(getEndOfEvaluation()) ); if ( error != CL_SUCCESS ) throw ( CLError ( error, "failed to enqueue memory transfer" ) ); }
int enqueueCommand (int command) { if (command != EOF) { Queue *queue = getCommandQueue(1); if (queue) { CommandQueueItem *item = malloc(sizeof(CommandQueueItem)); if (item) { item->command = command; if (enqueueItem(queue, item)) { if (getQueueSize(queue) == 1) setExecuteCommandAlarm(NULL); return 1; } free(item); } } } return 0; }
void compare_images::init_value_profiler() { v_profiler->init(getCommandQueue(),getContext()); }