annotate src/gpu/hsail/vm/gpu_hsail.cpp @ 18408:2c3666f44855

Truffle: initial commit of object API implementation
author Andreas Woess <andreas.woess@jku.at>
date Tue, 18 Nov 2014 23:19:43 +0100
parents f55f2d400797
children 82e5b5ccdb0c
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
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"
15582
063ec2920d21 made Graal runtime initialization in hosted mode lazy
Doug Simon <doug.simon@oracle.com>
parents: 15488
diff changeset
36 #include "graal/graalRuntime.hpp"
13819
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 "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
43
13819
49db2c1e3bee added support for co-existing GPU backends (JBS:GRAAL-1)
Doug Simon <doug.simon@oracle.com>
parents: 13740
diff changeset
44 // 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
45 #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
46 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
47 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
48
49db2c1e3bee added support for co-existing GPU backends (JBS:GRAAL-1)
Doug Simon <doug.simon@oracle.com>
parents: 13740
diff changeset
49 // 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
50 // 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
51 #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
52 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
53
49db2c1e3bee added support for co-existing GPU backends (JBS:GRAAL-1)
Doug Simon <doug.simon@oracle.com>
parents: 13740
diff changeset
54 #define GPU_END }
49db2c1e3bee added support for co-existing GPU backends (JBS:GRAAL-1)
Doug Simon <doug.simon@oracle.com>
parents: 13740
diff changeset
55
49db2c1e3bee added support for co-existing GPU backends (JBS:GRAAL-1)
Doug Simon <doug.simon@oracle.com>
parents: 13740
diff changeset
56 #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
57 #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
58
49db2c1e3bee added support for co-existing GPU backends (JBS:GRAAL-1)
Doug Simon <doug.simon@oracle.com>
parents: 13740
diff changeset
59 #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
60 #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
61 #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
62 #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
63 #define HS_COMPILED_NMETHOD "Lcom/oracle/graal/hotspot/HotSpotCompiledNmethod;"
3e9a960f0da1 HSAIL: preliminary deopt support
Doug Simon <doug.simon@oracle.com>
parents: 13888
diff changeset
64 #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
65
13888
51584f76462d pulled Ptx and Hsail classes out of gpu class namespace
Doug Simon <doug.simon@oracle.com>
parents: 13826
diff changeset
66 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
67 {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
68 {CC"generateKernel", CC"([B" STRING ")J", FN_PTR(Hsail::generate_kernel)},
16795
a29e6e7b7a86 Replace hsail donor threads with hsail tlabs
Tom Rodriguez <tom.rodriguez@oracle.com>
parents: 16540
diff changeset
69 {CC"executeKernel0", CC"("HS_INSTALLED_CODE"I["OBJECT"II[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
70 };
49db2c1e3bee added support for co-existing GPU backends (JBS:GRAAL-1)
Doug Simon <doug.simon@oracle.com>
parents: 13740
diff changeset
71
16076
06eedda53e14 HSAIL: add support to allocate new TLAB from GPU
Doug Simon <doug.simon@oracle.com>
parents: 16006
diff changeset
72 void* Hsail::_device_context = NULL;
06eedda53e14 HSAIL: add support to allocate new TLAB from GPU
Doug Simon <doug.simon@oracle.com>
parents: 16006
diff changeset
73 jint Hsail::_notice_safepoints = false;
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
16533
d5c4bb0039d8 HSAIL: update simulator
Bernhard Urban <bernhard.urban@jku.at>
parents: 16242
diff changeset
75 Hsail::okra_get_context_func_t Hsail::_okra_get_context;
13888
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;
16533
d5c4bb0039d8 HSAIL: update simulator
Bernhard Urban <bernhard.urban@jku.at>
parents: 16242
diff changeset
77 Hsail::okra_push_pointer_func_t Hsail::_okra_push_pointer;
13888
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;
16533
d5c4bb0039d8 HSAIL: update simulator
Bernhard Urban <bernhard.urban@jku.at>
parents: 16242
diff changeset
84 Hsail::okra_execute_kernel_func_t Hsail::_okra_execute_kernel;
d5c4bb0039d8 HSAIL: update simulator
Bernhard Urban <bernhard.urban@jku.at>
parents: 16242
diff changeset
85 Hsail::okra_clear_args_func_t Hsail::_okra_clear_args;
d5c4bb0039d8 HSAIL: update simulator
Bernhard Urban <bernhard.urban@jku.at>
parents: 16242
diff changeset
86 Hsail::okra_dispose_kernel_func_t Hsail::_okra_dispose_kernel;
d5c4bb0039d8 HSAIL: update simulator
Bernhard Urban <bernhard.urban@jku.at>
parents: 16242
diff changeset
87 Hsail::okra_dispose_context_func_t Hsail::_okra_dispose_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
88
15177
66e3af78ea96 HSAIL: added safepoint support
Doug Simon <doug.simon@oracle.com>
parents: 15161
diff changeset
89 //static jint in_kernel = 0;
66e3af78ea96 HSAIL: added safepoint support
Doug Simon <doug.simon@oracle.com>
parents: 15161
diff changeset
90
66e3af78ea96 HSAIL: added safepoint support
Doug Simon <doug.simon@oracle.com>
parents: 15161
diff changeset
91 void Hsail::notice_safepoints() {
66e3af78ea96 HSAIL: added safepoint support
Doug Simon <doug.simon@oracle.com>
parents: 15161
diff changeset
92 _notice_safepoints = true;
66e3af78ea96 HSAIL: added safepoint support
Doug Simon <doug.simon@oracle.com>
parents: 15161
diff changeset
93 // if (TraceGPUInteraction) {
66e3af78ea96 HSAIL: added safepoint support
Doug Simon <doug.simon@oracle.com>
parents: 15161
diff changeset
94 // tty->print_cr("[HSAIL] Notice safepoint in_kernel=%d", in_kernel);
66e3af78ea96 HSAIL: added safepoint support
Doug Simon <doug.simon@oracle.com>
parents: 15161
diff changeset
95 // }
66e3af78ea96 HSAIL: added safepoint support
Doug Simon <doug.simon@oracle.com>
parents: 15161
diff changeset
96 }
66e3af78ea96 HSAIL: added safepoint support
Doug Simon <doug.simon@oracle.com>
parents: 15161
diff changeset
97
66e3af78ea96 HSAIL: added safepoint support
Doug Simon <doug.simon@oracle.com>
parents: 15161
diff changeset
98 void Hsail::ignore_safepoints() {
66e3af78ea96 HSAIL: added safepoint support
Doug Simon <doug.simon@oracle.com>
parents: 15161
diff changeset
99 _notice_safepoints = false;
66e3af78ea96 HSAIL: added safepoint support
Doug Simon <doug.simon@oracle.com>
parents: 15161
diff changeset
100 }
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
101
16242
e9998e2be7f5 use oops_do to modify saved hsail state
Gilles Duboscq <duboscq@ssw.jku.at>
parents: 16076
diff changeset
102 GPU_VMENTRY(jboolean, Hsail::execute_kernel_void_1d, (JNIEnv* env, jclass, jobject kernel_handle, jint dimX, jobject args,
16795
a29e6e7b7a86 Replace hsail donor threads with hsail tlabs
Tom Rodriguez <tom.rodriguez@oracle.com>
parents: 16540
diff changeset
103 jint num_tlabs, jint allocBytesPerWorkitem, jobject oop_map_array))
13819
49db2c1e3bee added support for co-existing GPU backends (JBS:GRAAL-1)
Doug Simon <doug.simon@oracle.com>
parents: 13740
diff changeset
104
49db2c1e3bee added support for co-existing GPU backends (JBS:GRAAL-1)
Doug Simon <doug.simon@oracle.com>
parents: 13740
diff changeset
105 ResourceMark rm;
15161
2c940b1a48d8 Convert InstalledCode from an interface into an abstract class.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents: 15067
diff changeset
106 jlong nmethodValue = InstalledCode::address(kernel_handle);
13819
49db2c1e3bee added support for co-existing GPU backends (JBS:GRAAL-1)
Doug Simon <doug.simon@oracle.com>
parents: 13740
diff changeset
107 if (nmethodValue == 0) {
49db2c1e3bee added support for co-existing GPU backends (JBS:GRAAL-1)
Doug Simon <doug.simon@oracle.com>
parents: 13740
diff changeset
108 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
109 }
49db2c1e3bee added support for co-existing GPU backends (JBS:GRAAL-1)
Doug Simon <doug.simon@oracle.com>
parents: 13740
diff changeset
110 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
111 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
112 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
113
49db2c1e3bee added support for co-existing GPU backends (JBS:GRAAL-1)
Doug Simon <doug.simon@oracle.com>
parents: 13740
diff changeset
114 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
115 if (kernel == NULL) {
49db2c1e3bee added support for co-existing GPU backends (JBS:GRAAL-1)
Doug Simon <doug.simon@oracle.com>
parents: 13740
diff changeset
116 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
117 }
49db2c1e3bee added support for co-existing GPU backends (JBS:GRAAL-1)
Doug Simon <doug.simon@oracle.com>
parents: 13740
diff changeset
118
16795
a29e6e7b7a86 Replace hsail donor threads with hsail tlabs
Tom Rodriguez <tom.rodriguez@oracle.com>
parents: 16540
diff changeset
119 return execute_kernel_void_1d_internal((address) kernel, dimX, args, mh, nm, num_tlabs, allocBytesPerWorkitem, oop_map_array, CHECK_0);
14768
3e9a960f0da1 HSAIL: preliminary deopt support
Doug Simon <doug.simon@oracle.com>
parents: 13888
diff changeset
120 GPU_END
3e9a960f0da1 HSAIL: preliminary deopt support
Doug Simon <doug.simon@oracle.com>
parents: 13888
diff changeset
121
16076
06eedda53e14 HSAIL: add support to allocate new TLAB from GPU
Doug Simon <doug.simon@oracle.com>
parents: 16006
diff changeset
122 static void showRanges(jboolean* a, int len) {
14768
3e9a960f0da1 HSAIL: preliminary deopt support
Doug Simon <doug.simon@oracle.com>
parents: 13888
diff changeset
123 // show ranges
3e9a960f0da1 HSAIL: preliminary deopt support
Doug Simon <doug.simon@oracle.com>
parents: 13888
diff changeset
124 bool lookFor = true;
3e9a960f0da1 HSAIL: preliminary deopt support
Doug Simon <doug.simon@oracle.com>
parents: 13888
diff changeset
125 for (int i = 0; i < len; i++) {
3e9a960f0da1 HSAIL: preliminary deopt support
Doug Simon <doug.simon@oracle.com>
parents: 13888
diff changeset
126 if ((lookFor == true) && (a[i] != 0)) {
3e9a960f0da1 HSAIL: preliminary deopt support
Doug Simon <doug.simon@oracle.com>
parents: 13888
diff changeset
127 tty->print("%d", i);
3e9a960f0da1 HSAIL: preliminary deopt support
Doug Simon <doug.simon@oracle.com>
parents: 13888
diff changeset
128 lookFor = false;
3e9a960f0da1 HSAIL: preliminary deopt support
Doug Simon <doug.simon@oracle.com>
parents: 13888
diff changeset
129 } else if ((lookFor == false) && (a[i] == 0)) {
3e9a960f0da1 HSAIL: preliminary deopt support
Doug Simon <doug.simon@oracle.com>
parents: 13888
diff changeset
130 tty->print_cr("-%d", i-1);
3e9a960f0da1 HSAIL: preliminary deopt support
Doug Simon <doug.simon@oracle.com>
parents: 13888
diff changeset
131 lookFor = true;
3e9a960f0da1 HSAIL: preliminary deopt support
Doug Simon <doug.simon@oracle.com>
parents: 13888
diff changeset
132 }
3e9a960f0da1 HSAIL: preliminary deopt support
Doug Simon <doug.simon@oracle.com>
parents: 13888
diff changeset
133 }
3e9a960f0da1 HSAIL: preliminary deopt support
Doug Simon <doug.simon@oracle.com>
parents: 13888
diff changeset
134 if (lookFor == false) {
3e9a960f0da1 HSAIL: preliminary deopt support
Doug Simon <doug.simon@oracle.com>
parents: 13888
diff changeset
135 tty->print_cr("-%d", len-1);
3e9a960f0da1 HSAIL: preliminary deopt support
Doug Simon <doug.simon@oracle.com>
parents: 13888
diff changeset
136 }
3e9a960f0da1 HSAIL: preliminary deopt support
Doug Simon <doug.simon@oracle.com>
parents: 13888
diff changeset
137 }
3e9a960f0da1 HSAIL: preliminary deopt support
Doug Simon <doug.simon@oracle.com>
parents: 13888
diff changeset
138
16242
e9998e2be7f5 use oops_do to modify saved hsail state
Gilles Duboscq <duboscq@ssw.jku.at>
parents: 16076
diff changeset
139 jboolean Hsail::execute_kernel_void_1d_internal(address kernel, int dimX, jobject args, methodHandle& mh, nmethod* nm,
16795
a29e6e7b7a86 Replace hsail donor threads with hsail tlabs
Tom Rodriguez <tom.rodriguez@oracle.com>
parents: 16540
diff changeset
140 jint num_tlabs, int allocBytesPerWorkitem, jobject oop_map_array, TRAPS) {
14768
3e9a960f0da1 HSAIL: preliminary deopt support
Doug Simon <doug.simon@oracle.com>
parents: 13888
diff changeset
141 ResourceMark rm(THREAD);
15066
2cae21d9f122 HSAIL: initial support for object allocation in HSAIL kernels
Doug Simon <doug.simon@oracle.com>
parents: 14969
diff changeset
142 objArrayOop argsArray = (objArrayOop) JNIHandles::resolve(args);
16878
bbb987aec58d HSAIL: pass the number of argument to the JavaCallArguments constructor. Add TraceTime for kernel creation.
Gilles Duboscq <duboscq@ssw.jku.at>
parents: 16795
diff changeset
143 // Note this length does not include the iteration variable since it is replaced by the HSA workitemid
bbb987aec58d HSAIL: pass the number of argument to the JavaCallArguments constructor. Add TraceTime for kernel creation.
Gilles Duboscq <duboscq@ssw.jku.at>
parents: 16795
diff changeset
144 int argsArrayLength = argsArray->length();
16242
e9998e2be7f5 use oops_do to modify saved hsail state
Gilles Duboscq <duboscq@ssw.jku.at>
parents: 16076
diff changeset
145 assert(THREAD->is_Java_thread(), "must be a JavaThread");
15066
2cae21d9f122 HSAIL: initial support for object allocation in HSAIL kernels
Doug Simon <doug.simon@oracle.com>
parents: 14969
diff changeset
146
16076
06eedda53e14 HSAIL: add support to allocate new TLAB from GPU
Doug Simon <doug.simon@oracle.com>
parents: 16006
diff changeset
147 // We avoid HSAILAllocationInfo logic if kernel does not allocate
16795
a29e6e7b7a86 Replace hsail donor threads with hsail tlabs
Tom Rodriguez <tom.rodriguez@oracle.com>
parents: 16540
diff changeset
148 // in which case the num_tlabs passed in will be 0
a29e6e7b7a86 Replace hsail donor threads with hsail tlabs
Tom Rodriguez <tom.rodriguez@oracle.com>
parents: 16540
diff changeset
149 HSAILAllocationInfo* allocInfo = (num_tlabs == 0 ? NULL : new HSAILAllocationInfo(num_tlabs, dimX, allocBytesPerWorkitem));
16076
06eedda53e14 HSAIL: add support to allocate new TLAB from GPU
Doug Simon <doug.simon@oracle.com>
parents: 16006
diff changeset
150
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
151 // Reset the kernel arguments
16533
d5c4bb0039d8 HSAIL: update simulator
Bernhard Urban <bernhard.urban@jku.at>
parents: 16242
diff changeset
152 _okra_clear_args(kernel);
12743
f1a55428a8d7 more HSAIL support in the C++ layer for executing HSAIL code on the simulator
Doug Simon <doug.simon@oracle.com>
parents:
diff changeset
153
16242
e9998e2be7f5 use oops_do to modify saved hsail state
Gilles Duboscq <duboscq@ssw.jku.at>
parents: 16076
diff changeset
154 JavaThread* thread = (JavaThread*)THREAD;
14768
3e9a960f0da1 HSAIL: preliminary deopt support
Doug Simon <doug.simon@oracle.com>
parents: 13888
diff changeset
155 HSAILDeoptimizationInfo* e;
14969
a6c144380ce7 HSAIL: added UseHSAILDeoptimization VM option for disabling HSAIL deopt support
Doug Simon <doug.simon@oracle.com>
parents: 14768
diff changeset
156 if (UseHSAILDeoptimization) {
15609
66d31e70bd79 HSAIL: fixed deopt bug; cleaned up C++ code
Doug Simon <doug.simon@oracle.com>
parents: 15582
diff changeset
157 // get how many bytes per deopt save area are required
16242
e9998e2be7f5 use oops_do to modify saved hsail state
Gilles Duboscq <duboscq@ssw.jku.at>
parents: 16076
diff changeset
158 int saveAreaCounts = HSAILOopMapHelper::get_save_area_counts(oop_map_array);
15609
66d31e70bd79 HSAIL: fixed deopt bug; cleaned up C++ code
Doug Simon <doug.simon@oracle.com>
parents: 15582
diff changeset
159 int numSRegs = saveAreaCounts & 0xff;
66d31e70bd79 HSAIL: fixed deopt bug; cleaned up C++ code
Doug Simon <doug.simon@oracle.com>
parents: 15582
diff changeset
160 int numDRegs = (saveAreaCounts >> 8) & 0xff;
66d31e70bd79 HSAIL: fixed deopt bug; cleaned up C++ code
Doug Simon <doug.simon@oracle.com>
parents: 15582
diff changeset
161 int numStackSlots = (saveAreaCounts >> 16);
66d31e70bd79 HSAIL: fixed deopt bug; cleaned up C++ code
Doug Simon <doug.simon@oracle.com>
parents: 15582
diff changeset
162 int bytesPerSaveArea = numSRegs * 4 + (numDRegs + numStackSlots) * 8;
66d31e70bd79 HSAIL: fixed deopt bug; cleaned up C++ code
Doug Simon <doug.simon@oracle.com>
parents: 15582
diff changeset
163
16242
e9998e2be7f5 use oops_do to modify saved hsail state
Gilles Duboscq <duboscq@ssw.jku.at>
parents: 16076
diff changeset
164 e = new (MAX_DEOPT_SLOTS, bytesPerSaveArea) HSAILDeoptimizationInfo(MAX_DEOPT_SLOTS, bytesPerSaveArea, dimX, allocInfo, oop_map_array);
16076
06eedda53e14 HSAIL: add support to allocate new TLAB from GPU
Doug Simon <doug.simon@oracle.com>
parents: 16006
diff changeset
165 // copy cur_tlab_infos
06eedda53e14 HSAIL: add support to allocate new TLAB from GPU
Doug Simon <doug.simon@oracle.com>
parents: 16006
diff changeset
166 if (allocInfo != NULL) {
16242
e9998e2be7f5 use oops_do to modify saved hsail state
Gilles Duboscq <duboscq@ssw.jku.at>
parents: 16076
diff changeset
167 e->set_cur_tlabInfos(allocInfo->getCurTlabInfos());
16076
06eedda53e14 HSAIL: add support to allocate new TLAB from GPU
Doug Simon <doug.simon@oracle.com>
parents: 16006
diff changeset
168 }
16242
e9998e2be7f5 use oops_do to modify saved hsail state
Gilles Duboscq <duboscq@ssw.jku.at>
parents: 16076
diff changeset
169 // set deopt info in thread so gc oops_do processing can find it
e9998e2be7f5 use oops_do to modify saved hsail state
Gilles Duboscq <duboscq@ssw.jku.at>
parents: 16076
diff changeset
170 thread->set_gpu_hsail_deopt_info(e);
14768
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
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
173 // This object sets up the kernel arguments
14768
3e9a960f0da1 HSAIL: preliminary deopt support
Doug Simon <doug.simon@oracle.com>
parents: 13888
diff changeset
174 HSAILKernelArguments hka((address) kernel, mh->signature(), argsArray, mh->is_static(), e);
15177
66e3af78ea96 HSAIL: added safepoint support
Doug Simon <doug.simon@oracle.com>
parents: 15161
diff changeset
175 if (TraceGPUInteraction) {
66e3af78ea96 HSAIL: added safepoint support
Doug Simon <doug.simon@oracle.com>
parents: 15161
diff changeset
176 tty->print_cr("[HSAIL] range=%d", dimX);
66e3af78ea96 HSAIL: added safepoint support
Doug Simon <doug.simon@oracle.com>
parents: 15161
diff changeset
177 }
14768
3e9a960f0da1 HSAIL: preliminary deopt support
Doug Simon <doug.simon@oracle.com>
parents: 13888
diff changeset
178
16076
06eedda53e14 HSAIL: add support to allocate new TLAB from GPU
Doug Simon <doug.simon@oracle.com>
parents: 16006
diff changeset
179 // If any object passed was null, throw an exception here. Doing this
06eedda53e14 HSAIL: add support to allocate new TLAB from GPU
Doug Simon <doug.simon@oracle.com>
parents: 16006
diff changeset
180 // means the kernel code can avoid null checks on the object parameters.
14768
3e9a960f0da1 HSAIL: preliminary deopt support
Doug Simon <doug.simon@oracle.com>
parents: 13888
diff changeset
181 if (hka.getFirstNullParameterIndex() >= 0) {
3e9a960f0da1 HSAIL: preliminary deopt support
Doug Simon <doug.simon@oracle.com>
parents: 13888
diff changeset
182 char buf[64];
3e9a960f0da1 HSAIL: preliminary deopt support
Doug Simon <doug.simon@oracle.com>
parents: 13888
diff changeset
183 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
184 thread->set_gpu_exception_bci(0);
3e9a960f0da1 HSAIL: preliminary deopt support
Doug Simon <doug.simon@oracle.com>
parents: 13888
diff changeset
185 thread->set_gpu_exception_method(mh());
3e9a960f0da1 HSAIL: preliminary deopt support
Doug Simon <doug.simon@oracle.com>
parents: 13888
diff changeset
186 THROW_MSG_0(vmSymbols::java_lang_NullPointerException(), buf);
3e9a960f0da1 HSAIL: preliminary deopt support
Doug Simon <doug.simon@oracle.com>
parents: 13888
diff changeset
187 }
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
188
f1a55428a8d7 more HSAIL support in the C++ layer for executing HSAIL code on the simulator
Doug Simon <doug.simon@oracle.com>
parents:
diff changeset
189 // Run the kernel
16540
a18c229b9a0b HSAIL: fix performance warning (treated as error on windows!) due to jint=>bool conversion (in line 197)
Christian Wirth <christian.wirth@oracle.com>
parents: 16533
diff changeset
190 jboolean success = false;
14969
a6c144380ce7 HSAIL: added UseHSAILDeoptimization VM option for disabling HSAIL deopt support
Doug Simon <doug.simon@oracle.com>
parents: 14768
diff changeset
191 {
15177
66e3af78ea96 HSAIL: added safepoint support
Doug Simon <doug.simon@oracle.com>
parents: 15161
diff changeset
192 TraceTime t("execute kernel", TraceGPUInteraction);
16533
d5c4bb0039d8 HSAIL: update simulator
Bernhard Urban <bernhard.urban@jku.at>
parents: 16242
diff changeset
193 graal_okra_range_t kernel_range = {0};
15177
66e3af78ea96 HSAIL: added safepoint support
Doug Simon <doug.simon@oracle.com>
parents: 15161
diff changeset
194
66e3af78ea96 HSAIL: added safepoint support
Doug Simon <doug.simon@oracle.com>
parents: 15161
diff changeset
195 //in_kernel = 1;
66e3af78ea96 HSAIL: added safepoint support
Doug Simon <doug.simon@oracle.com>
parents: 15161
diff changeset
196 // Run the kernel
16533
d5c4bb0039d8 HSAIL: update simulator
Bernhard Urban <bernhard.urban@jku.at>
parents: 16242
diff changeset
197 kernel_range.dimension = 1;
d5c4bb0039d8 HSAIL: update simulator
Bernhard Urban <bernhard.urban@jku.at>
parents: 16242
diff changeset
198 kernel_range.global_size[0] = dimX;
d5c4bb0039d8 HSAIL: update simulator
Bernhard Urban <bernhard.urban@jku.at>
parents: 16242
diff changeset
199 success = _okra_execute_kernel(_device_context, kernel, &kernel_range);
15177
66e3af78ea96 HSAIL: added safepoint support
Doug Simon <doug.simon@oracle.com>
parents: 15161
diff changeset
200 //in_kernel = 0;
14969
a6c144380ce7 HSAIL: added UseHSAILDeoptimization VM option for disabling HSAIL deopt support
Doug Simon <doug.simon@oracle.com>
parents: 14768
diff changeset
201 }
14768
3e9a960f0da1 HSAIL: preliminary deopt support
Doug Simon <doug.simon@oracle.com>
parents: 13888
diff changeset
202
16076
06eedda53e14 HSAIL: add support to allocate new TLAB from GPU
Doug Simon <doug.simon@oracle.com>
parents: 16006
diff changeset
203 // avoid HSAILAllocationInfo logic if kernel does not allocate
06eedda53e14 HSAIL: add support to allocate new TLAB from GPU
Doug Simon <doug.simon@oracle.com>
parents: 16006
diff changeset
204 if (allocInfo != NULL) {
06eedda53e14 HSAIL: add support to allocate new TLAB from GPU
Doug Simon <doug.simon@oracle.com>
parents: 16006
diff changeset
205 allocInfo->postKernelCleanup();
15066
2cae21d9f122 HSAIL: initial support for object allocation in HSAIL kernels
Doug Simon <doug.simon@oracle.com>
parents: 14969
diff changeset
206 }
2cae21d9f122 HSAIL: initial support for object allocation in HSAIL kernels
Doug Simon <doug.simon@oracle.com>
parents: 14969
diff changeset
207
14969
a6c144380ce7 HSAIL: added UseHSAILDeoptimization VM option for disabling HSAIL deopt support
Doug Simon <doug.simon@oracle.com>
parents: 14768
diff changeset
208 if (UseHSAILDeoptimization) {
a6c144380ce7 HSAIL: added UseHSAILDeoptimization VM option for disabling HSAIL deopt support
Doug Simon <doug.simon@oracle.com>
parents: 14768
diff changeset
209 // 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
210 int deoptcode = e->deopt_occurred();
15177
66e3af78ea96 HSAIL: added safepoint support
Doug Simon <doug.simon@oracle.com>
parents: 15161
diff changeset
211 if (deoptcode != 1) {
66e3af78ea96 HSAIL: added safepoint support
Doug Simon <doug.simon@oracle.com>
parents: 15161
diff changeset
212 if (deoptcode == 0) {
66e3af78ea96 HSAIL: added safepoint support
Doug Simon <doug.simon@oracle.com>
parents: 15161
diff changeset
213 if (TraceGPUInteraction && _notice_safepoints != 0) {
66e3af78ea96 HSAIL: added safepoint support
Doug Simon <doug.simon@oracle.com>
parents: 15161
diff changeset
214 tty->print_cr("[HSAIL] observed safepoint during kernel");
66e3af78ea96 HSAIL: added safepoint support
Doug Simon <doug.simon@oracle.com>
parents: 15161
diff changeset
215 }
66e3af78ea96 HSAIL: added safepoint support
Doug Simon <doug.simon@oracle.com>
parents: 15161
diff changeset
216 } else {
14969
a6c144380ce7 HSAIL: added UseHSAILDeoptimization VM option for disabling HSAIL deopt support
Doug Simon <doug.simon@oracle.com>
parents: 14768
diff changeset
217 // 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
218 char msg[200];
a6c144380ce7 HSAIL: added UseHSAILDeoptimization VM option for disabling HSAIL deopt support
Doug Simon <doug.simon@oracle.com>
parents: 14768
diff changeset
219 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
220 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
221 }
15177
66e3af78ea96 HSAIL: added safepoint support
Doug Simon <doug.simon@oracle.com>
parents: 15161
diff changeset
222 } else {
14969
a6c144380ce7 HSAIL: added UseHSAILDeoptimization VM option for disabling HSAIL deopt support
Doug Simon <doug.simon@oracle.com>
parents: 14768
diff changeset
223 {
a6c144380ce7 HSAIL: added UseHSAILDeoptimization VM option for disabling HSAIL deopt support
Doug Simon <doug.simon@oracle.com>
parents: 14768
diff changeset
224 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
225 if (TraceGPUInteraction) {
a6c144380ce7 HSAIL: added UseHSAILDeoptimization VM option for disabling HSAIL deopt support
Doug Simon <doug.simon@oracle.com>
parents: 14768
diff changeset
226 tty->print_cr("deopt happened.");
16076
06eedda53e14 HSAIL: add support to allocate new TLAB from GPU
Doug Simon <doug.simon@oracle.com>
parents: 16006
diff changeset
227 HSAILKernelDeoptimization* pdeopt = e->get_deopt_save_state(0);
14969
a6c144380ce7 HSAIL: added UseHSAILDeoptimization VM option for disabling HSAIL deopt support
Doug Simon <doug.simon@oracle.com>
parents: 14768
diff changeset
228 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
229 }
14768
3e9a960f0da1 HSAIL: preliminary deopt support
Doug Simon <doug.simon@oracle.com>
parents: 13888
diff changeset
230
14969
a6c144380ce7 HSAIL: added UseHSAILDeoptimization VM option for disabling HSAIL deopt support
Doug Simon <doug.simon@oracle.com>
parents: 14768
diff changeset
231 // 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
232 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
233 for (int k = 0; k < e->num_deopts(); k++) {
16076
06eedda53e14 HSAIL: add support to allocate new TLAB from GPU
Doug Simon <doug.simon@oracle.com>
parents: 16006
diff changeset
234 HSAILKernelDeoptimization* pdeopt = e->get_deopt_save_state(k);
14969
a6c144380ce7 HSAIL: added UseHSAILDeoptimization VM option for disabling HSAIL deopt support
Doug Simon <doug.simon@oracle.com>
parents: 14768
diff changeset
235
a6c144380ce7 HSAIL: added UseHSAILDeoptimization VM option for disabling HSAIL deopt support
Doug Simon <doug.simon@oracle.com>
parents: 14768
diff changeset
236 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
237 if (workitem != -1) {
a6c144380ce7 HSAIL: added UseHSAILDeoptimization VM option for disabling HSAIL deopt support
Doug Simon <doug.simon@oracle.com>
parents: 14768
diff changeset
238 int deoptId = pdeopt->pc_offset();
16076
06eedda53e14 HSAIL: add support to allocate new TLAB from GPU
Doug Simon <doug.simon@oracle.com>
parents: 16006
diff changeset
239 HSAILFrame* hsailFrame = pdeopt->first_frame();
14969
a6c144380ce7 HSAIL: added UseHSAILDeoptimization VM option for disabling HSAIL deopt support
Doug Simon <doug.simon@oracle.com>
parents: 14768
diff changeset
240
a6c144380ce7 HSAIL: added UseHSAILDeoptimization VM option for disabling HSAIL deopt support
Doug Simon <doug.simon@oracle.com>
parents: 14768
diff changeset
241 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
242 JavaCallArguments javaArgs;
a6c144380ce7 HSAIL: added UseHSAILDeoptimization VM option for disabling HSAIL deopt support
Doug Simon <doug.simon@oracle.com>
parents: 14768
diff changeset
243 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
244 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
245 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
246
16076
06eedda53e14 HSAIL: add support to allocate new TLAB from GPU
Doug Simon <doug.simon@oracle.com>
parents: 16006
diff changeset
247 // Override the deoptimization action with Action_none until we decide
14969
a6c144380ce7 HSAIL: added UseHSAILDeoptimization VM option for disabling HSAIL deopt support
Doug Simon <doug.simon@oracle.com>
parents: 14768
diff changeset
248 // 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
249 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
250 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
251 javaArgs.push_oop((oop) NULL);
17033
2d6dd2eebd51 Fixed HSAIL deopt
Tom Rodriguez <tom.rodriguez@oracle.com>
parents: 16878
diff changeset
252 javaArgs.push_int(mh->size_of_parameters());
14969
a6c144380ce7 HSAIL: added UseHSAILDeoptimization VM option for disabling HSAIL deopt support
Doug Simon <doug.simon@oracle.com>
parents: 14768
diff changeset
253 if (TraceGPUInteraction) {
18043
f55f2d400797 Fix some format strings
Gilles Duboscq <duboscq@ssw.jku.at>
parents: 17033
diff changeset
254 tty->print_cr("[HSAIL] Deoptimizing to host for workitem=%d (slot=%d) with deoptId=%d, frame=" INTPTR_FORMAT ", actionAndReason=%d", workitem, k, deoptId, p2i(hsailFrame), myActionReason);
15482
a250a512434d HSAIL: support for object values in stack slots at deoptimization points
Doug Simon <doug.simon@oracle.com>
parents: 15177
diff changeset
255 // show the $d registers or stack slots containing references
a250a512434d HSAIL: support for object values in stack slots at deoptimization points
Doug Simon <doug.simon@oracle.com>
parents: 15177
diff changeset
256 int maxOopBits = hsailFrame->num_d_regs() + hsailFrame->num_stack_slots();
16242
e9998e2be7f5 use oops_do to modify saved hsail state
Gilles Duboscq <duboscq@ssw.jku.at>
parents: 16076
diff changeset
257 HSAILOopMapHelper oopMapHelper(oop_map_array);
e9998e2be7f5 use oops_do to modify saved hsail state
Gilles Duboscq <duboscq@ssw.jku.at>
parents: 16076
diff changeset
258 int pc_offset = hsailFrame->pc_offset();
15482
a250a512434d HSAIL: support for object values in stack slots at deoptimization points
Doug Simon <doug.simon@oracle.com>
parents: 15177
diff changeset
259 for (int bit = 0; bit < maxOopBits; bit++) {
16242
e9998e2be7f5 use oops_do to modify saved hsail state
Gilles Duboscq <duboscq@ssw.jku.at>
parents: 16076
diff changeset
260 if (oopMapHelper.is_oop(pc_offset, bit)) {
15482
a250a512434d HSAIL: support for object values in stack slots at deoptimization points
Doug Simon <doug.simon@oracle.com>
parents: 15177
diff changeset
261 if (bit < hsailFrame->num_d_regs()) {
a250a512434d HSAIL: support for object values in stack slots at deoptimization points
Doug Simon <doug.simon@oracle.com>
parents: 15177
diff changeset
262 // show $d reg oop
18043
f55f2d400797 Fix some format strings
Gilles Duboscq <duboscq@ssw.jku.at>
parents: 17033
diff changeset
263 tty->print_cr(" oop $d%d = " INTPTR_FORMAT, bit, hsailFrame->get_oop_for_bit(bit));
15482
a250a512434d HSAIL: support for object values in stack slots at deoptimization points
Doug Simon <doug.simon@oracle.com>
parents: 15177
diff changeset
264 } else {
a250a512434d HSAIL: support for object values in stack slots at deoptimization points
Doug Simon <doug.simon@oracle.com>
parents: 15177
diff changeset
265 // show stack slot oop
a250a512434d HSAIL: support for object values in stack slots at deoptimization points
Doug Simon <doug.simon@oracle.com>
parents: 15177
diff changeset
266 int stackOffset = (bit - hsailFrame->num_d_regs()) * 8; // 8 bytes per stack slot
18043
f55f2d400797 Fix some format strings
Gilles Duboscq <duboscq@ssw.jku.at>
parents: 17033
diff changeset
267 tty->print_cr(" oop stk:%d = " INTPTR_FORMAT, stackOffset, hsailFrame->get_oop_for_bit(bit));
15482
a250a512434d HSAIL: support for object values in stack slots at deoptimization points
Doug Simon <doug.simon@oracle.com>
parents: 15177
diff changeset
268 }
14969
a6c144380ce7 HSAIL: added UseHSAILDeoptimization VM option for disabling HSAIL deopt support
Doug Simon <doug.simon@oracle.com>
parents: 14768
diff changeset
269 }
a6c144380ce7 HSAIL: added UseHSAILDeoptimization VM option for disabling HSAIL deopt support
Doug Simon <doug.simon@oracle.com>
parents: 14768
diff changeset
270 }
a6c144380ce7 HSAIL: added UseHSAILDeoptimization VM option for disabling HSAIL deopt support
Doug Simon <doug.simon@oracle.com>
parents: 14768
diff changeset
271 }
a6c144380ce7 HSAIL: added UseHSAILDeoptimization VM option for disabling HSAIL deopt support
Doug Simon <doug.simon@oracle.com>
parents: 14768
diff changeset
272 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
273 count_deoptimized++;
16242
e9998e2be7f5 use oops_do to modify saved hsail state
Gilles Duboscq <duboscq@ssw.jku.at>
parents: 16076
diff changeset
274 e->set_deopt_work_index(k + 1);
14969
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 }
a6c144380ce7 HSAIL: added UseHSAILDeoptimization VM option for disabling HSAIL deopt support
Doug Simon <doug.simon@oracle.com>
parents: 14768
diff changeset
277 if (TraceGPUInteraction) {
a6c144380ce7 HSAIL: added UseHSAILDeoptimization VM option for disabling HSAIL deopt support
Doug Simon <doug.simon@oracle.com>
parents: 14768
diff changeset
278 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
279 }
14768
3e9a960f0da1 HSAIL: preliminary deopt support
Doug Simon <doug.simon@oracle.com>
parents: 13888
diff changeset
280 }
15177
66e3af78ea96 HSAIL: added safepoint support
Doug Simon <doug.simon@oracle.com>
parents: 15161
diff changeset
281 }
16242
e9998e2be7f5 use oops_do to modify saved hsail state
Gilles Duboscq <duboscq@ssw.jku.at>
parents: 16076
diff changeset
282 // when we are done with the deopts, we don't need to oops_do anything
e9998e2be7f5 use oops_do to modify saved hsail state
Gilles Duboscq <duboscq@ssw.jku.at>
parents: 16076
diff changeset
283 // in the saved state anymore
e9998e2be7f5 use oops_do to modify saved hsail state
Gilles Duboscq <duboscq@ssw.jku.at>
parents: 16076
diff changeset
284 thread->set_gpu_hsail_deopt_info(NULL);
14969
a6c144380ce7 HSAIL: added UseHSAILDeoptimization VM option for disabling HSAIL deopt support
Doug Simon <doug.simon@oracle.com>
parents: 14768
diff changeset
285
15177
66e3af78ea96 HSAIL: added safepoint support
Doug Simon <doug.simon@oracle.com>
parents: 15161
diff changeset
286 // Handle any never_ran workitems if there were any
66e3af78ea96 HSAIL: added safepoint support
Doug Simon <doug.simon@oracle.com>
parents: 15161
diff changeset
287 {
66e3af78ea96 HSAIL: added safepoint support
Doug Simon <doug.simon@oracle.com>
parents: 15161
diff changeset
288 TraceTime t("handle never-rans ", TraceGPUInteraction);
66e3af78ea96 HSAIL: added safepoint support
Doug Simon <doug.simon@oracle.com>
parents: 15161
diff changeset
289 int count_never_ran = 0;
66e3af78ea96 HSAIL: added safepoint support
Doug Simon <doug.simon@oracle.com>
parents: 15161
diff changeset
290 bool handleNeverRansHere = true;
66e3af78ea96 HSAIL: added safepoint support
Doug Simon <doug.simon@oracle.com>
parents: 15161
diff changeset
291 // turn off verbose trace stuff for javacall arg setup
66e3af78ea96 HSAIL: added safepoint support
Doug Simon <doug.simon@oracle.com>
parents: 15161
diff changeset
292 bool savedTraceGPUInteraction = TraceGPUInteraction;
66e3af78ea96 HSAIL: added safepoint support
Doug Simon <doug.simon@oracle.com>
parents: 15161
diff changeset
293 TraceGPUInteraction = false;
16076
06eedda53e14 HSAIL: add support to allocate new TLAB from GPU
Doug Simon <doug.simon@oracle.com>
parents: 16006
diff changeset
294 jboolean* never_ran_array = e->never_ran_array();
15177
66e3af78ea96 HSAIL: added safepoint support
Doug Simon <doug.simon@oracle.com>
parents: 15161
diff changeset
295 if (handleNeverRansHere) {
66e3af78ea96 HSAIL: added safepoint support
Doug Simon <doug.simon@oracle.com>
parents: 15161
diff changeset
296 for (int k = 0; k < dimX; k++) {
66e3af78ea96 HSAIL: added safepoint support
Doug Simon <doug.simon@oracle.com>
parents: 15161
diff changeset
297 if (never_ran_array[k]) {
66e3af78ea96 HSAIL: added safepoint support
Doug Simon <doug.simon@oracle.com>
parents: 15161
diff changeset
298 // run it as a javaCall
66e3af78ea96 HSAIL: added safepoint support
Doug Simon <doug.simon@oracle.com>
parents: 15161
diff changeset
299 KlassHandle methKlass = mh->method_holder();
66e3af78ea96 HSAIL: added safepoint support
Doug Simon <doug.simon@oracle.com>
parents: 15161
diff changeset
300 Thread* THREAD = Thread::current();
66e3af78ea96 HSAIL: added safepoint support
Doug Simon <doug.simon@oracle.com>
parents: 15161
diff changeset
301 JavaValue result(T_VOID);
16878
bbb987aec58d HSAIL: pass the number of argument to the JavaCallArguments constructor. Add TraceTime for kernel creation.
Gilles Duboscq <duboscq@ssw.jku.at>
parents: 16795
diff changeset
302 // Add the iteration variable to the HSA args length
bbb987aec58d HSAIL: pass the number of argument to the JavaCallArguments constructor. Add TraceTime for kernel creation.
Gilles Duboscq <duboscq@ssw.jku.at>
parents: 16795
diff changeset
303 JavaCallArguments javaArgs(argsArrayLength + 1);
15177
66e3af78ea96 HSAIL: added safepoint support
Doug Simon <doug.simon@oracle.com>
parents: 15161
diff changeset
304 // re-resolve the args_handle here
66e3af78ea96 HSAIL: added safepoint support
Doug Simon <doug.simon@oracle.com>
parents: 15161
diff changeset
305 objArrayOop resolvedArgsArray = (objArrayOop) JNIHandles::resolve(args);
16076
06eedda53e14 HSAIL: add support to allocate new TLAB from GPU
Doug Simon <doug.simon@oracle.com>
parents: 16006
diff changeset
306
06eedda53e14 HSAIL: add support to allocate new TLAB from GPU
Doug Simon <doug.simon@oracle.com>
parents: 16006
diff changeset
307 // This object sets up the javaCall arguments. The way
06eedda53e14 HSAIL: add support to allocate new TLAB from GPU
Doug Simon <doug.simon@oracle.com>
parents: 16006
diff changeset
308 // argsArray is set up, this should work for instance
06eedda53e14 HSAIL: add support to allocate new TLAB from GPU
Doug Simon <doug.simon@oracle.com>
parents: 16006
diff changeset
309 // methods as well (the receiver will be the first oop pushed)
15177
66e3af78ea96 HSAIL: added safepoint support
Doug Simon <doug.simon@oracle.com>
parents: 15161
diff changeset
310 HSAILJavaCallArguments hjca(&javaArgs, k, mh->signature(), resolvedArgsArray, mh->is_static());
66e3af78ea96 HSAIL: added safepoint support
Doug Simon <doug.simon@oracle.com>
parents: 15161
diff changeset
311 if (mh->is_static()) {
66e3af78ea96 HSAIL: added safepoint support
Doug Simon <doug.simon@oracle.com>
parents: 15161
diff changeset
312 JavaCalls::call_static(&result, methKlass, mh->name(), mh->signature(), &javaArgs, THREAD);
66e3af78ea96 HSAIL: added safepoint support
Doug Simon <doug.simon@oracle.com>
parents: 15161
diff changeset
313 } else {
66e3af78ea96 HSAIL: added safepoint support
Doug Simon <doug.simon@oracle.com>
parents: 15161
diff changeset
314 JavaCalls::call_virtual(&result, methKlass, mh->name(), mh->signature(), &javaArgs, THREAD);
14969
a6c144380ce7 HSAIL: added UseHSAILDeoptimization VM option for disabling HSAIL deopt support
Doug Simon <doug.simon@oracle.com>
parents: 14768
diff changeset
315 }
15177
66e3af78ea96 HSAIL: added safepoint support
Doug Simon <doug.simon@oracle.com>
parents: 15161
diff changeset
316 count_never_ran++;
14969
a6c144380ce7 HSAIL: added UseHSAILDeoptimization VM option for disabling HSAIL deopt support
Doug Simon <doug.simon@oracle.com>
parents: 14768
diff changeset
317 }
15177
66e3af78ea96 HSAIL: added safepoint support
Doug Simon <doug.simon@oracle.com>
parents: 15161
diff changeset
318 }
66e3af78ea96 HSAIL: added safepoint support
Doug Simon <doug.simon@oracle.com>
parents: 15161
diff changeset
319 TraceGPUInteraction = savedTraceGPUInteraction;
15482
a250a512434d HSAIL: support for object values in stack slots at deoptimization points
Doug Simon <doug.simon@oracle.com>
parents: 15177
diff changeset
320 if (TraceGPUInteraction && (count_never_ran > 0)) {
15177
66e3af78ea96 HSAIL: added safepoint support
Doug Simon <doug.simon@oracle.com>
parents: 15161
diff changeset
321 tty->print_cr("%d workitems never ran, have been run via JavaCall", count_never_ran);
66e3af78ea96 HSAIL: added safepoint support
Doug Simon <doug.simon@oracle.com>
parents: 15161
diff changeset
322 showRanges(never_ran_array, dimX);
66e3af78ea96 HSAIL: added safepoint support
Doug Simon <doug.simon@oracle.com>
parents: 15161
diff changeset
323 }
66e3af78ea96 HSAIL: added safepoint support
Doug Simon <doug.simon@oracle.com>
parents: 15161
diff changeset
324 } // end of never-ran handling
14768
3e9a960f0da1 HSAIL: preliminary deopt support
Doug Simon <doug.simon@oracle.com>
parents: 13888
diff changeset
325 }
15177
66e3af78ea96 HSAIL: added safepoint support
Doug Simon <doug.simon@oracle.com>
parents: 15161
diff changeset
326
14768
3e9a960f0da1 HSAIL: preliminary deopt support
Doug Simon <doug.simon@oracle.com>
parents: 13888
diff changeset
327 delete e;
16076
06eedda53e14 HSAIL: add support to allocate new TLAB from GPU
Doug Simon <doug.simon@oracle.com>
parents: 16006
diff changeset
328 delete allocInfo;
14768
3e9a960f0da1 HSAIL: preliminary deopt support
Doug Simon <doug.simon@oracle.com>
parents: 13888
diff changeset
329 }
3e9a960f0da1 HSAIL: preliminary deopt support
Doug Simon <doug.simon@oracle.com>
parents: 13888
diff changeset
330 return success;
3e9a960f0da1 HSAIL: preliminary deopt support
Doug Simon <doug.simon@oracle.com>
parents: 13888
diff changeset
331 }
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
332
16076
06eedda53e14 HSAIL: add support to allocate new TLAB from GPU
Doug Simon <doug.simon@oracle.com>
parents: 16006
diff changeset
333 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
334 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
335 ResourceMark rm;
49db2c1e3bee added support for co-existing GPU backends (JBS:GRAAL-1)
Doug Simon <doug.simon@oracle.com>
parents: 13740
diff changeset
336 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
337 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
338
13819
49db2c1e3bee added support for co-existing GPU backends (JBS:GRAAL-1)
Doug Simon <doug.simon@oracle.com>
parents: 13740
diff changeset
339 char* name = NEW_RESOURCE_ARRAY(char, name_len + 1);
16076
06eedda53e14 HSAIL: add support to allocate new TLAB from GPU
Doug Simon <doug.simon@oracle.com>
parents: 16006
diff changeset
340 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: 13115
diff changeset
341
13819
49db2c1e3bee added support for co-existing GPU backends (JBS:GRAAL-1)
Doug Simon <doug.simon@oracle.com>
parents: 13740
diff changeset
342 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
343 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
344
49db2c1e3bee added support for co-existing GPU backends (JBS:GRAAL-1)
Doug Simon <doug.simon@oracle.com>
parents: 13740
diff changeset
345 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
346 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
347
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
348 // 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
349 const char* entryPointName = "&run";
16533
d5c4bb0039d8 HSAIL: update simulator
Bernhard Urban <bernhard.urban@jku.at>
parents: 16242
diff changeset
350 jlong okra_kernel;
16878
bbb987aec58d HSAIL: pass the number of argument to the JavaCallArguments constructor. Add TraceTime for kernel creation.
Gilles Duboscq <duboscq@ssw.jku.at>
parents: 16795
diff changeset
351 {
bbb987aec58d HSAIL: pass the number of argument to the JavaCallArguments constructor. Add TraceTime for kernel creation.
Gilles Duboscq <duboscq@ssw.jku.at>
parents: 16795
diff changeset
352 TraceTime t("generate kernel ", TraceGPUInteraction);
bbb987aec58d HSAIL: pass the number of argument to the JavaCallArguments constructor. Add TraceTime for kernel creation.
Gilles Duboscq <duboscq@ssw.jku.at>
parents: 16795
diff changeset
353 jint okra_status = _okra_create_kernel(_device_context, code, entryPointName, (void**)&okra_kernel);
bbb987aec58d HSAIL: pass the number of argument to the JavaCallArguments constructor. Add TraceTime for kernel creation.
Gilles Duboscq <duboscq@ssw.jku.at>
parents: 16795
diff changeset
354 guarantee(okra_status==0, "_okra_create_kernel failed");
bbb987aec58d HSAIL: pass the number of argument to the JavaCallArguments constructor. Add TraceTime for kernel creation.
Gilles Duboscq <duboscq@ssw.jku.at>
parents: 16795
diff changeset
355 }
16533
d5c4bb0039d8 HSAIL: update simulator
Bernhard Urban <bernhard.urban@jku.at>
parents: 16242
diff changeset
356 return (jlong) okra_kernel;
13819
49db2c1e3bee added support for co-existing GPU backends (JBS:GRAAL-1)
Doug Simon <doug.simon@oracle.com>
parents: 13740
diff changeset
357 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
358
f1a55428a8d7 more HSAIL support in the C++ layer for executing HSAIL code on the simulator
Doug Simon <doug.simon@oracle.com>
parents:
diff changeset
359 #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
360 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
361 #elif defined(_WINDOWS)
62bd4705894c reverted removal of Okra Windows DLL name
Doug Simon <doug.simon@oracle.com>
parents: 13822
diff changeset
362 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
363 #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
364 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
365 #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
366
13115
166ed1584f30 HSAIL: null checks when loading Okra library functions
Doug Simon <doug.simon@oracle.com>
parents: 13097
diff changeset
367 #define STRINGIFY(x) #x
166ed1584f30 HSAIL: null checks when loading Okra library functions
Doug Simon <doug.simon@oracle.com>
parents: 13097
diff changeset
368
166ed1584f30 HSAIL: null checks when loading Okra library functions
Doug Simon <doug.simon@oracle.com>
parents: 13097
diff changeset
369 #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
370 _##alias = \
15067
0e689f20706e HSAIL: avoid loading native Okra library twice
Doug Simon <doug.simon@oracle.com>
parents: 15066
diff changeset
371 CAST_TO_FN_PTR(alias##_func_t, os::dll_lookup(okra_lib_handle, STRINGIFY(name))); \
13115
166ed1584f30 HSAIL: null checks when loading Okra library functions
Doug Simon <doug.simon@oracle.com>
parents: 13097
diff changeset
372 if (_##alias == NULL) { \
166ed1584f30 HSAIL: null checks when loading Okra library functions
Doug Simon <doug.simon@oracle.com>
parents: 13097
diff changeset
373 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
374 return false; \
13115
166ed1584f30 HSAIL: null checks when loading Okra library functions
Doug Simon <doug.simon@oracle.com>
parents: 13097
diff changeset
375 } \
166ed1584f30 HSAIL: null checks when loading Okra library functions
Doug Simon <doug.simon@oracle.com>
parents: 13097
diff changeset
376
16076
06eedda53e14 HSAIL: add support to allocate new TLAB from GPU
Doug Simon <doug.simon@oracle.com>
parents: 16006
diff changeset
377 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: 13115
diff changeset
378 if (okra_library_name == NULL) {
13097
14db5ffd5ed9 make HSAIL silent
twisti
parents: 12743
diff changeset
379 if (TraceGPUInteraction) {
14db5ffd5ed9 make HSAIL silent
twisti
parents: 12743
diff changeset
380 tty->print_cr("Unsupported HSAIL platform");
14db5ffd5ed9 make HSAIL silent
twisti
parents: 12743
diff changeset
381 }
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
382 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
383 }
13740
bfd61161d752 HSAIL: support for using Okra simulator without needing to configure PATH and LD_LIBRARY_PATH
Doug Simon <doug.simon@oracle.com>
parents: 13115
diff changeset
384
bfd61161d752 HSAIL: support for using Okra simulator without needing to configure PATH and LD_LIBRARY_PATH
Doug Simon <doug.simon@oracle.com>
parents: 13115
diff changeset
385 // 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
386 char ebuf[O_BUFLEN];
16076
06eedda53e14 HSAIL: add support to allocate new TLAB from GPU
Doug Simon <doug.simon@oracle.com>
parents: 16006
diff changeset
387 char* okra_lib_name_from_env_var = getenv("_OKRA_SIM_LIB_PATH_");
15067
0e689f20706e HSAIL: avoid loading native Okra library twice
Doug Simon <doug.simon@oracle.com>
parents: 15066
diff changeset
388 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
389 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
390 }
13097
14db5ffd5ed9 make HSAIL silent
twisti
parents: 12743
diff changeset
391 if (TraceGPUInteraction) {
15067
0e689f20706e HSAIL: avoid loading native Okra library twice
Doug Simon <doug.simon@oracle.com>
parents: 15066
diff changeset
392 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: 13115
diff changeset
393 }
16076
06eedda53e14 HSAIL: add support to allocate new TLAB from GPU
Doug Simon <doug.simon@oracle.com>
parents: 16006
diff changeset
394 void* okra_lib_handle = NULL;
15067
0e689f20706e HSAIL: avoid loading native Okra library twice
Doug Simon <doug.simon@oracle.com>
parents: 15066
diff changeset
395 #if defined(LINUX)
0e689f20706e HSAIL: avoid loading native Okra library twice
Doug Simon <doug.simon@oracle.com>
parents: 15066
diff changeset
396 // 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
397 // 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
398 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
399 #endif
0e689f20706e HSAIL: avoid loading native Okra library twice
Doug Simon <doug.simon@oracle.com>
parents: 15066
diff changeset
400 // 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
401 if (okra_lib_handle == NULL) {
0e689f20706e HSAIL: avoid loading native Okra library twice
Doug Simon <doug.simon@oracle.com>
parents: 15066
diff changeset
402 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
403 }
0e689f20706e HSAIL: avoid loading native Okra library twice
Doug Simon <doug.simon@oracle.com>
parents: 15066
diff changeset
404 if (okra_lib_handle == NULL) {
0e689f20706e HSAIL: avoid loading native Okra library twice
Doug Simon <doug.simon@oracle.com>
parents: 15066
diff changeset
405 // 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: 13115
diff changeset
406 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: 13115
diff changeset
407 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: 13115
diff changeset
408 }
bfd61161d752 HSAIL: support for using Okra simulator without needing to configure PATH and LD_LIBRARY_PATH
Doug Simon <doug.simon@oracle.com>
parents: 13115
diff changeset
409 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: 13115
diff changeset
410 }
bfd61161d752 HSAIL: support for using Okra simulator without needing to configure PATH and LD_LIBRARY_PATH
Doug Simon <doug.simon@oracle.com>
parents: 13115
diff changeset
411
16533
d5c4bb0039d8 HSAIL: update simulator
Bernhard Urban <bernhard.urban@jku.at>
parents: 16242
diff changeset
412 guarantee(_okra_get_context == NULL, "cannot repeat GPU initialization");
13819
49db2c1e3bee added support for co-existing GPU backends (JBS:GRAAL-1)
Doug Simon <doug.simon@oracle.com>
parents: 13740
diff changeset
413
16076
06eedda53e14 HSAIL: add support to allocate new TLAB from GPU
Doug Simon <doug.simon@oracle.com>
parents: 16006
diff changeset
414 // At this point we know okra_lib_handle is valid whether we loaded
06eedda53e14 HSAIL: add support to allocate new TLAB from GPU
Doug Simon <doug.simon@oracle.com>
parents: 16006
diff changeset
415 // here or earlier. In either case, we can lookup the functions.
16533
d5c4bb0039d8 HSAIL: update simulator
Bernhard Urban <bernhard.urban@jku.at>
parents: 16242
diff changeset
416 LOOKUP_OKRA_FUNCTION(okra_get_context, okra_get_context);
13740
bfd61161d752 HSAIL: support for using Okra simulator without needing to configure PATH and LD_LIBRARY_PATH
Doug Simon <doug.simon@oracle.com>
parents: 13115
diff changeset
417 LOOKUP_OKRA_FUNCTION(okra_create_kernel, okra_create_kernel);
16533
d5c4bb0039d8 HSAIL: update simulator
Bernhard Urban <bernhard.urban@jku.at>
parents: 16242
diff changeset
418 LOOKUP_OKRA_FUNCTION(okra_push_pointer, okra_push_pointer);
13740
bfd61161d752 HSAIL: support for using Okra simulator without needing to configure PATH and LD_LIBRARY_PATH
Doug Simon <doug.simon@oracle.com>
parents: 13115
diff changeset
419 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: 13115
diff changeset
420 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: 13115
diff changeset
421 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: 13115
diff changeset
422 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: 13115
diff changeset
423 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: 13115
diff changeset
424 LOOKUP_OKRA_FUNCTION(okra_push_long, okra_push_long);
16533
d5c4bb0039d8 HSAIL: update simulator
Bernhard Urban <bernhard.urban@jku.at>
parents: 16242
diff changeset
425 LOOKUP_OKRA_FUNCTION(okra_execute_kernel, okra_execute_kernel);
d5c4bb0039d8 HSAIL: update simulator
Bernhard Urban <bernhard.urban@jku.at>
parents: 16242
diff changeset
426 LOOKUP_OKRA_FUNCTION(okra_clear_args, okra_clear_args);
d5c4bb0039d8 HSAIL: update simulator
Bernhard Urban <bernhard.urban@jku.at>
parents: 16242
diff changeset
427 LOOKUP_OKRA_FUNCTION(okra_dispose_kernel, okra_dispose_kernel);
d5c4bb0039d8 HSAIL: update simulator
Bernhard Urban <bernhard.urban@jku.at>
parents: 16242
diff changeset
428 LOOKUP_OKRA_FUNCTION(okra_dispose_context, okra_dispose_context);
13740
bfd61161d752 HSAIL: support for using Okra simulator without needing to configure PATH and LD_LIBRARY_PATH
Doug Simon <doug.simon@oracle.com>
parents: 13115
diff changeset
429 // 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
430
15177
66e3af78ea96 HSAIL: added safepoint support
Doug Simon <doug.simon@oracle.com>
parents: 15161
diff changeset
431 Gpu::initialized_gpu(new Hsail());
13819
49db2c1e3bee added support for co-existing GPU backends (JBS:GRAAL-1)
Doug Simon <doug.simon@oracle.com>
parents: 13740
diff changeset
432
16533
d5c4bb0039d8 HSAIL: update simulator
Bernhard Urban <bernhard.urban@jku.at>
parents: 16242
diff changeset
433 // There is 1 context per process
d5c4bb0039d8 HSAIL: update simulator
Bernhard Urban <bernhard.urban@jku.at>
parents: 16242
diff changeset
434 jint result = _okra_get_context(&_device_context);
d5c4bb0039d8 HSAIL: update simulator
Bernhard Urban <bernhard.urban@jku.at>
parents: 16242
diff changeset
435 guarantee(result==0, "get context failed");
d5c4bb0039d8 HSAIL: update simulator
Bernhard Urban <bernhard.urban@jku.at>
parents: 16242
diff changeset
436
13819
49db2c1e3bee added support for co-existing GPU backends (JBS:GRAAL-1)
Doug Simon <doug.simon@oracle.com>
parents: 13740
diff changeset
437 return true;
49db2c1e3bee added support for co-existing GPU backends (JBS:GRAAL-1)
Doug Simon <doug.simon@oracle.com>
parents: 13740
diff changeset
438 GPU_END
49db2c1e3bee added support for co-existing GPU backends (JBS:GRAAL-1)
Doug Simon <doug.simon@oracle.com>
parents: 13740
diff changeset
439
14768
3e9a960f0da1 HSAIL: preliminary deopt support
Doug Simon <doug.simon@oracle.com>
parents: 13888
diff changeset
440
13888
51584f76462d pulled Ptx and Hsail classes out of gpu class namespace
Doug Simon <doug.simon@oracle.com>
parents: 13826
diff changeset
441 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
442 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
443 if (klass == NULL) {
49db2c1e3bee added support for co-existing GPU backends (JBS:GRAAL-1)
Doug Simon <doug.simon@oracle.com>
parents: 13740
diff changeset
444 if (TraceGPUInteraction) {
49db2c1e3bee added support for co-existing GPU backends (JBS:GRAAL-1)
Doug Simon <doug.simon@oracle.com>
parents: 13740
diff changeset
445 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
446 }
49db2c1e3bee added support for co-existing GPU backends (JBS:GRAAL-1)
Doug Simon <doug.simon@oracle.com>
parents: 13740
diff changeset
447 return false;
49db2c1e3bee added support for co-existing GPU backends (JBS:GRAAL-1)
Doug Simon <doug.simon@oracle.com>
parents: 13740
diff changeset
448 }
49db2c1e3bee added support for co-existing GPU backends (JBS:GRAAL-1)
Doug Simon <doug.simon@oracle.com>
parents: 13740
diff changeset
449 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
450 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
451 if (TraceGPUInteraction) {
49db2c1e3bee added support for co-existing GPU backends (JBS:GRAAL-1)
Doug Simon <doug.simon@oracle.com>
parents: 13740
diff changeset
452 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
453 }
49db2c1e3bee added support for co-existing GPU backends (JBS:GRAAL-1)
Doug Simon <doug.simon@oracle.com>
parents: 13740
diff changeset
454 return false;
49db2c1e3bee added support for co-existing GPU backends (JBS:GRAAL-1)
Doug Simon <doug.simon@oracle.com>
parents: 13740
diff changeset
455 }
13740
bfd61161d752 HSAIL: support for using Okra simulator without needing to configure PATH and LD_LIBRARY_PATH
Doug Simon <doug.simon@oracle.com>
parents: 13115
diff changeset
456 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
457 }
16242
e9998e2be7f5 use oops_do to modify saved hsail state
Gilles Duboscq <duboscq@ssw.jku.at>
parents: 16076
diff changeset
458
e9998e2be7f5 use oops_do to modify saved hsail state
Gilles Duboscq <duboscq@ssw.jku.at>
parents: 16076
diff changeset
459
e9998e2be7f5 use oops_do to modify saved hsail state
Gilles Duboscq <duboscq@ssw.jku.at>
parents: 16076
diff changeset
460 void Hsail::HSAILDeoptimizationInfo::oops_do(OopClosure* f) {
e9998e2be7f5 use oops_do to modify saved hsail state
Gilles Duboscq <duboscq@ssw.jku.at>
parents: 16076
diff changeset
461 int unprocessed_deopts = num_deopts() - deopt_work_index();
e9998e2be7f5 use oops_do to modify saved hsail state
Gilles Duboscq <duboscq@ssw.jku.at>
parents: 16076
diff changeset
462 if (TraceGPUInteraction) {
18043
f55f2d400797 Fix some format strings
Gilles Duboscq <duboscq@ssw.jku.at>
parents: 17033
diff changeset
463 tty->print_cr("HSAILDeoptimizationInfo::oops_do deopt_occurred=%d, total_deopts=%d, unprocessed_deopts=%d, oop_map_array=" INTPTR_FORMAT, _deopt_occurred, num_deopts(), unprocessed_deopts, p2i(_oop_map_array));
16242
e9998e2be7f5 use oops_do to modify saved hsail state
Gilles Duboscq <duboscq@ssw.jku.at>
parents: 16076
diff changeset
464 }
e9998e2be7f5 use oops_do to modify saved hsail state
Gilles Duboscq <duboscq@ssw.jku.at>
parents: 16076
diff changeset
465 if (num_deopts() == 0 || unprocessed_deopts <= 0) {
e9998e2be7f5 use oops_do to modify saved hsail state
Gilles Duboscq <duboscq@ssw.jku.at>
parents: 16076
diff changeset
466 return; // nothing to do
e9998e2be7f5 use oops_do to modify saved hsail state
Gilles Duboscq <duboscq@ssw.jku.at>
parents: 16076
diff changeset
467 }
e9998e2be7f5 use oops_do to modify saved hsail state
Gilles Duboscq <duboscq@ssw.jku.at>
parents: 16076
diff changeset
468 HSAILOopMapHelper oopMapHelper(_oop_map_array);
e9998e2be7f5 use oops_do to modify saved hsail state
Gilles Duboscq <duboscq@ssw.jku.at>
parents: 16076
diff changeset
469 oopMapHelper.resolve_arrays(); // resolve once before processing
e9998e2be7f5 use oops_do to modify saved hsail state
Gilles Duboscq <duboscq@ssw.jku.at>
parents: 16076
diff changeset
470
e9998e2be7f5 use oops_do to modify saved hsail state
Gilles Duboscq <duboscq@ssw.jku.at>
parents: 16076
diff changeset
471 // go thru the unprocessed deopt frames, finding each oop and applying the closre
e9998e2be7f5 use oops_do to modify saved hsail state
Gilles Duboscq <duboscq@ssw.jku.at>
parents: 16076
diff changeset
472 for (int k = deopt_work_index(); k < num_deopts(); k++) {
e9998e2be7f5 use oops_do to modify saved hsail state
Gilles Duboscq <duboscq@ssw.jku.at>
parents: 16076
diff changeset
473 HSAILKernelDeoptimization* pdeopt = get_deopt_save_state(k);
e9998e2be7f5 use oops_do to modify saved hsail state
Gilles Duboscq <duboscq@ssw.jku.at>
parents: 16076
diff changeset
474 assert (pdeopt->workitem() >= 0, "bad workitem in deopt");
e9998e2be7f5 use oops_do to modify saved hsail state
Gilles Duboscq <duboscq@ssw.jku.at>
parents: 16076
diff changeset
475 if (TraceGPUInteraction) {
e9998e2be7f5 use oops_do to modify saved hsail state
Gilles Duboscq <duboscq@ssw.jku.at>
parents: 16076
diff changeset
476 tty->print_cr(" deopt %d, workitem %d, pc %d", k, pdeopt->workitem(), pdeopt->pc_offset());
e9998e2be7f5 use oops_do to modify saved hsail state
Gilles Duboscq <duboscq@ssw.jku.at>
parents: 16076
diff changeset
477 }
e9998e2be7f5 use oops_do to modify saved hsail state
Gilles Duboscq <duboscq@ssw.jku.at>
parents: 16076
diff changeset
478 HSAILFrame* hsailFrame = pdeopt->first_frame();
e9998e2be7f5 use oops_do to modify saved hsail state
Gilles Duboscq <duboscq@ssw.jku.at>
parents: 16076
diff changeset
479 hsailFrame->oops_do(f, &oopMapHelper);
e9998e2be7f5 use oops_do to modify saved hsail state
Gilles Duboscq <duboscq@ssw.jku.at>
parents: 16076
diff changeset
480 }
e9998e2be7f5 use oops_do to modify saved hsail state
Gilles Duboscq <duboscq@ssw.jku.at>
parents: 16076
diff changeset
481 }