Mercurial > hg > graal-compiler
annotate src/gpu/hsail/vm/gpu_hsail.cpp @ 15137:4a162f0b59d7
Simplify NodePredicates (use overrides instead of if cascades)
author | Gilles Duboscq <duboscq@ssw.jku.at> |
---|---|
date | Fri, 11 Apr 2014 18:16:32 +0200 |
parents | 0e689f20706e |
children | 2c940b1a48d8 |
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 #include "precompiled.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 #include "runtime/javaCalls.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 #include "runtime/gpu.hpp" |
14768
3e9a960f0da1
HSAIL: preliminary deopt support
Doug Simon <doug.simon@oracle.com>
parents:
13888
diff
changeset
|
28 #include "runtime/deoptimization.hpp" |
3e9a960f0da1
HSAIL: preliminary deopt support
Doug Simon <doug.simon@oracle.com>
parents:
13888
diff
changeset
|
29 #include "gpu_hsail.hpp" |
3e9a960f0da1
HSAIL: preliminary deopt support
Doug Simon <doug.simon@oracle.com>
parents:
13888
diff
changeset
|
30 #include "utilities/debug.hpp" |
3e9a960f0da1
HSAIL: preliminary deopt support
Doug Simon <doug.simon@oracle.com>
parents:
13888
diff
changeset
|
31 #include "utilities/exceptions.hpp" |
13888
51584f76462d
pulled Ptx and Hsail classes out of gpu class namespace
Doug Simon <doug.simon@oracle.com>
parents:
13826
diff
changeset
|
32 #include "hsail/vm/gpu_hsail.hpp" |
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
|
33 #include "utilities/globalDefinitions.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
|
34 #include "utilities/ostream.hpp" |
13819
49db2c1e3bee
added support for co-existing GPU backends (JBS:GRAAL-1)
Doug Simon <doug.simon@oracle.com>
parents:
13740
diff
changeset
|
35 #include "graal/graalEnv.hpp" |
49db2c1e3bee
added support for co-existing GPU backends (JBS:GRAAL-1)
Doug Simon <doug.simon@oracle.com>
parents:
13740
diff
changeset
|
36 #include "graal/graalCompiler.hpp" |
49db2c1e3bee
added support for co-existing GPU backends (JBS:GRAAL-1)
Doug Simon <doug.simon@oracle.com>
parents:
13740
diff
changeset
|
37 #include "graal/graalJavaAccess.hpp" |
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
|
38 #include "hsailKernelArguments.hpp" |
14768
3e9a960f0da1
HSAIL: preliminary deopt support
Doug Simon <doug.simon@oracle.com>
parents:
13888
diff
changeset
|
39 #include "hsailJavaCallArguments.hpp" |
3e9a960f0da1
HSAIL: preliminary deopt support
Doug Simon <doug.simon@oracle.com>
parents:
13888
diff
changeset
|
40 #include "code/pcDesc.hpp" |
3e9a960f0da1
HSAIL: preliminary deopt support
Doug Simon <doug.simon@oracle.com>
parents:
13888
diff
changeset
|
41 #include "code/scopeDesc.hpp" |
3e9a960f0da1
HSAIL: preliminary deopt support
Doug Simon <doug.simon@oracle.com>
parents:
13888
diff
changeset
|
42 #include "graal/graalVMToCompiler.hpp" |
3e9a960f0da1
HSAIL: preliminary deopt support
Doug Simon <doug.simon@oracle.com>
parents:
13888
diff
changeset
|
43 #include "gpu_hsail_Frame.hpp" |
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
|
44 |
13819
49db2c1e3bee
added support for co-existing GPU backends (JBS:GRAAL-1)
Doug Simon <doug.simon@oracle.com>
parents:
13740
diff
changeset
|
45 // Entry to GPU native method implementation that transitions current thread to '_thread_in_vm'. |
49db2c1e3bee
added support for co-existing GPU backends (JBS:GRAAL-1)
Doug Simon <doug.simon@oracle.com>
parents:
13740
diff
changeset
|
46 #define GPU_VMENTRY(result_type, name, signature) \ |
49db2c1e3bee
added support for co-existing GPU backends (JBS:GRAAL-1)
Doug Simon <doug.simon@oracle.com>
parents:
13740
diff
changeset
|
47 JNIEXPORT result_type JNICALL name signature { \ |
49db2c1e3bee
added support for co-existing GPU backends (JBS:GRAAL-1)
Doug Simon <doug.simon@oracle.com>
parents:
13740
diff
changeset
|
48 GRAAL_VM_ENTRY_MARK; \ |
49db2c1e3bee
added support for co-existing GPU backends (JBS:GRAAL-1)
Doug Simon <doug.simon@oracle.com>
parents:
13740
diff
changeset
|
49 |
49db2c1e3bee
added support for co-existing GPU backends (JBS:GRAAL-1)
Doug Simon <doug.simon@oracle.com>
parents:
13740
diff
changeset
|
50 // Entry to GPU native method implementation that calls a JNI function |
49db2c1e3bee
added support for co-existing GPU backends (JBS:GRAAL-1)
Doug Simon <doug.simon@oracle.com>
parents:
13740
diff
changeset
|
51 // and hence cannot transition current thread to '_thread_in_vm'. |
49db2c1e3bee
added support for co-existing GPU backends (JBS:GRAAL-1)
Doug Simon <doug.simon@oracle.com>
parents:
13740
diff
changeset
|
52 #define GPU_ENTRY(result_type, name, signature) \ |
49db2c1e3bee
added support for co-existing GPU backends (JBS:GRAAL-1)
Doug Simon <doug.simon@oracle.com>
parents:
13740
diff
changeset
|
53 JNIEXPORT result_type JNICALL name signature { \ |
49db2c1e3bee
added support for co-existing GPU backends (JBS:GRAAL-1)
Doug Simon <doug.simon@oracle.com>
parents:
13740
diff
changeset
|
54 |
49db2c1e3bee
added support for co-existing GPU backends (JBS:GRAAL-1)
Doug Simon <doug.simon@oracle.com>
parents:
13740
diff
changeset
|
55 #define GPU_END } |
49db2c1e3bee
added support for co-existing GPU backends (JBS:GRAAL-1)
Doug Simon <doug.simon@oracle.com>
parents:
13740
diff
changeset
|
56 |
49db2c1e3bee
added support for co-existing GPU backends (JBS:GRAAL-1)
Doug Simon <doug.simon@oracle.com>
parents:
13740
diff
changeset
|
57 #define CC (char*) /*cast a literal from (const char*)*/ |
49db2c1e3bee
added support for co-existing GPU backends (JBS:GRAAL-1)
Doug Simon <doug.simon@oracle.com>
parents:
13740
diff
changeset
|
58 #define FN_PTR(f) CAST_FROM_FN_PTR(void*, &(f)) |
49db2c1e3bee
added support for co-existing GPU backends (JBS:GRAAL-1)
Doug Simon <doug.simon@oracle.com>
parents:
13740
diff
changeset
|
59 |
49db2c1e3bee
added support for co-existing GPU backends (JBS:GRAAL-1)
Doug Simon <doug.simon@oracle.com>
parents:
13740
diff
changeset
|
60 #define OBJECT "Ljava/lang/Object;" |
49db2c1e3bee
added support for co-existing GPU backends (JBS:GRAAL-1)
Doug Simon <doug.simon@oracle.com>
parents:
13740
diff
changeset
|
61 #define STRING "Ljava/lang/String;" |
15066
2cae21d9f122
HSAIL: initial support for object allocation in HSAIL kernels
Doug Simon <doug.simon@oracle.com>
parents:
14969
diff
changeset
|
62 #define JLTHREAD "Ljava/lang/Thread;" |
13819
49db2c1e3bee
added support for co-existing GPU backends (JBS:GRAAL-1)
Doug Simon <doug.simon@oracle.com>
parents:
13740
diff
changeset
|
63 #define HS_INSTALLED_CODE "Lcom/oracle/graal/hotspot/meta/HotSpotInstalledCode;" |
14768
3e9a960f0da1
HSAIL: preliminary deopt support
Doug Simon <doug.simon@oracle.com>
parents:
13888
diff
changeset
|
64 #define HS_COMPILED_NMETHOD "Lcom/oracle/graal/hotspot/HotSpotCompiledNmethod;" |
3e9a960f0da1
HSAIL: preliminary deopt support
Doug Simon <doug.simon@oracle.com>
parents:
13888
diff
changeset
|
65 #define HS_NMETHOD "Lcom/oracle/graal/hotspot/meta/HotSpotNmethod;" |
13819
49db2c1e3bee
added support for co-existing GPU backends (JBS:GRAAL-1)
Doug Simon <doug.simon@oracle.com>
parents:
13740
diff
changeset
|
66 |
13888
51584f76462d
pulled Ptx and Hsail classes out of gpu class namespace
Doug Simon <doug.simon@oracle.com>
parents:
13826
diff
changeset
|
67 JNINativeMethod Hsail::HSAIL_methods[] = { |
51584f76462d
pulled Ptx and Hsail classes out of gpu class namespace
Doug Simon <doug.simon@oracle.com>
parents:
13826
diff
changeset
|
68 {CC"initialize", CC"()Z", FN_PTR(Hsail::initialize)}, |
51584f76462d
pulled Ptx and Hsail classes out of gpu class namespace
Doug Simon <doug.simon@oracle.com>
parents:
13826
diff
changeset
|
69 {CC"generateKernel", CC"([B" STRING ")J", FN_PTR(Hsail::generate_kernel)}, |
15066
2cae21d9f122
HSAIL: initial support for object allocation in HSAIL kernels
Doug Simon <doug.simon@oracle.com>
parents:
14969
diff
changeset
|
70 {CC"executeKernel0", CC"("HS_INSTALLED_CODE"I["OBJECT"["OBJECT"["JLTHREAD"I)Z", FN_PTR(Hsail::execute_kernel_void_1d)}, |
13819
49db2c1e3bee
added support for co-existing GPU backends (JBS:GRAAL-1)
Doug Simon <doug.simon@oracle.com>
parents:
13740
diff
changeset
|
71 }; |
49db2c1e3bee
added support for co-existing GPU backends (JBS:GRAAL-1)
Doug Simon <doug.simon@oracle.com>
parents:
13740
diff
changeset
|
72 |
13888
51584f76462d
pulled Ptx and Hsail classes out of gpu class namespace
Doug Simon <doug.simon@oracle.com>
parents:
13826
diff
changeset
|
73 void * Hsail::_device_context = NULL; |
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
|
74 |
13888
51584f76462d
pulled Ptx and Hsail classes out of gpu class namespace
Doug Simon <doug.simon@oracle.com>
parents:
13826
diff
changeset
|
75 Hsail::okra_create_context_func_t Hsail::_okra_create_context; |
51584f76462d
pulled Ptx and Hsail classes out of gpu class namespace
Doug Simon <doug.simon@oracle.com>
parents:
13826
diff
changeset
|
76 Hsail::okra_create_kernel_func_t Hsail::_okra_create_kernel; |
51584f76462d
pulled Ptx and Hsail classes out of gpu class namespace
Doug Simon <doug.simon@oracle.com>
parents:
13826
diff
changeset
|
77 Hsail::okra_push_object_func_t Hsail::_okra_push_object; |
51584f76462d
pulled Ptx and Hsail classes out of gpu class namespace
Doug Simon <doug.simon@oracle.com>
parents:
13826
diff
changeset
|
78 Hsail::okra_push_boolean_func_t Hsail::_okra_push_boolean; |
51584f76462d
pulled Ptx and Hsail classes out of gpu class namespace
Doug Simon <doug.simon@oracle.com>
parents:
13826
diff
changeset
|
79 Hsail::okra_push_byte_func_t Hsail::_okra_push_byte; |
51584f76462d
pulled Ptx and Hsail classes out of gpu class namespace
Doug Simon <doug.simon@oracle.com>
parents:
13826
diff
changeset
|
80 Hsail::okra_push_double_func_t Hsail::_okra_push_double; |
51584f76462d
pulled Ptx and Hsail classes out of gpu class namespace
Doug Simon <doug.simon@oracle.com>
parents:
13826
diff
changeset
|
81 Hsail::okra_push_float_func_t Hsail::_okra_push_float; |
51584f76462d
pulled Ptx and Hsail classes out of gpu class namespace
Doug Simon <doug.simon@oracle.com>
parents:
13826
diff
changeset
|
82 Hsail::okra_push_int_func_t Hsail::_okra_push_int; |
51584f76462d
pulled Ptx and Hsail classes out of gpu class namespace
Doug Simon <doug.simon@oracle.com>
parents:
13826
diff
changeset
|
83 Hsail::okra_push_long_func_t Hsail::_okra_push_long; |
51584f76462d
pulled Ptx and Hsail classes out of gpu class namespace
Doug Simon <doug.simon@oracle.com>
parents:
13826
diff
changeset
|
84 Hsail::okra_execute_with_range_func_t Hsail::_okra_execute_with_range; |
51584f76462d
pulled Ptx and Hsail classes out of gpu class namespace
Doug Simon <doug.simon@oracle.com>
parents:
13826
diff
changeset
|
85 Hsail::okra_clearargs_func_t Hsail::_okra_clearargs; |
51584f76462d
pulled Ptx and Hsail classes out of gpu class namespace
Doug Simon <doug.simon@oracle.com>
parents:
13826
diff
changeset
|
86 Hsail::okra_register_heap_func_t Hsail::_okra_register_heap; |
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
|
87 |
15066
2cae21d9f122
HSAIL: initial support for object allocation in HSAIL kernels
Doug Simon <doug.simon@oracle.com>
parents:
14969
diff
changeset
|
88 struct Stats { |
2cae21d9f122
HSAIL: initial support for object allocation in HSAIL kernels
Doug Simon <doug.simon@oracle.com>
parents:
14969
diff
changeset
|
89 int _dispatches; |
2cae21d9f122
HSAIL: initial support for object allocation in HSAIL kernels
Doug Simon <doug.simon@oracle.com>
parents:
14969
diff
changeset
|
90 int _deopts; |
2cae21d9f122
HSAIL: initial support for object allocation in HSAIL kernels
Doug Simon <doug.simon@oracle.com>
parents:
14969
diff
changeset
|
91 int _overflows; |
2cae21d9f122
HSAIL: initial support for object allocation in HSAIL kernels
Doug Simon <doug.simon@oracle.com>
parents:
14969
diff
changeset
|
92 bool _changeSeen; |
2cae21d9f122
HSAIL: initial support for object allocation in HSAIL kernels
Doug Simon <doug.simon@oracle.com>
parents:
14969
diff
changeset
|
93 |
2cae21d9f122
HSAIL: initial support for object allocation in HSAIL kernels
Doug Simon <doug.simon@oracle.com>
parents:
14969
diff
changeset
|
94 public: |
2cae21d9f122
HSAIL: initial support for object allocation in HSAIL kernels
Doug Simon <doug.simon@oracle.com>
parents:
14969
diff
changeset
|
95 Stats() { |
2cae21d9f122
HSAIL: initial support for object allocation in HSAIL kernels
Doug Simon <doug.simon@oracle.com>
parents:
14969
diff
changeset
|
96 _dispatches = _deopts = _overflows = 0; |
2cae21d9f122
HSAIL: initial support for object allocation in HSAIL kernels
Doug Simon <doug.simon@oracle.com>
parents:
14969
diff
changeset
|
97 _changeSeen = false; |
2cae21d9f122
HSAIL: initial support for object allocation in HSAIL kernels
Doug Simon <doug.simon@oracle.com>
parents:
14969
diff
changeset
|
98 } |
2cae21d9f122
HSAIL: initial support for object allocation in HSAIL kernels
Doug Simon <doug.simon@oracle.com>
parents:
14969
diff
changeset
|
99 |
2cae21d9f122
HSAIL: initial support for object allocation in HSAIL kernels
Doug Simon <doug.simon@oracle.com>
parents:
14969
diff
changeset
|
100 void incDeopts() { |
2cae21d9f122
HSAIL: initial support for object allocation in HSAIL kernels
Doug Simon <doug.simon@oracle.com>
parents:
14969
diff
changeset
|
101 _deopts++; |
2cae21d9f122
HSAIL: initial support for object allocation in HSAIL kernels
Doug Simon <doug.simon@oracle.com>
parents:
14969
diff
changeset
|
102 _changeSeen = true; |
2cae21d9f122
HSAIL: initial support for object allocation in HSAIL kernels
Doug Simon <doug.simon@oracle.com>
parents:
14969
diff
changeset
|
103 } |
2cae21d9f122
HSAIL: initial support for object allocation in HSAIL kernels
Doug Simon <doug.simon@oracle.com>
parents:
14969
diff
changeset
|
104 void incOverflows() { |
2cae21d9f122
HSAIL: initial support for object allocation in HSAIL kernels
Doug Simon <doug.simon@oracle.com>
parents:
14969
diff
changeset
|
105 _overflows++; |
2cae21d9f122
HSAIL: initial support for object allocation in HSAIL kernels
Doug Simon <doug.simon@oracle.com>
parents:
14969
diff
changeset
|
106 _changeSeen = true; |
2cae21d9f122
HSAIL: initial support for object allocation in HSAIL kernels
Doug Simon <doug.simon@oracle.com>
parents:
14969
diff
changeset
|
107 } |
2cae21d9f122
HSAIL: initial support for object allocation in HSAIL kernels
Doug Simon <doug.simon@oracle.com>
parents:
14969
diff
changeset
|
108 |
2cae21d9f122
HSAIL: initial support for object allocation in HSAIL kernels
Doug Simon <doug.simon@oracle.com>
parents:
14969
diff
changeset
|
109 void finishDispatch() { |
2cae21d9f122
HSAIL: initial support for object allocation in HSAIL kernels
Doug Simon <doug.simon@oracle.com>
parents:
14969
diff
changeset
|
110 _dispatches++; |
2cae21d9f122
HSAIL: initial support for object allocation in HSAIL kernels
Doug Simon <doug.simon@oracle.com>
parents:
14969
diff
changeset
|
111 if (_changeSeen) { |
2cae21d9f122
HSAIL: initial support for object allocation in HSAIL kernels
Doug Simon <doug.simon@oracle.com>
parents:
14969
diff
changeset
|
112 // print(); |
2cae21d9f122
HSAIL: initial support for object allocation in HSAIL kernels
Doug Simon <doug.simon@oracle.com>
parents:
14969
diff
changeset
|
113 _changeSeen = false; |
2cae21d9f122
HSAIL: initial support for object allocation in HSAIL kernels
Doug Simon <doug.simon@oracle.com>
parents:
14969
diff
changeset
|
114 } |
2cae21d9f122
HSAIL: initial support for object allocation in HSAIL kernels
Doug Simon <doug.simon@oracle.com>
parents:
14969
diff
changeset
|
115 } |
2cae21d9f122
HSAIL: initial support for object allocation in HSAIL kernels
Doug Simon <doug.simon@oracle.com>
parents:
14969
diff
changeset
|
116 |
2cae21d9f122
HSAIL: initial support for object allocation in HSAIL kernels
Doug Simon <doug.simon@oracle.com>
parents:
14969
diff
changeset
|
117 void print() { |
2cae21d9f122
HSAIL: initial support for object allocation in HSAIL kernels
Doug Simon <doug.simon@oracle.com>
parents:
14969
diff
changeset
|
118 tty->print_cr("Disp=%d, Deopts=%d, Ovflows=%d", _dispatches, _deopts, _overflows); |
2cae21d9f122
HSAIL: initial support for object allocation in HSAIL kernels
Doug Simon <doug.simon@oracle.com>
parents:
14969
diff
changeset
|
119 } |
2cae21d9f122
HSAIL: initial support for object allocation in HSAIL kernels
Doug Simon <doug.simon@oracle.com>
parents:
14969
diff
changeset
|
120 |
2cae21d9f122
HSAIL: initial support for object allocation in HSAIL kernels
Doug Simon <doug.simon@oracle.com>
parents:
14969
diff
changeset
|
121 }; |
2cae21d9f122
HSAIL: initial support for object allocation in HSAIL kernels
Doug Simon <doug.simon@oracle.com>
parents:
14969
diff
changeset
|
122 |
2cae21d9f122
HSAIL: initial support for object allocation in HSAIL kernels
Doug Simon <doug.simon@oracle.com>
parents:
14969
diff
changeset
|
123 static Stats kernelStats; |
2cae21d9f122
HSAIL: initial support for object allocation in HSAIL kernels
Doug Simon <doug.simon@oracle.com>
parents:
14969
diff
changeset
|
124 |
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
|
125 |
13888
51584f76462d
pulled Ptx and Hsail classes out of gpu class namespace
Doug Simon <doug.simon@oracle.com>
parents:
13826
diff
changeset
|
126 void Hsail::register_heap() { |
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
|
127 // After the okra functions are set up and the heap is initialized, register the java heap with HSA |
f1a55428a8d7
more HSAIL support in the C++ layer for executing HSAIL code on the simulator
Doug Simon <doug.simon@oracle.com>
parents:
diff
changeset
|
128 guarantee(Universe::heap() != NULL, "heap should be there by now."); |
f1a55428a8d7
more HSAIL support in the C++ layer for executing HSAIL code on the simulator
Doug Simon <doug.simon@oracle.com>
parents:
diff
changeset
|
129 if (TraceGPUInteraction) { |
f1a55428a8d7
more HSAIL support in the C++ layer for executing HSAIL code on the simulator
Doug Simon <doug.simon@oracle.com>
parents:
diff
changeset
|
130 tty->print_cr("[HSAIL] heap=" PTR_FORMAT, Universe::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
|
131 tty->print_cr("[HSAIL] base=0x%08x, capacity=%ld", Universe::heap()->base(), Universe::heap()->capacity()); |
f1a55428a8d7
more HSAIL support in the C++ layer for executing HSAIL code on the simulator
Doug Simon <doug.simon@oracle.com>
parents:
diff
changeset
|
132 } |
f1a55428a8d7
more HSAIL support in the C++ layer for executing HSAIL code on the simulator
Doug Simon <doug.simon@oracle.com>
parents:
diff
changeset
|
133 _okra_register_heap(Universe::heap()->base(), Universe::heap()->capacity()); |
f1a55428a8d7
more HSAIL support in the C++ layer for executing HSAIL code on the simulator
Doug Simon <doug.simon@oracle.com>
parents:
diff
changeset
|
134 } |
f1a55428a8d7
more HSAIL support in the C++ layer for executing HSAIL code on the simulator
Doug Simon <doug.simon@oracle.com>
parents:
diff
changeset
|
135 |
15066
2cae21d9f122
HSAIL: initial support for object allocation in HSAIL kernels
Doug Simon <doug.simon@oracle.com>
parents:
14969
diff
changeset
|
136 GPU_VMENTRY(jboolean, Hsail::execute_kernel_void_1d, (JNIEnv* env, jclass, jobject kernel_handle, jint dimX, jobject args, jobject oops_save, |
2cae21d9f122
HSAIL: initial support for object allocation in HSAIL kernels
Doug Simon <doug.simon@oracle.com>
parents:
14969
diff
changeset
|
137 jobject donor_threads, jint allocBytesPerWorkitem)) |
13819
49db2c1e3bee
added support for co-existing GPU backends (JBS:GRAAL-1)
Doug Simon <doug.simon@oracle.com>
parents:
13740
diff
changeset
|
138 |
49db2c1e3bee
added support for co-existing GPU backends (JBS:GRAAL-1)
Doug Simon <doug.simon@oracle.com>
parents:
13740
diff
changeset
|
139 ResourceMark rm; |
49db2c1e3bee
added support for co-existing GPU backends (JBS:GRAAL-1)
Doug Simon <doug.simon@oracle.com>
parents:
13740
diff
changeset
|
140 jlong nmethodValue = HotSpotInstalledCode::codeBlob(kernel_handle); |
49db2c1e3bee
added support for co-existing GPU backends (JBS:GRAAL-1)
Doug Simon <doug.simon@oracle.com>
parents:
13740
diff
changeset
|
141 if (nmethodValue == 0) { |
49db2c1e3bee
added support for co-existing GPU backends (JBS:GRAAL-1)
Doug Simon <doug.simon@oracle.com>
parents:
13740
diff
changeset
|
142 SharedRuntime::throw_and_post_jvmti_exception(JavaThread::current(), vmSymbols::com_oracle_graal_api_code_InvalidInstalledCodeException(), NULL); |
49db2c1e3bee
added support for co-existing GPU backends (JBS:GRAAL-1)
Doug Simon <doug.simon@oracle.com>
parents:
13740
diff
changeset
|
143 } |
49db2c1e3bee
added support for co-existing GPU backends (JBS:GRAAL-1)
Doug Simon <doug.simon@oracle.com>
parents:
13740
diff
changeset
|
144 nmethod* nm = (nmethod*) (address) nmethodValue; |
49db2c1e3bee
added support for co-existing GPU backends (JBS:GRAAL-1)
Doug Simon <doug.simon@oracle.com>
parents:
13740
diff
changeset
|
145 methodHandle mh = nm->method(); |
49db2c1e3bee
added support for co-existing GPU backends (JBS:GRAAL-1)
Doug Simon <doug.simon@oracle.com>
parents:
13740
diff
changeset
|
146 Symbol* signature = mh->signature(); |
49db2c1e3bee
added support for co-existing GPU backends (JBS:GRAAL-1)
Doug Simon <doug.simon@oracle.com>
parents:
13740
diff
changeset
|
147 |
49db2c1e3bee
added support for co-existing GPU backends (JBS:GRAAL-1)
Doug Simon <doug.simon@oracle.com>
parents:
13740
diff
changeset
|
148 void* kernel = (void*) HotSpotInstalledCode::codeStart(kernel_handle); |
49db2c1e3bee
added support for co-existing GPU backends (JBS:GRAAL-1)
Doug Simon <doug.simon@oracle.com>
parents:
13740
diff
changeset
|
149 if (kernel == NULL) { |
49db2c1e3bee
added support for co-existing GPU backends (JBS:GRAAL-1)
Doug Simon <doug.simon@oracle.com>
parents:
13740
diff
changeset
|
150 SharedRuntime::throw_and_post_jvmti_exception(JavaThread::current(), vmSymbols::com_oracle_graal_api_code_InvalidInstalledCodeException(), NULL); |
49db2c1e3bee
added support for co-existing GPU backends (JBS:GRAAL-1)
Doug Simon <doug.simon@oracle.com>
parents:
13740
diff
changeset
|
151 } |
49db2c1e3bee
added support for co-existing GPU backends (JBS:GRAAL-1)
Doug Simon <doug.simon@oracle.com>
parents:
13740
diff
changeset
|
152 |
15066
2cae21d9f122
HSAIL: initial support for object allocation in HSAIL kernels
Doug Simon <doug.simon@oracle.com>
parents:
14969
diff
changeset
|
153 return execute_kernel_void_1d_internal((address) kernel, dimX, args, mh, nm, oops_save, donor_threads, allocBytesPerWorkitem, CHECK_0); |
14768
3e9a960f0da1
HSAIL: preliminary deopt support
Doug Simon <doug.simon@oracle.com>
parents:
13888
diff
changeset
|
154 GPU_END |
3e9a960f0da1
HSAIL: preliminary deopt support
Doug Simon <doug.simon@oracle.com>
parents:
13888
diff
changeset
|
155 |
3e9a960f0da1
HSAIL: preliminary deopt support
Doug Simon <doug.simon@oracle.com>
parents:
13888
diff
changeset
|
156 static void showRanges(jboolean *a, int len) { |
3e9a960f0da1
HSAIL: preliminary deopt support
Doug Simon <doug.simon@oracle.com>
parents:
13888
diff
changeset
|
157 // show ranges |
3e9a960f0da1
HSAIL: preliminary deopt support
Doug Simon <doug.simon@oracle.com>
parents:
13888
diff
changeset
|
158 bool lookFor = true; |
3e9a960f0da1
HSAIL: preliminary deopt support
Doug Simon <doug.simon@oracle.com>
parents:
13888
diff
changeset
|
159 for (int i = 0; i < len; i++) { |
3e9a960f0da1
HSAIL: preliminary deopt support
Doug Simon <doug.simon@oracle.com>
parents:
13888
diff
changeset
|
160 if ((lookFor == true) && (a[i] != 0)) { |
3e9a960f0da1
HSAIL: preliminary deopt support
Doug Simon <doug.simon@oracle.com>
parents:
13888
diff
changeset
|
161 tty->print("%d", i); |
3e9a960f0da1
HSAIL: preliminary deopt support
Doug Simon <doug.simon@oracle.com>
parents:
13888
diff
changeset
|
162 lookFor = false; |
3e9a960f0da1
HSAIL: preliminary deopt support
Doug Simon <doug.simon@oracle.com>
parents:
13888
diff
changeset
|
163 } else if ((lookFor == false) && (a[i] == 0)) { |
3e9a960f0da1
HSAIL: preliminary deopt support
Doug Simon <doug.simon@oracle.com>
parents:
13888
diff
changeset
|
164 tty->print_cr("-%d", i-1); |
3e9a960f0da1
HSAIL: preliminary deopt support
Doug Simon <doug.simon@oracle.com>
parents:
13888
diff
changeset
|
165 lookFor = true; |
3e9a960f0da1
HSAIL: preliminary deopt support
Doug Simon <doug.simon@oracle.com>
parents:
13888
diff
changeset
|
166 } |
3e9a960f0da1
HSAIL: preliminary deopt support
Doug Simon <doug.simon@oracle.com>
parents:
13888
diff
changeset
|
167 } |
3e9a960f0da1
HSAIL: preliminary deopt support
Doug Simon <doug.simon@oracle.com>
parents:
13888
diff
changeset
|
168 if (lookFor == false) { |
3e9a960f0da1
HSAIL: preliminary deopt support
Doug Simon <doug.simon@oracle.com>
parents:
13888
diff
changeset
|
169 tty->print_cr("-%d", len-1); |
3e9a960f0da1
HSAIL: preliminary deopt support
Doug Simon <doug.simon@oracle.com>
parents:
13888
diff
changeset
|
170 } |
3e9a960f0da1
HSAIL: preliminary deopt support
Doug Simon <doug.simon@oracle.com>
parents:
13888
diff
changeset
|
171 } |
3e9a960f0da1
HSAIL: preliminary deopt support
Doug Simon <doug.simon@oracle.com>
parents:
13888
diff
changeset
|
172 |
15066
2cae21d9f122
HSAIL: initial support for object allocation in HSAIL kernels
Doug Simon <doug.simon@oracle.com>
parents:
14969
diff
changeset
|
173 // fill and retire old tlab and get a new one |
2cae21d9f122
HSAIL: initial support for object allocation in HSAIL kernels
Doug Simon <doug.simon@oracle.com>
parents:
14969
diff
changeset
|
174 // if we can't get one, no problem someone will eventually do a gc |
2cae21d9f122
HSAIL: initial support for object allocation in HSAIL kernels
Doug Simon <doug.simon@oracle.com>
parents:
14969
diff
changeset
|
175 void Hsail::getNewTlabForDonorThread(ThreadLocalAllocBuffer* tlab, size_t tlabMinHsail) { |
2cae21d9f122
HSAIL: initial support for object allocation in HSAIL kernels
Doug Simon <doug.simon@oracle.com>
parents:
14969
diff
changeset
|
176 tlab->clear_before_allocation(); // fill and retire old tlab (will also check for null) |
2cae21d9f122
HSAIL: initial support for object allocation in HSAIL kernels
Doug Simon <doug.simon@oracle.com>
parents:
14969
diff
changeset
|
177 |
2cae21d9f122
HSAIL: initial support for object allocation in HSAIL kernels
Doug Simon <doug.simon@oracle.com>
parents:
14969
diff
changeset
|
178 // get a size for a new tlab that is at least tlabMinHsail. |
2cae21d9f122
HSAIL: initial support for object allocation in HSAIL kernels
Doug Simon <doug.simon@oracle.com>
parents:
14969
diff
changeset
|
179 size_t new_tlab_size = tlab->compute_size(tlabMinHsail); |
2cae21d9f122
HSAIL: initial support for object allocation in HSAIL kernels
Doug Simon <doug.simon@oracle.com>
parents:
14969
diff
changeset
|
180 if (new_tlab_size == 0) return; |
2cae21d9f122
HSAIL: initial support for object allocation in HSAIL kernels
Doug Simon <doug.simon@oracle.com>
parents:
14969
diff
changeset
|
181 |
2cae21d9f122
HSAIL: initial support for object allocation in HSAIL kernels
Doug Simon <doug.simon@oracle.com>
parents:
14969
diff
changeset
|
182 HeapWord* tlab_start = Universe::heap()->allocate_new_tlab(new_tlab_size); |
2cae21d9f122
HSAIL: initial support for object allocation in HSAIL kernels
Doug Simon <doug.simon@oracle.com>
parents:
14969
diff
changeset
|
183 if (tlab_start == NULL) return; |
2cae21d9f122
HSAIL: initial support for object allocation in HSAIL kernels
Doug Simon <doug.simon@oracle.com>
parents:
14969
diff
changeset
|
184 |
2cae21d9f122
HSAIL: initial support for object allocation in HSAIL kernels
Doug Simon <doug.simon@oracle.com>
parents:
14969
diff
changeset
|
185 // ..and clear it if required |
2cae21d9f122
HSAIL: initial support for object allocation in HSAIL kernels
Doug Simon <doug.simon@oracle.com>
parents:
14969
diff
changeset
|
186 if (ZeroTLAB) { |
2cae21d9f122
HSAIL: initial support for object allocation in HSAIL kernels
Doug Simon <doug.simon@oracle.com>
parents:
14969
diff
changeset
|
187 Copy::zero_to_words(tlab_start, new_tlab_size); |
2cae21d9f122
HSAIL: initial support for object allocation in HSAIL kernels
Doug Simon <doug.simon@oracle.com>
parents:
14969
diff
changeset
|
188 } |
2cae21d9f122
HSAIL: initial support for object allocation in HSAIL kernels
Doug Simon <doug.simon@oracle.com>
parents:
14969
diff
changeset
|
189 // and init the tlab pointers |
2cae21d9f122
HSAIL: initial support for object allocation in HSAIL kernels
Doug Simon <doug.simon@oracle.com>
parents:
14969
diff
changeset
|
190 tlab->fill(tlab_start, tlab_start, new_tlab_size); |
2cae21d9f122
HSAIL: initial support for object allocation in HSAIL kernels
Doug Simon <doug.simon@oracle.com>
parents:
14969
diff
changeset
|
191 } |
2cae21d9f122
HSAIL: initial support for object allocation in HSAIL kernels
Doug Simon <doug.simon@oracle.com>
parents:
14969
diff
changeset
|
192 |
2cae21d9f122
HSAIL: initial support for object allocation in HSAIL kernels
Doug Simon <doug.simon@oracle.com>
parents:
14969
diff
changeset
|
193 static void printTlabInfo (ThreadLocalAllocBuffer* tlab) { |
2cae21d9f122
HSAIL: initial support for object allocation in HSAIL kernels
Doug Simon <doug.simon@oracle.com>
parents:
14969
diff
changeset
|
194 HeapWord *start = tlab->start(); |
2cae21d9f122
HSAIL: initial support for object allocation in HSAIL kernels
Doug Simon <doug.simon@oracle.com>
parents:
14969
diff
changeset
|
195 HeapWord *top = tlab->top(); |
2cae21d9f122
HSAIL: initial support for object allocation in HSAIL kernels
Doug Simon <doug.simon@oracle.com>
parents:
14969
diff
changeset
|
196 HeapWord *end = tlab->end(); |
2cae21d9f122
HSAIL: initial support for object allocation in HSAIL kernels
Doug Simon <doug.simon@oracle.com>
parents:
14969
diff
changeset
|
197 // sizes are in bytes |
2cae21d9f122
HSAIL: initial support for object allocation in HSAIL kernels
Doug Simon <doug.simon@oracle.com>
parents:
14969
diff
changeset
|
198 size_t tlabFree = tlab->free() * HeapWordSize; |
2cae21d9f122
HSAIL: initial support for object allocation in HSAIL kernels
Doug Simon <doug.simon@oracle.com>
parents:
14969
diff
changeset
|
199 size_t tlabUsed = tlab->used() * HeapWordSize; |
2cae21d9f122
HSAIL: initial support for object allocation in HSAIL kernels
Doug Simon <doug.simon@oracle.com>
parents:
14969
diff
changeset
|
200 size_t tlabSize = tlabFree + tlabUsed; |
2cae21d9f122
HSAIL: initial support for object allocation in HSAIL kernels
Doug Simon <doug.simon@oracle.com>
parents:
14969
diff
changeset
|
201 double freePct = 100.0 * (double) tlabFree/(double) tlabSize; |
2cae21d9f122
HSAIL: initial support for object allocation in HSAIL kernels
Doug Simon <doug.simon@oracle.com>
parents:
14969
diff
changeset
|
202 tty->print_cr("(%p, %p, %p), siz=%ld, free=%ld (%f%%)", start, top, end, tlabSize, tlabFree, freePct); |
2cae21d9f122
HSAIL: initial support for object allocation in HSAIL kernels
Doug Simon <doug.simon@oracle.com>
parents:
14969
diff
changeset
|
203 } |
2cae21d9f122
HSAIL: initial support for object allocation in HSAIL kernels
Doug Simon <doug.simon@oracle.com>
parents:
14969
diff
changeset
|
204 |
2cae21d9f122
HSAIL: initial support for object allocation in HSAIL kernels
Doug Simon <doug.simon@oracle.com>
parents:
14969
diff
changeset
|
205 |
14768
3e9a960f0da1
HSAIL: preliminary deopt support
Doug Simon <doug.simon@oracle.com>
parents:
13888
diff
changeset
|
206 |
15066
2cae21d9f122
HSAIL: initial support for object allocation in HSAIL kernels
Doug Simon <doug.simon@oracle.com>
parents:
14969
diff
changeset
|
207 jboolean Hsail::execute_kernel_void_1d_internal(address kernel, int dimX, jobject args, methodHandle& mh, nmethod *nm, jobject oops_save, |
2cae21d9f122
HSAIL: initial support for object allocation in HSAIL kernels
Doug Simon <doug.simon@oracle.com>
parents:
14969
diff
changeset
|
208 jobject donor_threads, int allocBytesPerWorkitem, TRAPS) { |
14768
3e9a960f0da1
HSAIL: preliminary deopt support
Doug Simon <doug.simon@oracle.com>
parents:
13888
diff
changeset
|
209 ResourceMark rm(THREAD); |
15066
2cae21d9f122
HSAIL: initial support for object allocation in HSAIL kernels
Doug Simon <doug.simon@oracle.com>
parents:
14969
diff
changeset
|
210 objArrayOop argsArray = (objArrayOop) JNIHandles::resolve(args); |
2cae21d9f122
HSAIL: initial support for object allocation in HSAIL kernels
Doug Simon <doug.simon@oracle.com>
parents:
14969
diff
changeset
|
211 |
2cae21d9f122
HSAIL: initial support for object allocation in HSAIL kernels
Doug Simon <doug.simon@oracle.com>
parents:
14969
diff
changeset
|
212 // TODO: avoid donor thread logic if kernel does not allocate |
2cae21d9f122
HSAIL: initial support for object allocation in HSAIL kernels
Doug Simon <doug.simon@oracle.com>
parents:
14969
diff
changeset
|
213 objArrayOop donorThreadObjects = (objArrayOop) JNIHandles::resolve(donor_threads); |
2cae21d9f122
HSAIL: initial support for object allocation in HSAIL kernels
Doug Simon <doug.simon@oracle.com>
parents:
14969
diff
changeset
|
214 int numDonorThreads = donorThreadObjects->length(); |
2cae21d9f122
HSAIL: initial support for object allocation in HSAIL kernels
Doug Simon <doug.simon@oracle.com>
parents:
14969
diff
changeset
|
215 guarantee(numDonorThreads > 0, "need at least one donor thread"); |
2cae21d9f122
HSAIL: initial support for object allocation in HSAIL kernels
Doug Simon <doug.simon@oracle.com>
parents:
14969
diff
changeset
|
216 JavaThread** donorThreads = NEW_RESOURCE_ARRAY(JavaThread*, numDonorThreads); |
2cae21d9f122
HSAIL: initial support for object allocation in HSAIL kernels
Doug Simon <doug.simon@oracle.com>
parents:
14969
diff
changeset
|
217 for (int i = 0; i < numDonorThreads; i++) { |
2cae21d9f122
HSAIL: initial support for object allocation in HSAIL kernels
Doug Simon <doug.simon@oracle.com>
parents:
14969
diff
changeset
|
218 donorThreads[i] = java_lang_Thread::thread(donorThreadObjects->obj_at(i)); |
2cae21d9f122
HSAIL: initial support for object allocation in HSAIL kernels
Doug Simon <doug.simon@oracle.com>
parents:
14969
diff
changeset
|
219 } |
2cae21d9f122
HSAIL: initial support for object allocation in HSAIL kernels
Doug Simon <doug.simon@oracle.com>
parents:
14969
diff
changeset
|
220 |
2cae21d9f122
HSAIL: initial support for object allocation in HSAIL kernels
Doug Simon <doug.simon@oracle.com>
parents:
14969
diff
changeset
|
221 |
2cae21d9f122
HSAIL: initial support for object allocation in HSAIL kernels
Doug Simon <doug.simon@oracle.com>
parents:
14969
diff
changeset
|
222 // compute tlabMinHsail based on number of workitems, number of donor |
2cae21d9f122
HSAIL: initial support for object allocation in HSAIL kernels
Doug Simon <doug.simon@oracle.com>
parents:
14969
diff
changeset
|
223 // threads, allocBytesPerWorkitem rounded up |
2cae21d9f122
HSAIL: initial support for object allocation in HSAIL kernels
Doug Simon <doug.simon@oracle.com>
parents:
14969
diff
changeset
|
224 size_t tlabMinHsail = (allocBytesPerWorkitem * dimX + (numDonorThreads - 1)) / numDonorThreads; |
2cae21d9f122
HSAIL: initial support for object allocation in HSAIL kernels
Doug Simon <doug.simon@oracle.com>
parents:
14969
diff
changeset
|
225 if (TraceGPUInteraction) { |
2cae21d9f122
HSAIL: initial support for object allocation in HSAIL kernels
Doug Simon <doug.simon@oracle.com>
parents:
14969
diff
changeset
|
226 tty->print_cr("computed tlabMinHsail = %d", tlabMinHsail); |
2cae21d9f122
HSAIL: initial support for object allocation in HSAIL kernels
Doug Simon <doug.simon@oracle.com>
parents:
14969
diff
changeset
|
227 } |
2cae21d9f122
HSAIL: initial support for object allocation in HSAIL kernels
Doug Simon <doug.simon@oracle.com>
parents:
14969
diff
changeset
|
228 |
2cae21d9f122
HSAIL: initial support for object allocation in HSAIL kernels
Doug Simon <doug.simon@oracle.com>
parents:
14969
diff
changeset
|
229 for (int i = 0; i < numDonorThreads; i++) { |
2cae21d9f122
HSAIL: initial support for object allocation in HSAIL kernels
Doug Simon <doug.simon@oracle.com>
parents:
14969
diff
changeset
|
230 JavaThread* donorThread = donorThreads[i]; |
2cae21d9f122
HSAIL: initial support for object allocation in HSAIL kernels
Doug Simon <doug.simon@oracle.com>
parents:
14969
diff
changeset
|
231 ThreadLocalAllocBuffer* tlab = &donorThread->tlab(); |
2cae21d9f122
HSAIL: initial support for object allocation in HSAIL kernels
Doug Simon <doug.simon@oracle.com>
parents:
14969
diff
changeset
|
232 if (TraceGPUInteraction) { |
2cae21d9f122
HSAIL: initial support for object allocation in HSAIL kernels
Doug Simon <doug.simon@oracle.com>
parents:
14969
diff
changeset
|
233 tty->print("donorThread %d, is %p, tlab at %p -> ", i, donorThread, tlab); |
2cae21d9f122
HSAIL: initial support for object allocation in HSAIL kernels
Doug Simon <doug.simon@oracle.com>
parents:
14969
diff
changeset
|
234 printTlabInfo(tlab); |
2cae21d9f122
HSAIL: initial support for object allocation in HSAIL kernels
Doug Simon <doug.simon@oracle.com>
parents:
14969
diff
changeset
|
235 } |
2cae21d9f122
HSAIL: initial support for object allocation in HSAIL kernels
Doug Simon <doug.simon@oracle.com>
parents:
14969
diff
changeset
|
236 |
2cae21d9f122
HSAIL: initial support for object allocation in HSAIL kernels
Doug Simon <doug.simon@oracle.com>
parents:
14969
diff
changeset
|
237 // note: this used vs. free limit checking should be based on some |
2cae21d9f122
HSAIL: initial support for object allocation in HSAIL kernels
Doug Simon <doug.simon@oracle.com>
parents:
14969
diff
changeset
|
238 // heuristic where we see how much this kernel tends to allocate |
2cae21d9f122
HSAIL: initial support for object allocation in HSAIL kernels
Doug Simon <doug.simon@oracle.com>
parents:
14969
diff
changeset
|
239 if ((tlab->end() == NULL) || (tlab->free() * HeapWordSize < tlabMinHsail)) { |
2cae21d9f122
HSAIL: initial support for object allocation in HSAIL kernels
Doug Simon <doug.simon@oracle.com>
parents:
14969
diff
changeset
|
240 getNewTlabForDonorThread(tlab, tlabMinHsail); |
2cae21d9f122
HSAIL: initial support for object allocation in HSAIL kernels
Doug Simon <doug.simon@oracle.com>
parents:
14969
diff
changeset
|
241 if (TraceGPUInteraction) { |
2cae21d9f122
HSAIL: initial support for object allocation in HSAIL kernels
Doug Simon <doug.simon@oracle.com>
parents:
14969
diff
changeset
|
242 tty->print("donorThread %d, refilled tlab, -> ", i); |
2cae21d9f122
HSAIL: initial support for object allocation in HSAIL kernels
Doug Simon <doug.simon@oracle.com>
parents:
14969
diff
changeset
|
243 printTlabInfo(tlab); |
2cae21d9f122
HSAIL: initial support for object allocation in HSAIL kernels
Doug Simon <doug.simon@oracle.com>
parents:
14969
diff
changeset
|
244 } |
2cae21d9f122
HSAIL: initial support for object allocation in HSAIL kernels
Doug Simon <doug.simon@oracle.com>
parents:
14969
diff
changeset
|
245 } |
2cae21d9f122
HSAIL: initial support for object allocation in HSAIL kernels
Doug Simon <doug.simon@oracle.com>
parents:
14969
diff
changeset
|
246 } |
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
|
247 |
f1a55428a8d7
more HSAIL support in the C++ layer for executing HSAIL code on the simulator
Doug Simon <doug.simon@oracle.com>
parents:
diff
changeset
|
248 // Reset the kernel arguments |
f1a55428a8d7
more HSAIL support in the C++ layer for executing HSAIL code on the simulator
Doug Simon <doug.simon@oracle.com>
parents:
diff
changeset
|
249 _okra_clearargs(kernel); |
f1a55428a8d7
more HSAIL support in the C++ layer for executing HSAIL code on the simulator
Doug Simon <doug.simon@oracle.com>
parents:
diff
changeset
|
250 |
14768
3e9a960f0da1
HSAIL: preliminary deopt support
Doug Simon <doug.simon@oracle.com>
parents:
13888
diff
changeset
|
251 HSAILDeoptimizationInfo* e; |
14969
a6c144380ce7
HSAIL: added UseHSAILDeoptimization VM option for disabling HSAIL deopt support
Doug Simon <doug.simon@oracle.com>
parents:
14768
diff
changeset
|
252 if (UseHSAILDeoptimization) { |
14768
3e9a960f0da1
HSAIL: preliminary deopt support
Doug Simon <doug.simon@oracle.com>
parents:
13888
diff
changeset
|
253 e = new (ResourceObj::C_HEAP, mtInternal) HSAILDeoptimizationInfo(); |
3e9a960f0da1
HSAIL: preliminary deopt support
Doug Simon <doug.simon@oracle.com>
parents:
13888
diff
changeset
|
254 e->set_never_ran_array(NEW_C_HEAP_ARRAY(jboolean, dimX, mtInternal)); |
3e9a960f0da1
HSAIL: preliminary deopt support
Doug Simon <doug.simon@oracle.com>
parents:
13888
diff
changeset
|
255 memset(e->never_ran_array(), 0, dimX * sizeof(jboolean)); |
15066
2cae21d9f122
HSAIL: initial support for object allocation in HSAIL kernels
Doug Simon <doug.simon@oracle.com>
parents:
14969
diff
changeset
|
256 e->set_donor_threads(donorThreads); |
14768
3e9a960f0da1
HSAIL: preliminary deopt support
Doug Simon <doug.simon@oracle.com>
parents:
13888
diff
changeset
|
257 } |
3e9a960f0da1
HSAIL: preliminary deopt support
Doug Simon <doug.simon@oracle.com>
parents:
13888
diff
changeset
|
258 |
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
|
259 // This object sets up the kernel arguments |
14768
3e9a960f0da1
HSAIL: preliminary deopt support
Doug Simon <doug.simon@oracle.com>
parents:
13888
diff
changeset
|
260 HSAILKernelArguments hka((address) kernel, mh->signature(), argsArray, mh->is_static(), e); |
3e9a960f0da1
HSAIL: preliminary deopt support
Doug Simon <doug.simon@oracle.com>
parents:
13888
diff
changeset
|
261 |
3e9a960f0da1
HSAIL: preliminary deopt support
Doug Simon <doug.simon@oracle.com>
parents:
13888
diff
changeset
|
262 // if any object passed was null, throw an exception here |
3e9a960f0da1
HSAIL: preliminary deopt support
Doug Simon <doug.simon@oracle.com>
parents:
13888
diff
changeset
|
263 // doing this means the kernel code can avoid null checks on the object parameters. |
3e9a960f0da1
HSAIL: preliminary deopt support
Doug Simon <doug.simon@oracle.com>
parents:
13888
diff
changeset
|
264 if (hka.getFirstNullParameterIndex() >= 0) { |
3e9a960f0da1
HSAIL: preliminary deopt support
Doug Simon <doug.simon@oracle.com>
parents:
13888
diff
changeset
|
265 char buf[64]; |
3e9a960f0da1
HSAIL: preliminary deopt support
Doug Simon <doug.simon@oracle.com>
parents:
13888
diff
changeset
|
266 sprintf(buf, "Null Kernel Parameter seen, Parameter Index: %d", hka.getFirstNullParameterIndex()); |
3e9a960f0da1
HSAIL: preliminary deopt support
Doug Simon <doug.simon@oracle.com>
parents:
13888
diff
changeset
|
267 JavaThread* thread = (JavaThread*)THREAD; |
3e9a960f0da1
HSAIL: preliminary deopt support
Doug Simon <doug.simon@oracle.com>
parents:
13888
diff
changeset
|
268 thread->set_gpu_exception_bci(0); |
3e9a960f0da1
HSAIL: preliminary deopt support
Doug Simon <doug.simon@oracle.com>
parents:
13888
diff
changeset
|
269 thread->set_gpu_exception_method(mh()); |
3e9a960f0da1
HSAIL: preliminary deopt support
Doug Simon <doug.simon@oracle.com>
parents:
13888
diff
changeset
|
270 THROW_MSG_0(vmSymbols::java_lang_NullPointerException(), buf); |
3e9a960f0da1
HSAIL: preliminary deopt support
Doug Simon <doug.simon@oracle.com>
parents:
13888
diff
changeset
|
271 } |
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
|
272 |
f1a55428a8d7
more HSAIL support in the C++ layer for executing HSAIL code on the simulator
Doug Simon <doug.simon@oracle.com>
parents:
diff
changeset
|
273 // Run the kernel |
14969
a6c144380ce7
HSAIL: added UseHSAILDeoptimization VM option for disabling HSAIL deopt support
Doug Simon <doug.simon@oracle.com>
parents:
14768
diff
changeset
|
274 bool success = false; |
a6c144380ce7
HSAIL: added UseHSAILDeoptimization VM option for disabling HSAIL deopt support
Doug Simon <doug.simon@oracle.com>
parents:
14768
diff
changeset
|
275 { |
a6c144380ce7
HSAIL: added UseHSAILDeoptimization VM option for disabling HSAIL deopt support
Doug Simon <doug.simon@oracle.com>
parents:
14768
diff
changeset
|
276 TraceTime t1("execute kernel", TraceGPUInteraction); |
a6c144380ce7
HSAIL: added UseHSAILDeoptimization VM option for disabling HSAIL deopt support
Doug Simon <doug.simon@oracle.com>
parents:
14768
diff
changeset
|
277 success = _okra_execute_with_range(kernel, dimX); |
a6c144380ce7
HSAIL: added UseHSAILDeoptimization VM option for disabling HSAIL deopt support
Doug Simon <doug.simon@oracle.com>
parents:
14768
diff
changeset
|
278 } |
14768
3e9a960f0da1
HSAIL: preliminary deopt support
Doug Simon <doug.simon@oracle.com>
parents:
13888
diff
changeset
|
279 |
15066
2cae21d9f122
HSAIL: initial support for object allocation in HSAIL kernels
Doug Simon <doug.simon@oracle.com>
parents:
14969
diff
changeset
|
280 // fix up any tlab tops that overflowed |
2cae21d9f122
HSAIL: initial support for object allocation in HSAIL kernels
Doug Simon <doug.simon@oracle.com>
parents:
14969
diff
changeset
|
281 bool anyOverflows = false; |
2cae21d9f122
HSAIL: initial support for object allocation in HSAIL kernels
Doug Simon <doug.simon@oracle.com>
parents:
14969
diff
changeset
|
282 for (int i = 0; i < numDonorThreads; i++) { |
2cae21d9f122
HSAIL: initial support for object allocation in HSAIL kernels
Doug Simon <doug.simon@oracle.com>
parents:
14969
diff
changeset
|
283 JavaThread * donorThread = donorThreads[i]; |
2cae21d9f122
HSAIL: initial support for object allocation in HSAIL kernels
Doug Simon <doug.simon@oracle.com>
parents:
14969
diff
changeset
|
284 ThreadLocalAllocBuffer* tlab = &donorThread->tlab(); |
2cae21d9f122
HSAIL: initial support for object allocation in HSAIL kernels
Doug Simon <doug.simon@oracle.com>
parents:
14969
diff
changeset
|
285 if (tlab->top() > tlab->end()) { |
2cae21d9f122
HSAIL: initial support for object allocation in HSAIL kernels
Doug Simon <doug.simon@oracle.com>
parents:
14969
diff
changeset
|
286 anyOverflows = true; |
2cae21d9f122
HSAIL: initial support for object allocation in HSAIL kernels
Doug Simon <doug.simon@oracle.com>
parents:
14969
diff
changeset
|
287 long overflowAmount = (long) tlab->top() - (long) tlab->pf_top(); |
2cae21d9f122
HSAIL: initial support for object allocation in HSAIL kernels
Doug Simon <doug.simon@oracle.com>
parents:
14969
diff
changeset
|
288 // tlab->set_top is private this ugly hack gets around that |
2cae21d9f122
HSAIL: initial support for object allocation in HSAIL kernels
Doug Simon <doug.simon@oracle.com>
parents:
14969
diff
changeset
|
289 *(long *)((char *)tlab + in_bytes(tlab->top_offset())) = (long) tlab->pf_top(); |
2cae21d9f122
HSAIL: initial support for object allocation in HSAIL kernels
Doug Simon <doug.simon@oracle.com>
parents:
14969
diff
changeset
|
290 if (TraceGPUInteraction) { |
2cae21d9f122
HSAIL: initial support for object allocation in HSAIL kernels
Doug Simon <doug.simon@oracle.com>
parents:
14969
diff
changeset
|
291 tty->print_cr("donorThread %d at %p overflowed by %ld bytes, setting last good top to %p", i, donorThread, overflowAmount, tlab->top()); |
2cae21d9f122
HSAIL: initial support for object allocation in HSAIL kernels
Doug Simon <doug.simon@oracle.com>
parents:
14969
diff
changeset
|
292 } |
2cae21d9f122
HSAIL: initial support for object allocation in HSAIL kernels
Doug Simon <doug.simon@oracle.com>
parents:
14969
diff
changeset
|
293 } |
2cae21d9f122
HSAIL: initial support for object allocation in HSAIL kernels
Doug Simon <doug.simon@oracle.com>
parents:
14969
diff
changeset
|
294 } |
2cae21d9f122
HSAIL: initial support for object allocation in HSAIL kernels
Doug Simon <doug.simon@oracle.com>
parents:
14969
diff
changeset
|
295 if (anyOverflows) { |
2cae21d9f122
HSAIL: initial support for object allocation in HSAIL kernels
Doug Simon <doug.simon@oracle.com>
parents:
14969
diff
changeset
|
296 kernelStats.incOverflows(); |
2cae21d9f122
HSAIL: initial support for object allocation in HSAIL kernels
Doug Simon <doug.simon@oracle.com>
parents:
14969
diff
changeset
|
297 } |
2cae21d9f122
HSAIL: initial support for object allocation in HSAIL kernels
Doug Simon <doug.simon@oracle.com>
parents:
14969
diff
changeset
|
298 |
14969
a6c144380ce7
HSAIL: added UseHSAILDeoptimization VM option for disabling HSAIL deopt support
Doug Simon <doug.simon@oracle.com>
parents:
14768
diff
changeset
|
299 if (UseHSAILDeoptimization) { |
a6c144380ce7
HSAIL: added UseHSAILDeoptimization VM option for disabling HSAIL deopt support
Doug Simon <doug.simon@oracle.com>
parents:
14768
diff
changeset
|
300 // check if any workitem requested a deopt |
a6c144380ce7
HSAIL: added UseHSAILDeoptimization VM option for disabling HSAIL deopt support
Doug Simon <doug.simon@oracle.com>
parents:
14768
diff
changeset
|
301 // currently we only support at most one such workitem |
a6c144380ce7
HSAIL: added UseHSAILDeoptimization VM option for disabling HSAIL deopt support
Doug Simon <doug.simon@oracle.com>
parents:
14768
diff
changeset
|
302 int deoptcode = e->deopt_occurred(); |
a6c144380ce7
HSAIL: added UseHSAILDeoptimization VM option for disabling HSAIL deopt support
Doug Simon <doug.simon@oracle.com>
parents:
14768
diff
changeset
|
303 if (deoptcode != 0) { |
a6c144380ce7
HSAIL: added UseHSAILDeoptimization VM option for disabling HSAIL deopt support
Doug Simon <doug.simon@oracle.com>
parents:
14768
diff
changeset
|
304 if (deoptcode != 1) { |
a6c144380ce7
HSAIL: added UseHSAILDeoptimization VM option for disabling HSAIL deopt support
Doug Simon <doug.simon@oracle.com>
parents:
14768
diff
changeset
|
305 // error condition detected in deopt code |
a6c144380ce7
HSAIL: added UseHSAILDeoptimization VM option for disabling HSAIL deopt support
Doug Simon <doug.simon@oracle.com>
parents:
14768
diff
changeset
|
306 char msg[200]; |
a6c144380ce7
HSAIL: added UseHSAILDeoptimization VM option for disabling HSAIL deopt support
Doug Simon <doug.simon@oracle.com>
parents:
14768
diff
changeset
|
307 sprintf(msg, "deopt error detected, slot for workitem %d was not empty", -1 * (deoptcode + 1)); |
a6c144380ce7
HSAIL: added UseHSAILDeoptimization VM option for disabling HSAIL deopt support
Doug Simon <doug.simon@oracle.com>
parents:
14768
diff
changeset
|
308 guarantee(deoptcode == 1, msg); |
a6c144380ce7
HSAIL: added UseHSAILDeoptimization VM option for disabling HSAIL deopt support
Doug Simon <doug.simon@oracle.com>
parents:
14768
diff
changeset
|
309 } |
15066
2cae21d9f122
HSAIL: initial support for object allocation in HSAIL kernels
Doug Simon <doug.simon@oracle.com>
parents:
14969
diff
changeset
|
310 kernelStats.incDeopts(); |
14969
a6c144380ce7
HSAIL: added UseHSAILDeoptimization VM option for disabling HSAIL deopt support
Doug Simon <doug.simon@oracle.com>
parents:
14768
diff
changeset
|
311 { |
a6c144380ce7
HSAIL: added UseHSAILDeoptimization VM option for disabling HSAIL deopt support
Doug Simon <doug.simon@oracle.com>
parents:
14768
diff
changeset
|
312 TraceTime t3("handle deoptimizing workitems", TraceGPUInteraction); |
a6c144380ce7
HSAIL: added UseHSAILDeoptimization VM option for disabling HSAIL deopt support
Doug Simon <doug.simon@oracle.com>
parents:
14768
diff
changeset
|
313 if (TraceGPUInteraction) { |
a6c144380ce7
HSAIL: added UseHSAILDeoptimization VM option for disabling HSAIL deopt support
Doug Simon <doug.simon@oracle.com>
parents:
14768
diff
changeset
|
314 tty->print_cr("deopt happened."); |
a6c144380ce7
HSAIL: added UseHSAILDeoptimization VM option for disabling HSAIL deopt support
Doug Simon <doug.simon@oracle.com>
parents:
14768
diff
changeset
|
315 HSAILKernelDeoptimization * pdeopt = &e->_deopt_save_states[0]; |
a6c144380ce7
HSAIL: added UseHSAILDeoptimization VM option for disabling HSAIL deopt support
Doug Simon <doug.simon@oracle.com>
parents:
14768
diff
changeset
|
316 tty->print_cr("first deopter was workitem %d", pdeopt->workitem()); |
a6c144380ce7
HSAIL: added UseHSAILDeoptimization VM option for disabling HSAIL deopt support
Doug Simon <doug.simon@oracle.com>
parents:
14768
diff
changeset
|
317 } |
14768
3e9a960f0da1
HSAIL: preliminary deopt support
Doug Simon <doug.simon@oracle.com>
parents:
13888
diff
changeset
|
318 |
14969
a6c144380ce7
HSAIL: added UseHSAILDeoptimization VM option for disabling HSAIL deopt support
Doug Simon <doug.simon@oracle.com>
parents:
14768
diff
changeset
|
319 // Before handling any deopting workitems, save the pointers from |
a6c144380ce7
HSAIL: added UseHSAILDeoptimization VM option for disabling HSAIL deopt support
Doug Simon <doug.simon@oracle.com>
parents:
14768
diff
changeset
|
320 // the hsail frames in oops_save so they get adjusted by any |
a6c144380ce7
HSAIL: added UseHSAILDeoptimization VM option for disabling HSAIL deopt support
Doug Simon <doug.simon@oracle.com>
parents:
14768
diff
changeset
|
321 // GC. Need to do this before leaving thread_in_vm mode. |
a6c144380ce7
HSAIL: added UseHSAILDeoptimization VM option for disabling HSAIL deopt support
Doug Simon <doug.simon@oracle.com>
parents:
14768
diff
changeset
|
322 // resolve handle only needed once here (not exiting vm mode) |
15066
2cae21d9f122
HSAIL: initial support for object allocation in HSAIL kernels
Doug Simon <doug.simon@oracle.com>
parents:
14969
diff
changeset
|
323 objArrayOop oopsSaveArray = (objArrayOop) JNIHandles::resolve(oops_save); |
14768
3e9a960f0da1
HSAIL: preliminary deopt support
Doug Simon <doug.simon@oracle.com>
parents:
13888
diff
changeset
|
324 |
14969
a6c144380ce7
HSAIL: added UseHSAILDeoptimization VM option for disabling HSAIL deopt support
Doug Simon <doug.simon@oracle.com>
parents:
14768
diff
changeset
|
325 // since slots are allocated from the beginning, we know how far to look |
a6c144380ce7
HSAIL: added UseHSAILDeoptimization VM option for disabling HSAIL deopt support
Doug Simon <doug.simon@oracle.com>
parents:
14768
diff
changeset
|
326 assert(e->num_deopts() < MAX_DEOPT_SAVE_STATES_SIZE, "deopt save state overflow"); |
a6c144380ce7
HSAIL: added UseHSAILDeoptimization VM option for disabling HSAIL deopt support
Doug Simon <doug.simon@oracle.com>
parents:
14768
diff
changeset
|
327 for (int k = 0; k < e->num_deopts(); k++) { |
a6c144380ce7
HSAIL: added UseHSAILDeoptimization VM option for disabling HSAIL deopt support
Doug Simon <doug.simon@oracle.com>
parents:
14768
diff
changeset
|
328 HSAILKernelDeoptimization * pdeopt = &e->_deopt_save_states[k]; |
a6c144380ce7
HSAIL: added UseHSAILDeoptimization VM option for disabling HSAIL deopt support
Doug Simon <doug.simon@oracle.com>
parents:
14768
diff
changeset
|
329 jint workitem = pdeopt->workitem(); |
a6c144380ce7
HSAIL: added UseHSAILDeoptimization VM option for disabling HSAIL deopt support
Doug Simon <doug.simon@oracle.com>
parents:
14768
diff
changeset
|
330 if (workitem != -1) { |
a6c144380ce7
HSAIL: added UseHSAILDeoptimization VM option for disabling HSAIL deopt support
Doug Simon <doug.simon@oracle.com>
parents:
14768
diff
changeset
|
331 // this is a workitem that deopted |
a6c144380ce7
HSAIL: added UseHSAILDeoptimization VM option for disabling HSAIL deopt support
Doug Simon <doug.simon@oracle.com>
parents:
14768
diff
changeset
|
332 HSAILFrame *hsailFrame = pdeopt->first_frame(); |
a6c144380ce7
HSAIL: added UseHSAILDeoptimization VM option for disabling HSAIL deopt support
Doug Simon <doug.simon@oracle.com>
parents:
14768
diff
changeset
|
333 int dregOopMap = hsailFrame->dreg_oops_map(); |
a6c144380ce7
HSAIL: added UseHSAILDeoptimization VM option for disabling HSAIL deopt support
Doug Simon <doug.simon@oracle.com>
parents:
14768
diff
changeset
|
334 for (int bit = 0; bit < 16; bit++) { |
a6c144380ce7
HSAIL: added UseHSAILDeoptimization VM option for disabling HSAIL deopt support
Doug Simon <doug.simon@oracle.com>
parents:
14768
diff
changeset
|
335 if ((dregOopMap & (1 << bit)) != 0) { |
a6c144380ce7
HSAIL: added UseHSAILDeoptimization VM option for disabling HSAIL deopt support
Doug Simon <doug.simon@oracle.com>
parents:
14768
diff
changeset
|
336 // the dregister at this bit is an oop, save it in the array |
a6c144380ce7
HSAIL: added UseHSAILDeoptimization VM option for disabling HSAIL deopt support
Doug Simon <doug.simon@oracle.com>
parents:
14768
diff
changeset
|
337 int index = k * 16 + bit; |
a6c144380ce7
HSAIL: added UseHSAILDeoptimization VM option for disabling HSAIL deopt support
Doug Simon <doug.simon@oracle.com>
parents:
14768
diff
changeset
|
338 void* saved_oop = (void*) hsailFrame->get_d_reg(bit); |
a6c144380ce7
HSAIL: added UseHSAILDeoptimization VM option for disabling HSAIL deopt support
Doug Simon <doug.simon@oracle.com>
parents:
14768
diff
changeset
|
339 oopsSaveArray->obj_at_put(index, (oop) saved_oop); |
14768
3e9a960f0da1
HSAIL: preliminary deopt support
Doug Simon <doug.simon@oracle.com>
parents:
13888
diff
changeset
|
340 } |
3e9a960f0da1
HSAIL: preliminary deopt support
Doug Simon <doug.simon@oracle.com>
parents:
13888
diff
changeset
|
341 } |
3e9a960f0da1
HSAIL: preliminary deopt support
Doug Simon <doug.simon@oracle.com>
parents:
13888
diff
changeset
|
342 } |
3e9a960f0da1
HSAIL: preliminary deopt support
Doug Simon <doug.simon@oracle.com>
parents:
13888
diff
changeset
|
343 } |
14969
a6c144380ce7
HSAIL: added UseHSAILDeoptimization VM option for disabling HSAIL deopt support
Doug Simon <doug.simon@oracle.com>
parents:
14768
diff
changeset
|
344 |
a6c144380ce7
HSAIL: added UseHSAILDeoptimization VM option for disabling HSAIL deopt support
Doug Simon <doug.simon@oracle.com>
parents:
14768
diff
changeset
|
345 // Handle any deopting workitems. |
a6c144380ce7
HSAIL: added UseHSAILDeoptimization VM option for disabling HSAIL deopt support
Doug Simon <doug.simon@oracle.com>
parents:
14768
diff
changeset
|
346 int count_deoptimized = 0; |
a6c144380ce7
HSAIL: added UseHSAILDeoptimization VM option for disabling HSAIL deopt support
Doug Simon <doug.simon@oracle.com>
parents:
14768
diff
changeset
|
347 for (int k = 0; k < e->num_deopts(); k++) { |
a6c144380ce7
HSAIL: added UseHSAILDeoptimization VM option for disabling HSAIL deopt support
Doug Simon <doug.simon@oracle.com>
parents:
14768
diff
changeset
|
348 HSAILKernelDeoptimization * pdeopt = &e->_deopt_save_states[k]; |
a6c144380ce7
HSAIL: added UseHSAILDeoptimization VM option for disabling HSAIL deopt support
Doug Simon <doug.simon@oracle.com>
parents:
14768
diff
changeset
|
349 |
a6c144380ce7
HSAIL: added UseHSAILDeoptimization VM option for disabling HSAIL deopt support
Doug Simon <doug.simon@oracle.com>
parents:
14768
diff
changeset
|
350 jint workitem = pdeopt->workitem(); |
a6c144380ce7
HSAIL: added UseHSAILDeoptimization VM option for disabling HSAIL deopt support
Doug Simon <doug.simon@oracle.com>
parents:
14768
diff
changeset
|
351 if (workitem != -1) { |
a6c144380ce7
HSAIL: added UseHSAILDeoptimization VM option for disabling HSAIL deopt support
Doug Simon <doug.simon@oracle.com>
parents:
14768
diff
changeset
|
352 int deoptId = pdeopt->pc_offset(); |
a6c144380ce7
HSAIL: added UseHSAILDeoptimization VM option for disabling HSAIL deopt support
Doug Simon <doug.simon@oracle.com>
parents:
14768
diff
changeset
|
353 HSAILFrame *hsailFrame = pdeopt->first_frame(); |
a6c144380ce7
HSAIL: added UseHSAILDeoptimization VM option for disabling HSAIL deopt support
Doug Simon <doug.simon@oracle.com>
parents:
14768
diff
changeset
|
354 |
a6c144380ce7
HSAIL: added UseHSAILDeoptimization VM option for disabling HSAIL deopt support
Doug Simon <doug.simon@oracle.com>
parents:
14768
diff
changeset
|
355 // update the hsailFrame from the oopsSaveArray |
a6c144380ce7
HSAIL: added UseHSAILDeoptimization VM option for disabling HSAIL deopt support
Doug Simon <doug.simon@oracle.com>
parents:
14768
diff
changeset
|
356 // re-resolve the handle |
15066
2cae21d9f122
HSAIL: initial support for object allocation in HSAIL kernels
Doug Simon <doug.simon@oracle.com>
parents:
14969
diff
changeset
|
357 oopsSaveArray = (objArrayOop) JNIHandles::resolve(oops_save); |
14969
a6c144380ce7
HSAIL: added UseHSAILDeoptimization VM option for disabling HSAIL deopt support
Doug Simon <doug.simon@oracle.com>
parents:
14768
diff
changeset
|
358 |
a6c144380ce7
HSAIL: added UseHSAILDeoptimization VM option for disabling HSAIL deopt support
Doug Simon <doug.simon@oracle.com>
parents:
14768
diff
changeset
|
359 int dregOopMap = hsailFrame->dreg_oops_map(); |
a6c144380ce7
HSAIL: added UseHSAILDeoptimization VM option for disabling HSAIL deopt support
Doug Simon <doug.simon@oracle.com>
parents:
14768
diff
changeset
|
360 for (int bit = 0; bit < 16; bit++) { |
a6c144380ce7
HSAIL: added UseHSAILDeoptimization VM option for disabling HSAIL deopt support
Doug Simon <doug.simon@oracle.com>
parents:
14768
diff
changeset
|
361 if ((dregOopMap & (1 << bit)) != 0) { |
a6c144380ce7
HSAIL: added UseHSAILDeoptimization VM option for disabling HSAIL deopt support
Doug Simon <doug.simon@oracle.com>
parents:
14768
diff
changeset
|
362 // the dregister at this bit is an oop, retrieve it from array and put back in frame |
a6c144380ce7
HSAIL: added UseHSAILDeoptimization VM option for disabling HSAIL deopt support
Doug Simon <doug.simon@oracle.com>
parents:
14768
diff
changeset
|
363 int index = k * 16 + bit; |
a6c144380ce7
HSAIL: added UseHSAILDeoptimization VM option for disabling HSAIL deopt support
Doug Simon <doug.simon@oracle.com>
parents:
14768
diff
changeset
|
364 void * dregValue = (void *) oopsSaveArray->obj_at(index); |
a6c144380ce7
HSAIL: added UseHSAILDeoptimization VM option for disabling HSAIL deopt support
Doug Simon <doug.simon@oracle.com>
parents:
14768
diff
changeset
|
365 void * oldDregValue = (void *) hsailFrame->get_d_reg(bit); |
a6c144380ce7
HSAIL: added UseHSAILDeoptimization VM option for disabling HSAIL deopt support
Doug Simon <doug.simon@oracle.com>
parents:
14768
diff
changeset
|
366 assert((oldDregValue != 0 ? dregValue != 0 : dregValue == 0), "bad dregValue retrieved"); |
a6c144380ce7
HSAIL: added UseHSAILDeoptimization VM option for disabling HSAIL deopt support
Doug Simon <doug.simon@oracle.com>
parents:
14768
diff
changeset
|
367 if (TraceGPUInteraction) { |
a6c144380ce7
HSAIL: added UseHSAILDeoptimization VM option for disabling HSAIL deopt support
Doug Simon <doug.simon@oracle.com>
parents:
14768
diff
changeset
|
368 if (dregValue != oldDregValue) { |
a6c144380ce7
HSAIL: added UseHSAILDeoptimization VM option for disabling HSAIL deopt support
Doug Simon <doug.simon@oracle.com>
parents:
14768
diff
changeset
|
369 tty->print_cr("oop moved for $d%d, workitem %d, slot %d, old=%p, new=%p", bit, workitem, k, oldDregValue, dregValue); |
a6c144380ce7
HSAIL: added UseHSAILDeoptimization VM option for disabling HSAIL deopt support
Doug Simon <doug.simon@oracle.com>
parents:
14768
diff
changeset
|
370 } |
a6c144380ce7
HSAIL: added UseHSAILDeoptimization VM option for disabling HSAIL deopt support
Doug Simon <doug.simon@oracle.com>
parents:
14768
diff
changeset
|
371 } |
a6c144380ce7
HSAIL: added UseHSAILDeoptimization VM option for disabling HSAIL deopt support
Doug Simon <doug.simon@oracle.com>
parents:
14768
diff
changeset
|
372 hsailFrame->put_d_reg(bit, (jlong) dregValue); |
a6c144380ce7
HSAIL: added UseHSAILDeoptimization VM option for disabling HSAIL deopt support
Doug Simon <doug.simon@oracle.com>
parents:
14768
diff
changeset
|
373 } |
a6c144380ce7
HSAIL: added UseHSAILDeoptimization VM option for disabling HSAIL deopt support
Doug Simon <doug.simon@oracle.com>
parents:
14768
diff
changeset
|
374 } |
a6c144380ce7
HSAIL: added UseHSAILDeoptimization VM option for disabling HSAIL deopt support
Doug Simon <doug.simon@oracle.com>
parents:
14768
diff
changeset
|
375 |
a6c144380ce7
HSAIL: added UseHSAILDeoptimization VM option for disabling HSAIL deopt support
Doug Simon <doug.simon@oracle.com>
parents:
14768
diff
changeset
|
376 JavaValue result(T_VOID); |
a6c144380ce7
HSAIL: added UseHSAILDeoptimization VM option for disabling HSAIL deopt support
Doug Simon <doug.simon@oracle.com>
parents:
14768
diff
changeset
|
377 JavaCallArguments javaArgs; |
a6c144380ce7
HSAIL: added UseHSAILDeoptimization VM option for disabling HSAIL deopt support
Doug Simon <doug.simon@oracle.com>
parents:
14768
diff
changeset
|
378 javaArgs.set_alternative_target(nm); |
a6c144380ce7
HSAIL: added UseHSAILDeoptimization VM option for disabling HSAIL deopt support
Doug Simon <doug.simon@oracle.com>
parents:
14768
diff
changeset
|
379 javaArgs.push_int(deoptId); |
a6c144380ce7
HSAIL: added UseHSAILDeoptimization VM option for disabling HSAIL deopt support
Doug Simon <doug.simon@oracle.com>
parents:
14768
diff
changeset
|
380 javaArgs.push_long((jlong) hsailFrame); |
a6c144380ce7
HSAIL: added UseHSAILDeoptimization VM option for disabling HSAIL deopt support
Doug Simon <doug.simon@oracle.com>
parents:
14768
diff
changeset
|
381 |
a6c144380ce7
HSAIL: added UseHSAILDeoptimization VM option for disabling HSAIL deopt support
Doug Simon <doug.simon@oracle.com>
parents:
14768
diff
changeset
|
382 // override the deoptimization action with Action_none until we decide |
a6c144380ce7
HSAIL: added UseHSAILDeoptimization VM option for disabling HSAIL deopt support
Doug Simon <doug.simon@oracle.com>
parents:
14768
diff
changeset
|
383 // how to handle the other actions. |
a6c144380ce7
HSAIL: added UseHSAILDeoptimization VM option for disabling HSAIL deopt support
Doug Simon <doug.simon@oracle.com>
parents:
14768
diff
changeset
|
384 int myActionReason = Deoptimization::make_trap_request(Deoptimization::trap_request_reason(pdeopt->reason()), Deoptimization::Action_none); |
a6c144380ce7
HSAIL: added UseHSAILDeoptimization VM option for disabling HSAIL deopt support
Doug Simon <doug.simon@oracle.com>
parents:
14768
diff
changeset
|
385 javaArgs.push_int(myActionReason); |
a6c144380ce7
HSAIL: added UseHSAILDeoptimization VM option for disabling HSAIL deopt support
Doug Simon <doug.simon@oracle.com>
parents:
14768
diff
changeset
|
386 javaArgs.push_oop((oop) NULL); |
a6c144380ce7
HSAIL: added UseHSAILDeoptimization VM option for disabling HSAIL deopt support
Doug Simon <doug.simon@oracle.com>
parents:
14768
diff
changeset
|
387 if (TraceGPUInteraction) { |
a6c144380ce7
HSAIL: added UseHSAILDeoptimization VM option for disabling HSAIL deopt support
Doug Simon <doug.simon@oracle.com>
parents:
14768
diff
changeset
|
388 int dregOopMap = hsailFrame->dreg_oops_map(); |
a6c144380ce7
HSAIL: added UseHSAILDeoptimization VM option for disabling HSAIL deopt support
Doug Simon <doug.simon@oracle.com>
parents:
14768
diff
changeset
|
389 tty->print_cr("[HSAIL] Deoptimizing to host for workitem=%d (slot=%d) with deoptId=%d, frame=" INTPTR_FORMAT ", actionAndReason=%d, dregOopMap=%04x", workitem, k, deoptId, hsailFrame, myActionReason, dregOopMap); |
a6c144380ce7
HSAIL: added UseHSAILDeoptimization VM option for disabling HSAIL deopt support
Doug Simon <doug.simon@oracle.com>
parents:
14768
diff
changeset
|
390 // show the registers containing references |
a6c144380ce7
HSAIL: added UseHSAILDeoptimization VM option for disabling HSAIL deopt support
Doug Simon <doug.simon@oracle.com>
parents:
14768
diff
changeset
|
391 for (int bit = 0; bit < 16; bit++) { |
a6c144380ce7
HSAIL: added UseHSAILDeoptimization VM option for disabling HSAIL deopt support
Doug Simon <doug.simon@oracle.com>
parents:
14768
diff
changeset
|
392 if ((dregOopMap & (1 << bit)) != 0) { |
a6c144380ce7
HSAIL: added UseHSAILDeoptimization VM option for disabling HSAIL deopt support
Doug Simon <doug.simon@oracle.com>
parents:
14768
diff
changeset
|
393 tty->print_cr(" oop $d%d = %p", bit, hsailFrame->get_d_reg(bit)); |
a6c144380ce7
HSAIL: added UseHSAILDeoptimization VM option for disabling HSAIL deopt support
Doug Simon <doug.simon@oracle.com>
parents:
14768
diff
changeset
|
394 } |
a6c144380ce7
HSAIL: added UseHSAILDeoptimization VM option for disabling HSAIL deopt support
Doug Simon <doug.simon@oracle.com>
parents:
14768
diff
changeset
|
395 } |
a6c144380ce7
HSAIL: added UseHSAILDeoptimization VM option for disabling HSAIL deopt support
Doug Simon <doug.simon@oracle.com>
parents:
14768
diff
changeset
|
396 } |
a6c144380ce7
HSAIL: added UseHSAILDeoptimization VM option for disabling HSAIL deopt support
Doug Simon <doug.simon@oracle.com>
parents:
14768
diff
changeset
|
397 JavaCalls::call(&result, mh, &javaArgs, THREAD); |
a6c144380ce7
HSAIL: added UseHSAILDeoptimization VM option for disabling HSAIL deopt support
Doug Simon <doug.simon@oracle.com>
parents:
14768
diff
changeset
|
398 count_deoptimized++; |
a6c144380ce7
HSAIL: added UseHSAILDeoptimization VM option for disabling HSAIL deopt support
Doug Simon <doug.simon@oracle.com>
parents:
14768
diff
changeset
|
399 } |
a6c144380ce7
HSAIL: added UseHSAILDeoptimization VM option for disabling HSAIL deopt support
Doug Simon <doug.simon@oracle.com>
parents:
14768
diff
changeset
|
400 } |
a6c144380ce7
HSAIL: added UseHSAILDeoptimization VM option for disabling HSAIL deopt support
Doug Simon <doug.simon@oracle.com>
parents:
14768
diff
changeset
|
401 if (TraceGPUInteraction) { |
a6c144380ce7
HSAIL: added UseHSAILDeoptimization VM option for disabling HSAIL deopt support
Doug Simon <doug.simon@oracle.com>
parents:
14768
diff
changeset
|
402 tty->print_cr("[HSAIL] Deoptimizing to host completed for %d workitems", count_deoptimized); |
a6c144380ce7
HSAIL: added UseHSAILDeoptimization VM option for disabling HSAIL deopt support
Doug Simon <doug.simon@oracle.com>
parents:
14768
diff
changeset
|
403 } |
14768
3e9a960f0da1
HSAIL: preliminary deopt support
Doug Simon <doug.simon@oracle.com>
parents:
13888
diff
changeset
|
404 } |
14969
a6c144380ce7
HSAIL: added UseHSAILDeoptimization VM option for disabling HSAIL deopt support
Doug Simon <doug.simon@oracle.com>
parents:
14768
diff
changeset
|
405 |
a6c144380ce7
HSAIL: added UseHSAILDeoptimization VM option for disabling HSAIL deopt support
Doug Simon <doug.simon@oracle.com>
parents:
14768
diff
changeset
|
406 { |
a6c144380ce7
HSAIL: added UseHSAILDeoptimization VM option for disabling HSAIL deopt support
Doug Simon <doug.simon@oracle.com>
parents:
14768
diff
changeset
|
407 TraceTime t3("handle never-rans", TraceGPUInteraction); |
a6c144380ce7
HSAIL: added UseHSAILDeoptimization VM option for disabling HSAIL deopt support
Doug Simon <doug.simon@oracle.com>
parents:
14768
diff
changeset
|
408 |
a6c144380ce7
HSAIL: added UseHSAILDeoptimization VM option for disabling HSAIL deopt support
Doug Simon <doug.simon@oracle.com>
parents:
14768
diff
changeset
|
409 // Handle any never_ran workitems if there were any |
a6c144380ce7
HSAIL: added UseHSAILDeoptimization VM option for disabling HSAIL deopt support
Doug Simon <doug.simon@oracle.com>
parents:
14768
diff
changeset
|
410 int count_never_ran = 0; |
a6c144380ce7
HSAIL: added UseHSAILDeoptimization VM option for disabling HSAIL deopt support
Doug Simon <doug.simon@oracle.com>
parents:
14768
diff
changeset
|
411 bool handleNeverRansHere = true; |
a6c144380ce7
HSAIL: added UseHSAILDeoptimization VM option for disabling HSAIL deopt support
Doug Simon <doug.simon@oracle.com>
parents:
14768
diff
changeset
|
412 // turn off verbose trace stuff for javacall arg setup |
a6c144380ce7
HSAIL: added UseHSAILDeoptimization VM option for disabling HSAIL deopt support
Doug Simon <doug.simon@oracle.com>
parents:
14768
diff
changeset
|
413 bool savedTraceGPUInteraction = TraceGPUInteraction; |
a6c144380ce7
HSAIL: added UseHSAILDeoptimization VM option for disabling HSAIL deopt support
Doug Simon <doug.simon@oracle.com>
parents:
14768
diff
changeset
|
414 TraceGPUInteraction = false; |
a6c144380ce7
HSAIL: added UseHSAILDeoptimization VM option for disabling HSAIL deopt support
Doug Simon <doug.simon@oracle.com>
parents:
14768
diff
changeset
|
415 jboolean *never_ran_array = e->never_ran_array(); |
a6c144380ce7
HSAIL: added UseHSAILDeoptimization VM option for disabling HSAIL deopt support
Doug Simon <doug.simon@oracle.com>
parents:
14768
diff
changeset
|
416 if (handleNeverRansHere) { |
a6c144380ce7
HSAIL: added UseHSAILDeoptimization VM option for disabling HSAIL deopt support
Doug Simon <doug.simon@oracle.com>
parents:
14768
diff
changeset
|
417 for (int k = 0; k < dimX; k++) { |
a6c144380ce7
HSAIL: added UseHSAILDeoptimization VM option for disabling HSAIL deopt support
Doug Simon <doug.simon@oracle.com>
parents:
14768
diff
changeset
|
418 if (never_ran_array[k]) { |
a6c144380ce7
HSAIL: added UseHSAILDeoptimization VM option for disabling HSAIL deopt support
Doug Simon <doug.simon@oracle.com>
parents:
14768
diff
changeset
|
419 // run it as a javaCall |
a6c144380ce7
HSAIL: added UseHSAILDeoptimization VM option for disabling HSAIL deopt support
Doug Simon <doug.simon@oracle.com>
parents:
14768
diff
changeset
|
420 KlassHandle methKlass = mh->method_holder(); |
a6c144380ce7
HSAIL: added UseHSAILDeoptimization VM option for disabling HSAIL deopt support
Doug Simon <doug.simon@oracle.com>
parents:
14768
diff
changeset
|
421 Thread* THREAD = Thread::current(); |
a6c144380ce7
HSAIL: added UseHSAILDeoptimization VM option for disabling HSAIL deopt support
Doug Simon <doug.simon@oracle.com>
parents:
14768
diff
changeset
|
422 JavaValue result(T_VOID); |
a6c144380ce7
HSAIL: added UseHSAILDeoptimization VM option for disabling HSAIL deopt support
Doug Simon <doug.simon@oracle.com>
parents:
14768
diff
changeset
|
423 JavaCallArguments javaArgs; |
a6c144380ce7
HSAIL: added UseHSAILDeoptimization VM option for disabling HSAIL deopt support
Doug Simon <doug.simon@oracle.com>
parents:
14768
diff
changeset
|
424 // re-resolve the args_handle here |
15066
2cae21d9f122
HSAIL: initial support for object allocation in HSAIL kernels
Doug Simon <doug.simon@oracle.com>
parents:
14969
diff
changeset
|
425 objArrayOop resolvedArgsArray = (objArrayOop) JNIHandles::resolve(args); |
14969
a6c144380ce7
HSAIL: added UseHSAILDeoptimization VM option for disabling HSAIL deopt support
Doug Simon <doug.simon@oracle.com>
parents:
14768
diff
changeset
|
426 // This object sets up the javaCall arguments |
a6c144380ce7
HSAIL: added UseHSAILDeoptimization VM option for disabling HSAIL deopt support
Doug Simon <doug.simon@oracle.com>
parents:
14768
diff
changeset
|
427 // the way argsArray is set up, this should work for instance methods as well |
a6c144380ce7
HSAIL: added UseHSAILDeoptimization VM option for disabling HSAIL deopt support
Doug Simon <doug.simon@oracle.com>
parents:
14768
diff
changeset
|
428 // (the receiver will be the first oop pushed) |
a6c144380ce7
HSAIL: added UseHSAILDeoptimization VM option for disabling HSAIL deopt support
Doug Simon <doug.simon@oracle.com>
parents:
14768
diff
changeset
|
429 HSAILJavaCallArguments hjca(&javaArgs, k, mh->signature(), resolvedArgsArray, mh->is_static()); |
a6c144380ce7
HSAIL: added UseHSAILDeoptimization VM option for disabling HSAIL deopt support
Doug Simon <doug.simon@oracle.com>
parents:
14768
diff
changeset
|
430 if (mh->is_static()) { |
a6c144380ce7
HSAIL: added UseHSAILDeoptimization VM option for disabling HSAIL deopt support
Doug Simon <doug.simon@oracle.com>
parents:
14768
diff
changeset
|
431 JavaCalls::call_static(&result, methKlass, mh->name(), mh->signature(), &javaArgs, THREAD); |
a6c144380ce7
HSAIL: added UseHSAILDeoptimization VM option for disabling HSAIL deopt support
Doug Simon <doug.simon@oracle.com>
parents:
14768
diff
changeset
|
432 } else { |
a6c144380ce7
HSAIL: added UseHSAILDeoptimization VM option for disabling HSAIL deopt support
Doug Simon <doug.simon@oracle.com>
parents:
14768
diff
changeset
|
433 JavaCalls::call_virtual(&result, methKlass, mh->name(), mh->signature(), &javaArgs, THREAD); |
a6c144380ce7
HSAIL: added UseHSAILDeoptimization VM option for disabling HSAIL deopt support
Doug Simon <doug.simon@oracle.com>
parents:
14768
diff
changeset
|
434 } |
a6c144380ce7
HSAIL: added UseHSAILDeoptimization VM option for disabling HSAIL deopt support
Doug Simon <doug.simon@oracle.com>
parents:
14768
diff
changeset
|
435 count_never_ran++; |
a6c144380ce7
HSAIL: added UseHSAILDeoptimization VM option for disabling HSAIL deopt support
Doug Simon <doug.simon@oracle.com>
parents:
14768
diff
changeset
|
436 } |
a6c144380ce7
HSAIL: added UseHSAILDeoptimization VM option for disabling HSAIL deopt support
Doug Simon <doug.simon@oracle.com>
parents:
14768
diff
changeset
|
437 } |
a6c144380ce7
HSAIL: added UseHSAILDeoptimization VM option for disabling HSAIL deopt support
Doug Simon <doug.simon@oracle.com>
parents:
14768
diff
changeset
|
438 TraceGPUInteraction = savedTraceGPUInteraction; |
a6c144380ce7
HSAIL: added UseHSAILDeoptimization VM option for disabling HSAIL deopt support
Doug Simon <doug.simon@oracle.com>
parents:
14768
diff
changeset
|
439 if (TraceGPUInteraction) { |
a6c144380ce7
HSAIL: added UseHSAILDeoptimization VM option for disabling HSAIL deopt support
Doug Simon <doug.simon@oracle.com>
parents:
14768
diff
changeset
|
440 tty->print_cr("%d workitems never ran, have been run via JavaCall", count_never_ran); |
a6c144380ce7
HSAIL: added UseHSAILDeoptimization VM option for disabling HSAIL deopt support
Doug Simon <doug.simon@oracle.com>
parents:
14768
diff
changeset
|
441 showRanges(never_ran_array, dimX); |
a6c144380ce7
HSAIL: added UseHSAILDeoptimization VM option for disabling HSAIL deopt support
Doug Simon <doug.simon@oracle.com>
parents:
14768
diff
changeset
|
442 } |
a6c144380ce7
HSAIL: added UseHSAILDeoptimization VM option for disabling HSAIL deopt support
Doug Simon <doug.simon@oracle.com>
parents:
14768
diff
changeset
|
443 } // end of never-ran handling |
a6c144380ce7
HSAIL: added UseHSAILDeoptimization VM option for disabling HSAIL deopt support
Doug Simon <doug.simon@oracle.com>
parents:
14768
diff
changeset
|
444 } |
14768
3e9a960f0da1
HSAIL: preliminary deopt support
Doug Simon <doug.simon@oracle.com>
parents:
13888
diff
changeset
|
445 } |
15066
2cae21d9f122
HSAIL: initial support for object allocation in HSAIL kernels
Doug Simon <doug.simon@oracle.com>
parents:
14969
diff
changeset
|
446 |
14768
3e9a960f0da1
HSAIL: preliminary deopt support
Doug Simon <doug.simon@oracle.com>
parents:
13888
diff
changeset
|
447 FREE_C_HEAP_ARRAY(jboolean, e->never_ran_array(), mtInternal); |
3e9a960f0da1
HSAIL: preliminary deopt support
Doug Simon <doug.simon@oracle.com>
parents:
13888
diff
changeset
|
448 delete e; |
3e9a960f0da1
HSAIL: preliminary deopt support
Doug Simon <doug.simon@oracle.com>
parents:
13888
diff
changeset
|
449 } |
15066
2cae21d9f122
HSAIL: initial support for object allocation in HSAIL kernels
Doug Simon <doug.simon@oracle.com>
parents:
14969
diff
changeset
|
450 kernelStats.finishDispatch(); |
14768
3e9a960f0da1
HSAIL: preliminary deopt support
Doug Simon <doug.simon@oracle.com>
parents:
13888
diff
changeset
|
451 return success; |
3e9a960f0da1
HSAIL: preliminary deopt support
Doug Simon <doug.simon@oracle.com>
parents:
13888
diff
changeset
|
452 } |
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
|
453 |
13888
51584f76462d
pulled Ptx and Hsail classes out of gpu class namespace
Doug Simon <doug.simon@oracle.com>
parents:
13826
diff
changeset
|
454 GPU_ENTRY(jlong, Hsail::generate_kernel, (JNIEnv *env, jclass, jbyteArray code_handle, jstring name_handle)) |
13819
49db2c1e3bee
added support for co-existing GPU backends (JBS:GRAAL-1)
Doug Simon <doug.simon@oracle.com>
parents:
13740
diff
changeset
|
455 guarantee(_okra_create_kernel != NULL, "[HSAIL] Okra not linked"); |
49db2c1e3bee
added support for co-existing GPU backends (JBS:GRAAL-1)
Doug Simon <doug.simon@oracle.com>
parents:
13740
diff
changeset
|
456 ResourceMark rm; |
49db2c1e3bee
added support for co-existing GPU backends (JBS:GRAAL-1)
Doug Simon <doug.simon@oracle.com>
parents:
13740
diff
changeset
|
457 jsize name_len = env->GetStringLength(name_handle); |
49db2c1e3bee
added support for co-existing GPU backends (JBS:GRAAL-1)
Doug Simon <doug.simon@oracle.com>
parents:
13740
diff
changeset
|
458 jsize code_len = env->GetArrayLength(code_handle); |
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
|
459 |
13819
49db2c1e3bee
added support for co-existing GPU backends (JBS:GRAAL-1)
Doug Simon <doug.simon@oracle.com>
parents:
13740
diff
changeset
|
460 char* name = NEW_RESOURCE_ARRAY(char, name_len + 1); |
49db2c1e3bee
added support for co-existing GPU backends (JBS:GRAAL-1)
Doug Simon <doug.simon@oracle.com>
parents:
13740
diff
changeset
|
461 unsigned char *code = NEW_RESOURCE_ARRAY(unsigned char, code_len + 1); |
13740
bfd61161d752
HSAIL: support for using Okra simulator without needing to configure PATH and LD_LIBRARY_PATH
Doug Simon <doug.simon@oracle.com>
parents:
13112
diff
changeset
|
462 |
13819
49db2c1e3bee
added support for co-existing GPU backends (JBS:GRAAL-1)
Doug Simon <doug.simon@oracle.com>
parents:
13740
diff
changeset
|
463 code[code_len] = 0; |
49db2c1e3bee
added support for co-existing GPU backends (JBS:GRAAL-1)
Doug Simon <doug.simon@oracle.com>
parents:
13740
diff
changeset
|
464 name[name_len] = 0; |
49db2c1e3bee
added support for co-existing GPU backends (JBS:GRAAL-1)
Doug Simon <doug.simon@oracle.com>
parents:
13740
diff
changeset
|
465 |
49db2c1e3bee
added support for co-existing GPU backends (JBS:GRAAL-1)
Doug Simon <doug.simon@oracle.com>
parents:
13740
diff
changeset
|
466 env->GetByteArrayRegion(code_handle, 0, code_len, (jbyte*) code); |
49db2c1e3bee
added support for co-existing GPU backends (JBS:GRAAL-1)
Doug Simon <doug.simon@oracle.com>
parents:
13740
diff
changeset
|
467 env->GetStringUTFRegion(name_handle, 0, name_len, name); |
49db2c1e3bee
added support for co-existing GPU backends (JBS:GRAAL-1)
Doug Simon <doug.simon@oracle.com>
parents:
13740
diff
changeset
|
468 |
49db2c1e3bee
added support for co-existing GPU backends (JBS:GRAAL-1)
Doug Simon <doug.simon@oracle.com>
parents:
13740
diff
changeset
|
469 register_heap(); |
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
|
470 |
f1a55428a8d7
more HSAIL support in the C++ layer for executing HSAIL code on the simulator
Doug Simon <doug.simon@oracle.com>
parents:
diff
changeset
|
471 // The kernel entrypoint is always run for the time being |
f1a55428a8d7
more HSAIL support in the C++ layer for executing HSAIL code on the simulator
Doug Simon <doug.simon@oracle.com>
parents:
diff
changeset
|
472 const char* entryPointName = "&run"; |
f1a55428a8d7
more HSAIL support in the C++ layer for executing HSAIL code on the simulator
Doug Simon <doug.simon@oracle.com>
parents:
diff
changeset
|
473 |
13112
166ed1584f30
HSAIL: null checks when loading Okra library functions
Doug Simon <doug.simon@oracle.com>
parents:
13097
diff
changeset
|
474 _device_context = _okra_create_context(); |
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
|
475 |
13819
49db2c1e3bee
added support for co-existing GPU backends (JBS:GRAAL-1)
Doug Simon <doug.simon@oracle.com>
parents:
13740
diff
changeset
|
476 return (jlong) _okra_create_kernel(_device_context, code, entryPointName); |
49db2c1e3bee
added support for co-existing GPU backends (JBS:GRAAL-1)
Doug Simon <doug.simon@oracle.com>
parents:
13740
diff
changeset
|
477 GPU_END |
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
|
478 |
f1a55428a8d7
more HSAIL support in the C++ layer for executing HSAIL code on the simulator
Doug Simon <doug.simon@oracle.com>
parents:
diff
changeset
|
479 #if defined(LINUX) |
13822
35fc64972250
fixed Linux compile error and removed name of not-yet-existing Windows Okra dll
Doug Simon <doug.simon@oracle.com>
parents:
13819
diff
changeset
|
480 static const char* okra_library_name = "libokra_x86_64.so"; |
13826
62bd4705894c
reverted removal of Okra Windows DLL name
Doug Simon <doug.simon@oracle.com>
parents:
13822
diff
changeset
|
481 #elif defined(_WINDOWS) |
62bd4705894c
reverted removal of Okra Windows DLL name
Doug Simon <doug.simon@oracle.com>
parents:
13822
diff
changeset
|
482 static char const* okra_library_name = "okra_x86_64.dll"; |
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
|
483 #else |
13822
35fc64972250
fixed Linux compile error and removed name of not-yet-existing Windows Okra dll
Doug Simon <doug.simon@oracle.com>
parents:
13819
diff
changeset
|
484 static char const* okra_library_name = NULL; |
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
|
485 #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
|
486 |
13112
166ed1584f30
HSAIL: null checks when loading Okra library functions
Doug Simon <doug.simon@oracle.com>
parents:
13097
diff
changeset
|
487 #define STRINGIFY(x) #x |
166ed1584f30
HSAIL: null checks when loading Okra library functions
Doug Simon <doug.simon@oracle.com>
parents:
13097
diff
changeset
|
488 |
166ed1584f30
HSAIL: null checks when loading Okra library functions
Doug Simon <doug.simon@oracle.com>
parents:
13097
diff
changeset
|
489 #define LOOKUP_OKRA_FUNCTION(name, alias) \ |
166ed1584f30
HSAIL: null checks when loading Okra library functions
Doug Simon <doug.simon@oracle.com>
parents:
13097
diff
changeset
|
490 _##alias = \ |
15067
0e689f20706e
HSAIL: avoid loading native Okra library twice
Doug Simon <doug.simon@oracle.com>
parents:
15066
diff
changeset
|
491 CAST_TO_FN_PTR(alias##_func_t, os::dll_lookup(okra_lib_handle, STRINGIFY(name))); \ |
13112
166ed1584f30
HSAIL: null checks when loading Okra library functions
Doug Simon <doug.simon@oracle.com>
parents:
13097
diff
changeset
|
492 if (_##alias == NULL) { \ |
166ed1584f30
HSAIL: null checks when loading Okra library functions
Doug Simon <doug.simon@oracle.com>
parents:
13097
diff
changeset
|
493 tty->print_cr("[HSAIL] ***** Error: Failed to lookup %s in %s, wrong version of OKRA?", STRINGIFY(name), okra_library_name); \ |
13819
49db2c1e3bee
added support for co-existing GPU backends (JBS:GRAAL-1)
Doug Simon <doug.simon@oracle.com>
parents:
13740
diff
changeset
|
494 return false; \ |
13112
166ed1584f30
HSAIL: null checks when loading Okra library functions
Doug Simon <doug.simon@oracle.com>
parents:
13097
diff
changeset
|
495 } \ |
166ed1584f30
HSAIL: null checks when loading Okra library functions
Doug Simon <doug.simon@oracle.com>
parents:
13097
diff
changeset
|
496 |
13888
51584f76462d
pulled Ptx and Hsail classes out of gpu class namespace
Doug Simon <doug.simon@oracle.com>
parents:
13826
diff
changeset
|
497 GPU_ENTRY(jboolean, Hsail::initialize, (JNIEnv *env, jclass)) |
13740
bfd61161d752
HSAIL: support for using Okra simulator without needing to configure PATH and LD_LIBRARY_PATH
Doug Simon <doug.simon@oracle.com>
parents:
13112
diff
changeset
|
498 if (okra_library_name == NULL) { |
13097 | 499 if (TraceGPUInteraction) { |
500 tty->print_cr("Unsupported HSAIL platform"); | |
501 } | |
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
|
502 return false; |
f1a55428a8d7
more HSAIL support in the C++ layer for executing HSAIL code on the simulator
Doug Simon <doug.simon@oracle.com>
parents:
diff
changeset
|
503 } |
13740
bfd61161d752
HSAIL: support for using Okra simulator without needing to configure PATH and LD_LIBRARY_PATH
Doug Simon <doug.simon@oracle.com>
parents:
13112
diff
changeset
|
504 |
bfd61161d752
HSAIL: support for using Okra simulator without needing to configure PATH and LD_LIBRARY_PATH
Doug Simon <doug.simon@oracle.com>
parents:
13112
diff
changeset
|
505 // here we know we have a valid okra_library_name to try to load |
13819
49db2c1e3bee
added support for co-existing GPU backends (JBS:GRAAL-1)
Doug Simon <doug.simon@oracle.com>
parents:
13740
diff
changeset
|
506 char ebuf[O_BUFLEN]; |
15067
0e689f20706e
HSAIL: avoid loading native Okra library twice
Doug Simon <doug.simon@oracle.com>
parents:
15066
diff
changeset
|
507 char *okra_lib_name_from_env_var = getenv("_OKRA_SIM_LIB_PATH_"); |
0e689f20706e
HSAIL: avoid loading native Okra library twice
Doug Simon <doug.simon@oracle.com>
parents:
15066
diff
changeset
|
508 if (okra_lib_name_from_env_var != NULL) { |
0e689f20706e
HSAIL: avoid loading native Okra library twice
Doug Simon <doug.simon@oracle.com>
parents:
15066
diff
changeset
|
509 okra_library_name = okra_lib_name_from_env_var; |
0e689f20706e
HSAIL: avoid loading native Okra library twice
Doug Simon <doug.simon@oracle.com>
parents:
15066
diff
changeset
|
510 } |
13097 | 511 if (TraceGPUInteraction) { |
15067
0e689f20706e
HSAIL: avoid loading native Okra library twice
Doug Simon <doug.simon@oracle.com>
parents:
15066
diff
changeset
|
512 tty->print_cr("[HSAIL] library is %s", okra_library_name); |
13740
bfd61161d752
HSAIL: support for using Okra simulator without needing to configure PATH and LD_LIBRARY_PATH
Doug Simon <doug.simon@oracle.com>
parents:
13112
diff
changeset
|
513 } |
15067
0e689f20706e
HSAIL: avoid loading native Okra library twice
Doug Simon <doug.simon@oracle.com>
parents:
15066
diff
changeset
|
514 void *okra_lib_handle = NULL; |
0e689f20706e
HSAIL: avoid loading native Okra library twice
Doug Simon <doug.simon@oracle.com>
parents:
15066
diff
changeset
|
515 #if defined(LINUX) |
0e689f20706e
HSAIL: avoid loading native Okra library twice
Doug Simon <doug.simon@oracle.com>
parents:
15066
diff
changeset
|
516 // Check first if the Okra library is already loaded. |
0e689f20706e
HSAIL: avoid loading native Okra library twice
Doug Simon <doug.simon@oracle.com>
parents:
15066
diff
changeset
|
517 // TODO: Figure out how to do this on other OSes. |
0e689f20706e
HSAIL: avoid loading native Okra library twice
Doug Simon <doug.simon@oracle.com>
parents:
15066
diff
changeset
|
518 okra_lib_handle = ::dlopen(okra_library_name, RTLD_LAZY | RTLD_NOLOAD); |
0e689f20706e
HSAIL: avoid loading native Okra library twice
Doug Simon <doug.simon@oracle.com>
parents:
15066
diff
changeset
|
519 #endif |
0e689f20706e
HSAIL: avoid loading native Okra library twice
Doug Simon <doug.simon@oracle.com>
parents:
15066
diff
changeset
|
520 // If Okra library is not already loaded, load it here |
0e689f20706e
HSAIL: avoid loading native Okra library twice
Doug Simon <doug.simon@oracle.com>
parents:
15066
diff
changeset
|
521 if (okra_lib_handle == NULL) { |
0e689f20706e
HSAIL: avoid loading native Okra library twice
Doug Simon <doug.simon@oracle.com>
parents:
15066
diff
changeset
|
522 okra_lib_handle = os::dll_load(okra_library_name, ebuf, O_BUFLEN); |
0e689f20706e
HSAIL: avoid loading native Okra library twice
Doug Simon <doug.simon@oracle.com>
parents:
15066
diff
changeset
|
523 } |
0e689f20706e
HSAIL: avoid loading native Okra library twice
Doug Simon <doug.simon@oracle.com>
parents:
15066
diff
changeset
|
524 if (okra_lib_handle == NULL) { |
0e689f20706e
HSAIL: avoid loading native Okra library twice
Doug Simon <doug.simon@oracle.com>
parents:
15066
diff
changeset
|
525 // Unable to open Okra library |
13740
bfd61161d752
HSAIL: support for using Okra simulator without needing to configure PATH and LD_LIBRARY_PATH
Doug Simon <doug.simon@oracle.com>
parents:
13112
diff
changeset
|
526 if (TraceGPUInteraction) { |
bfd61161d752
HSAIL: support for using Okra simulator without needing to configure PATH and LD_LIBRARY_PATH
Doug Simon <doug.simon@oracle.com>
parents:
13112
diff
changeset
|
527 tty->print_cr("[HSAIL] library load failed."); |
bfd61161d752
HSAIL: support for using Okra simulator without needing to configure PATH and LD_LIBRARY_PATH
Doug Simon <doug.simon@oracle.com>
parents:
13112
diff
changeset
|
528 } |
bfd61161d752
HSAIL: support for using Okra simulator without needing to configure PATH and LD_LIBRARY_PATH
Doug Simon <doug.simon@oracle.com>
parents:
13112
diff
changeset
|
529 return false; |
bfd61161d752
HSAIL: support for using Okra simulator without needing to configure PATH and LD_LIBRARY_PATH
Doug Simon <doug.simon@oracle.com>
parents:
13112
diff
changeset
|
530 } |
bfd61161d752
HSAIL: support for using Okra simulator without needing to configure PATH and LD_LIBRARY_PATH
Doug Simon <doug.simon@oracle.com>
parents:
13112
diff
changeset
|
531 |
13819
49db2c1e3bee
added support for co-existing GPU backends (JBS:GRAAL-1)
Doug Simon <doug.simon@oracle.com>
parents:
13740
diff
changeset
|
532 guarantee(_okra_create_context == NULL, "cannot repeat GPU initialization"); |
49db2c1e3bee
added support for co-existing GPU backends (JBS:GRAAL-1)
Doug Simon <doug.simon@oracle.com>
parents:
13740
diff
changeset
|
533 |
15067
0e689f20706e
HSAIL: avoid loading native Okra library twice
Doug Simon <doug.simon@oracle.com>
parents:
15066
diff
changeset
|
534 // at this point we know okra_lib_handle is valid whether we loaded |
0e689f20706e
HSAIL: avoid loading native Okra library twice
Doug Simon <doug.simon@oracle.com>
parents:
15066
diff
changeset
|
535 // here or earlier. In either case, we can lookup the functions |
13740
bfd61161d752
HSAIL: support for using Okra simulator without needing to configure PATH and LD_LIBRARY_PATH
Doug Simon <doug.simon@oracle.com>
parents:
13112
diff
changeset
|
536 LOOKUP_OKRA_FUNCTION(okra_create_context, okra_create_context); |
bfd61161d752
HSAIL: support for using Okra simulator without needing to configure PATH and LD_LIBRARY_PATH
Doug Simon <doug.simon@oracle.com>
parents:
13112
diff
changeset
|
537 LOOKUP_OKRA_FUNCTION(okra_create_kernel, okra_create_kernel); |
bfd61161d752
HSAIL: support for using Okra simulator without needing to configure PATH and LD_LIBRARY_PATH
Doug Simon <doug.simon@oracle.com>
parents:
13112
diff
changeset
|
538 LOOKUP_OKRA_FUNCTION(okra_push_object, okra_push_object); |
bfd61161d752
HSAIL: support for using Okra simulator without needing to configure PATH and LD_LIBRARY_PATH
Doug Simon <doug.simon@oracle.com>
parents:
13112
diff
changeset
|
539 LOOKUP_OKRA_FUNCTION(okra_push_boolean, okra_push_boolean); |
bfd61161d752
HSAIL: support for using Okra simulator without needing to configure PATH and LD_LIBRARY_PATH
Doug Simon <doug.simon@oracle.com>
parents:
13112
diff
changeset
|
540 LOOKUP_OKRA_FUNCTION(okra_push_byte, okra_push_byte); |
bfd61161d752
HSAIL: support for using Okra simulator without needing to configure PATH and LD_LIBRARY_PATH
Doug Simon <doug.simon@oracle.com>
parents:
13112
diff
changeset
|
541 LOOKUP_OKRA_FUNCTION(okra_push_double, okra_push_double); |
bfd61161d752
HSAIL: support for using Okra simulator without needing to configure PATH and LD_LIBRARY_PATH
Doug Simon <doug.simon@oracle.com>
parents:
13112
diff
changeset
|
542 LOOKUP_OKRA_FUNCTION(okra_push_float, okra_push_float); |
bfd61161d752
HSAIL: support for using Okra simulator without needing to configure PATH and LD_LIBRARY_PATH
Doug Simon <doug.simon@oracle.com>
parents:
13112
diff
changeset
|
543 LOOKUP_OKRA_FUNCTION(okra_push_int, okra_push_int); |
bfd61161d752
HSAIL: support for using Okra simulator without needing to configure PATH and LD_LIBRARY_PATH
Doug Simon <doug.simon@oracle.com>
parents:
13112
diff
changeset
|
544 LOOKUP_OKRA_FUNCTION(okra_push_long, okra_push_long); |
bfd61161d752
HSAIL: support for using Okra simulator without needing to configure PATH and LD_LIBRARY_PATH
Doug Simon <doug.simon@oracle.com>
parents:
13112
diff
changeset
|
545 LOOKUP_OKRA_FUNCTION(okra_execute_with_range, okra_execute_with_range); |
bfd61161d752
HSAIL: support for using Okra simulator without needing to configure PATH and LD_LIBRARY_PATH
Doug Simon <doug.simon@oracle.com>
parents:
13112
diff
changeset
|
546 LOOKUP_OKRA_FUNCTION(okra_clearargs, okra_clearargs); |
bfd61161d752
HSAIL: support for using Okra simulator without needing to configure PATH and LD_LIBRARY_PATH
Doug Simon <doug.simon@oracle.com>
parents:
13112
diff
changeset
|
547 LOOKUP_OKRA_FUNCTION(okra_register_heap, okra_register_heap); |
bfd61161d752
HSAIL: support for using Okra simulator without needing to configure PATH and LD_LIBRARY_PATH
Doug Simon <doug.simon@oracle.com>
parents:
13112
diff
changeset
|
548 // if we made it this far, real success |
13819
49db2c1e3bee
added support for co-existing GPU backends (JBS:GRAAL-1)
Doug Simon <doug.simon@oracle.com>
parents:
13740
diff
changeset
|
549 |
49db2c1e3bee
added support for co-existing GPU backends (JBS:GRAAL-1)
Doug Simon <doug.simon@oracle.com>
parents:
13740
diff
changeset
|
550 gpu::initialized_gpu("Okra"); |
49db2c1e3bee
added support for co-existing GPU backends (JBS:GRAAL-1)
Doug Simon <doug.simon@oracle.com>
parents:
13740
diff
changeset
|
551 |
49db2c1e3bee
added support for co-existing GPU backends (JBS:GRAAL-1)
Doug Simon <doug.simon@oracle.com>
parents:
13740
diff
changeset
|
552 return true; |
49db2c1e3bee
added support for co-existing GPU backends (JBS:GRAAL-1)
Doug Simon <doug.simon@oracle.com>
parents:
13740
diff
changeset
|
553 GPU_END |
49db2c1e3bee
added support for co-existing GPU backends (JBS:GRAAL-1)
Doug Simon <doug.simon@oracle.com>
parents:
13740
diff
changeset
|
554 |
14768
3e9a960f0da1
HSAIL: preliminary deopt support
Doug Simon <doug.simon@oracle.com>
parents:
13888
diff
changeset
|
555 |
13888
51584f76462d
pulled Ptx and Hsail classes out of gpu class namespace
Doug Simon <doug.simon@oracle.com>
parents:
13826
diff
changeset
|
556 bool Hsail::register_natives(JNIEnv* env) { |
13819
49db2c1e3bee
added support for co-existing GPU backends (JBS:GRAAL-1)
Doug Simon <doug.simon@oracle.com>
parents:
13740
diff
changeset
|
557 jclass klass = env->FindClass("com/oracle/graal/hotspot/hsail/HSAILHotSpotBackend"); |
49db2c1e3bee
added support for co-existing GPU backends (JBS:GRAAL-1)
Doug Simon <doug.simon@oracle.com>
parents:
13740
diff
changeset
|
558 if (klass == NULL) { |
49db2c1e3bee
added support for co-existing GPU backends (JBS:GRAAL-1)
Doug Simon <doug.simon@oracle.com>
parents:
13740
diff
changeset
|
559 if (TraceGPUInteraction) { |
49db2c1e3bee
added support for co-existing GPU backends (JBS:GRAAL-1)
Doug Simon <doug.simon@oracle.com>
parents:
13740
diff
changeset
|
560 tty->print_cr("HSAILHotSpotBackend class not found"); |
49db2c1e3bee
added support for co-existing GPU backends (JBS:GRAAL-1)
Doug Simon <doug.simon@oracle.com>
parents:
13740
diff
changeset
|
561 } |
49db2c1e3bee
added support for co-existing GPU backends (JBS:GRAAL-1)
Doug Simon <doug.simon@oracle.com>
parents:
13740
diff
changeset
|
562 return false; |
49db2c1e3bee
added support for co-existing GPU backends (JBS:GRAAL-1)
Doug Simon <doug.simon@oracle.com>
parents:
13740
diff
changeset
|
563 } |
49db2c1e3bee
added support for co-existing GPU backends (JBS:GRAAL-1)
Doug Simon <doug.simon@oracle.com>
parents:
13740
diff
changeset
|
564 jint status = env->RegisterNatives(klass, HSAIL_methods, sizeof(HSAIL_methods) / sizeof(JNINativeMethod)); |
49db2c1e3bee
added support for co-existing GPU backends (JBS:GRAAL-1)
Doug Simon <doug.simon@oracle.com>
parents:
13740
diff
changeset
|
565 if (status != JNI_OK) { |
49db2c1e3bee
added support for co-existing GPU backends (JBS:GRAAL-1)
Doug Simon <doug.simon@oracle.com>
parents:
13740
diff
changeset
|
566 if (TraceGPUInteraction) { |
49db2c1e3bee
added support for co-existing GPU backends (JBS:GRAAL-1)
Doug Simon <doug.simon@oracle.com>
parents:
13740
diff
changeset
|
567 tty->print_cr("Error registering natives for HSAILHotSpotBackend: %d", status); |
49db2c1e3bee
added support for co-existing GPU backends (JBS:GRAAL-1)
Doug Simon <doug.simon@oracle.com>
parents:
13740
diff
changeset
|
568 } |
49db2c1e3bee
added support for co-existing GPU backends (JBS:GRAAL-1)
Doug Simon <doug.simon@oracle.com>
parents:
13740
diff
changeset
|
569 return false; |
49db2c1e3bee
added support for co-existing GPU backends (JBS:GRAAL-1)
Doug Simon <doug.simon@oracle.com>
parents:
13740
diff
changeset
|
570 } |
13740
bfd61161d752
HSAIL: support for using Okra simulator without needing to configure PATH and LD_LIBRARY_PATH
Doug Simon <doug.simon@oracle.com>
parents:
13112
diff
changeset
|
571 return true; |
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
|
572 } |