コード例 #1
0
	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;
	}
コード例 #2
0
	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;
	}
コード例 #3
0
ファイル: clmatrix.cpp プロジェクト: ewaybotYan/liblooklike
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" ) );
}
コード例 #4
0
ファイル: cmd_queue.c プロジェクト: Kartofelna/brltty
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);
  }
}
コード例 #5
0
ファイル: clmatrix.cpp プロジェクト: ewaybotYan/liblooklike
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" ) );
}
コード例 #6
0
ファイル: cmd_queue.c プロジェクト: Kartofelna/brltty
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;
}
コード例 #7
0
void compare_images::init_value_profiler()
{
	v_profiler->init(getCommandQueue(),getContext());
}