Mercurial > hg > truffle
annotate src/gpu/hsail/vm/gpu_hsail.cpp @ 14142:4eac66a9b87d
Remove reference to graph in LIRGenerator.
author | Thomas Wuerthinger <thomas.wuerthinger@oracle.com> |
---|---|
date | Tue, 11 Mar 2014 16:16:24 +0100 |
parents | 51584f76462d |
children | 3e9a960f0da1 |
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" |
13888
51584f76462d
pulled Ptx and Hsail classes out of gpu class namespace
Doug Simon <doug.simon@oracle.com>
parents:
13826
diff
changeset
|
28 #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
|
29 #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
|
30 #include "utilities/ostream.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
|
31 #include "memory/allocation.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
|
32 #include "memory/allocation.inline.hpp" |
13819
49db2c1e3bee
added support for co-existing GPU backends (JBS:GRAAL-1)
Doug Simon <doug.simon@oracle.com>
parents:
13740
diff
changeset
|
33 #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
|
34 #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
|
35 #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
|
36 #include "hsailKernelArguments.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
|
37 |
13819
49db2c1e3bee
added support for co-existing GPU backends (JBS:GRAAL-1)
Doug Simon <doug.simon@oracle.com>
parents:
13740
diff
changeset
|
38 // 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
|
39 #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
|
40 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
|
41 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
|
42 |
49db2c1e3bee
added support for co-existing GPU backends (JBS:GRAAL-1)
Doug Simon <doug.simon@oracle.com>
parents:
13740
diff
changeset
|
43 // 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
|
44 // 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
|
45 #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
|
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 |
49db2c1e3bee
added support for co-existing GPU backends (JBS:GRAAL-1)
Doug Simon <doug.simon@oracle.com>
parents:
13740
diff
changeset
|
48 #define GPU_END } |
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 #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
|
51 #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
|
52 |
49db2c1e3bee
added support for co-existing GPU backends (JBS:GRAAL-1)
Doug Simon <doug.simon@oracle.com>
parents:
13740
diff
changeset
|
53 #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
|
54 #define STRING "Ljava/lang/String;" |
49db2c1e3bee
added support for co-existing GPU backends (JBS:GRAAL-1)
Doug Simon <doug.simon@oracle.com>
parents:
13740
diff
changeset
|
55 #define HS_INSTALLED_CODE "Lcom/oracle/graal/hotspot/meta/HotSpotInstalledCode;" |
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 // public native void executeKernel(HotSpotNmethod kernel, int jobSize, int i, int j, Object[] args) throws InvalidInstalledCodeException; |
49db2c1e3bee
added support for co-existing GPU backends (JBS:GRAAL-1)
Doug Simon <doug.simon@oracle.com>
parents:
13740
diff
changeset
|
58 |
13888
51584f76462d
pulled Ptx and Hsail classes out of gpu class namespace
Doug Simon <doug.simon@oracle.com>
parents:
13826
diff
changeset
|
59 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
|
60 {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
|
61 {CC"generateKernel", CC"([B" STRING ")J", FN_PTR(Hsail::generate_kernel)}, |
51584f76462d
pulled Ptx and Hsail classes out of gpu class namespace
Doug Simon <doug.simon@oracle.com>
parents:
13826
diff
changeset
|
62 {CC"executeKernel0", CC"("HS_INSTALLED_CODE"I["OBJECT")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
|
63 }; |
49db2c1e3bee
added support for co-existing GPU backends (JBS:GRAAL-1)
Doug Simon <doug.simon@oracle.com>
parents:
13740
diff
changeset
|
64 |
13888
51584f76462d
pulled Ptx and Hsail classes out of gpu class namespace
Doug Simon <doug.simon@oracle.com>
parents:
13826
diff
changeset
|
65 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
|
66 |
13888
51584f76462d
pulled Ptx and Hsail classes out of gpu class namespace
Doug Simon <doug.simon@oracle.com>
parents:
13826
diff
changeset
|
67 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
|
68 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
|
69 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
|
70 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
|
71 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
|
72 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
|
73 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
|
74 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
|
75 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
|
76 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
|
77 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
|
78 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
|
79 |
f1a55428a8d7
more HSAIL support in the C++ layer for executing HSAIL code on the simulator
Doug Simon <doug.simon@oracle.com>
parents:
diff
changeset
|
80 |
13888
51584f76462d
pulled Ptx and Hsail classes out of gpu class namespace
Doug Simon <doug.simon@oracle.com>
parents:
13826
diff
changeset
|
81 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
|
82 // 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
|
83 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
|
84 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
|
85 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
|
86 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
|
87 } |
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 _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
|
89 } |
f1a55428a8d7
more HSAIL support in the C++ layer for executing HSAIL code on the simulator
Doug Simon <doug.simon@oracle.com>
parents:
diff
changeset
|
90 |
13888
51584f76462d
pulled Ptx and Hsail classes out of gpu class namespace
Doug Simon <doug.simon@oracle.com>
parents:
13826
diff
changeset
|
91 GPU_VMENTRY(jboolean, Hsail::execute_kernel_void_1d, (JNIEnv* env, jclass, jobject kernel_handle, jint dimX, jobject args_handle)) |
13819
49db2c1e3bee
added support for co-existing GPU backends (JBS:GRAAL-1)
Doug Simon <doug.simon@oracle.com>
parents:
13740
diff
changeset
|
92 |
49db2c1e3bee
added support for co-existing GPU backends (JBS:GRAAL-1)
Doug Simon <doug.simon@oracle.com>
parents:
13740
diff
changeset
|
93 ResourceMark rm; |
49db2c1e3bee
added support for co-existing GPU backends (JBS:GRAAL-1)
Doug Simon <doug.simon@oracle.com>
parents:
13740
diff
changeset
|
94 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
|
95 if (nmethodValue == 0) { |
49db2c1e3bee
added support for co-existing GPU backends (JBS:GRAAL-1)
Doug Simon <doug.simon@oracle.com>
parents:
13740
diff
changeset
|
96 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
|
97 } |
49db2c1e3bee
added support for co-existing GPU backends (JBS:GRAAL-1)
Doug Simon <doug.simon@oracle.com>
parents:
13740
diff
changeset
|
98 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
|
99 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
|
100 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
|
101 |
49db2c1e3bee
added support for co-existing GPU backends (JBS:GRAAL-1)
Doug Simon <doug.simon@oracle.com>
parents:
13740
diff
changeset
|
102 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
|
103 if (kernel == NULL) { |
49db2c1e3bee
added support for co-existing GPU backends (JBS:GRAAL-1)
Doug Simon <doug.simon@oracle.com>
parents:
13740
diff
changeset
|
104 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
|
105 } |
49db2c1e3bee
added support for co-existing GPU backends (JBS:GRAAL-1)
Doug Simon <doug.simon@oracle.com>
parents:
13740
diff
changeset
|
106 |
49db2c1e3bee
added support for co-existing GPU backends (JBS:GRAAL-1)
Doug Simon <doug.simon@oracle.com>
parents:
13740
diff
changeset
|
107 objArrayOop args = (objArrayOop) JNIHandles::resolve(args_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
|
108 |
f1a55428a8d7
more HSAIL support in the C++ layer for executing HSAIL code on the simulator
Doug Simon <doug.simon@oracle.com>
parents:
diff
changeset
|
109 // 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
|
110 _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
|
111 |
f1a55428a8d7
more HSAIL support in the C++ layer for executing HSAIL code on the simulator
Doug Simon <doug.simon@oracle.com>
parents:
diff
changeset
|
112 // This object sets up the kernel arguments |
13819
49db2c1e3bee
added support for co-existing GPU backends (JBS:GRAAL-1)
Doug Simon <doug.simon@oracle.com>
parents:
13740
diff
changeset
|
113 HSAILKernelArguments hka((address) kernel, mh->signature(), args, mh->is_static()); |
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
|
114 |
f1a55428a8d7
more HSAIL support in the C++ layer for executing HSAIL code on the simulator
Doug Simon <doug.simon@oracle.com>
parents:
diff
changeset
|
115 // Run the kernel |
13819
49db2c1e3bee
added support for co-existing GPU backends (JBS:GRAAL-1)
Doug Simon <doug.simon@oracle.com>
parents:
13740
diff
changeset
|
116 return _okra_execute_with_range(kernel, dimX); |
49db2c1e3bee
added support for co-existing GPU backends (JBS:GRAAL-1)
Doug Simon <doug.simon@oracle.com>
parents:
13740
diff
changeset
|
117 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
|
118 |
13888
51584f76462d
pulled Ptx and Hsail classes out of gpu class namespace
Doug Simon <doug.simon@oracle.com>
parents:
13826
diff
changeset
|
119 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
|
120 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
|
121 ResourceMark rm; |
49db2c1e3bee
added support for co-existing GPU backends (JBS:GRAAL-1)
Doug Simon <doug.simon@oracle.com>
parents:
13740
diff
changeset
|
122 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
|
123 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
|
124 |
13819
49db2c1e3bee
added support for co-existing GPU backends (JBS:GRAAL-1)
Doug Simon <doug.simon@oracle.com>
parents:
13740
diff
changeset
|
125 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
|
126 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
|
127 |
13819
49db2c1e3bee
added support for co-existing GPU backends (JBS:GRAAL-1)
Doug Simon <doug.simon@oracle.com>
parents:
13740
diff
changeset
|
128 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
|
129 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
|
130 |
49db2c1e3bee
added support for co-existing GPU backends (JBS:GRAAL-1)
Doug Simon <doug.simon@oracle.com>
parents:
13740
diff
changeset
|
131 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
|
132 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
|
133 |
49db2c1e3bee
added support for co-existing GPU backends (JBS:GRAAL-1)
Doug Simon <doug.simon@oracle.com>
parents:
13740
diff
changeset
|
134 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
|
135 |
f1a55428a8d7
more HSAIL support in the C++ layer for executing HSAIL code on the simulator
Doug Simon <doug.simon@oracle.com>
parents:
diff
changeset
|
136 // 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
|
137 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
|
138 |
13115
166ed1584f30
HSAIL: null checks when loading Okra library functions
Doug Simon <doug.simon@oracle.com>
parents:
13097
diff
changeset
|
139 _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
|
140 |
13819
49db2c1e3bee
added support for co-existing GPU backends (JBS:GRAAL-1)
Doug Simon <doug.simon@oracle.com>
parents:
13740
diff
changeset
|
141 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
|
142 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
|
143 |
f1a55428a8d7
more HSAIL support in the C++ layer for executing HSAIL code on the simulator
Doug Simon <doug.simon@oracle.com>
parents:
diff
changeset
|
144 #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
|
145 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
|
146 #elif defined(_WINDOWS) |
62bd4705894c
reverted removal of Okra Windows DLL name
Doug Simon <doug.simon@oracle.com>
parents:
13822
diff
changeset
|
147 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
|
148 #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
|
149 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
|
150 #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
|
151 |
13115
166ed1584f30
HSAIL: null checks when loading Okra library functions
Doug Simon <doug.simon@oracle.com>
parents:
13097
diff
changeset
|
152 #define STRINGIFY(x) #x |
166ed1584f30
HSAIL: null checks when loading Okra library functions
Doug Simon <doug.simon@oracle.com>
parents:
13097
diff
changeset
|
153 |
166ed1584f30
HSAIL: null checks when loading Okra library functions
Doug Simon <doug.simon@oracle.com>
parents:
13097
diff
changeset
|
154 #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
|
155 _##alias = \ |
166ed1584f30
HSAIL: null checks when loading Okra library functions
Doug Simon <doug.simon@oracle.com>
parents:
13097
diff
changeset
|
156 CAST_TO_FN_PTR(alias##_func_t, os::dll_lookup(handle, STRINGIFY(name))); \ |
166ed1584f30
HSAIL: null checks when loading Okra library functions
Doug Simon <doug.simon@oracle.com>
parents:
13097
diff
changeset
|
157 if (_##alias == NULL) { \ |
166ed1584f30
HSAIL: null checks when loading Okra library functions
Doug Simon <doug.simon@oracle.com>
parents:
13097
diff
changeset
|
158 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
|
159 return false; \ |
13115
166ed1584f30
HSAIL: null checks when loading Okra library functions
Doug Simon <doug.simon@oracle.com>
parents:
13097
diff
changeset
|
160 } \ |
166ed1584f30
HSAIL: null checks when loading Okra library functions
Doug Simon <doug.simon@oracle.com>
parents:
13097
diff
changeset
|
161 |
13888
51584f76462d
pulled Ptx and Hsail classes out of gpu class namespace
Doug Simon <doug.simon@oracle.com>
parents:
13826
diff
changeset
|
162 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
|
163 if (okra_library_name == NULL) { |
13097 | 164 if (TraceGPUInteraction) { |
165 tty->print_cr("Unsupported HSAIL platform"); | |
166 } | |
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
|
167 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
|
168 } |
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
|
169 |
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
|
170 // 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
|
171 char ebuf[O_BUFLEN]; |
13097 | 172 if (TraceGPUInteraction) { |
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
|
173 tty->print_cr("[HSAIL] library is %s", okra_library_name); |
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
|
174 } |
13819
49db2c1e3bee
added support for co-existing GPU backends (JBS:GRAAL-1)
Doug Simon <doug.simon@oracle.com>
parents:
13740
diff
changeset
|
175 void *handle = os::dll_load(okra_library_name, ebuf, O_BUFLEN); |
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
|
176 // try alternate location if env variable set |
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
|
177 char *okra_lib_name_from_env_var = getenv("_OKRA_SIM_LIB_PATH_"); |
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
|
178 if ((handle == NULL) && (okra_lib_name_from_env_var != NULL)) { |
13819
49db2c1e3bee
added support for co-existing GPU backends (JBS:GRAAL-1)
Doug Simon <doug.simon@oracle.com>
parents:
13740
diff
changeset
|
179 handle = os::dll_load(okra_lib_name_from_env_var, ebuf, O_BUFLEN); |
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
|
180 if ((handle != NULL) && 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
|
181 tty->print_cr("[HSAIL] using _OKRA_SIM_LIB_PATH_=%s", getenv("_OKRA_SIM_LIB_PATH_")); |
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
|
182 } |
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
|
183 } |
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
|
184 |
13819
49db2c1e3bee
added support for co-existing GPU backends (JBS:GRAAL-1)
Doug Simon <doug.simon@oracle.com>
parents:
13740
diff
changeset
|
185 if (handle == NULL) { |
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
|
186 // Unable to dlopen okra |
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
|
187 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
|
188 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
|
189 } |
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
|
190 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
|
191 } |
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
|
192 |
13819
49db2c1e3bee
added support for co-existing GPU backends (JBS:GRAAL-1)
Doug Simon <doug.simon@oracle.com>
parents:
13740
diff
changeset
|
193 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
|
194 |
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
|
195 // at this point we know handle is valid and we can lookup the functions |
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
|
196 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:
13115
diff
changeset
|
197 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:
13115
diff
changeset
|
198 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:
13115
diff
changeset
|
199 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
|
200 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
|
201 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
|
202 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
|
203 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
|
204 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:
13115
diff
changeset
|
205 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:
13115
diff
changeset
|
206 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:
13115
diff
changeset
|
207 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:
13115
diff
changeset
|
208 // 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
|
209 |
49db2c1e3bee
added support for co-existing GPU backends (JBS:GRAAL-1)
Doug Simon <doug.simon@oracle.com>
parents:
13740
diff
changeset
|
210 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
|
211 |
49db2c1e3bee
added support for co-existing GPU backends (JBS:GRAAL-1)
Doug Simon <doug.simon@oracle.com>
parents:
13740
diff
changeset
|
212 return true; |
49db2c1e3bee
added support for co-existing GPU backends (JBS:GRAAL-1)
Doug Simon <doug.simon@oracle.com>
parents:
13740
diff
changeset
|
213 GPU_END |
49db2c1e3bee
added support for co-existing GPU backends (JBS:GRAAL-1)
Doug Simon <doug.simon@oracle.com>
parents:
13740
diff
changeset
|
214 |
13888
51584f76462d
pulled Ptx and Hsail classes out of gpu class namespace
Doug Simon <doug.simon@oracle.com>
parents:
13826
diff
changeset
|
215 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
|
216 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
|
217 if (klass == NULL) { |
49db2c1e3bee
added support for co-existing GPU backends (JBS:GRAAL-1)
Doug Simon <doug.simon@oracle.com>
parents:
13740
diff
changeset
|
218 if (TraceGPUInteraction) { |
49db2c1e3bee
added support for co-existing GPU backends (JBS:GRAAL-1)
Doug Simon <doug.simon@oracle.com>
parents:
13740
diff
changeset
|
219 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
|
220 } |
49db2c1e3bee
added support for co-existing GPU backends (JBS:GRAAL-1)
Doug Simon <doug.simon@oracle.com>
parents:
13740
diff
changeset
|
221 return false; |
49db2c1e3bee
added support for co-existing GPU backends (JBS:GRAAL-1)
Doug Simon <doug.simon@oracle.com>
parents:
13740
diff
changeset
|
222 } |
49db2c1e3bee
added support for co-existing GPU backends (JBS:GRAAL-1)
Doug Simon <doug.simon@oracle.com>
parents:
13740
diff
changeset
|
223 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
|
224 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
|
225 if (TraceGPUInteraction) { |
49db2c1e3bee
added support for co-existing GPU backends (JBS:GRAAL-1)
Doug Simon <doug.simon@oracle.com>
parents:
13740
diff
changeset
|
226 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
|
227 } |
49db2c1e3bee
added support for co-existing GPU backends (JBS:GRAAL-1)
Doug Simon <doug.simon@oracle.com>
parents:
13740
diff
changeset
|
228 return false; |
49db2c1e3bee
added support for co-existing GPU backends (JBS:GRAAL-1)
Doug Simon <doug.simon@oracle.com>
parents:
13740
diff
changeset
|
229 } |
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
|
230 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
|
231 } |