comparison src/gpu/ptx/gpu_ptx.hpp @ 9430:147162b27799

GRAAL-234 - PTX code loading
author Morris Meyer <morris.meyer@oracle.com>
date Tue, 30 Apr 2013 08:17:55 -0400
parents
children 7a3499bf5e2c
comparison
equal deleted inserted replaced
9429:aaf8798b0969 9430:147162b27799
1 /*
2 * Copyright (c) 2013, Oracle and/or its affiliates. All rights reserved.
3 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
4 *
5 * This code is free software; you can redistribute it and/or modify it
6 * under the terms of the GNU General Public License version 2 only, as
7 * published by the Free Software Foundation.
8 *
9 * This code is distributed in the hope that it will be useful, but WITHOUT
10 * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
11 * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
12 * version 2 for more details (a copy is included in the LICENSE file that
13 * accompanied this code).
14 *
15 * You should have received a copy of the GNU General Public License version
16 * 2 along with this work; if not, write to the Free Software Foundation,
17 * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
18 *
19 * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
20 * or visit www.oracle.com if you need additional information or have any
21 * questions.
22 *
23 */
24
25 #ifndef GPU_PTX_HPP
26 #define GPU_PTX_HPP
27
28 class Ptx {
29 friend class gpu;
30
31 protected:
32 static void probe_linkage();
33 #ifdef __APPLE__
34 static bool probe_linkage_apple();
35 #endif
36 static bool initialize_gpu();
37 static void generate_kernel(unsigned char *code, int code_len, const char *name);
38
39 private:
40 typedef int (*cuda_cu_init_func_t)(unsigned int, int);
41 typedef int (*cuda_cu_ctx_create_func_t)(void *, int, int);
42 typedef int (*cuda_cu_ctx_detach_func_t)(int *);
43 typedef int (*cuda_cu_ctx_synchronize_func_t)(int *);
44 typedef int (*cuda_cu_device_get_count_func_t)(int *);
45 typedef int (*cuda_cu_device_get_name_func_t)(char *, int, int);
46 typedef int (*cuda_cu_device_get_func_t)(int *, int);
47 typedef int (*cuda_cu_device_compute_capability_func_t)(int *, int *, int);
48 typedef int (*cuda_cu_launch_kernel_func_t)(int *, int *, int);
49 typedef int (*cuda_cu_module_get_function_func_t)(void *, void *, const char *);
50 typedef int (*cuda_cu_module_load_data_ex_func_t)(void *, void *, unsigned int, int *, void **);
51
52 static cuda_cu_init_func_t _cuda_cu_init;
53 static cuda_cu_ctx_create_func_t _cuda_cu_ctx_create;
54 static cuda_cu_ctx_detach_func_t _cuda_cu_ctx_detach;
55 static cuda_cu_ctx_synchronize_func_t _cuda_cu_ctx_synchronize;
56 static cuda_cu_device_get_count_func_t _cuda_cu_device_get_count;
57 static cuda_cu_device_get_name_func_t _cuda_cu_device_get_name;
58 static cuda_cu_device_get_func_t _cuda_cu_device_get;
59 static cuda_cu_device_compute_capability_func_t _cuda_cu_device_compute_capability;
60 static cuda_cu_launch_kernel_func_t _cuda_cu_launch_kernel;
61 static cuda_cu_module_get_function_func_t _cuda_cu_module_get_function;
62 static cuda_cu_module_load_data_ex_func_t _cuda_cu_module_load_data_ex;
63
64 protected:
65 static void * _device_context;
66 };
67
68 #endif // GPU_PTX_HPP