/
php_opencl.h
96 lines (79 loc) · 2.28 KB
/
php_opencl.h
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
/**
* The OpenCL PHP extension
*
* @package php-opencl
* @author Ryusuke SEKIYAMA <rsky0711@gmail.com>
* @copyright 2012 Ryusuke SEKIYAMA
* @license http://www.opensource.org/licenses/mit-license.php MIT License
*/
#ifndef PHP_OPENCL_H
#define PHP_OPENCL_H
#ifdef HAVE_CONFIG_H
#include "config.h"
#endif
#include <php.h>
#include <php_ini.h>
#include <SAPI.h>
#include <ext/standard/info.h>
#include <Zend/zend_extensions.h>
#include <OpenCL/opencl.h>
#define PHPCL_VERSION "0.0.1"
/* {{{ type definitions */
typedef struct {
cl_context context;
zval *callback;
zval *data;
zend_fcall_info fci;
zend_fcall_info_cache fcc;
} phpcl_context_t;
typedef enum {
INFO_TYPE_BITFIELD = 0,
INFO_TYPE_BOOL,
INFO_TYPE_SIZE,
INFO_TYPE_UINT,
INFO_TYPE_ULONG,
INFO_TYPE_STRING,
INFO_TYPE_PLATFORM,
INFO_TYPE_EXTRA,
} phpcl_info_type_t;
typedef struct {
const char *key;
cl_uint name;
phpcl_info_type_t type;
} phpcl_info_param_t;
typedef cl_int (*phpcl_get_info_func_t)(void *, /* obj1 */
void *, /* obj2 */
cl_uint, /* name */
size_t, /* value_size */
void *, /* value */
size_t * /* value_size_ret */);
typedef zval * (*phpcl_get_info_ex_func_t)(void *, /* obj1 */
void *, /* obj2 */
cl_uint /* name */
TSRMLS_DC);
/* }}} */
/* {{{ common functions */
const char *phpcl_errstr(cl_int errcode);
zval *phpcl_get_info(phpcl_get_info_func_t get_info,
phpcl_get_info_ex_func_t get_info_ex,
void *obj1, void *obj2,
const phpcl_info_param_t *param TSRMLS_DC);
int phpcl_le_platform(void);
int phpcl_le_device(void);
int phpcl_le_context(void);
int phpcl_le_command_queue(void);
int phpcl_le_mem(void);
int phpcl_le_event(void);
int phpcl_le_program(void);
int phpcl_le_kernel(void);
int phpcl_le_sampler(void);
/* }}} */
#endif /* PHP_OPENCL_H */
/*
* Local variables:
* tab-width: 4
* c-basic-offset: 4
* End:
* vim600: noet sw=4 ts=4 fdm=marker
* vim<600: noet sw=4 ts=4
*/