Mercurial > hg > truffle
annotate src/gpu/hsail/vm/gpu_hsail.hpp @ 13610:6537a75007e3
consider register priority in rematerialization decision
author | Erik Eckstein <erik.eckstein@oracle.com> |
---|---|
date | Mon, 13 Jan 2014 11:28:25 +0100 |
parents | 166ed1584f30 |
children | bfd61161d752 |
rev | line source |
---|---|
12743
f1a55428a8d7
more HSAIL support in the C++ layer for executing HSAIL code on the simulator
Doug Simon <doug.simon@oracle.com>
parents:
diff
changeset
|
1 /* |
f1a55428a8d7
more HSAIL support in the C++ layer for executing HSAIL code on the simulator
Doug Simon <doug.simon@oracle.com>
parents:
diff
changeset
|
2 * Copyright (c) 2013, Oracle and/or its affiliates. All rights reserved. |
f1a55428a8d7
more HSAIL support in the C++ layer for executing HSAIL code on the simulator
Doug Simon <doug.simon@oracle.com>
parents:
diff
changeset
|
3 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. |
f1a55428a8d7
more HSAIL support in the C++ layer for executing HSAIL code on the simulator
Doug Simon <doug.simon@oracle.com>
parents:
diff
changeset
|
4 * |
f1a55428a8d7
more HSAIL support in the C++ layer for executing HSAIL code on the simulator
Doug Simon <doug.simon@oracle.com>
parents:
diff
changeset
|
5 * This code is free software; you can redistribute it and/or modify it |
f1a55428a8d7
more HSAIL support in the C++ layer for executing HSAIL code on the simulator
Doug Simon <doug.simon@oracle.com>
parents:
diff
changeset
|
6 * under the terms of the GNU General Public License version 2 only, as |
f1a55428a8d7
more HSAIL support in the C++ layer for executing HSAIL code on the simulator
Doug Simon <doug.simon@oracle.com>
parents:
diff
changeset
|
7 * published by the Free Software Foundation. |
f1a55428a8d7
more HSAIL support in the C++ layer for executing HSAIL code on the simulator
Doug Simon <doug.simon@oracle.com>
parents:
diff
changeset
|
8 * |
f1a55428a8d7
more HSAIL support in the C++ layer for executing HSAIL code on the simulator
Doug Simon <doug.simon@oracle.com>
parents:
diff
changeset
|
9 * This code is distributed in the hope that it will be useful, but WITHOUT |
f1a55428a8d7
more HSAIL support in the C++ layer for executing HSAIL code on the simulator
Doug Simon <doug.simon@oracle.com>
parents:
diff
changeset
|
10 * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or |
f1a55428a8d7
more HSAIL support in the C++ layer for executing HSAIL code on the simulator
Doug Simon <doug.simon@oracle.com>
parents:
diff
changeset
|
11 * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License |
f1a55428a8d7
more HSAIL support in the C++ layer for executing HSAIL code on the simulator
Doug Simon <doug.simon@oracle.com>
parents:
diff
changeset
|
12 * version 2 for more details (a copy is included in the LICENSE file that |
f1a55428a8d7
more HSAIL support in the C++ layer for executing HSAIL code on the simulator
Doug Simon <doug.simon@oracle.com>
parents:
diff
changeset
|
13 * accompanied this code). |
f1a55428a8d7
more HSAIL support in the C++ layer for executing HSAIL code on the simulator
Doug Simon <doug.simon@oracle.com>
parents:
diff
changeset
|
14 * |
f1a55428a8d7
more HSAIL support in the C++ layer for executing HSAIL code on the simulator
Doug Simon <doug.simon@oracle.com>
parents:
diff
changeset
|
15 * You should have received a copy of the GNU General Public License version |
f1a55428a8d7
more HSAIL support in the C++ layer for executing HSAIL code on the simulator
Doug Simon <doug.simon@oracle.com>
parents:
diff
changeset
|
16 * 2 along with this work; if not, write to the Free Software Foundation, |
f1a55428a8d7
more HSAIL support in the C++ layer for executing HSAIL code on the simulator
Doug Simon <doug.simon@oracle.com>
parents:
diff
changeset
|
17 * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. |
f1a55428a8d7
more HSAIL support in the C++ layer for executing HSAIL code on the simulator
Doug Simon <doug.simon@oracle.com>
parents:
diff
changeset
|
18 * |
f1a55428a8d7
more HSAIL support in the C++ layer for executing HSAIL code on the simulator
Doug Simon <doug.simon@oracle.com>
parents:
diff
changeset
|
19 * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA |
f1a55428a8d7
more HSAIL support in the C++ layer for executing HSAIL code on the simulator
Doug Simon <doug.simon@oracle.com>
parents:
diff
changeset
|
20 * or visit www.oracle.com if you need additional information or have any |
f1a55428a8d7
more HSAIL support in the C++ layer for executing HSAIL code on the simulator
Doug Simon <doug.simon@oracle.com>
parents:
diff
changeset
|
21 * questions. |
f1a55428a8d7
more HSAIL support in the C++ layer for executing HSAIL code on the simulator
Doug Simon <doug.simon@oracle.com>
parents:
diff
changeset
|
22 * |
f1a55428a8d7
more HSAIL support in the C++ layer for executing HSAIL code on the simulator
Doug Simon <doug.simon@oracle.com>
parents:
diff
changeset
|
23 */ |
f1a55428a8d7
more HSAIL support in the C++ layer for executing HSAIL code on the simulator
Doug Simon <doug.simon@oracle.com>
parents:
diff
changeset
|
24 |
f1a55428a8d7
more HSAIL support in the C++ layer for executing HSAIL code on the simulator
Doug Simon <doug.simon@oracle.com>
parents:
diff
changeset
|
25 #ifndef GPU_HSAIL_HPP |
f1a55428a8d7
more HSAIL support in the C++ layer for executing HSAIL code on the simulator
Doug Simon <doug.simon@oracle.com>
parents:
diff
changeset
|
26 #define GPU_HSAIL_HPP |
f1a55428a8d7
more HSAIL support in the C++ layer for executing HSAIL code on the simulator
Doug Simon <doug.simon@oracle.com>
parents:
diff
changeset
|
27 |
f1a55428a8d7
more HSAIL support in the C++ layer for executing HSAIL code on the simulator
Doug Simon <doug.simon@oracle.com>
parents:
diff
changeset
|
28 class Hsail { |
f1a55428a8d7
more HSAIL support in the C++ layer for executing HSAIL code on the simulator
Doug Simon <doug.simon@oracle.com>
parents:
diff
changeset
|
29 friend class gpu; |
f1a55428a8d7
more HSAIL support in the C++ layer for executing HSAIL code on the simulator
Doug Simon <doug.simon@oracle.com>
parents:
diff
changeset
|
30 |
f1a55428a8d7
more HSAIL support in the C++ layer for executing HSAIL code on the simulator
Doug Simon <doug.simon@oracle.com>
parents:
diff
changeset
|
31 protected: |
f1a55428a8d7
more HSAIL support in the C++ layer for executing HSAIL code on the simulator
Doug Simon <doug.simon@oracle.com>
parents:
diff
changeset
|
32 static bool probe_linkage(); |
f1a55428a8d7
more HSAIL support in the C++ layer for executing HSAIL code on the simulator
Doug Simon <doug.simon@oracle.com>
parents:
diff
changeset
|
33 static bool initialize_gpu(); |
f1a55428a8d7
more HSAIL support in the C++ layer for executing HSAIL code on the simulator
Doug Simon <doug.simon@oracle.com>
parents:
diff
changeset
|
34 static unsigned int total_cores(); |
f1a55428a8d7
more HSAIL support in the C++ layer for executing HSAIL code on the simulator
Doug Simon <doug.simon@oracle.com>
parents:
diff
changeset
|
35 static void* generate_kernel(unsigned char *code, int code_len, const char *name); |
f1a55428a8d7
more HSAIL support in the C++ layer for executing HSAIL code on the simulator
Doug Simon <doug.simon@oracle.com>
parents:
diff
changeset
|
36 static bool execute_kernel_void_1d(address kernel, int dimX, jobject args, methodHandle& mh); |
f1a55428a8d7
more HSAIL support in the C++ layer for executing HSAIL code on the simulator
Doug Simon <doug.simon@oracle.com>
parents:
diff
changeset
|
37 static void register_heap(); |
f1a55428a8d7
more HSAIL support in the C++ layer for executing HSAIL code on the simulator
Doug Simon <doug.simon@oracle.com>
parents:
diff
changeset
|
38 |
f1a55428a8d7
more HSAIL support in the C++ layer for executing HSAIL code on the simulator
Doug Simon <doug.simon@oracle.com>
parents:
diff
changeset
|
39 public: |
f1a55428a8d7
more HSAIL support in the C++ layer for executing HSAIL code on the simulator
Doug Simon <doug.simon@oracle.com>
parents:
diff
changeset
|
40 #if defined(__x86_64) || defined(AMD64) || defined(_M_AMD64) |
f1a55428a8d7
more HSAIL support in the C++ layer for executing HSAIL code on the simulator
Doug Simon <doug.simon@oracle.com>
parents:
diff
changeset
|
41 typedef unsigned long long CUdeviceptr; |
f1a55428a8d7
more HSAIL support in the C++ layer for executing HSAIL code on the simulator
Doug Simon <doug.simon@oracle.com>
parents:
diff
changeset
|
42 #else |
f1a55428a8d7
more HSAIL support in the C++ layer for executing HSAIL code on the simulator
Doug Simon <doug.simon@oracle.com>
parents:
diff
changeset
|
43 typedef unsigned int CUdeviceptr; |
f1a55428a8d7
more HSAIL support in the C++ layer for executing HSAIL code on the simulator
Doug Simon <doug.simon@oracle.com>
parents:
diff
changeset
|
44 #endif |
f1a55428a8d7
more HSAIL support in the C++ layer for executing HSAIL code on the simulator
Doug Simon <doug.simon@oracle.com>
parents:
diff
changeset
|
45 |
f1a55428a8d7
more HSAIL support in the C++ layer for executing HSAIL code on the simulator
Doug Simon <doug.simon@oracle.com>
parents:
diff
changeset
|
46 private: |
13115
166ed1584f30
HSAIL: null checks when loading Okra library functions
Doug Simon <doug.simon@oracle.com>
parents:
12743
diff
changeset
|
47 typedef void* (*okra_create_context_func_t)(); |
166ed1584f30
HSAIL: null checks when loading Okra library functions
Doug Simon <doug.simon@oracle.com>
parents:
12743
diff
changeset
|
48 typedef void* (*okra_create_kernel_func_t)(void*, unsigned char *, const char *); |
12743
f1a55428a8d7
more HSAIL support in the C++ layer for executing HSAIL code on the simulator
Doug Simon <doug.simon@oracle.com>
parents:
diff
changeset
|
49 typedef bool (*okra_push_object_func_t)(void*, void*); |
f1a55428a8d7
more HSAIL support in the C++ layer for executing HSAIL code on the simulator
Doug Simon <doug.simon@oracle.com>
parents:
diff
changeset
|
50 typedef bool (*okra_push_boolean_func_t)(void*, jboolean); |
f1a55428a8d7
more HSAIL support in the C++ layer for executing HSAIL code on the simulator
Doug Simon <doug.simon@oracle.com>
parents:
diff
changeset
|
51 typedef bool (*okra_push_byte_func_t)(void*, jbyte); |
f1a55428a8d7
more HSAIL support in the C++ layer for executing HSAIL code on the simulator
Doug Simon <doug.simon@oracle.com>
parents:
diff
changeset
|
52 typedef bool (*okra_push_double_func_t)(void*, jdouble); |
f1a55428a8d7
more HSAIL support in the C++ layer for executing HSAIL code on the simulator
Doug Simon <doug.simon@oracle.com>
parents:
diff
changeset
|
53 typedef bool (*okra_push_float_func_t)(void*, jfloat); |
f1a55428a8d7
more HSAIL support in the C++ layer for executing HSAIL code on the simulator
Doug Simon <doug.simon@oracle.com>
parents:
diff
changeset
|
54 typedef bool (*okra_push_int_func_t)(void*, jint); |
f1a55428a8d7
more HSAIL support in the C++ layer for executing HSAIL code on the simulator
Doug Simon <doug.simon@oracle.com>
parents:
diff
changeset
|
55 typedef bool (*okra_push_long_func_t)(void*, jlong); |
f1a55428a8d7
more HSAIL support in the C++ layer for executing HSAIL code on the simulator
Doug Simon <doug.simon@oracle.com>
parents:
diff
changeset
|
56 typedef bool (*okra_execute_with_range_func_t)(void*, jint); |
f1a55428a8d7
more HSAIL support in the C++ layer for executing HSAIL code on the simulator
Doug Simon <doug.simon@oracle.com>
parents:
diff
changeset
|
57 typedef bool (*okra_clearargs_func_t)(void*); |
f1a55428a8d7
more HSAIL support in the C++ layer for executing HSAIL code on the simulator
Doug Simon <doug.simon@oracle.com>
parents:
diff
changeset
|
58 typedef bool (*okra_register_heap_func_t)(void*, size_t); |
f1a55428a8d7
more HSAIL support in the C++ layer for executing HSAIL code on the simulator
Doug Simon <doug.simon@oracle.com>
parents:
diff
changeset
|
59 |
f1a55428a8d7
more HSAIL support in the C++ layer for executing HSAIL code on the simulator
Doug Simon <doug.simon@oracle.com>
parents:
diff
changeset
|
60 public: |
13115
166ed1584f30
HSAIL: null checks when loading Okra library functions
Doug Simon <doug.simon@oracle.com>
parents:
12743
diff
changeset
|
61 static okra_create_context_func_t _okra_create_context; |
166ed1584f30
HSAIL: null checks when loading Okra library functions
Doug Simon <doug.simon@oracle.com>
parents:
12743
diff
changeset
|
62 static okra_create_kernel_func_t _okra_create_kernel; |
12743
f1a55428a8d7
more HSAIL support in the C++ layer for executing HSAIL code on the simulator
Doug Simon <doug.simon@oracle.com>
parents:
diff
changeset
|
63 static okra_push_object_func_t _okra_push_object; |
f1a55428a8d7
more HSAIL support in the C++ layer for executing HSAIL code on the simulator
Doug Simon <doug.simon@oracle.com>
parents:
diff
changeset
|
64 static okra_push_boolean_func_t _okra_push_boolean; |
f1a55428a8d7
more HSAIL support in the C++ layer for executing HSAIL code on the simulator
Doug Simon <doug.simon@oracle.com>
parents:
diff
changeset
|
65 static okra_push_byte_func_t _okra_push_byte; |
f1a55428a8d7
more HSAIL support in the C++ layer for executing HSAIL code on the simulator
Doug Simon <doug.simon@oracle.com>
parents:
diff
changeset
|
66 static okra_push_double_func_t _okra_push_double; |
f1a55428a8d7
more HSAIL support in the C++ layer for executing HSAIL code on the simulator
Doug Simon <doug.simon@oracle.com>
parents:
diff
changeset
|
67 static okra_push_float_func_t _okra_push_float; |
f1a55428a8d7
more HSAIL support in the C++ layer for executing HSAIL code on the simulator
Doug Simon <doug.simon@oracle.com>
parents:
diff
changeset
|
68 static okra_push_int_func_t _okra_push_int; |
f1a55428a8d7
more HSAIL support in the C++ layer for executing HSAIL code on the simulator
Doug Simon <doug.simon@oracle.com>
parents:
diff
changeset
|
69 static okra_push_long_func_t _okra_push_long; |
f1a55428a8d7
more HSAIL support in the C++ layer for executing HSAIL code on the simulator
Doug Simon <doug.simon@oracle.com>
parents:
diff
changeset
|
70 static okra_execute_with_range_func_t _okra_execute_with_range; |
f1a55428a8d7
more HSAIL support in the C++ layer for executing HSAIL code on the simulator
Doug Simon <doug.simon@oracle.com>
parents:
diff
changeset
|
71 static okra_clearargs_func_t _okra_clearargs; |
f1a55428a8d7
more HSAIL support in the C++ layer for executing HSAIL code on the simulator
Doug Simon <doug.simon@oracle.com>
parents:
diff
changeset
|
72 static okra_register_heap_func_t _okra_register_heap; |
f1a55428a8d7
more HSAIL support in the C++ layer for executing HSAIL code on the simulator
Doug Simon <doug.simon@oracle.com>
parents:
diff
changeset
|
73 |
f1a55428a8d7
more HSAIL support in the C++ layer for executing HSAIL code on the simulator
Doug Simon <doug.simon@oracle.com>
parents:
diff
changeset
|
74 protected: |
f1a55428a8d7
more HSAIL support in the C++ layer for executing HSAIL code on the simulator
Doug Simon <doug.simon@oracle.com>
parents:
diff
changeset
|
75 static void* _device_context; |
f1a55428a8d7
more HSAIL support in the C++ layer for executing HSAIL code on the simulator
Doug Simon <doug.simon@oracle.com>
parents:
diff
changeset
|
76 }; |
f1a55428a8d7
more HSAIL support in the C++ layer for executing HSAIL code on the simulator
Doug Simon <doug.simon@oracle.com>
parents:
diff
changeset
|
77 #endif // GPU_HSAIL_HPP |