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.15 by root, Sun Nov 20 22:29:36 2011 UTC

402 PPCODE: 402 PPCODE:
403 size_t size; 403 size_t size;
404 NEED_SUCCESS (GetDeviceInfo, (this, CL_DEVICE_MAX_WORK_ITEM_SIZES, 0, 0, &size)); 404 NEED_SUCCESS (GetDeviceInfo, (this, CL_DEVICE_MAX_WORK_ITEM_SIZES, 0, 0, &size));
405 size_t *value = tmpbuf (size); 405 size_t *value = tmpbuf (size);
406 NEED_SUCCESS (GetDeviceInfo, (this, CL_DEVICE_MAX_WORK_ITEM_SIZES, size, value, 0)); 406 NEED_SUCCESS (GetDeviceInfo, (this, CL_DEVICE_MAX_WORK_ITEM_SIZES, size, value, 0));
407 int i, n = size / sizeof (value [0]); 407 int i, n = size / sizeof (*value);
408 EXTEND (SP, n); 408 EXTEND (SP, n);
409 for (i = 0; i < n; ++i) 409 for (i = 0; i < n; ++i)
410 PUSHs (sv_2mortal (newSVuv (value [i]))); 410 PUSHs (sv_2mortal (newSVuv (value [i])));
411 411
412void 412void
940 PPCODE: 940 PPCODE:
941 size_t size; 941 size_t size;
942 NEED_SUCCESS (GetDeviceInfo, (this, CL_DEVICE_PARTITION_TYPES_EXT, 0, 0, &size)); 942 NEED_SUCCESS (GetDeviceInfo, (this, CL_DEVICE_PARTITION_TYPES_EXT, 0, 0, &size));
943 cl_device_partition_property_ext *value = tmpbuf (size); 943 cl_device_partition_property_ext *value = tmpbuf (size);
944 NEED_SUCCESS (GetDeviceInfo, (this, CL_DEVICE_PARTITION_TYPES_EXT, size, value, 0)); 944 NEED_SUCCESS (GetDeviceInfo, (this, CL_DEVICE_PARTITION_TYPES_EXT, size, value, 0));
945 int i, n = size / sizeof (value [0]); 945 int i, n = size / sizeof (*value);
946 EXTEND (SP, n); 946 EXTEND (SP, n);
947 for (i = 0; i < n; ++i) 947 for (i = 0; i < n; ++i)
948 PUSHs (sv_2mortal (newSVuv (value [i]))); 948 PUSHs (sv_2mortal (newSVuv (value [i])));
949 949
950void 950void
952 PPCODE: 952 PPCODE:
953 size_t size; 953 size_t size;
954 NEED_SUCCESS (GetDeviceInfo, (this, CL_DEVICE_AFFINITY_DOMAINS_EXT, 0, 0, &size)); 954 NEED_SUCCESS (GetDeviceInfo, (this, CL_DEVICE_AFFINITY_DOMAINS_EXT, 0, 0, &size));
955 cl_device_partition_property_ext *value = tmpbuf (size); 955 cl_device_partition_property_ext *value = tmpbuf (size);
956 NEED_SUCCESS (GetDeviceInfo, (this, CL_DEVICE_AFFINITY_DOMAINS_EXT, size, value, 0)); 956 NEED_SUCCESS (GetDeviceInfo, (this, CL_DEVICE_AFFINITY_DOMAINS_EXT, size, value, 0));
957 int i, n = size / sizeof (value [0]); 957 int i, n = size / sizeof (*value);
958 EXTEND (SP, n); 958 EXTEND (SP, n);
959 for (i = 0; i < n; ++i) 959 for (i = 0; i < n; ++i)
960 PUSHs (sv_2mortal (newSVuv (value [i]))); 960 PUSHs (sv_2mortal (newSVuv (value [i])));
961 961
962void 962void
973 PPCODE: 973 PPCODE:
974 size_t size; 974 size_t size;
975 NEED_SUCCESS (GetDeviceInfo, (this, CL_DEVICE_PARTITION_STYLE_EXT, 0, 0, &size)); 975 NEED_SUCCESS (GetDeviceInfo, (this, CL_DEVICE_PARTITION_STYLE_EXT, 0, 0, &size));
976 cl_device_partition_property_ext *value = tmpbuf (size); 976 cl_device_partition_property_ext *value = tmpbuf (size);
977 NEED_SUCCESS (GetDeviceInfo, (this, CL_DEVICE_PARTITION_STYLE_EXT, size, value, 0)); 977 NEED_SUCCESS (GetDeviceInfo, (this, CL_DEVICE_PARTITION_STYLE_EXT, size, value, 0));
978 int i, n = size / sizeof (value [0]); 978 int i, n = size / sizeof (*value);
979 EXTEND (SP, n); 979 EXTEND (SP, n);
980 for (i = 0; i < n; ++i) 980 for (i = 0; i < n; ++i)
981 PUSHs (sv_2mortal (newSVuv (value [i]))); 981 PUSHs (sv_2mortal (newSVuv (value [i])));
982 982
983#END:device 983#END:device
1100 PPCODE: 1100 PPCODE:
1101 size_t size; 1101 size_t size;
1102 NEED_SUCCESS (GetContextInfo, (this, CL_CONTEXT_DEVICES, 0, 0, &size)); 1102 NEED_SUCCESS (GetContextInfo, (this, CL_CONTEXT_DEVICES, 0, 0, &size));
1103 cl_device_id *value = tmpbuf (size); 1103 cl_device_id *value = tmpbuf (size);
1104 NEED_SUCCESS (GetContextInfo, (this, CL_CONTEXT_DEVICES, size, value, 0)); 1104 NEED_SUCCESS (GetContextInfo, (this, CL_CONTEXT_DEVICES, size, value, 0));
1105 int i, n = size / sizeof (value [0]); 1105 int i, n = size / sizeof (*value);
1106 EXTEND (SP, n); 1106 EXTEND (SP, n);
1107 for (i = 0; i < n; ++i) 1107 for (i = 0; i < n; ++i)
1108 { 1108 {
1109 PUSHs (NEW_MORTAL_OBJ ("OpenCL::Device", value [i])); 1109 PUSHs (NEW_MORTAL_OBJ ("OpenCL::Device", value [i]));
1110 } 1110 }
1114 PPCODE: 1114 PPCODE:
1115 size_t size; 1115 size_t size;
1116 NEED_SUCCESS (GetContextInfo, (this, CL_CONTEXT_PROPERTIES, 0, 0, &size)); 1116 NEED_SUCCESS (GetContextInfo, (this, CL_CONTEXT_PROPERTIES, 0, 0, &size));
1117 cl_context_properties *value = tmpbuf (size); 1117 cl_context_properties *value = tmpbuf (size);
1118 NEED_SUCCESS (GetContextInfo, (this, CL_CONTEXT_PROPERTIES, size, value, 0)); 1118 NEED_SUCCESS (GetContextInfo, (this, CL_CONTEXT_PROPERTIES, size, value, 0));
1119 int i, n = size / sizeof (value [0]); 1119 int i, n = size / sizeof (*value);
1120 EXTEND (SP, n); 1120 EXTEND (SP, n);
1121 for (i = 0; i < n; ++i) 1121 for (i = 0; i < n; ++i)
1122 PUSHs (sv_2mortal (newSVuv ((UV)value [i]))); 1122 PUSHs (sv_2mortal (newSVuv ((UV)value [i])));
1123 1123
1124void 1124void
1726void 1726void
1727info (OpenCL::Program this, cl_program_info name) 1727info (OpenCL::Program this, cl_program_info name)
1728 PPCODE: 1728 PPCODE:
1729 INFO (Program) 1729 INFO (Program)
1730 1730
1731void
1732binaries (OpenCL::Program this)
1733 PPCODE:
1734 cl_uint n, i;
1735 size_t size;
1736
1737 NEED_SUCCESS (GetProgramInfo, (this, CL_PROGRAM_NUM_DEVICES , sizeof (n) , &n , 0));
1738 if (!n) XSRETURN_EMPTY;
1739
1740 size_t *sizes = tmpbuf (sizeof (*sizes) * n);
1741 NEED_SUCCESS (GetProgramInfo, (this, CL_PROGRAM_BINARY_SIZES, sizeof (*sizes) * n, sizes, &size));
1742 if (size != sizeof (*sizes) * n) XSRETURN_EMPTY;
1743 unsigned char **ptrs = tmpbuf (sizeof (*ptrs) * n);
1744
1745 EXTEND (SP, n);
1746 for (i = 0; i < n; ++i)
1747 {
1748 SV *sv = sv_2mortal (newSV (sizes [i]));
1749 SvUPGRADE (sv, SVt_PV);
1750 SvPOK_only (sv);
1751 SvCUR_set (sv, sizes [i]);
1752 ptrs [i] = SvPVX (sv);
1753 PUSHs (sv);
1754 }
1755
1756 NEED_SUCCESS (GetProgramInfo, (this, CL_PROGRAM_BINARIES , sizeof (*ptrs ) * n, ptrs , &size));
1757 if (size != sizeof (*ptrs) * n) XSRETURN_EMPTY;
1758
1731#BEGIN:program 1759#BEGIN:program
1732 1760
1733void 1761void
1734reference_count (OpenCL::Program this) 1762reference_count (OpenCL::Program this)
1735 PPCODE: 1763 PPCODE:
1765 PPCODE: 1793 PPCODE:
1766 size_t size; 1794 size_t size;
1767 NEED_SUCCESS (GetProgramInfo, (this, CL_PROGRAM_DEVICES, 0, 0, &size)); 1795 NEED_SUCCESS (GetProgramInfo, (this, CL_PROGRAM_DEVICES, 0, 0, &size));
1768 cl_device_id *value = tmpbuf (size); 1796 cl_device_id *value = tmpbuf (size);
1769 NEED_SUCCESS (GetProgramInfo, (this, CL_PROGRAM_DEVICES, size, value, 0)); 1797 NEED_SUCCESS (GetProgramInfo, (this, CL_PROGRAM_DEVICES, size, value, 0));
1770 int i, n = size / sizeof (value [0]); 1798 int i, n = size / sizeof (*value);
1771 EXTEND (SP, n); 1799 EXTEND (SP, n);
1772 for (i = 0; i < n; ++i) 1800 for (i = 0; i < n; ++i)
1773 { 1801 {
1774 PUSHs (NEW_MORTAL_OBJ ("OpenCL::Device", value [i])); 1802 PUSHs (NEW_MORTAL_OBJ ("OpenCL::Device", value [i]));
1775 } 1803 }
1791 PPCODE: 1819 PPCODE:
1792 size_t size; 1820 size_t size;
1793 NEED_SUCCESS (GetProgramInfo, (this, CL_PROGRAM_BINARY_SIZES, 0, 0, &size)); 1821 NEED_SUCCESS (GetProgramInfo, (this, CL_PROGRAM_BINARY_SIZES, 0, 0, &size));
1794 size_t *value = tmpbuf (size); 1822 size_t *value = tmpbuf (size);
1795 NEED_SUCCESS (GetProgramInfo, (this, CL_PROGRAM_BINARY_SIZES, size, value, 0)); 1823 NEED_SUCCESS (GetProgramInfo, (this, CL_PROGRAM_BINARY_SIZES, size, value, 0));
1796 int i, n = size / sizeof (value [0]); 1824 int i, n = size / sizeof (*value);
1797 EXTEND (SP, n); 1825 EXTEND (SP, n);
1798 for (i = 0; i < n; ++i) 1826 for (i = 0; i < n; ++i)
1799 PUSHs (sv_2mortal (newSVuv (value [i]))); 1827 PUSHs (sv_2mortal (newSVuv (value [i])));
1800 1828
1801#END:program 1829#END:program
1983 PPCODE: 2011 PPCODE:
1984 size_t size; 2012 size_t size;
1985 NEED_SUCCESS (GetKernelWorkGroupInfo, (this, device, CL_KERNEL_COMPILE_WORK_GROUP_SIZE, 0, 0, &size)); 2013 NEED_SUCCESS (GetKernelWorkGroupInfo, (this, device, CL_KERNEL_COMPILE_WORK_GROUP_SIZE, 0, 0, &size));
1986 size_t *value = tmpbuf (size); 2014 size_t *value = tmpbuf (size);
1987 NEED_SUCCESS (GetKernelWorkGroupInfo, (this, device, CL_KERNEL_COMPILE_WORK_GROUP_SIZE, size, value, 0)); 2015 NEED_SUCCESS (GetKernelWorkGroupInfo, (this, device, CL_KERNEL_COMPILE_WORK_GROUP_SIZE, size, value, 0));
1988 int i, n = size / sizeof (value [0]); 2016 int i, n = size / sizeof (*value);
1989 EXTEND (SP, n); 2017 EXTEND (SP, n);
1990 for (i = 0; i < n; ++i) 2018 for (i = 0; i < n; ++i)
1991 PUSHs (sv_2mortal (newSVuv (value [i]))); 2019 PUSHs (sv_2mortal (newSVuv (value [i])));
1992 2020
1993void 2021void

Diff Legend

Removed lines
+ Added lines
< Changed lines
> Changed lines