ViewVC Help
View File | Revision Log | Show Annotations | Download File
/cvs/OpenCL/OpenCL.xs
(Generate patch)

Comparing OpenCL/OpenCL.xs (file contents):
Revision 1.15 by root, Sun Nov 20 22:29:36 2011 UTC vs.
Revision 1.20 by root, Sat Dec 10 23:07:38 2011 UTC

1#include "EXTERN.h" 1#include "EXTERN.h"
2#include "perl.h" 2#include "perl.h"
3#include "XSUB.h" 3#include "XSUB.h"
4 4
5#ifdef __APPLE__
6 #include <OpenCL/opencl.h>
7#else
5#include <CL/opencl.h> 8 #include <CL/opencl.h>
9#endif
6 10
7typedef cl_platform_id OpenCL__Platform; 11typedef cl_platform_id OpenCL__Platform;
8typedef cl_device_id OpenCL__Device; 12typedef cl_device_id OpenCL__Device;
9typedef cl_context OpenCL__Context; 13typedef cl_context OpenCL__Context;
10typedef cl_command_queue OpenCL__Queue; 14typedef cl_command_queue OpenCL__Queue;
11typedef cl_mem OpenCL__Memory; 15typedef cl_mem OpenCL__Memory;
12typedef cl_mem OpenCL__Buffer; 16typedef cl_mem OpenCL__Buffer;
17typedef cl_mem OpenCL__BufferObj;
13typedef cl_mem OpenCL__Image; 18typedef cl_mem OpenCL__Image;
14typedef cl_mem OpenCL__Image2D; 19typedef cl_mem OpenCL__Image2D;
15typedef cl_mem OpenCL__Image3D; 20typedef cl_mem OpenCL__Image3D;
16typedef cl_mem OpenCL__Memory_ornull; 21typedef cl_mem OpenCL__Memory_ornull;
17typedef cl_mem OpenCL__Buffer_ornull; 22typedef cl_mem OpenCL__Buffer_ornull;
18typedef cl_mem OpenCL__Image_ornull; 23typedef cl_mem OpenCL__Image_ornull;
19typedef cl_mem OpenCL__Image2D_ornull; 24typedef cl_mem OpenCL__Image2D_ornull;
20typedef cl_mem OpenCL__Image3D_ornull; 25typedef cl_mem OpenCL__Image3D_ornull;
21typedef cl_sampler OpenCL__Sampler; 26typedef cl_sampler OpenCL__Sampler;
22typedef cl_program OpenCL__Program; 27typedef cl_program OpenCL__Program;
23typedef cl_kernel OpenCL__Kernel; 28typedef cl_kernel OpenCL__Kernel;
24typedef cl_event OpenCL__Event; 29typedef cl_event OpenCL__Event;
25typedef cl_event OpenCL__UserEvent; 30typedef cl_event OpenCL__UserEvent;
26 31
27typedef SV *FUTURE; 32typedef SV *FUTURE;
28 33
29/*****************************************************************************/ 34/*****************************************************************************/
30 35
137} 142}
138 143
139static cl_event * 144static cl_event *
140event_list (SV **items, int count) 145event_list (SV **items, int count)
141{ 146{
147 if (!count)
148 return 0;
149
142 cl_event *list = tmpbuf (sizeof (cl_event) * count); 150 cl_event *list = tmpbuf (sizeof (cl_event) * count);
143 151
144 while (count--) 152 while (count--)
145 list [count] = SvPTROBJ ("clEnqueue", "wait_events", items [count], "OpenCL::Event"); 153 list [count] = SvPTROBJ ("clEnqueue", "wait_events", items [count], "OpenCL::Event");
146 154
242 250
243#BEGIN:platform 251#BEGIN:platform
244 252
245void 253void
246profile (OpenCL::Platform this) 254profile (OpenCL::Platform this)
255 ALIAS:
256 profile = CL_PLATFORM_PROFILE
257 version = CL_PLATFORM_VERSION
258 name = CL_PLATFORM_NAME
259 vendor = CL_PLATFORM_VENDOR
260 extensions = CL_PLATFORM_EXTENSIONS
247 PPCODE: 261 PPCODE:
248 size_t size; 262 size_t size;
249 NEED_SUCCESS (GetPlatformInfo, (this, CL_PLATFORM_PROFILE, 0, 0, &size)); 263 NEED_SUCCESS (GetPlatformInfo, (this, ix, 0, 0, &size));
250 char *value = tmpbuf (size); 264 char *value = tmpbuf (size);
251 NEED_SUCCESS (GetPlatformInfo, (this, CL_PLATFORM_PROFILE, size, value, 0)); 265 NEED_SUCCESS (GetPlatformInfo, (this, ix, size, value, 0));
252 int i, n = 1;
253 EXTEND (SP, n); 266 EXTEND (SP, 1);
254 for (i = 0; i < n; ++i) 267 const int i = 0;
255 PUSHs (sv_2mortal (newSVpv (value, 0)));
256
257void
258version (OpenCL::Platform this)
259 PPCODE:
260 size_t size;
261 NEED_SUCCESS (GetPlatformInfo, (this, CL_PLATFORM_VERSION, 0, 0, &size));
262 char *value = tmpbuf (size);
263 NEED_SUCCESS (GetPlatformInfo, (this, CL_PLATFORM_VERSION, size, value, 0));
264 int i, n = 1;
265 EXTEND (SP, n);
266 for (i = 0; i < n; ++i)
267 PUSHs (sv_2mortal (newSVpv (value, 0)));
268
269void
270name (OpenCL::Platform this)
271 PPCODE:
272 size_t size;
273 NEED_SUCCESS (GetPlatformInfo, (this, CL_PLATFORM_NAME, 0, 0, &size));
274 char *value = tmpbuf (size);
275 NEED_SUCCESS (GetPlatformInfo, (this, CL_PLATFORM_NAME, size, value, 0));
276 int i, n = 1;
277 EXTEND (SP, n);
278 for (i = 0; i < n; ++i)
279 PUSHs (sv_2mortal (newSVpv (value, 0)));
280
281void
282vendor (OpenCL::Platform this)
283 PPCODE:
284 size_t size;
285 NEED_SUCCESS (GetPlatformInfo, (this, CL_PLATFORM_VENDOR, 0, 0, &size));
286 char *value = tmpbuf (size);
287 NEED_SUCCESS (GetPlatformInfo, (this, CL_PLATFORM_VENDOR, size, value, 0));
288 int i, n = 1;
289 EXTEND (SP, n);
290 for (i = 0; i < n; ++i)
291 PUSHs (sv_2mortal (newSVpv (value, 0)));
292
293void
294extensions (OpenCL::Platform this)
295 PPCODE:
296 size_t size;
297 NEED_SUCCESS (GetPlatformInfo, (this, CL_PLATFORM_EXTENSIONS, 0, 0, &size));
298 char *value = tmpbuf (size);
299 NEED_SUCCESS (GetPlatformInfo, (this, CL_PLATFORM_EXTENSIONS, size, value, 0));
300 int i, n = 1;
301 EXTEND (SP, n);
302 for (i = 0; i < n; ++i)
303 PUSHs (sv_2mortal (newSVpv (value, 0))); 268 PUSHs (sv_2mortal (newSVpv (value, 0)));
304 269
305#END:platform 270#END:platform
306 271
307void 272void
361 const int i = 0; 326 const int i = 0;
362 PUSHs (sv_2mortal (newSViv (value [i]))); 327 PUSHs (sv_2mortal (newSViv (value [i])));
363 328
364void 329void
365vendor_id (OpenCL::Device this) 330vendor_id (OpenCL::Device this)
331 ALIAS:
332 vendor_id = CL_DEVICE_VENDOR_ID
333 max_compute_units = CL_DEVICE_MAX_COMPUTE_UNITS
334 max_work_item_dimensions = CL_DEVICE_MAX_WORK_ITEM_DIMENSIONS
335 preferred_vector_width_char = CL_DEVICE_PREFERRED_VECTOR_WIDTH_CHAR
336 preferred_vector_width_short = CL_DEVICE_PREFERRED_VECTOR_WIDTH_SHORT
337 preferred_vector_width_int = CL_DEVICE_PREFERRED_VECTOR_WIDTH_INT
338 preferred_vector_width_long = CL_DEVICE_PREFERRED_VECTOR_WIDTH_LONG
339 preferred_vector_width_float = CL_DEVICE_PREFERRED_VECTOR_WIDTH_FLOAT
340 preferred_vector_width_double = CL_DEVICE_PREFERRED_VECTOR_WIDTH_DOUBLE
341 max_clock_frequency = CL_DEVICE_MAX_CLOCK_FREQUENCY
342 max_read_image_args = CL_DEVICE_MAX_READ_IMAGE_ARGS
343 max_write_image_args = CL_DEVICE_MAX_WRITE_IMAGE_ARGS
344 image_support = CL_DEVICE_IMAGE_SUPPORT
345 max_samplers = CL_DEVICE_MAX_SAMPLERS
346 mem_base_addr_align = CL_DEVICE_MEM_BASE_ADDR_ALIGN
347 min_data_type_align_size = CL_DEVICE_MIN_DATA_TYPE_ALIGN_SIZE
348 global_mem_cacheline_size = CL_DEVICE_GLOBAL_MEM_CACHELINE_SIZE
349 max_constant_args = CL_DEVICE_MAX_CONSTANT_ARGS
350 preferred_vector_width_half = CL_DEVICE_PREFERRED_VECTOR_WIDTH_HALF
351 native_vector_width_char = CL_DEVICE_NATIVE_VECTOR_WIDTH_CHAR
352 native_vector_width_short = CL_DEVICE_NATIVE_VECTOR_WIDTH_SHORT
353 native_vector_width_int = CL_DEVICE_NATIVE_VECTOR_WIDTH_INT
354 native_vector_width_long = CL_DEVICE_NATIVE_VECTOR_WIDTH_LONG
355 native_vector_width_float = CL_DEVICE_NATIVE_VECTOR_WIDTH_FLOAT
356 native_vector_width_double = CL_DEVICE_NATIVE_VECTOR_WIDTH_DOUBLE
357 native_vector_width_half = CL_DEVICE_NATIVE_VECTOR_WIDTH_HALF
358 reference_count_ext = CL_DEVICE_REFERENCE_COUNT_EXT
366 PPCODE: 359 PPCODE:
367 cl_uint value [1]; 360 cl_uint value [1];
368 NEED_SUCCESS (GetDeviceInfo, (this, CL_DEVICE_VENDOR_ID, sizeof (value), value, 0)); 361 NEED_SUCCESS (GetDeviceInfo, (this, ix, sizeof (value), value, 0));
369 EXTEND (SP, 1);
370 const int i = 0;
371 PUSHs (sv_2mortal (newSVuv (value [i])));
372
373void
374max_compute_units (OpenCL::Device this)
375 PPCODE:
376 cl_uint value [1];
377 NEED_SUCCESS (GetDeviceInfo, (this, CL_DEVICE_MAX_COMPUTE_UNITS, sizeof (value), value, 0));
378 EXTEND (SP, 1);
379 const int i = 0;
380 PUSHs (sv_2mortal (newSVuv (value [i])));
381
382void
383max_work_item_dimensions (OpenCL::Device this)
384 PPCODE:
385 cl_uint value [1];
386 NEED_SUCCESS (GetDeviceInfo, (this, CL_DEVICE_MAX_WORK_ITEM_DIMENSIONS, sizeof (value), value, 0));
387 EXTEND (SP, 1); 362 EXTEND (SP, 1);
388 const int i = 0; 363 const int i = 0;
389 PUSHs (sv_2mortal (newSVuv (value [i]))); 364 PUSHs (sv_2mortal (newSVuv (value [i])));
390 365
391void 366void
392max_work_group_size (OpenCL::Device this) 367max_work_group_size (OpenCL::Device this)
368 ALIAS:
369 max_work_group_size = CL_DEVICE_MAX_WORK_GROUP_SIZE
370 image2d_max_width = CL_DEVICE_IMAGE2D_MAX_WIDTH
371 image2d_max_height = CL_DEVICE_IMAGE2D_MAX_HEIGHT
372 image3d_max_width = CL_DEVICE_IMAGE3D_MAX_WIDTH
373 image3d_max_height = CL_DEVICE_IMAGE3D_MAX_HEIGHT
374 image3d_max_depth = CL_DEVICE_IMAGE3D_MAX_DEPTH
375 max_parameter_size = CL_DEVICE_MAX_PARAMETER_SIZE
376 profiling_timer_resolution = CL_DEVICE_PROFILING_TIMER_RESOLUTION
393 PPCODE: 377 PPCODE:
394 size_t value [1]; 378 size_t value [1];
395 NEED_SUCCESS (GetDeviceInfo, (this, CL_DEVICE_MAX_WORK_GROUP_SIZE, sizeof (value), value, 0)); 379 NEED_SUCCESS (GetDeviceInfo, (this, ix, sizeof (value), value, 0));
396 EXTEND (SP, 1); 380 EXTEND (SP, 1);
397 const int i = 0; 381 const int i = 0;
398 PUSHs (sv_2mortal (newSVuv (value [i]))); 382 PUSHs (sv_2mortal (newSVuv (value [i])));
399 383
400void 384void
408 EXTEND (SP, n); 392 EXTEND (SP, n);
409 for (i = 0; i < n; ++i) 393 for (i = 0; i < n; ++i)
410 PUSHs (sv_2mortal (newSVuv (value [i]))); 394 PUSHs (sv_2mortal (newSVuv (value [i])));
411 395
412void 396void
413preferred_vector_width_char (OpenCL::Device this)
414 PPCODE:
415 cl_uint value [1];
416 NEED_SUCCESS (GetDeviceInfo, (this, CL_DEVICE_PREFERRED_VECTOR_WIDTH_CHAR, sizeof (value), value, 0));
417 EXTEND (SP, 1);
418 const int i = 0;
419 PUSHs (sv_2mortal (newSVuv (value [i])));
420
421void
422preferred_vector_width_short (OpenCL::Device this)
423 PPCODE:
424 cl_uint value [1];
425 NEED_SUCCESS (GetDeviceInfo, (this, CL_DEVICE_PREFERRED_VECTOR_WIDTH_SHORT, sizeof (value), value, 0));
426 EXTEND (SP, 1);
427 const int i = 0;
428 PUSHs (sv_2mortal (newSVuv (value [i])));
429
430void
431preferred_vector_width_int (OpenCL::Device this)
432 PPCODE:
433 cl_uint value [1];
434 NEED_SUCCESS (GetDeviceInfo, (this, CL_DEVICE_PREFERRED_VECTOR_WIDTH_INT, sizeof (value), value, 0));
435 EXTEND (SP, 1);
436 const int i = 0;
437 PUSHs (sv_2mortal (newSVuv (value [i])));
438
439void
440preferred_vector_width_long (OpenCL::Device this)
441 PPCODE:
442 cl_uint value [1];
443 NEED_SUCCESS (GetDeviceInfo, (this, CL_DEVICE_PREFERRED_VECTOR_WIDTH_LONG, sizeof (value), value, 0));
444 EXTEND (SP, 1);
445 const int i = 0;
446 PUSHs (sv_2mortal (newSVuv (value [i])));
447
448void
449preferred_vector_width_float (OpenCL::Device this)
450 PPCODE:
451 cl_uint value [1];
452 NEED_SUCCESS (GetDeviceInfo, (this, CL_DEVICE_PREFERRED_VECTOR_WIDTH_FLOAT, sizeof (value), value, 0));
453 EXTEND (SP, 1);
454 const int i = 0;
455 PUSHs (sv_2mortal (newSVuv (value [i])));
456
457void
458preferred_vector_width_double (OpenCL::Device this)
459 PPCODE:
460 cl_uint value [1];
461 NEED_SUCCESS (GetDeviceInfo, (this, CL_DEVICE_PREFERRED_VECTOR_WIDTH_DOUBLE, sizeof (value), value, 0));
462 EXTEND (SP, 1);
463 const int i = 0;
464 PUSHs (sv_2mortal (newSVuv (value [i])));
465
466void
467max_clock_frequency (OpenCL::Device this)
468 PPCODE:
469 cl_uint value [1];
470 NEED_SUCCESS (GetDeviceInfo, (this, CL_DEVICE_MAX_CLOCK_FREQUENCY, sizeof (value), value, 0));
471 EXTEND (SP, 1);
472 const int i = 0;
473 PUSHs (sv_2mortal (newSVuv (value [i])));
474
475void
476address_bits (OpenCL::Device this) 397address_bits (OpenCL::Device this)
477 PPCODE: 398 PPCODE:
478 cl_bitfield value [1]; 399 cl_bitfield value [1];
479 NEED_SUCCESS (GetDeviceInfo, (this, CL_DEVICE_ADDRESS_BITS, sizeof (value), value, 0)); 400 NEED_SUCCESS (GetDeviceInfo, (this, CL_DEVICE_ADDRESS_BITS, sizeof (value), value, 0));
480 EXTEND (SP, 1); 401 EXTEND (SP, 1);
481 const int i = 0; 402 const int i = 0;
482 PUSHs (sv_2mortal (newSVuv (value [i]))); 403 PUSHs (sv_2mortal (newSVuv (value [i])));
483 404
484void 405void
485max_read_image_args (OpenCL::Device this)
486 PPCODE:
487 cl_uint value [1];
488 NEED_SUCCESS (GetDeviceInfo, (this, CL_DEVICE_MAX_READ_IMAGE_ARGS, sizeof (value), value, 0));
489 EXTEND (SP, 1);
490 const int i = 0;
491 PUSHs (sv_2mortal (newSVuv (value [i])));
492
493void
494max_write_image_args (OpenCL::Device this)
495 PPCODE:
496 cl_uint value [1];
497 NEED_SUCCESS (GetDeviceInfo, (this, CL_DEVICE_MAX_WRITE_IMAGE_ARGS, sizeof (value), value, 0));
498 EXTEND (SP, 1);
499 const int i = 0;
500 PUSHs (sv_2mortal (newSVuv (value [i])));
501
502void
503max_mem_alloc_size (OpenCL::Device this) 406max_mem_alloc_size (OpenCL::Device this)
407 ALIAS:
408 max_mem_alloc_size = CL_DEVICE_MAX_MEM_ALLOC_SIZE
409 global_mem_cache_size = CL_DEVICE_GLOBAL_MEM_CACHE_SIZE
410 global_mem_size = CL_DEVICE_GLOBAL_MEM_SIZE
411 max_constant_buffer_size = CL_DEVICE_MAX_CONSTANT_BUFFER_SIZE
412 local_mem_size = CL_DEVICE_LOCAL_MEM_SIZE
504 PPCODE: 413 PPCODE:
505 cl_ulong value [1]; 414 cl_ulong value [1];
506 NEED_SUCCESS (GetDeviceInfo, (this, CL_DEVICE_MAX_MEM_ALLOC_SIZE, sizeof (value), value, 0));
507 EXTEND (SP, 1);
508 const int i = 0;
509 PUSHs (sv_2mortal (newSVuv (value [i])));
510
511void
512image2d_max_width (OpenCL::Device this)
513 PPCODE:
514 size_t value [1];
515 NEED_SUCCESS (GetDeviceInfo, (this, CL_DEVICE_IMAGE2D_MAX_WIDTH, sizeof (value), value, 0));
516 EXTEND (SP, 1);
517 const int i = 0;
518 PUSHs (sv_2mortal (newSVuv (value [i])));
519
520void
521image2d_max_height (OpenCL::Device this)
522 PPCODE:
523 size_t value [1];
524 NEED_SUCCESS (GetDeviceInfo, (this, CL_DEVICE_IMAGE2D_MAX_HEIGHT, sizeof (value), value, 0));
525 EXTEND (SP, 1);
526 const int i = 0;
527 PUSHs (sv_2mortal (newSVuv (value [i])));
528
529void
530image3d_max_width (OpenCL::Device this)
531 PPCODE:
532 size_t value [1];
533 NEED_SUCCESS (GetDeviceInfo, (this, CL_DEVICE_IMAGE3D_MAX_WIDTH, sizeof (value), value, 0));
534 EXTEND (SP, 1);
535 const int i = 0;
536 PUSHs (sv_2mortal (newSVuv (value [i])));
537
538void
539image3d_max_height (OpenCL::Device this)
540 PPCODE:
541 size_t value [1];
542 NEED_SUCCESS (GetDeviceInfo, (this, CL_DEVICE_IMAGE3D_MAX_HEIGHT, sizeof (value), value, 0));
543 EXTEND (SP, 1);
544 const int i = 0;
545 PUSHs (sv_2mortal (newSVuv (value [i])));
546
547void
548image3d_max_depth (OpenCL::Device this)
549 PPCODE:
550 size_t value [1];
551 NEED_SUCCESS (GetDeviceInfo, (this, CL_DEVICE_IMAGE3D_MAX_DEPTH, sizeof (value), value, 0));
552 EXTEND (SP, 1);
553 const int i = 0;
554 PUSHs (sv_2mortal (newSVuv (value [i])));
555
556void
557image_support (OpenCL::Device this)
558 PPCODE:
559 cl_uint value [1];
560 NEED_SUCCESS (GetDeviceInfo, (this, CL_DEVICE_IMAGE_SUPPORT, sizeof (value), value, 0));
561 EXTEND (SP, 1);
562 const int i = 0;
563 PUSHs (sv_2mortal (newSVuv (value [i])));
564
565void
566max_parameter_size (OpenCL::Device this)
567 PPCODE:
568 size_t value [1];
569 NEED_SUCCESS (GetDeviceInfo, (this, CL_DEVICE_MAX_PARAMETER_SIZE, sizeof (value), value, 0));
570 EXTEND (SP, 1);
571 const int i = 0;
572 PUSHs (sv_2mortal (newSVuv (value [i])));
573
574void
575max_samplers (OpenCL::Device this)
576 PPCODE:
577 cl_uint value [1];
578 NEED_SUCCESS (GetDeviceInfo, (this, CL_DEVICE_MAX_SAMPLERS, sizeof (value), value, 0)); 415 NEED_SUCCESS (GetDeviceInfo, (this, ix, sizeof (value), value, 0));
579 EXTEND (SP, 1);
580 const int i = 0;
581 PUSHs (sv_2mortal (newSVuv (value [i])));
582
583void
584mem_base_addr_align (OpenCL::Device this)
585 PPCODE:
586 cl_uint value [1];
587 NEED_SUCCESS (GetDeviceInfo, (this, CL_DEVICE_MEM_BASE_ADDR_ALIGN, sizeof (value), value, 0));
588 EXTEND (SP, 1);
589 const int i = 0;
590 PUSHs (sv_2mortal (newSVuv (value [i])));
591
592void
593min_data_type_align_size (OpenCL::Device this)
594 PPCODE:
595 cl_uint value [1];
596 NEED_SUCCESS (GetDeviceInfo, (this, CL_DEVICE_MIN_DATA_TYPE_ALIGN_SIZE, sizeof (value), value, 0));
597 EXTEND (SP, 1); 416 EXTEND (SP, 1);
598 const int i = 0; 417 const int i = 0;
599 PUSHs (sv_2mortal (newSVuv (value [i]))); 418 PUSHs (sv_2mortal (newSVuv (value [i])));
600 419
601void 420void
602single_fp_config (OpenCL::Device this) 421single_fp_config (OpenCL::Device this)
422 ALIAS:
423 single_fp_config = CL_DEVICE_SINGLE_FP_CONFIG
424 double_fp_config = CL_DEVICE_DOUBLE_FP_CONFIG
425 half_fp_config = CL_DEVICE_HALF_FP_CONFIG
603 PPCODE: 426 PPCODE:
604 cl_device_fp_config value [1]; 427 cl_device_fp_config value [1];
605 NEED_SUCCESS (GetDeviceInfo, (this, CL_DEVICE_SINGLE_FP_CONFIG, sizeof (value), value, 0)); 428 NEED_SUCCESS (GetDeviceInfo, (this, ix, sizeof (value), value, 0));
606 EXTEND (SP, 1); 429 EXTEND (SP, 1);
607 const int i = 0; 430 const int i = 0;
608 PUSHs (sv_2mortal (newSVuv (value [i]))); 431 PUSHs (sv_2mortal (newSVuv (value [i])));
609 432
610void 433void
615 EXTEND (SP, 1); 438 EXTEND (SP, 1);
616 const int i = 0; 439 const int i = 0;
617 PUSHs (sv_2mortal (newSVuv (value [i]))); 440 PUSHs (sv_2mortal (newSVuv (value [i])));
618 441
619void 442void
620global_mem_cacheline_size (OpenCL::Device this)
621 PPCODE:
622 cl_uint value [1];
623 NEED_SUCCESS (GetDeviceInfo, (this, CL_DEVICE_GLOBAL_MEM_CACHELINE_SIZE, sizeof (value), value, 0));
624 EXTEND (SP, 1);
625 const int i = 0;
626 PUSHs (sv_2mortal (newSVuv (value [i])));
627
628void
629global_mem_cache_size (OpenCL::Device this)
630 PPCODE:
631 cl_ulong value [1];
632 NEED_SUCCESS (GetDeviceInfo, (this, CL_DEVICE_GLOBAL_MEM_CACHE_SIZE, sizeof (value), value, 0));
633 EXTEND (SP, 1);
634 const int i = 0;
635 PUSHs (sv_2mortal (newSVuv (value [i])));
636
637void
638global_mem_size (OpenCL::Device this)
639 PPCODE:
640 cl_ulong value [1];
641 NEED_SUCCESS (GetDeviceInfo, (this, CL_DEVICE_GLOBAL_MEM_SIZE, sizeof (value), value, 0));
642 EXTEND (SP, 1);
643 const int i = 0;
644 PUSHs (sv_2mortal (newSVuv (value [i])));
645
646void
647max_constant_buffer_size (OpenCL::Device this)
648 PPCODE:
649 cl_ulong value [1];
650 NEED_SUCCESS (GetDeviceInfo, (this, CL_DEVICE_MAX_CONSTANT_BUFFER_SIZE, sizeof (value), value, 0));
651 EXTEND (SP, 1);
652 const int i = 0;
653 PUSHs (sv_2mortal (newSVuv (value [i])));
654
655void
656max_constant_args (OpenCL::Device this)
657 PPCODE:
658 cl_uint value [1];
659 NEED_SUCCESS (GetDeviceInfo, (this, CL_DEVICE_MAX_CONSTANT_ARGS, sizeof (value), value, 0));
660 EXTEND (SP, 1);
661 const int i = 0;
662 PUSHs (sv_2mortal (newSVuv (value [i])));
663
664void
665local_mem_type (OpenCL::Device this) 443local_mem_type (OpenCL::Device this)
666 PPCODE: 444 PPCODE:
667 cl_device_local_mem_type value [1]; 445 cl_device_local_mem_type value [1];
668 NEED_SUCCESS (GetDeviceInfo, (this, CL_DEVICE_LOCAL_MEM_TYPE, sizeof (value), value, 0)); 446 NEED_SUCCESS (GetDeviceInfo, (this, CL_DEVICE_LOCAL_MEM_TYPE, sizeof (value), value, 0));
669 EXTEND (SP, 1); 447 EXTEND (SP, 1);
670 const int i = 0; 448 const int i = 0;
671 PUSHs (sv_2mortal (newSVuv (value [i]))); 449 PUSHs (sv_2mortal (newSVuv (value [i])));
672 450
673void 451void
674local_mem_size (OpenCL::Device this)
675 PPCODE:
676 cl_ulong value [1];
677 NEED_SUCCESS (GetDeviceInfo, (this, CL_DEVICE_LOCAL_MEM_SIZE, sizeof (value), value, 0));
678 EXTEND (SP, 1);
679 const int i = 0;
680 PUSHs (sv_2mortal (newSVuv (value [i])));
681
682void
683error_correction_support (OpenCL::Device this) 452error_correction_support (OpenCL::Device this)
453 ALIAS:
454 error_correction_support = CL_DEVICE_ERROR_CORRECTION_SUPPORT
455 endian_little = CL_DEVICE_ENDIAN_LITTLE
456 available = CL_DEVICE_AVAILABLE
457 compiler_available = CL_DEVICE_COMPILER_AVAILABLE
458 host_unified_memory = CL_DEVICE_HOST_UNIFIED_MEMORY
684 PPCODE: 459 PPCODE:
685 cl_bool value [1]; 460 cl_bool value [1];
686 NEED_SUCCESS (GetDeviceInfo, (this, CL_DEVICE_ERROR_CORRECTION_SUPPORT, sizeof (value), value, 0));
687 EXTEND (SP, 1);
688 const int i = 0;
689 PUSHs (sv_2mortal (value [i] ? &PL_sv_yes : &PL_sv_no));
690
691void
692profiling_timer_resolution (OpenCL::Device this)
693 PPCODE:
694 size_t value [1];
695 NEED_SUCCESS (GetDeviceInfo, (this, CL_DEVICE_PROFILING_TIMER_RESOLUTION, sizeof (value), value, 0));
696 EXTEND (SP, 1);
697 const int i = 0;
698 PUSHs (sv_2mortal (newSVuv (value [i])));
699
700void
701endian_little (OpenCL::Device this)
702 PPCODE:
703 cl_bool value [1];
704 NEED_SUCCESS (GetDeviceInfo, (this, CL_DEVICE_ENDIAN_LITTLE, sizeof (value), value, 0));
705 EXTEND (SP, 1);
706 const int i = 0;
707 PUSHs (sv_2mortal (value [i] ? &PL_sv_yes : &PL_sv_no));
708
709void
710available (OpenCL::Device this)
711 PPCODE:
712 cl_bool value [1];
713 NEED_SUCCESS (GetDeviceInfo, (this, CL_DEVICE_AVAILABLE, sizeof (value), value, 0)); 461 NEED_SUCCESS (GetDeviceInfo, (this, ix, sizeof (value), value, 0));
714 EXTEND (SP, 1);
715 const int i = 0;
716 PUSHs (sv_2mortal (value [i] ? &PL_sv_yes : &PL_sv_no));
717
718void
719compiler_available (OpenCL::Device this)
720 PPCODE:
721 cl_bool value [1];
722 NEED_SUCCESS (GetDeviceInfo, (this, CL_DEVICE_COMPILER_AVAILABLE, sizeof (value), value, 0));
723 EXTEND (SP, 1); 462 EXTEND (SP, 1);
724 const int i = 0; 463 const int i = 0;
725 PUSHs (sv_2mortal (value [i] ? &PL_sv_yes : &PL_sv_no)); 464 PUSHs (sv_2mortal (value [i] ? &PL_sv_yes : &PL_sv_no));
726 465
727void 466void
753 PUSHs (NEW_MORTAL_OBJ ("OpenCL::Platform", value [i])); 492 PUSHs (NEW_MORTAL_OBJ ("OpenCL::Platform", value [i]));
754 } 493 }
755 494
756void 495void
757name (OpenCL::Device this) 496name (OpenCL::Device this)
497 ALIAS:
498 name = CL_DEVICE_NAME
499 vendor = CL_DEVICE_VENDOR
500 driver_version = CL_DRIVER_VERSION
501 profile = CL_DEVICE_PROFILE
502 version = CL_DEVICE_VERSION
503 extensions = CL_DEVICE_EXTENSIONS
758 PPCODE: 504 PPCODE:
759 size_t size; 505 size_t size;
760 NEED_SUCCESS (GetDeviceInfo, (this, CL_DEVICE_NAME, 0, 0, &size)); 506 NEED_SUCCESS (GetDeviceInfo, (this, ix, 0, 0, &size));
761 char *value = tmpbuf (size); 507 char *value = tmpbuf (size);
762 NEED_SUCCESS (GetDeviceInfo, (this, CL_DEVICE_NAME, size, value, 0)); 508 NEED_SUCCESS (GetDeviceInfo, (this, ix, size, value, 0));
763 int i, n = 1;
764 EXTEND (SP, n); 509 EXTEND (SP, 1);
765 for (i = 0; i < n; ++i) 510 const int i = 0;
766 PUSHs (sv_2mortal (newSVpv (value, 0))); 511 PUSHs (sv_2mortal (newSVpv (value, 0)));
767
768void
769vendor (OpenCL::Device this)
770 PPCODE:
771 size_t size;
772 NEED_SUCCESS (GetDeviceInfo, (this, CL_DEVICE_VENDOR, 0, 0, &size));
773 char *value = tmpbuf (size);
774 NEED_SUCCESS (GetDeviceInfo, (this, CL_DEVICE_VENDOR, size, value, 0));
775 int i, n = 1;
776 EXTEND (SP, n);
777 for (i = 0; i < n; ++i)
778 PUSHs (sv_2mortal (newSVpv (value, 0)));
779
780void
781driver_version (OpenCL::Device this)
782 PPCODE:
783 size_t size;
784 NEED_SUCCESS (GetDeviceInfo, (this, CL_DRIVER_VERSION, 0, 0, &size));
785 char *value = tmpbuf (size);
786 NEED_SUCCESS (GetDeviceInfo, (this, CL_DRIVER_VERSION, size, value, 0));
787 int i, n = 1;
788 EXTEND (SP, n);
789 for (i = 0; i < n; ++i)
790 PUSHs (sv_2mortal (newSVpv (value, 0)));
791
792void
793profile (OpenCL::Device this)
794 PPCODE:
795 size_t size;
796 NEED_SUCCESS (GetDeviceInfo, (this, CL_DEVICE_PROFILE, 0, 0, &size));
797 char *value = tmpbuf (size);
798 NEED_SUCCESS (GetDeviceInfo, (this, CL_DEVICE_PROFILE, size, value, 0));
799 int i, n = 1;
800 EXTEND (SP, n);
801 for (i = 0; i < n; ++i)
802 PUSHs (sv_2mortal (newSVpv (value, 0)));
803
804void
805version (OpenCL::Device this)
806 PPCODE:
807 size_t size;
808 NEED_SUCCESS (GetDeviceInfo, (this, CL_DEVICE_VERSION, 0, 0, &size));
809 char *value = tmpbuf (size);
810 NEED_SUCCESS (GetDeviceInfo, (this, CL_DEVICE_VERSION, size, value, 0));
811 int i, n = 1;
812 EXTEND (SP, n);
813 for (i = 0; i < n; ++i)
814 PUSHs (sv_2mortal (newSVpv (value, 0)));
815
816void
817extensions (OpenCL::Device this)
818 PPCODE:
819 size_t size;
820 NEED_SUCCESS (GetDeviceInfo, (this, CL_DEVICE_EXTENSIONS, 0, 0, &size));
821 char *value = tmpbuf (size);
822 NEED_SUCCESS (GetDeviceInfo, (this, CL_DEVICE_EXTENSIONS, size, value, 0));
823 int i, n = 1;
824 EXTEND (SP, n);
825 for (i = 0; i < n; ++i)
826 PUSHs (sv_2mortal (newSVpv (value, 0)));
827
828void
829preferred_vector_width_half (OpenCL::Device this)
830 PPCODE:
831 cl_uint value [1];
832 NEED_SUCCESS (GetDeviceInfo, (this, CL_DEVICE_PREFERRED_VECTOR_WIDTH_HALF, sizeof (value), value, 0));
833 EXTEND (SP, 1);
834 const int i = 0;
835 PUSHs (sv_2mortal (newSVuv (value [i])));
836
837void
838native_vector_width_char (OpenCL::Device this)
839 PPCODE:
840 cl_uint value [1];
841 NEED_SUCCESS (GetDeviceInfo, (this, CL_DEVICE_NATIVE_VECTOR_WIDTH_CHAR, sizeof (value), value, 0));
842 EXTEND (SP, 1);
843 const int i = 0;
844 PUSHs (sv_2mortal (newSVuv (value [i])));
845
846void
847native_vector_width_short (OpenCL::Device this)
848 PPCODE:
849 cl_uint value [1];
850 NEED_SUCCESS (GetDeviceInfo, (this, CL_DEVICE_NATIVE_VECTOR_WIDTH_SHORT, sizeof (value), value, 0));
851 EXTEND (SP, 1);
852 const int i = 0;
853 PUSHs (sv_2mortal (newSVuv (value [i])));
854
855void
856native_vector_width_int (OpenCL::Device this)
857 PPCODE:
858 cl_uint value [1];
859 NEED_SUCCESS (GetDeviceInfo, (this, CL_DEVICE_NATIVE_VECTOR_WIDTH_INT, sizeof (value), value, 0));
860 EXTEND (SP, 1);
861 const int i = 0;
862 PUSHs (sv_2mortal (newSVuv (value [i])));
863
864void
865native_vector_width_long (OpenCL::Device this)
866 PPCODE:
867 cl_uint value [1];
868 NEED_SUCCESS (GetDeviceInfo, (this, CL_DEVICE_NATIVE_VECTOR_WIDTH_LONG, sizeof (value), value, 0));
869 EXTEND (SP, 1);
870 const int i = 0;
871 PUSHs (sv_2mortal (newSVuv (value [i])));
872
873void
874native_vector_width_float (OpenCL::Device this)
875 PPCODE:
876 cl_uint value [1];
877 NEED_SUCCESS (GetDeviceInfo, (this, CL_DEVICE_NATIVE_VECTOR_WIDTH_FLOAT, sizeof (value), value, 0));
878 EXTEND (SP, 1);
879 const int i = 0;
880 PUSHs (sv_2mortal (newSVuv (value [i])));
881
882void
883native_vector_width_double (OpenCL::Device this)
884 PPCODE:
885 cl_uint value [1];
886 NEED_SUCCESS (GetDeviceInfo, (this, CL_DEVICE_NATIVE_VECTOR_WIDTH_DOUBLE, sizeof (value), value, 0));
887 EXTEND (SP, 1);
888 const int i = 0;
889 PUSHs (sv_2mortal (newSVuv (value [i])));
890
891void
892native_vector_width_half (OpenCL::Device this)
893 PPCODE:
894 cl_uint value [1];
895 NEED_SUCCESS (GetDeviceInfo, (this, CL_DEVICE_NATIVE_VECTOR_WIDTH_HALF, sizeof (value), value, 0));
896 EXTEND (SP, 1);
897 const int i = 0;
898 PUSHs (sv_2mortal (newSVuv (value [i])));
899
900void
901double_fp_config (OpenCL::Device this)
902 PPCODE:
903 cl_device_fp_config value [1];
904 NEED_SUCCESS (GetDeviceInfo, (this, CL_DEVICE_DOUBLE_FP_CONFIG, sizeof (value), value, 0));
905 EXTEND (SP, 1);
906 const int i = 0;
907 PUSHs (sv_2mortal (newSVuv (value [i])));
908
909void
910half_fp_config (OpenCL::Device this)
911 PPCODE:
912 cl_device_fp_config value [1];
913 NEED_SUCCESS (GetDeviceInfo, (this, CL_DEVICE_HALF_FP_CONFIG, sizeof (value), value, 0));
914 EXTEND (SP, 1);
915 const int i = 0;
916 PUSHs (sv_2mortal (newSVuv (value [i])));
917
918void
919host_unified_memory (OpenCL::Device this)
920 PPCODE:
921 cl_bool value [1];
922 NEED_SUCCESS (GetDeviceInfo, (this, CL_DEVICE_HOST_UNIFIED_MEMORY, sizeof (value), value, 0));
923 EXTEND (SP, 1);
924 const int i = 0;
925 PUSHs (sv_2mortal (value [i] ? &PL_sv_yes : &PL_sv_no));
926 512
927void 513void
928parent_device_ext (OpenCL::Device this) 514parent_device_ext (OpenCL::Device this)
929 PPCODE: 515 PPCODE:
930 cl_device_id value [1]; 516 cl_device_id value [1];
935 PUSHs (NEW_MORTAL_OBJ ("OpenCL::Device", value [i])); 521 PUSHs (NEW_MORTAL_OBJ ("OpenCL::Device", value [i]));
936 } 522 }
937 523
938void 524void
939partition_types_ext (OpenCL::Device this) 525partition_types_ext (OpenCL::Device this)
526 ALIAS:
527 partition_types_ext = CL_DEVICE_PARTITION_TYPES_EXT
528 affinity_domains_ext = CL_DEVICE_AFFINITY_DOMAINS_EXT
529 partition_style_ext = CL_DEVICE_PARTITION_STYLE_EXT
940 PPCODE: 530 PPCODE:
941 size_t size; 531 size_t size;
942 NEED_SUCCESS (GetDeviceInfo, (this, CL_DEVICE_PARTITION_TYPES_EXT, 0, 0, &size)); 532 NEED_SUCCESS (GetDeviceInfo, (this, ix, 0, 0, &size));
943 cl_device_partition_property_ext *value = tmpbuf (size); 533 cl_device_partition_property_ext *value = tmpbuf (size);
944 NEED_SUCCESS (GetDeviceInfo, (this, CL_DEVICE_PARTITION_TYPES_EXT, size, value, 0)); 534 NEED_SUCCESS (GetDeviceInfo, (this, ix, size, value, 0));
945 int i, n = size / sizeof (*value);
946 EXTEND (SP, n);
947 for (i = 0; i < n; ++i)
948 PUSHs (sv_2mortal (newSVuv (value [i])));
949
950void
951affinity_domains_ext (OpenCL::Device this)
952 PPCODE:
953 size_t size;
954 NEED_SUCCESS (GetDeviceInfo, (this, CL_DEVICE_AFFINITY_DOMAINS_EXT, 0, 0, &size));
955 cl_device_partition_property_ext *value = tmpbuf (size);
956 NEED_SUCCESS (GetDeviceInfo, (this, CL_DEVICE_AFFINITY_DOMAINS_EXT, size, value, 0));
957 int i, n = size / sizeof (*value);
958 EXTEND (SP, n);
959 for (i = 0; i < n; ++i)
960 PUSHs (sv_2mortal (newSVuv (value [i])));
961
962void
963reference_count_ext (OpenCL::Device this)
964 PPCODE:
965 cl_uint value [1];
966 NEED_SUCCESS (GetDeviceInfo, (this, CL_DEVICE_REFERENCE_COUNT_EXT , sizeof (value), value, 0));
967 EXTEND (SP, 1);
968 const int i = 0;
969 PUSHs (sv_2mortal (newSVuv (value [i])));
970
971void
972partition_style_ext (OpenCL::Device this)
973 PPCODE:
974 size_t size;
975 NEED_SUCCESS (GetDeviceInfo, (this, CL_DEVICE_PARTITION_STYLE_EXT, 0, 0, &size));
976 cl_device_partition_property_ext *value = tmpbuf (size);
977 NEED_SUCCESS (GetDeviceInfo, (this, CL_DEVICE_PARTITION_STYLE_EXT, size, value, 0));
978 int i, n = size / sizeof (*value); 535 int i, n = size / sizeof (*value);
979 EXTEND (SP, n); 536 EXTEND (SP, n);
980 for (i = 0; i < n; ++i) 537 for (i = 0; i < n; ++i)
981 PUSHs (sv_2mortal (newSVuv (value [i]))); 538 PUSHs (sv_2mortal (newSVuv (value [i])));
982 539
1011 PPCODE: 568 PPCODE:
1012 if (flags & (CL_MEM_USE_HOST_PTR | CL_MEM_COPY_HOST_PTR)) 569 if (flags & (CL_MEM_USE_HOST_PTR | CL_MEM_COPY_HOST_PTR))
1013 croak ("clCreateBuffer: cannot use/copy host ptr when no data is given, use $context->buffer_sv instead?"); 570 croak ("clCreateBuffer: cannot use/copy host ptr when no data is given, use $context->buffer_sv instead?");
1014 571
1015 NEED_SUCCESS_ARG (cl_mem mem, CreateBuffer, (this, flags, len, 0, &res)); 572 NEED_SUCCESS_ARG (cl_mem mem, CreateBuffer, (this, flags, len, 0, &res));
1016 XPUSH_NEW_OBJ ("OpenCL::Buffer", mem); 573 XPUSH_NEW_OBJ ("OpenCL::BufferObj", mem);
1017 574
1018void 575void
1019buffer_sv (OpenCL::Context this, cl_mem_flags flags, SV *data) 576buffer_sv (OpenCL::Context this, cl_mem_flags flags, SV *data)
1020 PPCODE: 577 PPCODE:
1021 STRLEN len; 578 STRLEN len;
1023 580
1024 if (!(flags & (CL_MEM_USE_HOST_PTR | CL_MEM_COPY_HOST_PTR))) 581 if (!(flags & (CL_MEM_USE_HOST_PTR | CL_MEM_COPY_HOST_PTR)))
1025 croak ("clCreateBuffer: have to specify use or copy host ptr when buffer data is given, use $context->buffer instead?"); 582 croak ("clCreateBuffer: have to specify use or copy host ptr when buffer data is given, use $context->buffer instead?");
1026 583
1027 NEED_SUCCESS_ARG (cl_mem mem, CreateBuffer, (this, flags, len, ptr, &res)); 584 NEED_SUCCESS_ARG (cl_mem mem, CreateBuffer, (this, flags, len, ptr, &res));
1028 XPUSH_NEW_OBJ ("OpenCL::Buffer", mem); 585 XPUSH_NEW_OBJ ("OpenCL::BufferObj", mem);
1029 586
1030void 587void
1031image2d (OpenCL::Context this, 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) 588image2d (OpenCL::Context this, 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)
1032 PPCODE: 589 PPCODE:
1033 STRLEN len; 590 STRLEN len;
1086 643
1087#BEGIN:context 644#BEGIN:context
1088 645
1089void 646void
1090reference_count (OpenCL::Context this) 647reference_count (OpenCL::Context this)
648 ALIAS:
649 reference_count = CL_CONTEXT_REFERENCE_COUNT
650 num_devices = CL_CONTEXT_NUM_DEVICES
1091 PPCODE: 651 PPCODE:
1092 cl_uint value [1]; 652 cl_uint value [1];
1093 NEED_SUCCESS (GetContextInfo, (this, CL_CONTEXT_REFERENCE_COUNT, sizeof (value), value, 0)); 653 NEED_SUCCESS (GetContextInfo, (this, ix, sizeof (value), value, 0));
1094 EXTEND (SP, 1); 654 EXTEND (SP, 1);
1095 const int i = 0; 655 const int i = 0;
1096 PUSHs (sv_2mortal (newSVuv (value [i]))); 656 PUSHs (sv_2mortal (newSVuv (value [i])));
1097 657
1098void 658void
1119 int i, n = size / sizeof (*value); 679 int i, n = size / sizeof (*value);
1120 EXTEND (SP, n); 680 EXTEND (SP, n);
1121 for (i = 0; i < n; ++i) 681 for (i = 0; i < n; ++i)
1122 PUSHs (sv_2mortal (newSVuv ((UV)value [i]))); 682 PUSHs (sv_2mortal (newSVuv ((UV)value [i])));
1123 683
1124void
1125num_devices (OpenCL::Context this)
1126 PPCODE:
1127 cl_uint value [1];
1128 NEED_SUCCESS (GetContextInfo, (this, CL_CONTEXT_NUM_DEVICES, sizeof (value), value, 0));
1129 EXTEND (SP, 1);
1130 const int i = 0;
1131 PUSHs (sv_2mortal (newSVuv (value [i])));
1132
1133#END:context 684#END:context
1134 685
1135MODULE = OpenCL PACKAGE = OpenCL::Queue 686MODULE = OpenCL PACKAGE = OpenCL::Queue
1136 687
1137void 688void
1172 PPCODE: 723 PPCODE:
1173 cl_event ev = 0; 724 cl_event ev = 0;
1174 EVENT_LIST (6, items - 6); 725 EVENT_LIST (6, items - 6);
1175 726
1176 NEED_SUCCESS (EnqueueCopyBuffer, (this, src, dst, src_offset, dst_offset, len, event_list_count, event_list_ptr, GIMME_V != G_VOID ? &ev : 0)); 727 NEED_SUCCESS (EnqueueCopyBuffer, (this, src, dst, src_offset, dst_offset, len, event_list_count, event_list_ptr, GIMME_V != G_VOID ? &ev : 0));
728
729 if (ev)
730 XPUSH_NEW_OBJ ("OpenCL::Event", ev);
731
732void
733enqueue_read_buffer_rect (OpenCL::Queue this, OpenCL::Memory buf, cl_bool blocking, size_t buf_x, size_t buf_y, size_t buf_z, size_t host_x, size_t host_y, size_t host_z, size_t width, size_t height, size_t depth, size_t buf_row_pitch, size_t buf_slice_pitch, size_t host_row_pitch, size_t host_slice_pitch, SV *data, ...)
734 PPCODE:
735 cl_event ev = 0;
736 const size_t buf_origin [3] = { buf_x , buf_y , buf_z };
737 const size_t host_origin[3] = { host_x, host_y, host_z };
738 const size_t region[3] = { width, height, depth };
739 EVENT_LIST (17, items - 17);
740
741 if (!buf_row_pitch)
742 buf_row_pitch = region [0];
743
744 if (!buf_slice_pitch)
745 buf_slice_pitch = region [1] * buf_row_pitch;
746
747 if (!host_row_pitch)
748 host_row_pitch = region [0];
749
750 if (!host_slice_pitch)
751 host_slice_pitch = region [1] * host_row_pitch;
752
753 size_t len = host_row_pitch * host_slice_pitch * region [2];
754
755 SvUPGRADE (data, SVt_PV);
756 SvGROW (data, len);
757 SvPOK_only (data);
758 SvCUR_set (data, len);
759 NEED_SUCCESS (EnqueueReadBufferRect, (this, buf, blocking, buf_origin, host_origin, region, buf_row_pitch, buf_slice_pitch, host_row_pitch, host_slice_pitch, SvPVX (data), event_list_count, event_list_ptr, GIMME_V != G_VOID ? &ev : 0));
760
761 if (ev)
762 XPUSH_NEW_OBJ ("OpenCL::Event", ev);
763
764void
765enqueue_write_buffer_rect (OpenCL::Queue this, OpenCL::Memory buf, cl_bool blocking, size_t buf_x, size_t buf_y, size_t buf_z, size_t host_x, size_t host_y, size_t host_z, size_t width, size_t height, size_t depth, size_t buf_row_pitch, size_t buf_slice_pitch, size_t host_row_pitch, size_t host_slice_pitch, SV *data, ...)
766 PPCODE:
767 cl_event ev = 0;
768 const size_t buf_origin [3] = { buf_x , buf_y , buf_z };
769 const size_t host_origin[3] = { host_x, host_y, host_z };
770 const size_t region[3] = { width, height, depth };
771 STRLEN len;
772 char *ptr = SvPVbyte (data, len);
773 EVENT_LIST (17, items - 17);
774
775 if (!buf_row_pitch)
776 buf_row_pitch = region [0];
777
778 if (!buf_slice_pitch)
779 buf_slice_pitch = region [1] * buf_row_pitch;
780
781 if (!host_row_pitch)
782 host_row_pitch = region [0];
783
784 if (!host_slice_pitch)
785 host_slice_pitch = region [1] * host_row_pitch;
786
787 size_t min_len = host_row_pitch * host_slice_pitch * region [2];
788
789 if (len < min_len)
790 croak ("clEnqueueWriteImage: data string is shorter than what would be transferred");
791
792 NEED_SUCCESS (EnqueueWriteBufferRect, (this, buf, blocking, buf_origin, host_origin, region, buf_row_pitch, buf_slice_pitch, host_row_pitch, host_slice_pitch, SvPVX (data), event_list_count, event_list_ptr, GIMME_V != G_VOID ? &ev : 0));
793
794 if (ev)
795 XPUSH_NEW_OBJ ("OpenCL::Event", ev);
796
797void
798enqueue_copy_buffer_rect (OpenCL::Queue this, OpenCL::Buffer src, OpenCL::Buffer dst, size_t src_x, size_t src_y, size_t src_z, size_t dst_x, size_t dst_y, size_t dst_z, size_t width, size_t height, size_t depth, size_t src_row_pitch, size_t src_slice_pitch, size_t dst_row_pitch, size_t dst_slice_pitch, ...)
799 PPCODE:
800 cl_event ev = 0;
801 const size_t src_origin[3] = { src_x, src_y, src_z };
802 const size_t dst_origin[3] = { dst_x, dst_y, dst_z };
803 const size_t region[3] = { width, height, depth };
804 EVENT_LIST (16, items - 16);
805
806 NEED_SUCCESS (EnqueueCopyBufferRect, (this, src, dst, src_origin, dst_origin, region, src_row_pitch, src_slice_pitch, dst_row_pitch, dst_slice_pitch, event_list_count, event_list_ptr, GIMME_V != G_VOID ? &ev : 0));
1177 807
1178 if (ev) 808 if (ev)
1179 XPUSH_NEW_OBJ ("OpenCL::Event", ev); 809 XPUSH_NEW_OBJ ("OpenCL::Event", ev);
1180 810
1181void 811void
1228 858
1229 if (ev) 859 if (ev)
1230 XPUSH_NEW_OBJ ("OpenCL::Event", ev); 860 XPUSH_NEW_OBJ ("OpenCL::Event", ev);
1231 861
1232void 862void
1233enqueue_copy_buffer_rect (OpenCL::Queue this, OpenCL::Buffer src, OpenCL::Buffer dst, size_t src_x, size_t src_y, size_t src_z, size_t dst_x, size_t dst_y, size_t dst_z, size_t width, size_t height, size_t depth, size_t src_row_pitch, size_t src_slice_pitch, size_t dst_row_pitch, size_t dst_slice_pitch, ...)
1234 PPCODE:
1235 cl_event ev = 0;
1236 const size_t src_origin[3] = { src_x, src_y, src_z };
1237 const size_t dst_origin[3] = { dst_x, dst_y, dst_z };
1238 const size_t region[3] = { width, height, depth };
1239 EVENT_LIST (16, items - 16);
1240
1241 NEED_SUCCESS (EnqueueCopyBufferRect, (this, src, dst, src_origin, dst_origin, region, src_row_pitch, src_slice_pitch, dst_row_pitch, dst_slice_pitch, event_list_count, event_list_ptr, GIMME_V != G_VOID ? &ev : 0));
1242
1243 if (ev)
1244 XPUSH_NEW_OBJ ("OpenCL::Event", ev);
1245
1246void
1247enqueue_copy_buffer_to_image (OpenCL::Queue this, OpenCL::Buffer src, OpenCL::Image dst, size_t src_offset, size_t dst_x, size_t dst_y, size_t dst_z, size_t width, size_t height, size_t depth, ...)
1248 PPCODE:
1249 cl_event ev = 0;
1250 const size_t dst_origin[3] = { dst_x, dst_y, dst_z };
1251 const size_t region[3] = { width, height, depth };
1252 EVENT_LIST (10, items - 10);
1253
1254 NEED_SUCCESS (EnqueueCopyBufferToImage, (this, src, dst, src_offset, dst_origin, region, event_list_count, event_list_ptr, GIMME_V != G_VOID ? &ev : 0));
1255
1256 if (ev)
1257 XPUSH_NEW_OBJ ("OpenCL::Event", ev);
1258
1259void
1260enqueue_copy_image (OpenCL::Queue this, OpenCL::Image src, OpenCL::Image dst, size_t src_x, size_t src_y, size_t src_z, size_t dst_x, size_t dst_y, size_t dst_z, size_t width, size_t height, size_t depth, ...) 863enqueue_copy_image (OpenCL::Queue this, OpenCL::Image src, OpenCL::Image dst, size_t src_x, size_t src_y, size_t src_z, size_t dst_x, size_t dst_y, size_t dst_z, size_t width, size_t height, size_t depth, ...)
1261 PPCODE: 864 PPCODE:
1262 cl_event ev = 0; 865 cl_event ev = 0;
1263 const size_t src_origin[3] = { src_x, src_y, src_z }; 866 const size_t src_origin[3] = { src_x, src_y, src_z };
1264 const size_t dst_origin[3] = { dst_x, dst_y, dst_z }; 867 const size_t dst_origin[3] = { dst_x, dst_y, dst_z };
1277 const size_t src_origin[3] = { src_x, src_y, src_z }; 880 const size_t src_origin[3] = { src_x, src_y, src_z };
1278 const size_t region[3] = { width, height, depth }; 881 const size_t region[3] = { width, height, depth };
1279 EVENT_LIST (10, items - 10); 882 EVENT_LIST (10, items - 10);
1280 883
1281 NEED_SUCCESS (EnqueueCopyImageToBuffer, (this, src, dst, src_origin, region, dst_offset, event_list_count, event_list_ptr, GIMME_V != G_VOID ? &ev : 0)); 884 NEED_SUCCESS (EnqueueCopyImageToBuffer, (this, src, dst, src_origin, region, dst_offset, event_list_count, event_list_ptr, GIMME_V != G_VOID ? &ev : 0));
885
886 if (ev)
887 XPUSH_NEW_OBJ ("OpenCL::Event", ev);
888
889void
890enqueue_copy_buffer_to_image (OpenCL::Queue this, OpenCL::Buffer src, OpenCL::Image dst, size_t src_offset, size_t dst_x, size_t dst_y, size_t dst_z, size_t width, size_t height, size_t depth, ...)
891 PPCODE:
892 cl_event ev = 0;
893 const size_t dst_origin[3] = { dst_x, dst_y, dst_z };
894 const size_t region[3] = { width, height, depth };
895 EVENT_LIST (10, items - 10);
896
897 NEED_SUCCESS (EnqueueCopyBufferToImage, (this, src, dst, src_offset, dst_origin, region, event_list_count, event_list_ptr, GIMME_V != G_VOID ? &ev : 0));
1282 898
1283 if (ev) 899 if (ev)
1284 XPUSH_NEW_OBJ ("OpenCL::Event", ev); 900 XPUSH_NEW_OBJ ("OpenCL::Event", ev);
1285 901
1286void 902void
1456 const int i = 0; 1072 const int i = 0;
1457 PUSHs (sv_2mortal (newSViv (value [i]))); 1073 PUSHs (sv_2mortal (newSViv (value [i])));
1458 1074
1459void 1075void
1460size (OpenCL::Memory this) 1076size (OpenCL::Memory this)
1077 ALIAS:
1078 size = CL_MEM_SIZE
1079 offset = CL_MEM_OFFSET
1461 PPCODE: 1080 PPCODE:
1462 size_t value [1]; 1081 size_t value [1];
1463 NEED_SUCCESS (GetMemObjectInfo, (this, CL_MEM_SIZE, sizeof (value), value, 0)); 1082 NEED_SUCCESS (GetMemObjectInfo, (this, ix, sizeof (value), value, 0));
1464 EXTEND (SP, 1); 1083 EXTEND (SP, 1);
1465 const int i = 0; 1084 const int i = 0;
1466 PUSHs (sv_2mortal (newSVuv (value [i]))); 1085 PUSHs (sv_2mortal (newSVuv (value [i])));
1467 1086
1468void 1087void
1474 const int i = 0; 1093 const int i = 0;
1475 PUSHs (sv_2mortal (newSVuv ((IV)(intptr_t)value [i]))); 1094 PUSHs (sv_2mortal (newSVuv ((IV)(intptr_t)value [i])));
1476 1095
1477void 1096void
1478map_count (OpenCL::Memory this) 1097map_count (OpenCL::Memory this)
1098 ALIAS:
1099 map_count = CL_MEM_MAP_COUNT
1100 reference_count = CL_MEM_REFERENCE_COUNT
1479 PPCODE: 1101 PPCODE:
1480 cl_uint value [1]; 1102 cl_uint value [1];
1481 NEED_SUCCESS (GetMemObjectInfo, (this, CL_MEM_MAP_COUNT, sizeof (value), value, 0)); 1103 NEED_SUCCESS (GetMemObjectInfo, (this, ix, sizeof (value), value, 0));
1482 EXTEND (SP, 1);
1483 const int i = 0;
1484 PUSHs (sv_2mortal (newSVuv (value [i])));
1485
1486void
1487reference_count (OpenCL::Memory this)
1488 PPCODE:
1489 cl_uint value [1];
1490 NEED_SUCCESS (GetMemObjectInfo, (this, CL_MEM_REFERENCE_COUNT, sizeof (value), value, 0));
1491 EXTEND (SP, 1); 1104 EXTEND (SP, 1);
1492 const int i = 0; 1105 const int i = 0;
1493 PUSHs (sv_2mortal (newSVuv (value [i]))); 1106 PUSHs (sv_2mortal (newSVuv (value [i])));
1494 1107
1495void 1108void
1514 { 1127 {
1515 NEED_SUCCESS (RetainMemObject, (value [i])); 1128 NEED_SUCCESS (RetainMemObject, (value [i]));
1516 PUSHs (NEW_MORTAL_OBJ ("OpenCL::Memory", value [i])); 1129 PUSHs (NEW_MORTAL_OBJ ("OpenCL::Memory", value [i]));
1517 } 1130 }
1518 1131
1132#END:mem
1133
1134MODULE = OpenCL PACKAGE = OpenCL::BufferObj
1135
1519void 1136void
1520offset (OpenCL::Memory this) 1137sub_buffer_region (OpenCL::BufferObj this, cl_mem_flags flags, size_t origin, size_t size)
1138 PPCODE:
1139 if (flags & (CL_MEM_USE_HOST_PTR | CL_MEM_COPY_HOST_PTR | CL_MEM_ALLOC_HOST_PTR))
1140 croak ("clCreateSubBuffer: cannot use/copy/alloc host ptr, doesn't make sense, check your flags!");
1141
1142 cl_buffer_region crdata = { origin, size };
1143
1144 NEED_SUCCESS_ARG (cl_mem mem, CreateSubBuffer, (this, flags, CL_BUFFER_CREATE_TYPE_REGION, &crdata, &res));
1145 XPUSH_NEW_OBJ ("OpenCL::Buffer", mem);
1146
1147MODULE = OpenCL PACKAGE = OpenCL::Image
1148
1149void
1150image_info (OpenCL::Image this, cl_image_info name)
1151 PPCODE:
1152 INFO (Image)
1153
1154#BEGIN:image
1155
1156void
1157element_size (OpenCL::Image this)
1158 ALIAS:
1159 element_size = CL_IMAGE_ELEMENT_SIZE
1160 row_pitch = CL_IMAGE_ROW_PITCH
1161 slice_pitch = CL_IMAGE_SLICE_PITCH
1162 width = CL_IMAGE_WIDTH
1163 height = CL_IMAGE_HEIGHT
1164 depth = CL_IMAGE_DEPTH
1521 PPCODE: 1165 PPCODE:
1522 size_t value [1]; 1166 size_t value [1];
1523 NEED_SUCCESS (GetMemObjectInfo, (this, CL_MEM_OFFSET, sizeof (value), value, 0));
1524 EXTEND (SP, 1);
1525 const int i = 0;
1526 PUSHs (sv_2mortal (newSVuv (value [i])));
1527
1528#END:mem
1529
1530MODULE = OpenCL PACKAGE = OpenCL::Image
1531
1532void
1533image_info (OpenCL::Image this, cl_image_info name)
1534 PPCODE:
1535 INFO (Image)
1536
1537#BEGIN:image
1538
1539void
1540element_size (OpenCL::Image this)
1541 PPCODE:
1542 size_t value [1];
1543 NEED_SUCCESS (GetImageInfo, (this, CL_IMAGE_ELEMENT_SIZE, sizeof (value), value, 0));
1544 EXTEND (SP, 1);
1545 const int i = 0;
1546 PUSHs (sv_2mortal (newSVuv (value [i])));
1547
1548void
1549row_pitch (OpenCL::Image this)
1550 PPCODE:
1551 size_t value [1];
1552 NEED_SUCCESS (GetImageInfo, (this, CL_IMAGE_ROW_PITCH, sizeof (value), value, 0));
1553 EXTEND (SP, 1);
1554 const int i = 0;
1555 PUSHs (sv_2mortal (newSVuv (value [i])));
1556
1557void
1558slice_pitch (OpenCL::Image this)
1559 PPCODE:
1560 size_t value [1];
1561 NEED_SUCCESS (GetImageInfo, (this, CL_IMAGE_SLICE_PITCH, sizeof (value), value, 0));
1562 EXTEND (SP, 1);
1563 const int i = 0;
1564 PUSHs (sv_2mortal (newSVuv (value [i])));
1565
1566void
1567width (OpenCL::Image this)
1568 PPCODE:
1569 size_t value [1];
1570 NEED_SUCCESS (GetImageInfo, (this, CL_IMAGE_WIDTH, sizeof (value), value, 0)); 1167 NEED_SUCCESS (GetImageInfo, (this, ix, sizeof (value), value, 0));
1571 EXTEND (SP, 1);
1572 const int i = 0;
1573 PUSHs (sv_2mortal (newSVuv (value [i])));
1574
1575void
1576height (OpenCL::Image this)
1577 PPCODE:
1578 size_t value [1];
1579 NEED_SUCCESS (GetImageInfo, (this, CL_IMAGE_HEIGHT, sizeof (value), value, 0));
1580 EXTEND (SP, 1);
1581 const int i = 0;
1582 PUSHs (sv_2mortal (newSVuv (value [i])));
1583
1584void
1585depth (OpenCL::Image this)
1586 PPCODE:
1587 size_t value [1];
1588 NEED_SUCCESS (GetImageInfo, (this, CL_IMAGE_DEPTH, sizeof (value), value, 0));
1589 EXTEND (SP, 1); 1168 EXTEND (SP, 1);
1590 const int i = 0; 1169 const int i = 0;
1591 PUSHs (sv_2mortal (newSVuv (value [i]))); 1170 PUSHs (sv_2mortal (newSVuv (value [i])));
1592 1171
1593#END:image 1172#END:image
1691 const int i = 0; 1270 const int i = 0;
1692 PUSHs (sv_2mortal (newSViv (value [i]))); 1271 PUSHs (sv_2mortal (newSViv (value [i])));
1693 1272
1694void 1273void
1695build_options (OpenCL::Program this, OpenCL::Device device) 1274build_options (OpenCL::Program this, OpenCL::Device device)
1275 ALIAS:
1276 build_options = CL_PROGRAM_BUILD_OPTIONS
1277 build_log = CL_PROGRAM_BUILD_LOG
1696 PPCODE: 1278 PPCODE:
1697 size_t size; 1279 size_t size;
1698 NEED_SUCCESS (GetProgramBuildInfo, (this, device, CL_PROGRAM_BUILD_OPTIONS, 0, 0, &size)); 1280 NEED_SUCCESS (GetProgramBuildInfo, (this, device, ix, 0, 0, &size));
1699 char *value = tmpbuf (size); 1281 char *value = tmpbuf (size);
1700 NEED_SUCCESS (GetProgramBuildInfo, (this, device, CL_PROGRAM_BUILD_OPTIONS, size, value, 0)); 1282 NEED_SUCCESS (GetProgramBuildInfo, (this, device, ix, size, value, 0));
1701 int i, n = 1;
1702 EXTEND (SP, n); 1283 EXTEND (SP, 1);
1703 for (i = 0; i < n; ++i) 1284 const int i = 0;
1704 PUSHs (sv_2mortal (newSVpv (value, 0)));
1705
1706void
1707build_log (OpenCL::Program this, OpenCL::Device device)
1708 PPCODE:
1709 size_t size;
1710 NEED_SUCCESS (GetProgramBuildInfo, (this, device, CL_PROGRAM_BUILD_LOG, 0, 0, &size));
1711 char *value = tmpbuf (size);
1712 NEED_SUCCESS (GetProgramBuildInfo, (this, device, CL_PROGRAM_BUILD_LOG, size, value, 0));
1713 int i, n = 1;
1714 EXTEND (SP, n);
1715 for (i = 0; i < n; ++i)
1716 PUSHs (sv_2mortal (newSVpv (value, 0))); 1285 PUSHs (sv_2mortal (newSVpv (value, 0)));
1717 1286
1718#END:program_build 1287#END:program_build
1719 1288
1720void 1289void
1758 1327
1759#BEGIN:program 1328#BEGIN:program
1760 1329
1761void 1330void
1762reference_count (OpenCL::Program this) 1331reference_count (OpenCL::Program this)
1332 ALIAS:
1333 reference_count = CL_PROGRAM_REFERENCE_COUNT
1334 num_devices = CL_PROGRAM_NUM_DEVICES
1763 PPCODE: 1335 PPCODE:
1764 cl_uint value [1]; 1336 cl_uint value [1];
1765 NEED_SUCCESS (GetProgramInfo, (this, CL_PROGRAM_REFERENCE_COUNT, sizeof (value), value, 0)); 1337 NEED_SUCCESS (GetProgramInfo, (this, ix, sizeof (value), value, 0));
1766 EXTEND (SP, 1); 1338 EXTEND (SP, 1);
1767 const int i = 0; 1339 const int i = 0;
1768 PUSHs (sv_2mortal (newSVuv (value [i]))); 1340 PUSHs (sv_2mortal (newSVuv (value [i])));
1769 1341
1770void 1342void
1776 const int i = 0; 1348 const int i = 0;
1777 { 1349 {
1778 NEED_SUCCESS (RetainContext, (value [i])); 1350 NEED_SUCCESS (RetainContext, (value [i]));
1779 PUSHs (NEW_MORTAL_OBJ ("OpenCL::Context", value [i])); 1351 PUSHs (NEW_MORTAL_OBJ ("OpenCL::Context", value [i]));
1780 } 1352 }
1781
1782void
1783num_devices (OpenCL::Program this)
1784 PPCODE:
1785 cl_uint value [1];
1786 NEED_SUCCESS (GetProgramInfo, (this, CL_PROGRAM_NUM_DEVICES, sizeof (value), value, 0));
1787 EXTEND (SP, 1);
1788 const int i = 0;
1789 PUSHs (sv_2mortal (newSVuv (value [i])));
1790 1353
1791void 1354void
1792devices (OpenCL::Program this) 1355devices (OpenCL::Program this)
1793 PPCODE: 1356 PPCODE:
1794 size_t size; 1357 size_t size;
1807 PPCODE: 1370 PPCODE:
1808 size_t size; 1371 size_t size;
1809 NEED_SUCCESS (GetProgramInfo, (this, CL_PROGRAM_SOURCE, 0, 0, &size)); 1372 NEED_SUCCESS (GetProgramInfo, (this, CL_PROGRAM_SOURCE, 0, 0, &size));
1810 char *value = tmpbuf (size); 1373 char *value = tmpbuf (size);
1811 NEED_SUCCESS (GetProgramInfo, (this, CL_PROGRAM_SOURCE, size, value, 0)); 1374 NEED_SUCCESS (GetProgramInfo, (this, CL_PROGRAM_SOURCE, size, value, 0));
1812 int i, n = 1;
1813 EXTEND (SP, n); 1375 EXTEND (SP, 1);
1814 for (i = 0; i < n; ++i) 1376 const int i = 0;
1815 PUSHs (sv_2mortal (newSVpv (value, 0))); 1377 PUSHs (sv_2mortal (newSVpv (value, 0)));
1816 1378
1817void 1379void
1818binary_sizes (OpenCL::Program this) 1380binary_sizes (OpenCL::Program this)
1819 PPCODE: 1381 PPCODE:
1932 PPCODE: 1494 PPCODE:
1933 size_t size; 1495 size_t size;
1934 NEED_SUCCESS (GetKernelInfo, (this, CL_KERNEL_FUNCTION_NAME, 0, 0, &size)); 1496 NEED_SUCCESS (GetKernelInfo, (this, CL_KERNEL_FUNCTION_NAME, 0, 0, &size));
1935 char *value = tmpbuf (size); 1497 char *value = tmpbuf (size);
1936 NEED_SUCCESS (GetKernelInfo, (this, CL_KERNEL_FUNCTION_NAME, size, value, 0)); 1498 NEED_SUCCESS (GetKernelInfo, (this, CL_KERNEL_FUNCTION_NAME, size, value, 0));
1937 int i, n = 1;
1938 EXTEND (SP, n); 1499 EXTEND (SP, 1);
1939 for (i = 0; i < n; ++i) 1500 const int i = 0;
1940 PUSHs (sv_2mortal (newSVpv (value, 0))); 1501 PUSHs (sv_2mortal (newSVpv (value, 0)));
1941 1502
1942void 1503void
1943num_args (OpenCL::Kernel this) 1504num_args (OpenCL::Kernel this)
1505 ALIAS:
1506 num_args = CL_KERNEL_NUM_ARGS
1507 reference_count = CL_KERNEL_REFERENCE_COUNT
1944 PPCODE: 1508 PPCODE:
1945 cl_uint value [1]; 1509 cl_uint value [1];
1946 NEED_SUCCESS (GetKernelInfo, (this, CL_KERNEL_NUM_ARGS, sizeof (value), value, 0)); 1510 NEED_SUCCESS (GetKernelInfo, (this, ix, sizeof (value), value, 0));
1947 EXTEND (SP, 1);
1948 const int i = 0;
1949 PUSHs (sv_2mortal (newSVuv (value [i])));
1950
1951void
1952reference_count (OpenCL::Kernel this)
1953 PPCODE:
1954 cl_uint value [1];
1955 NEED_SUCCESS (GetKernelInfo, (this, CL_KERNEL_REFERENCE_COUNT, sizeof (value), value, 0));
1956 EXTEND (SP, 1); 1511 EXTEND (SP, 1);
1957 const int i = 0; 1512 const int i = 0;
1958 PUSHs (sv_2mortal (newSVuv (value [i]))); 1513 PUSHs (sv_2mortal (newSVuv (value [i])));
1959 1514
1960void 1515void
1997 1552
1998#BEGIN:kernel_work_group 1553#BEGIN:kernel_work_group
1999 1554
2000void 1555void
2001work_group_size (OpenCL::Kernel this, OpenCL::Device device) 1556work_group_size (OpenCL::Kernel this, OpenCL::Device device)
1557 ALIAS:
1558 work_group_size = CL_KERNEL_WORK_GROUP_SIZE
1559 preferred_work_group_size_multiple = CL_KERNEL_PREFERRED_WORK_GROUP_SIZE_MULTIPLE
2002 PPCODE: 1560 PPCODE:
2003 size_t value [1]; 1561 size_t value [1];
2004 NEED_SUCCESS (GetKernelWorkGroupInfo, (this, device, CL_KERNEL_WORK_GROUP_SIZE, sizeof (value), value, 0)); 1562 NEED_SUCCESS (GetKernelWorkGroupInfo, (this, device, ix, sizeof (value), value, 0));
2005 EXTEND (SP, 1); 1563 EXTEND (SP, 1);
2006 const int i = 0; 1564 const int i = 0;
2007 PUSHs (sv_2mortal (newSVuv (value [i]))); 1565 PUSHs (sv_2mortal (newSVuv (value [i])));
2008 1566
2009void 1567void
2018 for (i = 0; i < n; ++i) 1576 for (i = 0; i < n; ++i)
2019 PUSHs (sv_2mortal (newSVuv (value [i]))); 1577 PUSHs (sv_2mortal (newSVuv (value [i])));
2020 1578
2021void 1579void
2022local_mem_size (OpenCL::Kernel this, OpenCL::Device device) 1580local_mem_size (OpenCL::Kernel this, OpenCL::Device device)
1581 ALIAS:
1582 local_mem_size = CL_KERNEL_LOCAL_MEM_SIZE
1583 private_mem_size = CL_KERNEL_PRIVATE_MEM_SIZE
2023 PPCODE: 1584 PPCODE:
2024 cl_ulong value [1]; 1585 cl_ulong value [1];
2025 NEED_SUCCESS (GetKernelWorkGroupInfo, (this, device, CL_KERNEL_LOCAL_MEM_SIZE, sizeof (value), value, 0)); 1586 NEED_SUCCESS (GetKernelWorkGroupInfo, (this, device, ix, sizeof (value), value, 0));
2026 EXTEND (SP, 1);
2027 const int i = 0;
2028 PUSHs (sv_2mortal (newSVuv (value [i])));
2029
2030void
2031preferred_work_group_size_multiple (OpenCL::Kernel this, OpenCL::Device device)
2032 PPCODE:
2033 size_t value [1];
2034 NEED_SUCCESS (GetKernelWorkGroupInfo, (this, device, CL_KERNEL_PREFERRED_WORK_GROUP_SIZE_MULTIPLE, sizeof (value), value, 0));
2035 EXTEND (SP, 1);
2036 const int i = 0;
2037 PUSHs (sv_2mortal (newSVuv (value [i])));
2038
2039void
2040private_mem_size (OpenCL::Kernel this, OpenCL::Device device)
2041 PPCODE:
2042 cl_ulong value [1];
2043 NEED_SUCCESS (GetKernelWorkGroupInfo, (this, device, CL_KERNEL_PRIVATE_MEM_SIZE, sizeof (value), value, 0));
2044 EXTEND (SP, 1); 1587 EXTEND (SP, 1);
2045 const int i = 0; 1588 const int i = 0;
2046 PUSHs (sv_2mortal (newSVuv (value [i]))); 1589 PUSHs (sv_2mortal (newSVuv (value [i])));
2047 1590
2048#END:kernel_work_group 1591#END:kernel_work_group
2087 const int i = 0; 1630 const int i = 0;
2088 PUSHs (sv_2mortal (newSVuv (value [i]))); 1631 PUSHs (sv_2mortal (newSVuv (value [i])));
2089 1632
2090void 1633void
2091reference_count (OpenCL::Event this) 1634reference_count (OpenCL::Event this)
1635 ALIAS:
1636 reference_count = CL_EVENT_REFERENCE_COUNT
1637 command_execution_status = CL_EVENT_COMMAND_EXECUTION_STATUS
2092 PPCODE: 1638 PPCODE:
2093 cl_uint value [1]; 1639 cl_uint value [1];
2094 NEED_SUCCESS (GetEventInfo, (this, CL_EVENT_REFERENCE_COUNT, sizeof (value), value, 0)); 1640 NEED_SUCCESS (GetEventInfo, (this, ix, sizeof (value), value, 0));
2095 EXTEND (SP, 1);
2096 const int i = 0;
2097 PUSHs (sv_2mortal (newSVuv (value [i])));
2098
2099void
2100command_execution_status (OpenCL::Event this)
2101 PPCODE:
2102 cl_uint value [1];
2103 NEED_SUCCESS (GetEventInfo, (this, CL_EVENT_COMMAND_EXECUTION_STATUS, sizeof (value), value, 0));
2104 EXTEND (SP, 1); 1641 EXTEND (SP, 1);
2105 const int i = 0; 1642 const int i = 0;
2106 PUSHs (sv_2mortal (newSVuv (value [i]))); 1643 PUSHs (sv_2mortal (newSVuv (value [i])));
2107 1644
2108void 1645void
2126 1663
2127#BEGIN:profiling 1664#BEGIN:profiling
2128 1665
2129void 1666void
2130profiling_command_queued (OpenCL::Event this) 1667profiling_command_queued (OpenCL::Event this)
1668 ALIAS:
1669 profiling_command_queued = CL_PROFILING_COMMAND_QUEUED
1670 profiling_command_submit = CL_PROFILING_COMMAND_SUBMIT
1671 profiling_command_start = CL_PROFILING_COMMAND_START
1672 profiling_command_end = CL_PROFILING_COMMAND_END
2131 PPCODE: 1673 PPCODE:
2132 cl_ulong value [1]; 1674 cl_ulong value [1];
2133 NEED_SUCCESS (GetEventProfilingInfo, (this, CL_PROFILING_COMMAND_QUEUED, sizeof (value), value, 0));
2134 EXTEND (SP, 1);
2135 const int i = 0;
2136 PUSHs (sv_2mortal (newSVuv (value [i])));
2137
2138void
2139profiling_command_submit (OpenCL::Event this)
2140 PPCODE:
2141 cl_ulong value [1];
2142 NEED_SUCCESS (GetEventProfilingInfo, (this, CL_PROFILING_COMMAND_SUBMIT, sizeof (value), value, 0));
2143 EXTEND (SP, 1);
2144 const int i = 0;
2145 PUSHs (sv_2mortal (newSVuv (value [i])));
2146
2147void
2148profiling_command_start (OpenCL::Event this)
2149 PPCODE:
2150 cl_ulong value [1];
2151 NEED_SUCCESS (GetEventProfilingInfo, (this, CL_PROFILING_COMMAND_START, sizeof (value), value, 0));
2152 EXTEND (SP, 1);
2153 const int i = 0;
2154 PUSHs (sv_2mortal (newSVuv (value [i])));
2155
2156void
2157profiling_command_end (OpenCL::Event this)
2158 PPCODE:
2159 cl_ulong value [1];
2160 NEED_SUCCESS (GetEventProfilingInfo, (this, CL_PROFILING_COMMAND_END, sizeof (value), value, 0)); 1675 NEED_SUCCESS (GetEventProfilingInfo, (this, ix, sizeof (value), value, 0));
2161 EXTEND (SP, 1); 1676 EXTEND (SP, 1);
2162 const int i = 0; 1677 const int i = 0;
2163 PUSHs (sv_2mortal (newSVuv (value [i]))); 1678 PUSHs (sv_2mortal (newSVuv (value [i])));
2164 1679
2165#END:profiling 1680#END:profiling

Diff Legend

Removed lines
+ Added lines
< Changed lines
> Changed lines