Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix build on Ubuntu/GCC 4.8.4 and 4.9.0 #83

Closed
wants to merge 1 commit into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
6 changes: 3 additions & 3 deletions src/c_wrapper/buffer.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ buffer::get_sub_region(size_t orig, size_t size, cl_mem_flags flags) const
cl_buffer_region reg = {orig, size};

auto mem = retry_mem_error([&] {
return pyopencl_call_guarded(clCreateSubBuffer, this, flags,
return pyopencl_call_guarded(clCreateSubBuffer, data(), flags,
CL_BUFFER_CREATE_TYPE_REGION, &reg);
});
return new_buffer(mem);
Expand All @@ -28,7 +28,7 @@ PYOPENCL_USE_RESULT buffer*
buffer::getitem(ssize_t start, ssize_t end) const
{
ssize_t length;
pyopencl_call_guarded(clGetMemObjectInfo, this, CL_MEM_SIZE,
pyopencl_call_guarded(clGetMemObjectInfo, data(), CL_MEM_SIZE,
size_arg(length), nullptr);
if (PYOPENCL_UNLIKELY(length <= 0))
throw clerror("Buffer.__getitem__", CL_INVALID_VALUE,
Expand All @@ -45,7 +45,7 @@ buffer::getitem(ssize_t start, ssize_t end) const
throw clerror("Buffer.__getitem__", CL_INVALID_VALUE,
"Buffer slice should have end > start >= 0");
cl_mem_flags flags;
pyopencl_call_guarded(clGetMemObjectInfo, this, CL_MEM_FLAGS,
pyopencl_call_guarded(clGetMemObjectInfo, data(), CL_MEM_FLAGS,
size_arg(flags), nullptr);
flags &= ~CL_MEM_COPY_HOST_PTR;
return get_sub_region((size_t)start, (size_t)(end - start), flags);
Expand Down
10 changes: 5 additions & 5 deletions src/c_wrapper/command_queue.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ template void print_buf<cl_command_queue>(

command_queue::~command_queue()
{
pyopencl_call_guarded_cleanup(clReleaseCommandQueue, this);
pyopencl_call_guarded_cleanup(clReleaseCommandQueue, data());
}

generic_info
Expand All @@ -22,15 +22,15 @@ command_queue::get_info(cl_uint param_name) const
switch ((cl_command_queue_info)param_name) {
case CL_QUEUE_CONTEXT:
return pyopencl_get_opaque_info(context, CommandQueue,
this, param_name);
data(), param_name);
case CL_QUEUE_DEVICE:
return pyopencl_get_opaque_info(device, CommandQueue, this, param_name);
return pyopencl_get_opaque_info(device, CommandQueue, data(), param_name);
case CL_QUEUE_REFERENCE_COUNT:
return pyopencl_get_int_info(cl_uint, CommandQueue,
this, param_name);
data(), param_name);
case CL_QUEUE_PROPERTIES:
return pyopencl_get_int_info(cl_command_queue_properties,
CommandQueue, this, param_name);
CommandQueue, data(), param_name);
default:
throw clerror("CommandQueue.get_info", CL_INVALID_VALUE);
}
Expand Down
2 changes: 1 addition & 1 deletion src/c_wrapper/command_queue.h
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ class command_queue : public clobj<cl_command_queue> {
: clobj(q)
{
if (retain) {
pyopencl_call_guarded(clRetainCommandQueue, this);
pyopencl_call_guarded(clRetainCommandQueue, data());
}
}
PYOPENCL_INLINE
Expand Down
10 changes: 5 additions & 5 deletions src/c_wrapper/context.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@ context::get_version(cl_context ctx, int *major, int *minor)

context::~context()
{
pyopencl_call_guarded_cleanup(clReleaseContext, this);
pyopencl_call_guarded_cleanup(clReleaseContext, data());
}

generic_info
Expand All @@ -42,13 +42,13 @@ context::get_info(cl_uint param_name) const
switch ((cl_context_info)param_name) {
case CL_CONTEXT_REFERENCE_COUNT:
return pyopencl_get_int_info(cl_uint, Context,
this, param_name);
data(), param_name);
case CL_CONTEXT_DEVICES:
return pyopencl_get_opaque_array_info(device, Context,
this, param_name);
data(), param_name);
case CL_CONTEXT_PROPERTIES: {
auto result = pyopencl_get_vec_info(
cl_context_properties, Context, this, param_name);
cl_context_properties, Context, data(), param_name);
pyopencl_buf<generic_info> py_result(result.len() / 2);
size_t i = 0;
for (;i < py_result.len();i++) {
Expand Down Expand Up @@ -96,7 +96,7 @@ context::get_info(cl_uint param_name) const
#if PYOPENCL_CL_VERSION >= 0x1010
case CL_CONTEXT_NUM_DEVICES:
return pyopencl_get_int_info(cl_uint, Context,
this, param_name);
data(), param_name);
#endif

default:
Expand Down
2 changes: 1 addition & 1 deletion src/c_wrapper/context.h
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ class context : public clobj<cl_context> {
: clobj(ctx)
{
if (retain) {
pyopencl_call_guarded(clRetainContext, this);
pyopencl_call_guarded(clRetainContext, data());
}
}
~context();
Expand Down
42 changes: 21 additions & 21 deletions src/c_wrapper/device.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -25,16 +25,16 @@ device::~device()
else if (m_ref_type == REF_FISSION_EXT) {
#if PYOPENCL_CL_VERSION >= 0x1020
cl_platform_id plat;
pyopencl_call_guarded_cleanup(clGetDeviceInfo, this, CL_DEVICE_PLATFORM,
pyopencl_call_guarded_cleanup(clGetDeviceInfo, data(), CL_DEVICE_PLATFORM,
size_arg(plat), nullptr);
#endif
pyopencl_call_guarded_cleanup(
pyopencl_get_ext_fun(plat, clReleaseDeviceEXT), this);
pyopencl_get_ext_fun(plat, clReleaseDeviceEXT), data());
}
#endif
#if PYOPENCL_CL_VERSION >= 0x1020
else if (m_ref_type == REF_CL_1_2) {
pyopencl_call_guarded_cleanup(clReleaseDevice, this);
pyopencl_call_guarded_cleanup(clReleaseDevice, data());
}
#endif
}
Expand All @@ -43,7 +43,7 @@ generic_info
device::get_info(cl_uint param_name) const
{
#define DEV_GET_INT_INF(TYPE) \
pyopencl_get_int_info(TYPE, Device, this, param_name)
pyopencl_get_int_info(TYPE, Device, data(), param_name)

switch ((cl_device_info)param_name) {
case CL_DEVICE_TYPE:
Expand All @@ -56,7 +56,7 @@ device::get_info(cl_uint param_name) const
return DEV_GET_INT_INF(cl_uint);

case CL_DEVICE_MAX_WORK_ITEM_SIZES:
return pyopencl_get_array_info(size_t, Device, this, param_name);
return pyopencl_get_array_info(size_t, Device, data(), param_name);

case CL_DEVICE_PREFERRED_VECTOR_WIDTH_CHAR:
case CL_DEVICE_PREFERRED_VECTOR_WIDTH_SHORT:
Expand Down Expand Up @@ -128,10 +128,10 @@ device::get_info(cl_uint param_name) const
case CL_DEVICE_PROFILE:
case CL_DEVICE_VERSION:
case CL_DEVICE_EXTENSIONS:
return pyopencl_get_str_info(Device, this, param_name);
return pyopencl_get_str_info(Device, data(), param_name);

case CL_DEVICE_PLATFORM:
return pyopencl_get_opaque_info(platform, Device, this, param_name);
return pyopencl_get_opaque_info(platform, Device, data(), param_name);
#if PYOPENCL_CL_VERSION >= 0x1010
case CL_DEVICE_PREFERRED_VECTOR_WIDTH_HALF:
case CL_DEVICE_NATIVE_VECTOR_WIDTH_CHAR:
Expand All @@ -146,7 +146,7 @@ device::get_info(cl_uint param_name) const
case CL_DEVICE_HOST_UNIFIED_MEMORY:
return DEV_GET_INT_INF(cl_bool);
case CL_DEVICE_OPENCL_C_VERSION:
return pyopencl_get_str_info(Device, this, param_name);
return pyopencl_get_str_info(Device, data(), param_name);
#endif
#ifdef CL_DEVICE_COMPUTE_CAPABILITY_MAJOR_NV
case CL_DEVICE_COMPUTE_CAPABILITY_MAJOR_NV:
Expand All @@ -161,34 +161,34 @@ device::get_info(cl_uint param_name) const
#endif
#if defined(cl_ext_device_fission) && defined(PYOPENCL_USE_DEVICE_FISSION)
case CL_DEVICE_PARENT_DEVICE_EXT:
return pyopencl_get_opaque_info(device, Device, this, param_name);
return pyopencl_get_opaque_info(device, Device, data(), param_name);
case CL_DEVICE_PARTITION_TYPES_EXT:
case CL_DEVICE_AFFINITY_DOMAINS_EXT:
case CL_DEVICE_PARTITION_STYLE_EXT:
return pyopencl_get_array_info(cl_device_partition_property_ext,
Device, this, param_name);
Device, data(), param_name);
case CL_DEVICE_REFERENCE_COUNT_EXT:
return DEV_GET_INT_INF(cl_uint);
#endif
#if PYOPENCL_CL_VERSION >= 0x1020
case CL_DEVICE_LINKER_AVAILABLE:
return DEV_GET_INT_INF(cl_bool);
case CL_DEVICE_BUILT_IN_KERNELS:
return pyopencl_get_str_info(Device, this, param_name);
return pyopencl_get_str_info(Device, data(), param_name);
case CL_DEVICE_IMAGE_MAX_BUFFER_SIZE:
case CL_DEVICE_IMAGE_MAX_ARRAY_SIZE:
return DEV_GET_INT_INF(size_t);
case CL_DEVICE_PARENT_DEVICE:
return pyopencl_get_opaque_info(device, Device, this, param_name);
return pyopencl_get_opaque_info(device, Device, data(), param_name);
case CL_DEVICE_PARTITION_MAX_SUB_DEVICES:
return DEV_GET_INT_INF(cl_uint);
case CL_DEVICE_PARTITION_TYPE:
case CL_DEVICE_PARTITION_PROPERTIES:
return pyopencl_get_array_info(cl_device_partition_property,
Device, this, param_name);
Device, data(), param_name);
case CL_DEVICE_PARTITION_AFFINITY_DOMAIN:
return pyopencl_get_array_info(cl_device_affinity_domain,
Device, this, param_name);
Device, data(), param_name);
case CL_DEVICE_REFERENCE_COUNT:
return DEV_GET_INT_INF(cl_uint);
case CL_DEVICE_PREFERRED_INTEROP_USER_SYNC:
Expand All @@ -210,12 +210,12 @@ device::get_info(cl_uint param_name) const
*/
#ifdef CL_DEVICE_BOARD_NAME_AMD
case CL_DEVICE_BOARD_NAME_AMD: ;
return pyopencl_get_str_info(Device, this, param_name);
return pyopencl_get_str_info(Device, data(), param_name);
#endif
#ifdef CL_DEVICE_GLOBAL_FREE_MEMORY_AMD
case CL_DEVICE_GLOBAL_FREE_MEMORY_AMD:
return pyopencl_get_array_info(size_t, Device,
this, param_name);
data(), param_name);
#endif
#ifdef CL_DEVICE_SIMD_PER_COMPUTE_UNIT_AMD
case CL_DEVICE_SIMD_PER_COMPUTE_UNIT_AMD:
Expand Down Expand Up @@ -262,10 +262,10 @@ device::create_sub_devices(const cl_device_partition_property *props)
{
// TODO debug print props
cl_uint num_devices;
pyopencl_call_guarded(clCreateSubDevices, this, props, 0, nullptr,
pyopencl_call_guarded(clCreateSubDevices, data(), props, 0, nullptr,
buf_arg(num_devices));
pyopencl_buf<cl_device_id> devices(num_devices);
pyopencl_call_guarded(clCreateSubDevices, this, props, devices,
pyopencl_call_guarded(clCreateSubDevices, data(), props, devices,
buf_arg(num_devices));
return buf_to_base<device>(devices, true, device::REF_CL_1_2);
}
Expand All @@ -276,18 +276,18 @@ device::create_sub_devices_ext(const cl_device_partition_property_ext *props)
{
#if PYOPENCL_CL_VERSION >= 0x1020
cl_platform_id plat;
pyopencl_call_guarded(clGetDeviceInfo, this, CL_DEVICE_PLATFORM,
pyopencl_call_guarded(clGetDeviceInfo, data(), CL_DEVICE_PLATFORM,
size_arg(plat), nullptr);
#endif
auto clCreateSubDevicesEXT =
pyopencl_get_ext_fun(plat, clCreateSubDevicesEXT);

// TODO debug print props
cl_uint num_devices;
pyopencl_call_guarded(clCreateSubDevicesEXT, this, props, 0, nullptr,
pyopencl_call_guarded(clCreateSubDevicesEXT, data(), props, 0, nullptr,
buf_arg(num_devices));
pyopencl_buf<cl_device_id> devices(num_devices);
pyopencl_call_guarded(clCreateSubDevicesEXT, this, props, devices,
pyopencl_call_guarded(clCreateSubDevicesEXT, data(), props, devices,
buf_arg(num_devices));
return buf_to_base<device>(devices, true, device::REF_FISSION_EXT);
}
Expand Down
6 changes: 3 additions & 3 deletions src/c_wrapper/device.h
Original file line number Diff line number Diff line change
Expand Up @@ -36,17 +36,17 @@ class device : public clobj<cl_device_id> {
else if (ref_type == REF_FISSION_EXT) {
#if PYOPENCL_CL_VERSION >= 0x1020
cl_platform_id plat;
pyopencl_call_guarded(clGetDeviceInfo, this,
pyopencl_call_guarded(clGetDeviceInfo, data(),
CL_DEVICE_PLATFORM, size_arg(plat),
nullptr);
#endif
pyopencl_call_guarded(
pyopencl_get_ext_fun(plat, clRetainDeviceEXT), this);
pyopencl_get_ext_fun(plat, clRetainDeviceEXT), data());
}
#endif
#if PYOPENCL_CL_VERSION >= 0x1020
else if (ref_type == REF_CL_1_2) {
pyopencl_call_guarded(clRetainDevice, this);
pyopencl_call_guarded(clRetainDevice, data());
}
#endif

Expand Down
18 changes: 9 additions & 9 deletions src/c_wrapper/event.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,7 @@ event::event(cl_event event, bool retain, event_private *p)
{
if (retain) {
try {
pyopencl_call_guarded(clRetainEvent, this);
pyopencl_call_guarded(clRetainEvent, data());
} catch (...) {
m_p->call_finish();
delete m_p;
Expand Down Expand Up @@ -106,25 +106,25 @@ event::release_private() noexcept
event::~event()
{
release_private();
pyopencl_call_guarded_cleanup(clReleaseEvent, this);
pyopencl_call_guarded_cleanup(clReleaseEvent, data());
}

generic_info
event::get_info(cl_uint param_name) const
{
switch ((cl_event_info)param_name) {
case CL_EVENT_COMMAND_QUEUE:
return pyopencl_get_opaque_info(command_queue, Event, this, param_name);
return pyopencl_get_opaque_info(command_queue, Event, data(), param_name);
case CL_EVENT_COMMAND_TYPE:
return pyopencl_get_int_info(cl_command_type, Event,
this, param_name);
data(), param_name);
case CL_EVENT_COMMAND_EXECUTION_STATUS:
return pyopencl_get_int_info(cl_int, Event, this, param_name);
return pyopencl_get_int_info(cl_int, Event, data(), param_name);
case CL_EVENT_REFERENCE_COUNT:
return pyopencl_get_int_info(cl_uint, Event, this, param_name);
return pyopencl_get_int_info(cl_uint, Event, data(), param_name);
#if PYOPENCL_CL_VERSION >= 0x1010
case CL_EVENT_CONTEXT:
return pyopencl_get_opaque_info(context, Event, this, param_name);
return pyopencl_get_opaque_info(context, Event, data(), param_name);
#endif

default:
Expand All @@ -140,7 +140,7 @@ event::get_profiling_info(cl_profiling_info param) const
case CL_PROFILING_COMMAND_SUBMIT:
case CL_PROFILING_COMMAND_START:
case CL_PROFILING_COMMAND_END:
return pyopencl_get_int_info(cl_ulong, EventProfiling, this, param);
return pyopencl_get_int_info(cl_ulong, EventProfiling, data(), param);
default:
throw clerror("Event.get_profiling_info", CL_INVALID_VALUE);
}
Expand Down Expand Up @@ -195,7 +195,7 @@ class user_event : public event {
PYOPENCL_INLINE void
set_status(cl_int status)
{
pyopencl_call_guarded(clSetUserEventStatus, this, status);
pyopencl_call_guarded(clSetUserEventStatus, data(), status);
}
};
#endif
Expand Down
2 changes: 1 addition & 1 deletion src/c_wrapper/event.h
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,7 @@ class event : public clobj<cl_event> {
auto func = new rm_ref_t<Func>(std::forward<Func>(_func));
try {
pyopencl_call_guarded(
clSetEventCallback, this, type,
clSetEventCallback, data(), type,
[] (cl_event, cl_int status, void *data) {
rm_ref_t<Func> *func = static_cast<rm_ref_t<Func>*>(data);
std::thread t([func, status] () {
Expand Down
6 changes: 3 additions & 3 deletions src/c_wrapper/image.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ image::get_image_info(cl_image_info param) const
{
switch (param) {
case CL_IMAGE_FORMAT:
return pyopencl_get_int_info(cl_image_format, Image, this, param);
return pyopencl_get_int_info(cl_image_format, Image, data(), param);
case CL_IMAGE_ELEMENT_SIZE:
case CL_IMAGE_ROW_PITCH:
case CL_IMAGE_SLICE_PITCH:
Expand All @@ -27,7 +27,7 @@ image::get_image_info(cl_image_info param) const
#if PYOPENCL_CL_VERSION >= 0x1020
case CL_IMAGE_ARRAY_SIZE:
#endif
return pyopencl_get_int_info(size_t, Image, this, param);
return pyopencl_get_int_info(size_t, Image, data(), param);

#if PYOPENCL_CL_VERSION >= 0x1020
// TODO:
Expand All @@ -44,7 +44,7 @@ image::get_image_info(cl_image_info param) const
// }
case CL_IMAGE_NUM_MIP_LEVELS:
case CL_IMAGE_NUM_SAMPLES:
return pyopencl_get_int_info(cl_uint, Image, this, param);
return pyopencl_get_int_info(cl_uint, Image, data(), param);
#endif
default:
throw clerror("Image.get_image_info", CL_INVALID_VALUE);
Expand Down
2 changes: 1 addition & 1 deletion src/c_wrapper/image.h
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ class image : public memory_object {
format()
{
if (!m_format.image_channel_data_type) {
pyopencl_call_guarded(clGetImageInfo, this, CL_IMAGE_FORMAT,
pyopencl_call_guarded(clGetImageInfo, data(), CL_IMAGE_FORMAT,
size_arg(m_format), nullptr);
}
return m_format;
Expand Down