Commit 88ccfff7 authored by Joseph Noir's avatar Joseph Noir

Fixed warnings

parent 881a492d
...@@ -162,7 +162,7 @@ class actor_facade<Ret(Args...)> : public abstract_actor { ...@@ -162,7 +162,7 @@ class actor_facade<Ret(Args...)> : public abstract_actor {
cl_int err{0}; cl_int err{0};
// rotate left (output buffer to the end) // rotate left (output buffer to the end)
rotate(begin(arguments), begin(arguments) + 1, end(arguments)); rotate(begin(arguments), begin(arguments) + 1, end(arguments));
for (size_t i = 0; i < arguments.size(); ++i) { for (cl_uint i = 0; i < arguments.size(); ++i) {
err = clSetKernelArg(m_kernel.get(), i, sizeof(cl_mem), err = clSetKernelArg(m_kernel.get(), i, sizeof(cl_mem),
static_cast<void*>(&arguments[i])); static_cast<void*>(&arguments[i]));
CAF_LOG_ERROR_IF(err != CL_SUCCESS, CAF_LOG_ERROR_IF(err != CL_SUCCESS,
......
...@@ -69,12 +69,14 @@ class command : public ref_counted { ...@@ -69,12 +69,14 @@ class command : public ref_counted {
auto data_or_nullptr = [](const dim_vec& vec) { auto data_or_nullptr = [](const dim_vec& vec) {
return vec.empty() ? nullptr : vec.data(); return vec.empty() ? nullptr : vec.data();
}; };
// OpenCL expects cl_uint (unsigned int), hence the cast
err = clEnqueueNDRangeKernel( err = clEnqueueNDRangeKernel(
m_queue.get(), m_actor_facade->m_kernel.get(), m_queue.get(), m_actor_facade->m_kernel.get(),
m_actor_facade->m_global_dimensions.size(), static_cast<cl_uint>(m_actor_facade->m_global_dimensions.size()),
data_or_nullptr(m_actor_facade->m_global_offsets), data_or_nullptr(m_actor_facade->m_global_offsets),
data_or_nullptr(m_actor_facade->m_global_dimensions), data_or_nullptr(m_actor_facade->m_global_dimensions),
data_or_nullptr(m_actor_facade->m_local_dimensions), m_events.size(), data_or_nullptr(m_actor_facade->m_local_dimensions),
static_cast<cl_uint>(m_events.size()),
(m_events.empty() ? nullptr : m_events.data()), &event_k); (m_events.empty() ? nullptr : m_events.data()), &event_k);
if (err != CL_SUCCESS) { if (err != CL_SUCCESS) {
CAF_LOGMF(CAF_ERROR, "clEnqueueNDRangeKernel: " << get_opencl_error(err)); CAF_LOGMF(CAF_ERROR, "clEnqueueNDRangeKernel: " << get_opencl_error(err));
...@@ -115,7 +117,7 @@ class command : public ref_counted { ...@@ -115,7 +117,7 @@ class command : public ref_counted {
} }
private: private:
int m_result_size; size_t m_result_size;
response_promise m_handle; response_promise m_handle;
intrusive_ptr<T> m_actor_facade; intrusive_ptr<T> m_actor_facade;
command_queue_ptr m_queue; command_queue_ptr m_queue;
......
...@@ -125,20 +125,22 @@ void opencl_metainfo::initialize() { ...@@ -125,20 +125,22 @@ void opencl_metainfo::initialize() {
CAF_LOG_DEBUG("creating command queue for device(s)"); CAF_LOG_DEBUG("creating command queue for device(s)");
command_queue_ptr cmd_queue; command_queue_ptr cmd_queue;
try { try {
cmd_queue.adopt(v2get(CAF_CLF(clCreateCommandQueue), m_context.get(), cmd_queue.adopt(v2get(CAF_CLF(clCreateCommandQueue),
device.get(), CL_QUEUE_PROFILING_ENABLE)); m_context.get(), device.get(),
static_cast<unsigned>(CL_QUEUE_PROFILING_ENABLE)));
} }
catch (std::runtime_error&) { catch (std::runtime_error&) {
CAF_LOG_DEBUG("unable to create command queue for device"); CAF_LOG_DEBUG("unable to create command queue for device");
} }
if (cmd_queue) { if (cmd_queue) {
auto max_wgs = v3get<size_t>(CAF_CLF(clGetDeviceInfo), device.get(), auto max_wgs = v3get<size_t>(CAF_CLF(clGetDeviceInfo), device.get(),
CL_DEVICE_MAX_WORK_GROUP_SIZE); static_cast<unsigned>(CL_DEVICE_MAX_WORK_GROUP_SIZE));
auto max_wid = v3get<cl_uint>(CAF_CLF(clGetDeviceInfo), device.get(), auto max_wid = v3get<cl_uint>(CAF_CLF(clGetDeviceInfo), device.get(),
CL_DEVICE_MAX_WORK_ITEM_DIMENSIONS); static_cast<unsigned>(CL_DEVICE_MAX_WORK_ITEM_DIMENSIONS));
dim_vec max_wi_per_dim(max_wid); dim_vec max_wi_per_dim(max_wid);
callcl(CAF_CLF(clGetDeviceInfo), device.get(), callcl(CAF_CLF(clGetDeviceInfo), device.get(),
CL_DEVICE_MAX_WORK_ITEM_SIZES, sizeof(size_t) * max_wid, static_cast<unsigned>(CL_DEVICE_MAX_WORK_ITEM_SIZES),
sizeof(size_t) * max_wid,
max_wi_per_dim.data()); max_wi_per_dim.data());
m_devices.push_back(device_info{std::move(device), std::move(cmd_queue), m_devices.push_back(device_info{std::move(device), std::move(cmd_queue),
max_wgs, max_wid, max_wi_per_dim}); max_wgs, max_wid, max_wi_per_dim});
......
...@@ -266,8 +266,8 @@ void test_opencl() { ...@@ -266,8 +266,8 @@ void test_opencl() {
// test for manuel return size selection // test for manuel return size selection
const int max_workgroup_size = static_cast<int>(get_max_workgroup_size(0,1)); // max workgroup size (1d) const int max_workgroup_size = static_cast<int>(get_max_workgroup_size(0,1)); // max workgroup size (1d)
const size_t reduce_buffer_size = max_workgroup_size * 8; const size_t reduce_buffer_size = static_cast<size_t>(max_workgroup_size * 8);
const size_t reduce_local_size = max_workgroup_size; const size_t reduce_local_size = static_cast<size_t>(max_workgroup_size);
const size_t reduce_work_groups = reduce_buffer_size / reduce_local_size; const size_t reduce_work_groups = reduce_buffer_size / reduce_local_size;
const size_t reduce_global_size = reduce_buffer_size; const size_t reduce_global_size = reduce_buffer_size;
const size_t reduce_result_size = reduce_work_groups; const size_t reduce_result_size = reduce_work_groups;
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment