comparison src/gpu/hsail/vm/gpu_hsail.hpp @ 12743:f1a55428a8d7

more HSAIL support in the C++ layer for executing HSAIL code on the simulator Contributed-by: Eric Caspole <eric.caspole@amd.com>
author Doug Simon <doug.simon@oracle.com>
date Sun, 10 Nov 2013 13:18:09 +0100
parents
children 166ed1584f30
comparison
equal deleted inserted replaced
12742:40924dbc623b 12743:f1a55428a8d7
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_HSAIL_HPP
26 #define GPU_HSAIL_HPP
27
28 class Hsail {
29 friend class gpu;
30
31 protected:
32 static bool probe_linkage();
33 static bool initialize_gpu();
34 static unsigned int total_cores();
35 static void* generate_kernel(unsigned char *code, int code_len, const char *name);
36 static bool execute_kernel_void_1d(address kernel, int dimX, jobject args, methodHandle& mh);
37 static void register_heap();
38
39 public:
40 #if defined(__x86_64) || defined(AMD64) || defined(_M_AMD64)
41 typedef unsigned long long CUdeviceptr;
42 #else
43 typedef unsigned int CUdeviceptr;
44 #endif
45
46 private:
47 typedef void* (*okra_ctx_create_func_t)();
48 typedef void* (*okra_kernel_create_func_t)(void*, unsigned char *, const char *);
49 typedef bool (*okra_push_object_func_t)(void*, void*);
50 typedef bool (*okra_push_boolean_func_t)(void*, jboolean);
51 typedef bool (*okra_push_byte_func_t)(void*, jbyte);
52 typedef bool (*okra_push_double_func_t)(void*, jdouble);
53 typedef bool (*okra_push_float_func_t)(void*, jfloat);
54 typedef bool (*okra_push_int_func_t)(void*, jint);
55 typedef bool (*okra_push_long_func_t)(void*, jlong);
56 typedef bool (*okra_execute_with_range_func_t)(void*, jint);
57 typedef bool (*okra_clearargs_func_t)(void*);
58 typedef bool (*okra_register_heap_func_t)(void*, size_t);
59
60 public:
61 static okra_ctx_create_func_t _okra_ctx_create;
62 static okra_kernel_create_func_t _okra_kernel_create;
63 static okra_push_object_func_t _okra_push_object;
64 static okra_push_boolean_func_t _okra_push_boolean;
65 static okra_push_byte_func_t _okra_push_byte;
66 static okra_push_double_func_t _okra_push_double;
67 static okra_push_float_func_t _okra_push_float;
68 static okra_push_int_func_t _okra_push_int;
69 static okra_push_long_func_t _okra_push_long;
70 static okra_execute_with_range_func_t _okra_execute_with_range;
71 static okra_clearargs_func_t _okra_clearargs;
72 static okra_register_heap_func_t _okra_register_heap;
73
74 protected:
75 static void* _device_context;
76 };
77 #endif // GPU_HSAIL_HPP