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

Comparing OpenCL/OpenCL.xs (file contents):
Revision 1.14 by root, Sun Nov 20 10:21:27 2011 UTC vs.
Revision 1.16 by root, Tue Nov 22 10:29:18 2011 UTC

2#include "perl.h" 2#include "perl.h"
3#include "XSUB.h" 3#include "XSUB.h"
4 4
5#include <CL/opencl.h> 5#include <CL/opencl.h>
6 6
7typedef cl_platform_id OpenCL__Platform; 7typedef cl_platform_id OpenCL__Platform;
8typedef cl_device_id OpenCL__Device; 8typedef cl_device_id OpenCL__Device;
9typedef cl_context OpenCL__Context; 9typedef cl_context OpenCL__Context;
10typedef cl_command_queue OpenCL__Queue; 10typedef cl_command_queue OpenCL__Queue;
11typedef cl_mem OpenCL__Memory; 11typedef cl_mem OpenCL__Memory;
12typedef cl_mem OpenCL__Buffer; 12typedef cl_mem OpenCL__Buffer;
13typedef cl_mem OpenCL__Image; 13typedef cl_mem OpenCL__Image;
14typedef cl_mem OpenCL__Image2D; 14typedef cl_mem OpenCL__Image2D;
15typedef cl_mem OpenCL__Image3D; 15typedef cl_mem OpenCL__Image3D;
16typedef cl_mem OpenCL__Memory_ornull; 16typedef cl_mem OpenCL__Memory_ornull;
17typedef cl_mem OpenCL__Buffer_ornull; 17typedef cl_mem OpenCL__Buffer_ornull;
18typedef cl_mem OpenCL__Image_ornull; 18typedef cl_mem OpenCL__Image_ornull;
19typedef cl_mem OpenCL__Image2D_ornull; 19typedef cl_mem OpenCL__Image2D_ornull;
20typedef cl_mem OpenCL__Image3D_ornull; 20typedef cl_mem OpenCL__Image3D_ornull;
21typedef cl_sampler OpenCL__Sampler; 21typedef cl_sampler OpenCL__Sampler;
22typedef cl_program OpenCL__Program; 22typedef cl_program OpenCL__Program;
23typedef cl_kernel OpenCL__Kernel; 23typedef cl_kernel OpenCL__Kernel;
24typedef cl_event OpenCL__Event; 24typedef cl_event OpenCL__Event;
25typedef cl_event OpenCL__UserEvent; 25typedef cl_event OpenCL__UserEvent;
26 26
27typedef SV *FUTURE; 27typedef SV *FUTURE;
28 28
29/*****************************************************************************/ 29/*****************************************************************************/
30 30
242 242
243#BEGIN:platform 243#BEGIN:platform
244 244
245void 245void
246profile (OpenCL::Platform this) 246profile (OpenCL::Platform this)
247 ALIAS:
248 profile = CL_PLATFORM_PROFILE
249 version = CL_PLATFORM_VERSION
250 name = CL_PLATFORM_NAME
251 vendor = CL_PLATFORM_VENDOR
252 extensions = CL_PLATFORM_EXTENSIONS
247 PPCODE: 253 PPCODE:
248 size_t size; 254 size_t size;
249 NEED_SUCCESS (GetPlatformInfo, (this, CL_PLATFORM_PROFILE, 0, 0, &size)); 255 NEED_SUCCESS (GetPlatformInfo, (this, ix, 0, 0, &size));
250 char *value = tmpbuf (size); 256 char *value = tmpbuf (size);
251 NEED_SUCCESS (GetPlatformInfo, (this, CL_PLATFORM_PROFILE, size, value, 0)); 257 NEED_SUCCESS (GetPlatformInfo, (this, ix, size, value, 0));
252 int i, n = 1;
253 EXTEND (SP, n); 258 EXTEND (SP, 1);
254 for (i = 0; i < n; ++i) 259 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))); 260 PUSHs (sv_2mortal (newSVpv (value, 0)));
304 261
305#END:platform 262#END:platform
306 263
307void 264void
361 const int i = 0; 318 const int i = 0;
362 PUSHs (sv_2mortal (newSViv (value [i]))); 319 PUSHs (sv_2mortal (newSViv (value [i])));
363 320
364void 321void
365vendor_id (OpenCL::Device this) 322vendor_id (OpenCL::Device this)
323 ALIAS:
324 vendor_id = CL_DEVICE_VENDOR_ID
325 max_compute_units = CL_DEVICE_MAX_COMPUTE_UNITS
326 max_work_item_dimensions = CL_DEVICE_MAX_WORK_ITEM_DIMENSIONS
327 preferred_vector_width_char = CL_DEVICE_PREFERRED_VECTOR_WIDTH_CHAR
328 preferred_vector_width_short = CL_DEVICE_PREFERRED_VECTOR_WIDTH_SHORT
329 preferred_vector_width_int = CL_DEVICE_PREFERRED_VECTOR_WIDTH_INT
330 preferred_vector_width_long = CL_DEVICE_PREFERRED_VECTOR_WIDTH_LONG
331 preferred_vector_width_float = CL_DEVICE_PREFERRED_VECTOR_WIDTH_FLOAT
332 preferred_vector_width_double = CL_DEVICE_PREFERRED_VECTOR_WIDTH_DOUBLE
333 max_clock_frequency = CL_DEVICE_MAX_CLOCK_FREQUENCY
334 max_read_image_args = CL_DEVICE_MAX_READ_IMAGE_ARGS
335 max_write_image_args = CL_DEVICE_MAX_WRITE_IMAGE_ARGS
336 image_support = CL_DEVICE_IMAGE_SUPPORT
337 max_samplers = CL_DEVICE_MAX_SAMPLERS
338 mem_base_addr_align = CL_DEVICE_MEM_BASE_ADDR_ALIGN
339 min_data_type_align_size = CL_DEVICE_MIN_DATA_TYPE_ALIGN_SIZE
340 global_mem_cacheline_size = CL_DEVICE_GLOBAL_MEM_CACHELINE_SIZE
341 max_constant_args = CL_DEVICE_MAX_CONSTANT_ARGS
342 preferred_vector_width_half = CL_DEVICE_PREFERRED_VECTOR_WIDTH_HALF
343 native_vector_width_char = CL_DEVICE_NATIVE_VECTOR_WIDTH_CHAR
344 native_vector_width_short = CL_DEVICE_NATIVE_VECTOR_WIDTH_SHORT
345 native_vector_width_int = CL_DEVICE_NATIVE_VECTOR_WIDTH_INT
346 native_vector_width_long = CL_DEVICE_NATIVE_VECTOR_WIDTH_LONG
347 native_vector_width_float = CL_DEVICE_NATIVE_VECTOR_WIDTH_FLOAT
348 native_vector_width_double = CL_DEVICE_NATIVE_VECTOR_WIDTH_DOUBLE
349 native_vector_width_half = CL_DEVICE_NATIVE_VECTOR_WIDTH_HALF
350 reference_count_ext = CL_DEVICE_REFERENCE_COUNT_EXT
366 PPCODE: 351 PPCODE:
367 cl_uint value [1]; 352 cl_uint value [1];
368 NEED_SUCCESS (GetDeviceInfo, (this, CL_DEVICE_VENDOR_ID, sizeof (value), value, 0)); 353 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); 354 EXTEND (SP, 1);
388 const int i = 0; 355 const int i = 0;
389 PUSHs (sv_2mortal (newSVuv (value [i]))); 356 PUSHs (sv_2mortal (newSVuv (value [i])));
390 357
391void 358void
392max_work_group_size (OpenCL::Device this) 359max_work_group_size (OpenCL::Device this)
360 ALIAS:
361 max_work_group_size = CL_DEVICE_MAX_WORK_GROUP_SIZE
362 image2d_max_width = CL_DEVICE_IMAGE2D_MAX_WIDTH
363 image2d_max_height = CL_DEVICE_IMAGE2D_MAX_HEIGHT
364 image3d_max_width = CL_DEVICE_IMAGE3D_MAX_WIDTH
365 image3d_max_height = CL_DEVICE_IMAGE3D_MAX_HEIGHT
366 image3d_max_depth = CL_DEVICE_IMAGE3D_MAX_DEPTH
367 max_parameter_size = CL_DEVICE_MAX_PARAMETER_SIZE
368 profiling_timer_resolution = CL_DEVICE_PROFILING_TIMER_RESOLUTION
393 PPCODE: 369 PPCODE:
394 size_t value [1]; 370 size_t value [1];
395 NEED_SUCCESS (GetDeviceInfo, (this, CL_DEVICE_MAX_WORK_GROUP_SIZE, sizeof (value), value, 0)); 371 NEED_SUCCESS (GetDeviceInfo, (this, ix, sizeof (value), value, 0));
396 EXTEND (SP, 1); 372 EXTEND (SP, 1);
397 const int i = 0; 373 const int i = 0;
398 PUSHs (sv_2mortal (newSVuv (value [i]))); 374 PUSHs (sv_2mortal (newSVuv (value [i])));
399 375
400void 376void
402 PPCODE: 378 PPCODE:
403 size_t size; 379 size_t size;
404 NEED_SUCCESS (GetDeviceInfo, (this, CL_DEVICE_MAX_WORK_ITEM_SIZES, 0, 0, &size)); 380 NEED_SUCCESS (GetDeviceInfo, (this, CL_DEVICE_MAX_WORK_ITEM_SIZES, 0, 0, &size));
405 size_t *value = tmpbuf (size); 381 size_t *value = tmpbuf (size);
406 NEED_SUCCESS (GetDeviceInfo, (this, CL_DEVICE_MAX_WORK_ITEM_SIZES, size, value, 0)); 382 NEED_SUCCESS (GetDeviceInfo, (this, CL_DEVICE_MAX_WORK_ITEM_SIZES, size, value, 0));
407 int i, n = size / sizeof (value [0]); 383 int i, n = size / sizeof (*value);
408 EXTEND (SP, n); 384 EXTEND (SP, n);
409 for (i = 0; i < n; ++i) 385 for (i = 0; i < n; ++i)
410 PUSHs (sv_2mortal (newSVuv (value [i]))); 386 PUSHs (sv_2mortal (newSVuv (value [i])));
411 387
412void 388void
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) 389address_bits (OpenCL::Device this)
477 PPCODE: 390 PPCODE:
478 cl_bitfield value [1]; 391 cl_bitfield value [1];
479 NEED_SUCCESS (GetDeviceInfo, (this, CL_DEVICE_ADDRESS_BITS, sizeof (value), value, 0)); 392 NEED_SUCCESS (GetDeviceInfo, (this, CL_DEVICE_ADDRESS_BITS, sizeof (value), value, 0));
480 EXTEND (SP, 1); 393 EXTEND (SP, 1);
481 const int i = 0; 394 const int i = 0;
482 PUSHs (sv_2mortal (newSVuv (value [i]))); 395 PUSHs (sv_2mortal (newSVuv (value [i])));
483 396
484void 397void
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) 398max_mem_alloc_size (OpenCL::Device this)
399 ALIAS:
400 max_mem_alloc_size = CL_DEVICE_MAX_MEM_ALLOC_SIZE
401 global_mem_cache_size = CL_DEVICE_GLOBAL_MEM_CACHE_SIZE
402 global_mem_size = CL_DEVICE_GLOBAL_MEM_SIZE
403 max_constant_buffer_size = CL_DEVICE_MAX_CONSTANT_BUFFER_SIZE
404 local_mem_size = CL_DEVICE_LOCAL_MEM_SIZE
504 PPCODE: 405 PPCODE:
505 cl_ulong value [1]; 406 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)); 407 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); 408 EXTEND (SP, 1);
598 const int i = 0; 409 const int i = 0;
599 PUSHs (sv_2mortal (newSVuv (value [i]))); 410 PUSHs (sv_2mortal (newSVuv (value [i])));
600 411
601void 412void
602single_fp_config (OpenCL::Device this) 413single_fp_config (OpenCL::Device this)
414 ALIAS:
415 single_fp_config = CL_DEVICE_SINGLE_FP_CONFIG
416 double_fp_config = CL_DEVICE_DOUBLE_FP_CONFIG
417 half_fp_config = CL_DEVICE_HALF_FP_CONFIG
603 PPCODE: 418 PPCODE:
604 cl_device_fp_config value [1]; 419 cl_device_fp_config value [1];
605 NEED_SUCCESS (GetDeviceInfo, (this, CL_DEVICE_SINGLE_FP_CONFIG, sizeof (value), value, 0)); 420 NEED_SUCCESS (GetDeviceInfo, (this, ix, sizeof (value), value, 0));
606 EXTEND (SP, 1); 421 EXTEND (SP, 1);
607 const int i = 0; 422 const int i = 0;
608 PUSHs (sv_2mortal (newSVuv (value [i]))); 423 PUSHs (sv_2mortal (newSVuv (value [i])));
609 424
610void 425void
615 EXTEND (SP, 1); 430 EXTEND (SP, 1);
616 const int i = 0; 431 const int i = 0;
617 PUSHs (sv_2mortal (newSVuv (value [i]))); 432 PUSHs (sv_2mortal (newSVuv (value [i])));
618 433
619void 434void
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) 435local_mem_type (OpenCL::Device this)
666 PPCODE: 436 PPCODE:
667 cl_device_local_mem_type value [1]; 437 cl_device_local_mem_type value [1];
668 NEED_SUCCESS (GetDeviceInfo, (this, CL_DEVICE_LOCAL_MEM_TYPE, sizeof (value), value, 0)); 438 NEED_SUCCESS (GetDeviceInfo, (this, CL_DEVICE_LOCAL_MEM_TYPE, sizeof (value), value, 0));
669 EXTEND (SP, 1); 439 EXTEND (SP, 1);
670 const int i = 0; 440 const int i = 0;
671 PUSHs (sv_2mortal (newSVuv (value [i]))); 441 PUSHs (sv_2mortal (newSVuv (value [i])));
672 442
673void 443void
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) 444error_correction_support (OpenCL::Device this)
445 ALIAS:
446 error_correction_support = CL_DEVICE_ERROR_CORRECTION_SUPPORT
447 endian_little = CL_DEVICE_ENDIAN_LITTLE
448 available = CL_DEVICE_AVAILABLE
449 compiler_available = CL_DEVICE_COMPILER_AVAILABLE
450 host_unified_memory = CL_DEVICE_HOST_UNIFIED_MEMORY
684 PPCODE: 451 PPCODE:
685 cl_bool value [1]; 452 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)); 453 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); 454 EXTEND (SP, 1);
724 const int i = 0; 455 const int i = 0;
725 PUSHs (sv_2mortal (value [i] ? &PL_sv_yes : &PL_sv_no)); 456 PUSHs (sv_2mortal (value [i] ? &PL_sv_yes : &PL_sv_no));
726 457
727void 458void
753 PUSHs (NEW_MORTAL_OBJ ("OpenCL::Platform", value [i])); 484 PUSHs (NEW_MORTAL_OBJ ("OpenCL::Platform", value [i]));
754 } 485 }
755 486
756void 487void
757name (OpenCL::Device this) 488name (OpenCL::Device this)
489 ALIAS:
490 name = CL_DEVICE_NAME
491 vendor = CL_DEVICE_VENDOR
492 driver_version = CL_DRIVER_VERSION
493 profile = CL_DEVICE_PROFILE
494 version = CL_DEVICE_VERSION
495 extensions = CL_DEVICE_EXTENSIONS
758 PPCODE: 496 PPCODE:
759 size_t size; 497 size_t size;
760 NEED_SUCCESS (GetDeviceInfo, (this, CL_DEVICE_NAME, 0, 0, &size)); 498 NEED_SUCCESS (GetDeviceInfo, (this, ix, 0, 0, &size));
761 char *value = tmpbuf (size); 499 char *value = tmpbuf (size);
762 NEED_SUCCESS (GetDeviceInfo, (this, CL_DEVICE_NAME, size, value, 0)); 500 NEED_SUCCESS (GetDeviceInfo, (this, ix, size, value, 0));
763 int i, n = 1;
764 EXTEND (SP, n); 501 EXTEND (SP, 1);
765 for (i = 0; i < n; ++i) 502 const int i = 0;
766 PUSHs (sv_2mortal (newSVpv (value, 0))); 503 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 504
927void 505void
928parent_device_ext (OpenCL::Device this) 506parent_device_ext (OpenCL::Device this)
929 PPCODE: 507 PPCODE:
930 cl_device_id value [1]; 508 cl_device_id value [1];
935 PUSHs (NEW_MORTAL_OBJ ("OpenCL::Device", value [i])); 513 PUSHs (NEW_MORTAL_OBJ ("OpenCL::Device", value [i]));
936 } 514 }
937 515
938void 516void
939partition_types_ext (OpenCL::Device this) 517partition_types_ext (OpenCL::Device this)
518 ALIAS:
519 partition_types_ext = CL_DEVICE_PARTITION_TYPES_EXT
520 affinity_domains_ext = CL_DEVICE_AFFINITY_DOMAINS_EXT
521 partition_style_ext = CL_DEVICE_PARTITION_STYLE_EXT
940 PPCODE: 522 PPCODE:
941 size_t size; 523 size_t size;
942 NEED_SUCCESS (GetDeviceInfo, (this, CL_DEVICE_PARTITION_TYPES_EXT, 0, 0, &size)); 524 NEED_SUCCESS (GetDeviceInfo, (this, ix, 0, 0, &size));
943 cl_device_partition_property_ext *value = tmpbuf (size); 525 cl_device_partition_property_ext *value = tmpbuf (size);
944 NEED_SUCCESS (GetDeviceInfo, (this, CL_DEVICE_PARTITION_TYPES_EXT, size, value, 0)); 526 NEED_SUCCESS (GetDeviceInfo, (this, ix, size, value, 0));
945 int i, n = size / sizeof (value [0]); 527 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 [0]);
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 [0]);
979 EXTEND (SP, n); 528 EXTEND (SP, n);
980 for (i = 0; i < n; ++i) 529 for (i = 0; i < n; ++i)
981 PUSHs (sv_2mortal (newSVuv (value [i]))); 530 PUSHs (sv_2mortal (newSVuv (value [i])));
982 531
983#END:device 532#END:device
1086 635
1087#BEGIN:context 636#BEGIN:context
1088 637
1089void 638void
1090reference_count (OpenCL::Context this) 639reference_count (OpenCL::Context this)
640 ALIAS:
641 reference_count = CL_CONTEXT_REFERENCE_COUNT
642 num_devices = CL_CONTEXT_NUM_DEVICES
1091 PPCODE: 643 PPCODE:
1092 cl_uint value [1]; 644 cl_uint value [1];
1093 NEED_SUCCESS (GetContextInfo, (this, CL_CONTEXT_REFERENCE_COUNT, sizeof (value), value, 0)); 645 NEED_SUCCESS (GetContextInfo, (this, ix, sizeof (value), value, 0));
1094 EXTEND (SP, 1); 646 EXTEND (SP, 1);
1095 const int i = 0; 647 const int i = 0;
1096 PUSHs (sv_2mortal (newSVuv (value [i]))); 648 PUSHs (sv_2mortal (newSVuv (value [i])));
1097 649
1098void 650void
1100 PPCODE: 652 PPCODE:
1101 size_t size; 653 size_t size;
1102 NEED_SUCCESS (GetContextInfo, (this, CL_CONTEXT_DEVICES, 0, 0, &size)); 654 NEED_SUCCESS (GetContextInfo, (this, CL_CONTEXT_DEVICES, 0, 0, &size));
1103 cl_device_id *value = tmpbuf (size); 655 cl_device_id *value = tmpbuf (size);
1104 NEED_SUCCESS (GetContextInfo, (this, CL_CONTEXT_DEVICES, size, value, 0)); 656 NEED_SUCCESS (GetContextInfo, (this, CL_CONTEXT_DEVICES, size, value, 0));
1105 int i, n = size / sizeof (value [0]); 657 int i, n = size / sizeof (*value);
1106 EXTEND (SP, n); 658 EXTEND (SP, n);
1107 for (i = 0; i < n; ++i) 659 for (i = 0; i < n; ++i)
1108 { 660 {
1109 PUSHs (NEW_MORTAL_OBJ ("OpenCL::Device", value [i])); 661 PUSHs (NEW_MORTAL_OBJ ("OpenCL::Device", value [i]));
1110 } 662 }
1114 PPCODE: 666 PPCODE:
1115 size_t size; 667 size_t size;
1116 NEED_SUCCESS (GetContextInfo, (this, CL_CONTEXT_PROPERTIES, 0, 0, &size)); 668 NEED_SUCCESS (GetContextInfo, (this, CL_CONTEXT_PROPERTIES, 0, 0, &size));
1117 cl_context_properties *value = tmpbuf (size); 669 cl_context_properties *value = tmpbuf (size);
1118 NEED_SUCCESS (GetContextInfo, (this, CL_CONTEXT_PROPERTIES, size, value, 0)); 670 NEED_SUCCESS (GetContextInfo, (this, CL_CONTEXT_PROPERTIES, size, value, 0));
1119 int i, n = size / sizeof (value [0]); 671 int i, n = size / sizeof (*value);
1120 EXTEND (SP, n); 672 EXTEND (SP, n);
1121 for (i = 0; i < n; ++i) 673 for (i = 0; i < n; ++i)
1122 PUSHs (sv_2mortal (newSVuv ((UV)value [i]))); 674 PUSHs (sv_2mortal (newSVuv ((UV)value [i])));
1123
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 675
1133#END:context 676#END:context
1134 677
1135MODULE = OpenCL PACKAGE = OpenCL::Queue 678MODULE = OpenCL PACKAGE = OpenCL::Queue
1136 679
1456 const int i = 0; 999 const int i = 0;
1457 PUSHs (sv_2mortal (newSViv (value [i]))); 1000 PUSHs (sv_2mortal (newSViv (value [i])));
1458 1001
1459void 1002void
1460size (OpenCL::Memory this) 1003size (OpenCL::Memory this)
1004 ALIAS:
1005 size = CL_MEM_SIZE
1006 offset = CL_MEM_OFFSET
1461 PPCODE: 1007 PPCODE:
1462 size_t value [1]; 1008 size_t value [1];
1463 NEED_SUCCESS (GetMemObjectInfo, (this, CL_MEM_SIZE, sizeof (value), value, 0)); 1009 NEED_SUCCESS (GetMemObjectInfo, (this, ix, sizeof (value), value, 0));
1464 EXTEND (SP, 1); 1010 EXTEND (SP, 1);
1465 const int i = 0; 1011 const int i = 0;
1466 PUSHs (sv_2mortal (newSVuv (value [i]))); 1012 PUSHs (sv_2mortal (newSVuv (value [i])));
1467 1013
1468void 1014void
1474 const int i = 0; 1020 const int i = 0;
1475 PUSHs (sv_2mortal (newSVuv ((IV)(intptr_t)value [i]))); 1021 PUSHs (sv_2mortal (newSVuv ((IV)(intptr_t)value [i])));
1476 1022
1477void 1023void
1478map_count (OpenCL::Memory this) 1024map_count (OpenCL::Memory this)
1025 ALIAS:
1026 map_count = CL_MEM_MAP_COUNT
1027 reference_count = CL_MEM_REFERENCE_COUNT
1479 PPCODE: 1028 PPCODE:
1480 cl_uint value [1]; 1029 cl_uint value [1];
1481 NEED_SUCCESS (GetMemObjectInfo, (this, CL_MEM_MAP_COUNT, sizeof (value), value, 0)); 1030 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); 1031 EXTEND (SP, 1);
1492 const int i = 0; 1032 const int i = 0;
1493 PUSHs (sv_2mortal (newSVuv (value [i]))); 1033 PUSHs (sv_2mortal (newSVuv (value [i])));
1494 1034
1495void 1035void
1514 { 1054 {
1515 NEED_SUCCESS (RetainMemObject, (value [i])); 1055 NEED_SUCCESS (RetainMemObject, (value [i]));
1516 PUSHs (NEW_MORTAL_OBJ ("OpenCL::Memory", value [i])); 1056 PUSHs (NEW_MORTAL_OBJ ("OpenCL::Memory", value [i]));
1517 } 1057 }
1518 1058
1059#END:mem
1060
1061MODULE = OpenCL PACKAGE = OpenCL::Image
1062
1519void 1063void
1520offset (OpenCL::Memory this) 1064image_info (OpenCL::Image this, cl_image_info name)
1065 PPCODE:
1066 INFO (Image)
1067
1068#BEGIN:image
1069
1070void
1071element_size (OpenCL::Image this)
1072 ALIAS:
1073 element_size = CL_IMAGE_ELEMENT_SIZE
1074 row_pitch = CL_IMAGE_ROW_PITCH
1075 slice_pitch = CL_IMAGE_SLICE_PITCH
1076 width = CL_IMAGE_WIDTH
1077 height = CL_IMAGE_HEIGHT
1078 depth = CL_IMAGE_DEPTH
1521 PPCODE: 1079 PPCODE:
1522 size_t value [1]; 1080 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)); 1081 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); 1082 EXTEND (SP, 1);
1590 const int i = 0; 1083 const int i = 0;
1591 PUSHs (sv_2mortal (newSVuv (value [i]))); 1084 PUSHs (sv_2mortal (newSVuv (value [i])));
1592 1085
1593#END:image 1086#END:image
1691 const int i = 0; 1184 const int i = 0;
1692 PUSHs (sv_2mortal (newSViv (value [i]))); 1185 PUSHs (sv_2mortal (newSViv (value [i])));
1693 1186
1694void 1187void
1695build_options (OpenCL::Program this, OpenCL::Device device) 1188build_options (OpenCL::Program this, OpenCL::Device device)
1189 ALIAS:
1190 build_options = CL_PROGRAM_BUILD_OPTIONS
1191 build_log = CL_PROGRAM_BUILD_LOG
1696 PPCODE: 1192 PPCODE:
1697 size_t size; 1193 size_t size;
1698 NEED_SUCCESS (GetProgramBuildInfo, (this, device, CL_PROGRAM_BUILD_OPTIONS, 0, 0, &size)); 1194 NEED_SUCCESS (GetProgramBuildInfo, (this, device, ix, 0, 0, &size));
1699 char *value = tmpbuf (size); 1195 char *value = tmpbuf (size);
1700 NEED_SUCCESS (GetProgramBuildInfo, (this, device, CL_PROGRAM_BUILD_OPTIONS, size, value, 0)); 1196 NEED_SUCCESS (GetProgramBuildInfo, (this, device, ix, size, value, 0));
1701 int i, n = 1;
1702 EXTEND (SP, n); 1197 EXTEND (SP, 1);
1703 for (i = 0; i < n; ++i) 1198 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))); 1199 PUSHs (sv_2mortal (newSVpv (value, 0)));
1717 1200
1718#END:program_build 1201#END:program_build
1719 1202
1720void 1203void
1726void 1209void
1727info (OpenCL::Program this, cl_program_info name) 1210info (OpenCL::Program this, cl_program_info name)
1728 PPCODE: 1211 PPCODE:
1729 INFO (Program) 1212 INFO (Program)
1730 1213
1214void
1215binaries (OpenCL::Program this)
1216 PPCODE:
1217 cl_uint n, i;
1218 size_t size;
1219
1220 NEED_SUCCESS (GetProgramInfo, (this, CL_PROGRAM_NUM_DEVICES , sizeof (n) , &n , 0));
1221 if (!n) XSRETURN_EMPTY;
1222
1223 size_t *sizes = tmpbuf (sizeof (*sizes) * n);
1224 NEED_SUCCESS (GetProgramInfo, (this, CL_PROGRAM_BINARY_SIZES, sizeof (*sizes) * n, sizes, &size));
1225 if (size != sizeof (*sizes) * n) XSRETURN_EMPTY;
1226 unsigned char **ptrs = tmpbuf (sizeof (*ptrs) * n);
1227
1228 EXTEND (SP, n);
1229 for (i = 0; i < n; ++i)
1230 {
1231 SV *sv = sv_2mortal (newSV (sizes [i]));
1232 SvUPGRADE (sv, SVt_PV);
1233 SvPOK_only (sv);
1234 SvCUR_set (sv, sizes [i]);
1235 ptrs [i] = SvPVX (sv);
1236 PUSHs (sv);
1237 }
1238
1239 NEED_SUCCESS (GetProgramInfo, (this, CL_PROGRAM_BINARIES , sizeof (*ptrs ) * n, ptrs , &size));
1240 if (size != sizeof (*ptrs) * n) XSRETURN_EMPTY;
1241
1731#BEGIN:program 1242#BEGIN:program
1732 1243
1733void 1244void
1734reference_count (OpenCL::Program this) 1245reference_count (OpenCL::Program this)
1246 ALIAS:
1247 reference_count = CL_PROGRAM_REFERENCE_COUNT
1248 num_devices = CL_PROGRAM_NUM_DEVICES
1735 PPCODE: 1249 PPCODE:
1736 cl_uint value [1]; 1250 cl_uint value [1];
1737 NEED_SUCCESS (GetProgramInfo, (this, CL_PROGRAM_REFERENCE_COUNT, sizeof (value), value, 0)); 1251 NEED_SUCCESS (GetProgramInfo, (this, ix, sizeof (value), value, 0));
1738 EXTEND (SP, 1); 1252 EXTEND (SP, 1);
1739 const int i = 0; 1253 const int i = 0;
1740 PUSHs (sv_2mortal (newSVuv (value [i]))); 1254 PUSHs (sv_2mortal (newSVuv (value [i])));
1741 1255
1742void 1256void
1750 NEED_SUCCESS (RetainContext, (value [i])); 1264 NEED_SUCCESS (RetainContext, (value [i]));
1751 PUSHs (NEW_MORTAL_OBJ ("OpenCL::Context", value [i])); 1265 PUSHs (NEW_MORTAL_OBJ ("OpenCL::Context", value [i]));
1752 } 1266 }
1753 1267
1754void 1268void
1755num_devices (OpenCL::Program this)
1756 PPCODE:
1757 cl_uint value [1];
1758 NEED_SUCCESS (GetProgramInfo, (this, CL_PROGRAM_NUM_DEVICES, sizeof (value), value, 0));
1759 EXTEND (SP, 1);
1760 const int i = 0;
1761 PUSHs (sv_2mortal (newSVuv (value [i])));
1762
1763void
1764devices (OpenCL::Program this) 1269devices (OpenCL::Program this)
1765 PPCODE: 1270 PPCODE:
1766 size_t size; 1271 size_t size;
1767 NEED_SUCCESS (GetProgramInfo, (this, CL_PROGRAM_DEVICES, 0, 0, &size)); 1272 NEED_SUCCESS (GetProgramInfo, (this, CL_PROGRAM_DEVICES, 0, 0, &size));
1768 cl_device_id *value = tmpbuf (size); 1273 cl_device_id *value = tmpbuf (size);
1769 NEED_SUCCESS (GetProgramInfo, (this, CL_PROGRAM_DEVICES, size, value, 0)); 1274 NEED_SUCCESS (GetProgramInfo, (this, CL_PROGRAM_DEVICES, size, value, 0));
1770 int i, n = size / sizeof (value [0]); 1275 int i, n = size / sizeof (*value);
1771 EXTEND (SP, n); 1276 EXTEND (SP, n);
1772 for (i = 0; i < n; ++i) 1277 for (i = 0; i < n; ++i)
1773 { 1278 {
1774 PUSHs (NEW_MORTAL_OBJ ("OpenCL::Device", value [i])); 1279 PUSHs (NEW_MORTAL_OBJ ("OpenCL::Device", value [i]));
1775 } 1280 }
1779 PPCODE: 1284 PPCODE:
1780 size_t size; 1285 size_t size;
1781 NEED_SUCCESS (GetProgramInfo, (this, CL_PROGRAM_SOURCE, 0, 0, &size)); 1286 NEED_SUCCESS (GetProgramInfo, (this, CL_PROGRAM_SOURCE, 0, 0, &size));
1782 char *value = tmpbuf (size); 1287 char *value = tmpbuf (size);
1783 NEED_SUCCESS (GetProgramInfo, (this, CL_PROGRAM_SOURCE, size, value, 0)); 1288 NEED_SUCCESS (GetProgramInfo, (this, CL_PROGRAM_SOURCE, size, value, 0));
1784 int i, n = 1;
1785 EXTEND (SP, n); 1289 EXTEND (SP, 1);
1786 for (i = 0; i < n; ++i) 1290 const int i = 0;
1787 PUSHs (sv_2mortal (newSVpv (value, 0))); 1291 PUSHs (sv_2mortal (newSVpv (value, 0)));
1788 1292
1789void 1293void
1790binary_sizes (OpenCL::Program this) 1294binary_sizes (OpenCL::Program this)
1791 PPCODE: 1295 PPCODE:
1792 size_t size; 1296 size_t size;
1793 NEED_SUCCESS (GetProgramInfo, (this, CL_PROGRAM_BINARY_SIZES, 0, 0, &size)); 1297 NEED_SUCCESS (GetProgramInfo, (this, CL_PROGRAM_BINARY_SIZES, 0, 0, &size));
1794 size_t *value = tmpbuf (size); 1298 size_t *value = tmpbuf (size);
1795 NEED_SUCCESS (GetProgramInfo, (this, CL_PROGRAM_BINARY_SIZES, size, value, 0)); 1299 NEED_SUCCESS (GetProgramInfo, (this, CL_PROGRAM_BINARY_SIZES, size, value, 0));
1796 int i, n = size / sizeof (value [0]); 1300 int i, n = size / sizeof (*value);
1797 EXTEND (SP, n); 1301 EXTEND (SP, n);
1798 for (i = 0; i < n; ++i) 1302 for (i = 0; i < n; ++i)
1799 PUSHs (sv_2mortal (newSVuv (value [i]))); 1303 PUSHs (sv_2mortal (newSVuv (value [i])));
1800 1304
1801#END:program 1305#END:program
1904 PPCODE: 1408 PPCODE:
1905 size_t size; 1409 size_t size;
1906 NEED_SUCCESS (GetKernelInfo, (this, CL_KERNEL_FUNCTION_NAME, 0, 0, &size)); 1410 NEED_SUCCESS (GetKernelInfo, (this, CL_KERNEL_FUNCTION_NAME, 0, 0, &size));
1907 char *value = tmpbuf (size); 1411 char *value = tmpbuf (size);
1908 NEED_SUCCESS (GetKernelInfo, (this, CL_KERNEL_FUNCTION_NAME, size, value, 0)); 1412 NEED_SUCCESS (GetKernelInfo, (this, CL_KERNEL_FUNCTION_NAME, size, value, 0));
1909 int i, n = 1;
1910 EXTEND (SP, n); 1413 EXTEND (SP, 1);
1911 for (i = 0; i < n; ++i) 1414 const int i = 0;
1912 PUSHs (sv_2mortal (newSVpv (value, 0))); 1415 PUSHs (sv_2mortal (newSVpv (value, 0)));
1913 1416
1914void 1417void
1915num_args (OpenCL::Kernel this) 1418num_args (OpenCL::Kernel this)
1419 ALIAS:
1420 num_args = CL_KERNEL_NUM_ARGS
1421 reference_count = CL_KERNEL_REFERENCE_COUNT
1916 PPCODE: 1422 PPCODE:
1917 cl_uint value [1]; 1423 cl_uint value [1];
1918 NEED_SUCCESS (GetKernelInfo, (this, CL_KERNEL_NUM_ARGS, sizeof (value), value, 0)); 1424 NEED_SUCCESS (GetKernelInfo, (this, ix, sizeof (value), value, 0));
1919 EXTEND (SP, 1);
1920 const int i = 0;
1921 PUSHs (sv_2mortal (newSVuv (value [i])));
1922
1923void
1924reference_count (OpenCL::Kernel this)
1925 PPCODE:
1926 cl_uint value [1];
1927 NEED_SUCCESS (GetKernelInfo, (this, CL_KERNEL_REFERENCE_COUNT, sizeof (value), value, 0));
1928 EXTEND (SP, 1); 1425 EXTEND (SP, 1);
1929 const int i = 0; 1426 const int i = 0;
1930 PUSHs (sv_2mortal (newSVuv (value [i]))); 1427 PUSHs (sv_2mortal (newSVuv (value [i])));
1931 1428
1932void 1429void
1969 1466
1970#BEGIN:kernel_work_group 1467#BEGIN:kernel_work_group
1971 1468
1972void 1469void
1973work_group_size (OpenCL::Kernel this, OpenCL::Device device) 1470work_group_size (OpenCL::Kernel this, OpenCL::Device device)
1471 ALIAS:
1472 work_group_size = CL_KERNEL_WORK_GROUP_SIZE
1473 preferred_work_group_size_multiple = CL_KERNEL_PREFERRED_WORK_GROUP_SIZE_MULTIPLE
1974 PPCODE: 1474 PPCODE:
1975 size_t value [1]; 1475 size_t value [1];
1976 NEED_SUCCESS (GetKernelWorkGroupInfo, (this, device, CL_KERNEL_WORK_GROUP_SIZE, sizeof (value), value, 0)); 1476 NEED_SUCCESS (GetKernelWorkGroupInfo, (this, device, ix, sizeof (value), value, 0));
1977 EXTEND (SP, 1); 1477 EXTEND (SP, 1);
1978 const int i = 0; 1478 const int i = 0;
1979 PUSHs (sv_2mortal (newSVuv (value [i]))); 1479 PUSHs (sv_2mortal (newSVuv (value [i])));
1980 1480
1981void 1481void
1983 PPCODE: 1483 PPCODE:
1984 size_t size; 1484 size_t size;
1985 NEED_SUCCESS (GetKernelWorkGroupInfo, (this, device, CL_KERNEL_COMPILE_WORK_GROUP_SIZE, 0, 0, &size)); 1485 NEED_SUCCESS (GetKernelWorkGroupInfo, (this, device, CL_KERNEL_COMPILE_WORK_GROUP_SIZE, 0, 0, &size));
1986 size_t *value = tmpbuf (size); 1486 size_t *value = tmpbuf (size);
1987 NEED_SUCCESS (GetKernelWorkGroupInfo, (this, device, CL_KERNEL_COMPILE_WORK_GROUP_SIZE, size, value, 0)); 1487 NEED_SUCCESS (GetKernelWorkGroupInfo, (this, device, CL_KERNEL_COMPILE_WORK_GROUP_SIZE, size, value, 0));
1988 int i, n = size / sizeof (value [0]); 1488 int i, n = size / sizeof (*value);
1989 EXTEND (SP, n); 1489 EXTEND (SP, n);
1990 for (i = 0; i < n; ++i) 1490 for (i = 0; i < n; ++i)
1991 PUSHs (sv_2mortal (newSVuv (value [i]))); 1491 PUSHs (sv_2mortal (newSVuv (value [i])));
1992 1492
1993void 1493void
1994local_mem_size (OpenCL::Kernel this, OpenCL::Device device) 1494local_mem_size (OpenCL::Kernel this, OpenCL::Device device)
1495 ALIAS:
1496 local_mem_size = CL_KERNEL_LOCAL_MEM_SIZE
1497 private_mem_size = CL_KERNEL_PRIVATE_MEM_SIZE
1995 PPCODE: 1498 PPCODE:
1996 cl_ulong value [1]; 1499 cl_ulong value [1];
1997 NEED_SUCCESS (GetKernelWorkGroupInfo, (this, device, CL_KERNEL_LOCAL_MEM_SIZE, sizeof (value), value, 0)); 1500 NEED_SUCCESS (GetKernelWorkGroupInfo, (this, device, ix, sizeof (value), value, 0));
1998 EXTEND (SP, 1);
1999 const int i = 0;
2000 PUSHs (sv_2mortal (newSVuv (value [i])));
2001
2002void
2003preferred_work_group_size_multiple (OpenCL::Kernel this, OpenCL::Device device)
2004 PPCODE:
2005 size_t value [1];
2006 NEED_SUCCESS (GetKernelWorkGroupInfo, (this, device, CL_KERNEL_PREFERRED_WORK_GROUP_SIZE_MULTIPLE, sizeof (value), value, 0));
2007 EXTEND (SP, 1);
2008 const int i = 0;
2009 PUSHs (sv_2mortal (newSVuv (value [i])));
2010
2011void
2012private_mem_size (OpenCL::Kernel this, OpenCL::Device device)
2013 PPCODE:
2014 cl_ulong value [1];
2015 NEED_SUCCESS (GetKernelWorkGroupInfo, (this, device, CL_KERNEL_PRIVATE_MEM_SIZE, sizeof (value), value, 0));
2016 EXTEND (SP, 1); 1501 EXTEND (SP, 1);
2017 const int i = 0; 1502 const int i = 0;
2018 PUSHs (sv_2mortal (newSVuv (value [i]))); 1503 PUSHs (sv_2mortal (newSVuv (value [i])));
2019 1504
2020#END:kernel_work_group 1505#END:kernel_work_group
2059 const int i = 0; 1544 const int i = 0;
2060 PUSHs (sv_2mortal (newSVuv (value [i]))); 1545 PUSHs (sv_2mortal (newSVuv (value [i])));
2061 1546
2062void 1547void
2063reference_count (OpenCL::Event this) 1548reference_count (OpenCL::Event this)
1549 ALIAS:
1550 reference_count = CL_EVENT_REFERENCE_COUNT
1551 command_execution_status = CL_EVENT_COMMAND_EXECUTION_STATUS
2064 PPCODE: 1552 PPCODE:
2065 cl_uint value [1]; 1553 cl_uint value [1];
2066 NEED_SUCCESS (GetEventInfo, (this, CL_EVENT_REFERENCE_COUNT, sizeof (value), value, 0)); 1554 NEED_SUCCESS (GetEventInfo, (this, ix, sizeof (value), value, 0));
2067 EXTEND (SP, 1);
2068 const int i = 0;
2069 PUSHs (sv_2mortal (newSVuv (value [i])));
2070
2071void
2072command_execution_status (OpenCL::Event this)
2073 PPCODE:
2074 cl_uint value [1];
2075 NEED_SUCCESS (GetEventInfo, (this, CL_EVENT_COMMAND_EXECUTION_STATUS, sizeof (value), value, 0));
2076 EXTEND (SP, 1); 1555 EXTEND (SP, 1);
2077 const int i = 0; 1556 const int i = 0;
2078 PUSHs (sv_2mortal (newSVuv (value [i]))); 1557 PUSHs (sv_2mortal (newSVuv (value [i])));
2079 1558
2080void 1559void
2098 1577
2099#BEGIN:profiling 1578#BEGIN:profiling
2100 1579
2101void 1580void
2102profiling_command_queued (OpenCL::Event this) 1581profiling_command_queued (OpenCL::Event this)
1582 ALIAS:
1583 profiling_command_queued = CL_PROFILING_COMMAND_QUEUED
1584 profiling_command_submit = CL_PROFILING_COMMAND_SUBMIT
1585 profiling_command_start = CL_PROFILING_COMMAND_START
1586 profiling_command_end = CL_PROFILING_COMMAND_END
2103 PPCODE: 1587 PPCODE:
2104 cl_ulong value [1]; 1588 cl_ulong value [1];
2105 NEED_SUCCESS (GetEventProfilingInfo, (this, CL_PROFILING_COMMAND_QUEUED, sizeof (value), value, 0));
2106 EXTEND (SP, 1);
2107 const int i = 0;
2108 PUSHs (sv_2mortal (newSVuv (value [i])));
2109
2110void
2111profiling_command_submit (OpenCL::Event this)
2112 PPCODE:
2113 cl_ulong value [1];
2114 NEED_SUCCESS (GetEventProfilingInfo, (this, CL_PROFILING_COMMAND_SUBMIT, sizeof (value), value, 0));
2115 EXTEND (SP, 1);
2116 const int i = 0;
2117 PUSHs (sv_2mortal (newSVuv (value [i])));
2118
2119void
2120profiling_command_start (OpenCL::Event this)
2121 PPCODE:
2122 cl_ulong value [1];
2123 NEED_SUCCESS (GetEventProfilingInfo, (this, CL_PROFILING_COMMAND_START, sizeof (value), value, 0));
2124 EXTEND (SP, 1);
2125 const int i = 0;
2126 PUSHs (sv_2mortal (newSVuv (value [i])));
2127
2128void
2129profiling_command_end (OpenCL::Event this)
2130 PPCODE:
2131 cl_ulong value [1];
2132 NEED_SUCCESS (GetEventProfilingInfo, (this, CL_PROFILING_COMMAND_END, sizeof (value), value, 0)); 1589 NEED_SUCCESS (GetEventProfilingInfo, (this, ix, sizeof (value), value, 0));
2133 EXTEND (SP, 1); 1590 EXTEND (SP, 1);
2134 const int i = 0; 1591 const int i = 0;
2135 PUSHs (sv_2mortal (newSVuv (value [i]))); 1592 PUSHs (sv_2mortal (newSVuv (value [i])));
2136 1593
2137#END:profiling 1594#END:profiling

Diff Legend

Removed lines
+ Added lines
< Changed lines
> Changed lines