… | |
… | |
11 | // this. This breaks 100% of the opencl 1.1 apps, for what reason? |
11 | // this. This breaks 100% of the opencl 1.1 apps, for what reason? |
12 | // after all, the functions are deprecated, not removed. |
12 | // after all, the functions are deprecated, not removed. |
13 | // in addition, you cannot test for this in any future-proof way. |
13 | // in addition, you cannot test for this in any future-proof way. |
14 | // each time a new opencl version comes out, you need to make a new |
14 | // each time a new opencl version comes out, you need to make a new |
15 | // release. |
15 | // release. |
16 | #define CL_USE_DEPRECATED_OPENCL_1_1_APIS |
|
|
17 | #define CL_USE_DEPRECATED_OPENCL_1_2_APIS /* just guessing, you stupid idiots */ |
16 | #define CL_USE_DEPRECATED_OPENCL_1_2_APIS /* just guessing, you stupid idiots */ |
|
|
17 | |
|
|
18 | #ifndef PREFER_1_1 |
|
|
19 | #define PREFER_1_1 1 |
|
|
20 | #endif |
|
|
21 | |
|
|
22 | #if PREFER_1_1 |
|
|
23 | #define CL_USE_DEPRECATED_OPENCL_1_1_APIS |
|
|
24 | #endif |
18 | |
25 | |
19 | #ifdef __APPLE__ |
26 | #ifdef __APPLE__ |
20 | #include <OpenCL/opencl.h> |
27 | #include <OpenCL/opencl.h> |
21 | #else |
28 | #else |
22 | #include <CL/opencl.h> |
29 | #include <CL/opencl.h> |
23 | #endif |
30 | #endif |
24 | |
31 | |
25 | #if 0 // testing |
|
|
26 | #undef CL_USE_DEPRECATED_OPENCL_1_1_APIS |
|
|
27 | #undef CL_VERSION_1_2 |
32 | #ifndef CL_VERSION_1_2 |
|
|
33 | #undef PREFER_1_1 |
|
|
34 | #define PREFER_1_1 1 |
28 | #endif |
35 | #endif |
29 | |
36 | |
30 | typedef cl_platform_id OpenCL__Platform; |
37 | typedef cl_platform_id OpenCL__Platform; |
31 | typedef cl_device_id OpenCL__Device; |
38 | typedef cl_device_id OpenCL__Device; |
32 | typedef cl_context OpenCL__Context; |
39 | typedef cl_context OpenCL__Context; |
… | |
… | |
393 | |
400 | |
394 | void |
401 | void |
395 | info (OpenCL::Platform self, cl_platform_info name) |
402 | info (OpenCL::Platform self, cl_platform_info name) |
396 | PPCODE: |
403 | PPCODE: |
397 | INFO (Platform) |
404 | INFO (Platform) |
|
|
405 | |
|
|
406 | void |
|
|
407 | unload_compiler (OpenCL::Platform self) |
|
|
408 | CODE: |
|
|
409 | #if CL_VERSION_1_2 |
|
|
410 | clUnloadPlatformCompiler (self); |
|
|
411 | #endif |
398 | |
412 | |
399 | #BEGIN:platform |
413 | #BEGIN:platform |
400 | |
414 | |
401 | void |
415 | void |
402 | profile (OpenCL::Platform self) |
416 | profile (OpenCL::Platform self) |
… | |
… | |
765 | image2d (OpenCL::Context self, cl_mem_flags flags, cl_channel_order channel_order, cl_channel_type channel_type, size_t width, size_t height, size_t row_pitch = 0, SV *data = &PL_sv_undef) |
779 | image2d (OpenCL::Context self, cl_mem_flags flags, cl_channel_order channel_order, cl_channel_type channel_type, size_t width, size_t height, size_t row_pitch = 0, SV *data = &PL_sv_undef) |
766 | PPCODE: |
780 | PPCODE: |
767 | STRLEN len; |
781 | STRLEN len; |
768 | char *ptr = SvOK (data) ? SvPVbyte (data, len) : 0; |
782 | char *ptr = SvOK (data) ? SvPVbyte (data, len) : 0; |
769 | const cl_image_format format = { channel_order, channel_type }; |
783 | const cl_image_format format = { channel_order, channel_type }; |
770 | #if CL_VERSION_1_2 |
784 | #if PREFER_1_1 |
|
|
785 | NEED_SUCCESS_ARG (cl_mem mem, CreateImage2D, (self, flags, &format, width, height, row_pitch, ptr, &res)); |
|
|
786 | #else |
771 | const cl_image_desc desc = { CL_MEM_OBJECT_IMAGE2D, width, height, 0, 0, row_pitch, 0, 0, 0, 0 }; |
787 | const cl_image_desc desc = { CL_MEM_OBJECT_IMAGE2D, width, height, 0, 0, row_pitch, 0, 0, 0, 0 }; |
772 | NEED_SUCCESS_ARG (cl_mem mem, CreateImage, (self, flags, &format, &desc, ptr, &res)); |
788 | NEED_SUCCESS_ARG (cl_mem mem, CreateImage, (self, flags, &format, &desc, ptr, &res)); |
773 | #else |
|
|
774 | NEED_SUCCESS_ARG (cl_mem mem, CreateImage2D, (self, flags, &format, width, height, row_pitch, ptr, &res)); |
|
|
775 | #endif |
789 | #endif |
776 | XPUSH_NEW_OBJ ("OpenCL::Image2D", mem); |
790 | XPUSH_NEW_OBJ ("OpenCL::Image2D", mem); |
777 | |
791 | |
778 | void |
792 | void |
779 | image3d (OpenCL::Context self, cl_mem_flags flags, cl_channel_order channel_order, cl_channel_type channel_type, size_t width, size_t height, size_t depth, size_t row_pitch = 0, size_t slice_pitch = 0, SV *data = &PL_sv_undef) |
793 | image3d (OpenCL::Context self, cl_mem_flags flags, cl_channel_order channel_order, cl_channel_type channel_type, size_t width, size_t height, size_t depth, size_t row_pitch = 0, size_t slice_pitch = 0, SV *data = &PL_sv_undef) |
780 | PPCODE: |
794 | PPCODE: |
781 | STRLEN len; |
795 | STRLEN len; |
782 | char *ptr = SvOK (data) ? SvPVbyte (data, len) : 0; |
796 | char *ptr = SvOK (data) ? SvPVbyte (data, len) : 0; |
783 | const cl_image_format format = { channel_order, channel_type }; |
797 | const cl_image_format format = { channel_order, channel_type }; |
784 | #if CL_VERSION_1_2 |
798 | #if PREFER_1_1 |
|
|
799 | NEED_SUCCESS_ARG (cl_mem mem, CreateImage3D, (self, flags, &format, width, height, depth, row_pitch, slice_pitch, ptr, &res)); |
|
|
800 | #else |
785 | const cl_image_desc desc = { CL_MEM_OBJECT_IMAGE3D, width, height, depth, 0, row_pitch, slice_pitch, 0, 0, 0 }; |
801 | const cl_image_desc desc = { CL_MEM_OBJECT_IMAGE3D, width, height, depth, 0, row_pitch, slice_pitch, 0, 0, 0 }; |
786 | NEED_SUCCESS_ARG (cl_mem mem, CreateImage, (self, flags, &format, &desc, ptr, &res)); |
802 | NEED_SUCCESS_ARG (cl_mem mem, CreateImage, (self, flags, &format, &desc, ptr, &res)); |
787 | #else |
|
|
788 | NEED_SUCCESS_ARG (cl_mem mem, CreateImage3D, (self, flags, &format, width, height, depth, row_pitch, slice_pitch, ptr, &res)); |
|
|
789 | #endif |
803 | #endif |
790 | XPUSH_NEW_OBJ ("OpenCL::Image3D", mem); |
804 | XPUSH_NEW_OBJ ("OpenCL::Image3D", mem); |
791 | |
805 | |
792 | #if cl_apple_gl_sharing || cl_khr_gl_sharing |
806 | #if cl_apple_gl_sharing || cl_khr_gl_sharing |
793 | |
807 | |
… | |
… | |
806 | #if CL_VERSION_1_2 |
820 | #if CL_VERSION_1_2 |
807 | |
821 | |
808 | void |
822 | void |
809 | gl_texture (OpenCL::Context self, cl_mem_flags flags, cl_GLenum target, cl_GLint miplevel, cl_GLuint texture) |
823 | gl_texture (OpenCL::Context self, cl_mem_flags flags, cl_GLenum target, cl_GLint miplevel, cl_GLuint texture) |
810 | ALIAS: |
824 | ALIAS: |
811 | gl_texture2d = 0 |
|
|
812 | gl_texture3d = 0 |
|
|
813 | PPCODE: |
825 | PPCODE: |
814 | NEED_SUCCESS_ARG (cl_mem mem, CreateFromGLTexture, (self, flags, target, miplevel, texture, &res)); |
826 | NEED_SUCCESS_ARG (cl_mem mem, CreateFromGLTexture, (self, flags, target, miplevel, texture, &res)); |
815 | cl_gl_object_type type; |
827 | cl_gl_object_type type; |
816 | NEED_SUCCESS (GetGLObjectInfo, (mem, &type, 0)); // TODO: use target instead? |
828 | NEED_SUCCESS (GetGLObjectInfo, (mem, &type, 0)); // TODO: use target instead? |
817 | char *klass = "OpenCL::Memory"; |
829 | char *klass = "OpenCL::Memory"; |
… | |
… | |
824 | case CL_GL_OBJECT_TEXTURE2D_ARRAY: klass = "OpenCL::Image2DArray"; break; |
836 | case CL_GL_OBJECT_TEXTURE2D_ARRAY: klass = "OpenCL::Image2DArray"; break; |
825 | case CL_GL_OBJECT_TEXTURE3D: klass = "OpenCL::Image3D"; break; |
837 | case CL_GL_OBJECT_TEXTURE3D: klass = "OpenCL::Image3D"; break; |
826 | } |
838 | } |
827 | XPUSH_NEW_OBJ (klass, mem); |
839 | XPUSH_NEW_OBJ (klass, mem); |
828 | |
840 | |
|
|
841 | #endif |
|
|
842 | |
|
|
843 | void |
|
|
844 | gl_texture2d (OpenCL::Context self, cl_mem_flags flags, cl_GLenum target, cl_GLint miplevel, cl_GLuint texture) |
|
|
845 | PPCODE: |
|
|
846 | #if PREFER_1_1 |
|
|
847 | NEED_SUCCESS_ARG (cl_mem mem, CreateFromGLTexture2D, (self, flags, target, miplevel, texture, &res)); |
829 | #else |
848 | #else |
830 | |
|
|
831 | void |
|
|
832 | gl_texture2d (OpenCL::Context self, cl_mem_flags flags, cl_GLenum target, cl_GLint miplevel, cl_GLuint texture) |
|
|
833 | PPCODE: |
|
|
834 | NEED_SUCCESS_ARG (cl_mem mem, CreateFromGLTexture2D, (self, flags, target, miplevel, texture, &res)); |
849 | NEED_SUCCESS_ARG (cl_mem mem, CreateFromGLTexture , (self, flags, target, miplevel, texture, &res)); |
|
|
850 | #endif |
835 | XPUSH_NEW_OBJ ("OpenCL::Image2D", mem); |
851 | XPUSH_NEW_OBJ ("OpenCL::Image2D", mem); |
836 | |
852 | |
837 | void |
853 | void |
838 | gl_texture3d (OpenCL::Context self, cl_mem_flags flags, cl_GLenum target, cl_GLint miplevel, cl_GLuint texture) |
854 | gl_texture3d (OpenCL::Context self, cl_mem_flags flags, cl_GLenum target, cl_GLint miplevel, cl_GLuint texture) |
839 | PPCODE: |
855 | PPCODE: |
|
|
856 | #if PREFER_1_1 |
840 | NEED_SUCCESS_ARG (cl_mem mem, CreateFromGLTexture3D, (self, flags, target, miplevel, texture, &res)); |
857 | NEED_SUCCESS_ARG (cl_mem mem, CreateFromGLTexture3D, (self, flags, target, miplevel, texture, &res)); |
|
|
858 | #else |
|
|
859 | NEED_SUCCESS_ARG (cl_mem mem, CreateFromGLTexture , (self, flags, target, miplevel, texture, &res)); |
|
|
860 | #endif |
841 | XPUSH_NEW_OBJ ("OpenCL::Image3D", mem); |
861 | XPUSH_NEW_OBJ ("OpenCL::Image3D", mem); |
842 | |
|
|
843 | #endif |
|
|
844 | |
862 | |
845 | #endif |
863 | #endif |
846 | |
864 | |
847 | void |
865 | void |
848 | supported_image_formats (OpenCL::Context self, cl_mem_flags flags, cl_mem_object_type image_type) |
866 | supported_image_formats (OpenCL::Context self, cl_mem_flags flags, cl_mem_object_type image_type) |
… | |
… | |
958 | NEED_SUCCESS (EnqueueWriteBuffer, (self, mem, blocking, offset, len, ptr, event_list_count, event_list_ptr, GIMME_V != G_VOID ? &ev : 0)); |
976 | NEED_SUCCESS (EnqueueWriteBuffer, (self, mem, blocking, offset, len, ptr, event_list_count, event_list_ptr, GIMME_V != G_VOID ? &ev : 0)); |
959 | |
977 | |
960 | if (ev) |
978 | if (ev) |
961 | XPUSH_NEW_OBJ ("OpenCL::Event", ev); |
979 | XPUSH_NEW_OBJ ("OpenCL::Event", ev); |
962 | |
980 | |
|
|
981 | #if CL_VERSION_1_2 |
|
|
982 | |
|
|
983 | void |
|
|
984 | enqueue_fill_buffer (OpenCL::Queue self, OpenCL::Buffer mem, SV *data, size_t offset, size_t size, ...) |
|
|
985 | PPCODE: |
|
|
986 | cl_event ev = 0; |
|
|
987 | STRLEN len; |
|
|
988 | char *ptr = SvPVbyte (data, len); |
|
|
989 | EVENT_LIST (5, items - 5); |
|
|
990 | |
|
|
991 | NEED_SUCCESS (EnqueueFillBuffer, (self, mem, ptr, len, offset, size, event_list_count, event_list_ptr, GIMME_V != G_VOID ? &ev : 0)); |
|
|
992 | |
|
|
993 | if (ev) |
|
|
994 | XPUSH_NEW_OBJ ("OpenCL::Event", ev); |
|
|
995 | |
|
|
996 | void |
|
|
997 | enqueue_fill_image (OpenCL::Queue self, OpenCL::Image img, NV r, NV g, NV b, NV a, size_t x, size_t y, size_t z, size_t width, size_t height, size_t depth, ...) |
|
|
998 | PPCODE: |
|
|
999 | cl_event ev = 0; |
|
|
1000 | STRLEN len; |
|
|
1001 | const size_t origin [3] = { x, y, z }; |
|
|
1002 | const size_t region [3] = { width, height, depth }; |
|
|
1003 | EVENT_LIST (12, items - 12); |
|
|
1004 | |
|
|
1005 | const cl_float c_f [4] = { r, g, b, a }; |
|
|
1006 | const cl_uint c_u [4] = { r, g, b, a }; |
|
|
1007 | const cl_int c_s [4] = { r, g, b, a }; |
|
|
1008 | const void *c_fus [3] = { &c_f, &c_u, &c_s }; |
|
|
1009 | static const char fus [] = { 0, 0, 0, 0, 0, 0, 0, 2, 2, 2, 1, 1, 1, 0, 0 }; |
|
|
1010 | cl_image_format format; |
|
|
1011 | NEED_SUCCESS (clGetImageInfo, (img, CL_IMAGE_FORMAT, sizeof (format), &format, 0)); |
|
|
1012 | assert (sizeof (fus) == CL_FLOAT + 1 - CL_SNORM_INT8); |
|
|
1013 | if (format.image_channel_data_type < CL_SNORM_INT8 || CL_FLOAT < format.image_channel_data_type) |
|
|
1014 | croak ("enqueue_fill_image: image has unsupported channel type, only opencl 1.2 channel types supported."); |
|
|
1015 | |
|
|
1016 | NEED_SUCCESS (EnqueueFillImage, (self, img, c_fus [fus [format.image_channel_data_type]], |
|
|
1017 | origin, region, event_list_count, event_list_ptr, GIMME_V != G_VOID ? &ev : 0)); |
|
|
1018 | |
|
|
1019 | if (ev) |
|
|
1020 | XPUSH_NEW_OBJ ("OpenCL::Event", ev); |
|
|
1021 | |
|
|
1022 | #endif |
|
|
1023 | |
963 | void |
1024 | void |
964 | enqueue_copy_buffer (OpenCL::Queue self, OpenCL::Buffer src, OpenCL::Buffer dst, size_t src_offset, size_t dst_offset, size_t len, ...) |
1025 | enqueue_copy_buffer (OpenCL::Queue self, OpenCL::Buffer src, OpenCL::Buffer dst, size_t src_offset, size_t dst_offset, size_t len, ...) |
965 | PPCODE: |
1026 | PPCODE: |
966 | cl_event ev = 0; |
1027 | cl_event ev = 0; |
967 | EVENT_LIST (6, items - 6); |
1028 | EVENT_LIST (6, items - 6); |
… | |
… | |
1232 | if (ev) |
1293 | if (ev) |
1233 | XPUSH_NEW_OBJ ("OpenCL::Event", ev); |
1294 | XPUSH_NEW_OBJ ("OpenCL::Event", ev); |
1234 | |
1295 | |
1235 | #endif |
1296 | #endif |
1236 | |
1297 | |
1237 | #if !CL_VERSION_1_2 || defined CL_USE_DEPRECATED_OPENCL_1_1_APIS |
|
|
1238 | |
|
|
1239 | void |
1298 | void |
1240 | enqueue_wait_for_events (OpenCL::Queue self, ...) |
1299 | enqueue_wait_for_events (OpenCL::Queue self, ...) |
1241 | CODE: |
1300 | CODE: |
1242 | EVENT_LIST (1, items - 1); |
1301 | EVENT_LIST (1, items - 1); |
|
|
1302 | #if PREFER_1_1 |
1243 | NEED_SUCCESS (EnqueueWaitForEvents, (self, event_list_count, event_list_ptr)); |
1303 | NEED_SUCCESS (EnqueueWaitForEvents, (self, event_list_count, event_list_ptr)); |
1244 | |
1304 | #else |
|
|
1305 | NEED_SUCCESS (EnqueueBarrierWithWaitList, (self, event_list_count, event_list_ptr, 0)); |
1245 | #endif |
1306 | #endif |
1246 | |
1307 | |
1247 | void |
1308 | void |
1248 | enqueue_marker (OpenCL::Queue self, ...) |
1309 | enqueue_marker (OpenCL::Queue self, ...) |
1249 | PPCODE: |
1310 | PPCODE: |
1250 | cl_event ev = 0; |
1311 | cl_event ev = 0; |
1251 | EVENT_LIST (1, items - 1); |
1312 | EVENT_LIST (1, items - 1); |
|
|
1313 | #if PREFER_1_1 |
|
|
1314 | if (!event_list_count) |
|
|
1315 | NEED_SUCCESS (EnqueueMarker, (self, GIMME_V != G_VOID ? &ev : 0)); |
|
|
1316 | else |
1252 | #if CL_VERSION_1_2 |
1317 | #if CL_VERSION_1_2 |
|
|
1318 | NEED_SUCCESS (EnqueueMarkerWithWaitList, (self, event_list_count, event_list_ptr, GIMME_V != G_VOID ? &ev : 0)); |
|
|
1319 | #else |
|
|
1320 | NEED_SUCCESS (EnqueueWaitForEvents, (self, event_list_count, event_list_ptr, GIMME_V != G_VOID ? &ev : 0)); // also a barrier |
|
|
1321 | #endif |
|
|
1322 | #else |
1253 | NEED_SUCCESS (EnqueueMarkerWithWaitList, (self, event_list_count, event_list_ptr, GIMME_V != G_VOID ? &ev : 0)); |
1323 | NEED_SUCCESS (EnqueueMarkerWithWaitList, (self, event_list_count, event_list_ptr, GIMME_V != G_VOID ? &ev : 0)); |
1254 | #else |
|
|
1255 | if (event_list_count) |
|
|
1256 | croak ("OpenCL::Queue->enqueue_marker does not support a wait list in OpenCL 1.1 - upgrade to 1.2"); |
|
|
1257 | NEED_SUCCESS (EnqueueMarker, (self, GIMME_V != G_VOID ? &ev : 0)); |
|
|
1258 | #endif |
1324 | #endif |
1259 | if (ev) |
1325 | if (ev) |
1260 | XPUSH_NEW_OBJ ("OpenCL::Event", ev); |
1326 | XPUSH_NEW_OBJ ("OpenCL::Event", ev); |
1261 | |
1327 | |
1262 | void |
1328 | void |
1263 | enqueue_barrier (OpenCL::Queue self, ...) |
1329 | enqueue_barrier (OpenCL::Queue self, ...) |
1264 | PPCODE: |
1330 | PPCODE: |
1265 | cl_event ev = 0; |
1331 | cl_event ev = 0; |
1266 | EVENT_LIST (1, items - 1); |
1332 | EVENT_LIST (1, items - 1); |
|
|
1333 | #if PREFER_1_1 |
|
|
1334 | if (!event_list_count && GIMME_V == G_VOID) |
|
|
1335 | NEED_SUCCESS (EnqueueBarrier, (self)); |
|
|
1336 | else |
1267 | #if CL_VERSION_1_2 |
1337 | #if CL_VERSION_1_2 |
1268 | NEED_SUCCESS (EnqueueBarrierWithWaitList, (self, event_list_count, event_list_ptr, &ev)); |
1338 | NEED_SUCCESS (EnqueueBarrierWithWaitList, (self, event_list_count, event_list_ptr, GIMME_V != G_VOID ? &ev : 0)); |
1269 | #else |
1339 | #else |
|
|
1340 | { |
1270 | if (event_list_count) |
1341 | if (event_list_count) |
1271 | croak ("OpenCL::Queue->enqueue_barrier does not support a wait list in OpenCL 1.1 - upgrade to 1.2"); |
1342 | NEED_SUCCESS (EnqueueWaitForEvents, (self, event_list_count, event_list_ptr, GIMME_V != G_VOID ? &ev : 0)); |
|
|
1343 | |
1272 | if (GIMME_V != G_VOID) |
1344 | if (GIMME_V != G_VOID) |
1273 | croak ("OpenCL::Queue->enqueue_barrier does not return an event object in OpenCL 1.1 - upgrade to 1.2"); |
|
|
1274 | NEED_SUCCESS (EnqueueBarrier, (self)); |
1345 | NEED_SUCCESS (EnqueueMarker, (self, &ev)); |
|
|
1346 | } |
|
|
1347 | #endif |
|
|
1348 | #else |
|
|
1349 | NEED_SUCCESS (EnqueueBarrierWithWaitList, (self, event_list_count, event_list_ptr, GIMME_V != G_VOID ? &ev : 0)); |
1275 | #endif |
1350 | #endif |
1276 | if (ev) |
1351 | if (ev) |
1277 | XPUSH_NEW_OBJ ("OpenCL::Event", ev); |
1352 | XPUSH_NEW_OBJ ("OpenCL::Event", ev); |
1278 | |
1353 | |
1279 | void |
1354 | void |
… | |
… | |
1459 | void |
1534 | void |
1460 | image_info (OpenCL::Image self, cl_image_info name) |
1535 | image_info (OpenCL::Image self, cl_image_info name) |
1461 | PPCODE: |
1536 | PPCODE: |
1462 | INFO (Image) |
1537 | INFO (Image) |
1463 | |
1538 | |
|
|
1539 | void |
|
|
1540 | format (OpenCL::Image self) |
|
|
1541 | PPCODE: |
|
|
1542 | cl_image_format format; |
|
|
1543 | NEED_SUCCESS (GetImageInfo, (self, CL_IMAGE_FORMAT, sizeof (format), &format, 0)); |
|
|
1544 | EXTEND (SP, 2); |
|
|
1545 | PUSHs (sv_2mortal (newSVuv (format.image_channel_order))); |
|
|
1546 | PUSHs (sv_2mortal (newSVuv (format.image_channel_data_type))); |
|
|
1547 | |
1464 | #BEGIN:image |
1548 | #BEGIN:image |
1465 | |
1549 | |
1466 | void |
1550 | void |
1467 | element_size (OpenCL::Image self) |
1551 | element_size (OpenCL::Image self) |
1468 | ALIAS: |
1552 | ALIAS: |
… | |
… | |
1625 | void |
1709 | void |
1626 | kernel (OpenCL::Program program, SV *function) |
1710 | kernel (OpenCL::Program program, SV *function) |
1627 | PPCODE: |
1711 | PPCODE: |
1628 | NEED_SUCCESS_ARG (cl_kernel kernel, CreateKernel, (program, SvPVbyte_nolen (function), &res)); |
1712 | NEED_SUCCESS_ARG (cl_kernel kernel, CreateKernel, (program, SvPVbyte_nolen (function), &res)); |
1629 | XPUSH_NEW_OBJ ("OpenCL::Kernel", kernel); |
1713 | XPUSH_NEW_OBJ ("OpenCL::Kernel", kernel); |
|
|
1714 | |
|
|
1715 | void |
|
|
1716 | kernels_in_program (OpenCL::Program program) |
|
|
1717 | PPCODE: |
|
|
1718 | cl_uint num_kernels; |
|
|
1719 | NEED_SUCCESS (CreateKernelsInProgram, (program, 0, 0, &num_kernels)); |
|
|
1720 | cl_kernel *kernels = tmpbuf (sizeof (cl_kernel) * num_kernels); |
|
|
1721 | NEED_SUCCESS (CreateKernelsInProgram, (program, num_kernels, kernels, 0)); |
|
|
1722 | |
|
|
1723 | int i; |
|
|
1724 | EXTEND (SP, num_kernels); |
|
|
1725 | for (i = 0; i < num_kernels; ++i) |
|
|
1726 | PUSHs (NEW_MORTAL_OBJ ("OpenCL::Kernel", kernels [i])); |
1630 | |
1727 | |
1631 | void |
1728 | void |
1632 | info (OpenCL::Program self, cl_program_info name) |
1729 | info (OpenCL::Program self, cl_program_info name) |
1633 | PPCODE: |
1730 | PPCODE: |
1634 | INFO (Program) |
1731 | INFO (Program) |