Mercurial > hg > graal-jvmci-8
annotate src/share/vm/graal/graalCompilerToGPU.cpp @ 13648:27acedac70b7
added support for @ParallelOver annotation in PTX kernel call wrapper
author | Doug Simon <doug.simon@oracle.com> |
---|---|
date | Wed, 15 Jan 2014 20:24:13 +0100 |
parents | 1dabd01a73bd |
children |
rev | line source |
---|---|
9430
147162b27799
GRAAL-234 - PTX code loading
Morris Meyer <morris.meyer@oracle.com>
parents:
diff
changeset
|
1 /* |
147162b27799
GRAAL-234 - PTX code loading
Morris Meyer <morris.meyer@oracle.com>
parents:
diff
changeset
|
2 * Copyright (c) 2013, Oracle and/or its affiliates. All rights reserved. |
147162b27799
GRAAL-234 - PTX code loading
Morris Meyer <morris.meyer@oracle.com>
parents:
diff
changeset
|
3 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. |
147162b27799
GRAAL-234 - PTX code loading
Morris Meyer <morris.meyer@oracle.com>
parents:
diff
changeset
|
4 * |
147162b27799
GRAAL-234 - PTX code loading
Morris Meyer <morris.meyer@oracle.com>
parents:
diff
changeset
|
5 * This code is free software; you can redistribute it and/or modify it |
147162b27799
GRAAL-234 - PTX code loading
Morris Meyer <morris.meyer@oracle.com>
parents:
diff
changeset
|
6 * under the terms of the GNU General Public License version 2 only, as |
147162b27799
GRAAL-234 - PTX code loading
Morris Meyer <morris.meyer@oracle.com>
parents:
diff
changeset
|
7 * published by the Free Software Foundation. |
147162b27799
GRAAL-234 - PTX code loading
Morris Meyer <morris.meyer@oracle.com>
parents:
diff
changeset
|
8 * |
147162b27799
GRAAL-234 - PTX code loading
Morris Meyer <morris.meyer@oracle.com>
parents:
diff
changeset
|
9 * This code is distributed in the hope that it will be useful, but WITHOUT |
147162b27799
GRAAL-234 - PTX code loading
Morris Meyer <morris.meyer@oracle.com>
parents:
diff
changeset
|
10 * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or |
147162b27799
GRAAL-234 - PTX code loading
Morris Meyer <morris.meyer@oracle.com>
parents:
diff
changeset
|
11 * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License |
147162b27799
GRAAL-234 - PTX code loading
Morris Meyer <morris.meyer@oracle.com>
parents:
diff
changeset
|
12 * version 2 for more details (a copy is included in the LICENSE file that |
147162b27799
GRAAL-234 - PTX code loading
Morris Meyer <morris.meyer@oracle.com>
parents:
diff
changeset
|
13 * accompanied this code). |
147162b27799
GRAAL-234 - PTX code loading
Morris Meyer <morris.meyer@oracle.com>
parents:
diff
changeset
|
14 * |
147162b27799
GRAAL-234 - PTX code loading
Morris Meyer <morris.meyer@oracle.com>
parents:
diff
changeset
|
15 * You should have received a copy of the GNU General Public License version |
147162b27799
GRAAL-234 - PTX code loading
Morris Meyer <morris.meyer@oracle.com>
parents:
diff
changeset
|
16 * 2 along with this work; if not, write to the Free Software Foundation, |
147162b27799
GRAAL-234 - PTX code loading
Morris Meyer <morris.meyer@oracle.com>
parents:
diff
changeset
|
17 * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. |
147162b27799
GRAAL-234 - PTX code loading
Morris Meyer <morris.meyer@oracle.com>
parents:
diff
changeset
|
18 * |
147162b27799
GRAAL-234 - PTX code loading
Morris Meyer <morris.meyer@oracle.com>
parents:
diff
changeset
|
19 * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA |
147162b27799
GRAAL-234 - PTX code loading
Morris Meyer <morris.meyer@oracle.com>
parents:
diff
changeset
|
20 * or visit www.oracle.com if you need additional information or have any |
147162b27799
GRAAL-234 - PTX code loading
Morris Meyer <morris.meyer@oracle.com>
parents:
diff
changeset
|
21 * questions. |
147162b27799
GRAAL-234 - PTX code loading
Morris Meyer <morris.meyer@oracle.com>
parents:
diff
changeset
|
22 */ |
147162b27799
GRAAL-234 - PTX code loading
Morris Meyer <morris.meyer@oracle.com>
parents:
diff
changeset
|
23 |
147162b27799
GRAAL-234 - PTX code loading
Morris Meyer <morris.meyer@oracle.com>
parents:
diff
changeset
|
24 #include "precompiled.hpp" |
147162b27799
GRAAL-234 - PTX code loading
Morris Meyer <morris.meyer@oracle.com>
parents:
diff
changeset
|
25 |
12456
f87c68d79f07
improved support for co-existing, multiple backends (GRAAL-363)
Doug Simon <doug.simon@oracle.com>
parents:
11902
diff
changeset
|
26 #include "memory/oopFactory.hpp" |
9430
147162b27799
GRAAL-234 - PTX code loading
Morris Meyer <morris.meyer@oracle.com>
parents:
diff
changeset
|
27 #include "graal/graalCompiler.hpp" |
147162b27799
GRAAL-234 - PTX code loading
Morris Meyer <morris.meyer@oracle.com>
parents:
diff
changeset
|
28 #include "graal/graalEnv.hpp" |
10577
9c7d9e2c8326
PTX kernel execution - no args or return value
Morris Meyer <morris.meyer@oracle.com>
parents:
10563
diff
changeset
|
29 #include "graal/graalJavaAccess.hpp" |
9430
147162b27799
GRAAL-234 - PTX code loading
Morris Meyer <morris.meyer@oracle.com>
parents:
diff
changeset
|
30 #include "runtime/gpu.hpp" |
10685 | 31 #include "runtime/javaCalls.hpp" |
11596
91e5f927af63
Initial implementation of PTXRuntime (RegisterConfig, PTX description etc); guarded with new flag UseGPU. Specify -XX:+UseGPU to exercise this new implementation.
bharadwaj
parents:
11485
diff
changeset
|
32 # include "ptx/vm/ptxKernelArguments.hpp" |
9430
147162b27799
GRAAL-234 - PTX code loading
Morris Meyer <morris.meyer@oracle.com>
parents:
diff
changeset
|
33 |
147162b27799
GRAAL-234 - PTX code loading
Morris Meyer <morris.meyer@oracle.com>
parents:
diff
changeset
|
34 // Entry to native method implementation that transitions current thread to '_thread_in_vm'. |
147162b27799
GRAAL-234 - PTX code loading
Morris Meyer <morris.meyer@oracle.com>
parents:
diff
changeset
|
35 #define C2V_VMENTRY(result_type, name, signature) \ |
147162b27799
GRAAL-234 - PTX code loading
Morris Meyer <morris.meyer@oracle.com>
parents:
diff
changeset
|
36 JNIEXPORT result_type JNICALL c2v_ ## name signature { \ |
147162b27799
GRAAL-234 - PTX code loading
Morris Meyer <morris.meyer@oracle.com>
parents:
diff
changeset
|
37 TRACE_graal_3("CompilerToGPU::" #name); \ |
147162b27799
GRAAL-234 - PTX code loading
Morris Meyer <morris.meyer@oracle.com>
parents:
diff
changeset
|
38 GRAAL_VM_ENTRY_MARK; \ |
147162b27799
GRAAL-234 - PTX code loading
Morris Meyer <morris.meyer@oracle.com>
parents:
diff
changeset
|
39 |
147162b27799
GRAAL-234 - PTX code loading
Morris Meyer <morris.meyer@oracle.com>
parents:
diff
changeset
|
40 // Entry to native method implementation that calls a JNI function |
147162b27799
GRAAL-234 - PTX code loading
Morris Meyer <morris.meyer@oracle.com>
parents:
diff
changeset
|
41 // and hence cannot transition current thread to '_thread_in_vm'. |
147162b27799
GRAAL-234 - PTX code loading
Morris Meyer <morris.meyer@oracle.com>
parents:
diff
changeset
|
42 #define C2V_ENTRY(result_type, name, signature) \ |
147162b27799
GRAAL-234 - PTX code loading
Morris Meyer <morris.meyer@oracle.com>
parents:
diff
changeset
|
43 JNIEXPORT result_type JNICALL c2v_ ## name signature { \ |
147162b27799
GRAAL-234 - PTX code loading
Morris Meyer <morris.meyer@oracle.com>
parents:
diff
changeset
|
44 TRACE_graal_3("CompilerToGPU::" #name); \ |
147162b27799
GRAAL-234 - PTX code loading
Morris Meyer <morris.meyer@oracle.com>
parents:
diff
changeset
|
45 |
147162b27799
GRAAL-234 - PTX code loading
Morris Meyer <morris.meyer@oracle.com>
parents:
diff
changeset
|
46 #define C2V_END } |
147162b27799
GRAAL-234 - PTX code loading
Morris Meyer <morris.meyer@oracle.com>
parents:
diff
changeset
|
47 |
147162b27799
GRAAL-234 - PTX code loading
Morris Meyer <morris.meyer@oracle.com>
parents:
diff
changeset
|
48 |
10879
d55f24eac4b1
PTX support for Linux
Morris Meyer <morris.meyer@oracle.com>
parents:
10685
diff
changeset
|
49 C2V_ENTRY(jlong, generateKernel, (JNIEnv *env, jobject, jbyteArray code, jstring name)) |
9430
147162b27799
GRAAL-234 - PTX code loading
Morris Meyer <morris.meyer@oracle.com>
parents:
diff
changeset
|
50 if (gpu::is_available() == false || gpu::has_gpu_linkage() == false && gpu::is_initialized()) { |
13648
27acedac70b7
added support for @ParallelOver annotation in PTX kernel call wrapper
Doug Simon <doug.simon@oracle.com>
parents:
13638
diff
changeset
|
51 if (TraceGPUInteraction) { |
27acedac70b7
added support for @ParallelOver annotation in PTX kernel call wrapper
Doug Simon <doug.simon@oracle.com>
parents:
13638
diff
changeset
|
52 tty->print_cr("generateKernel - not available / no linkage / not initialized"); |
27acedac70b7
added support for @ParallelOver annotation in PTX kernel call wrapper
Doug Simon <doug.simon@oracle.com>
parents:
13638
diff
changeset
|
53 } |
9430
147162b27799
GRAAL-234 - PTX code loading
Morris Meyer <morris.meyer@oracle.com>
parents:
diff
changeset
|
54 return 0; |
147162b27799
GRAAL-234 - PTX code loading
Morris Meyer <morris.meyer@oracle.com>
parents:
diff
changeset
|
55 } |
147162b27799
GRAAL-234 - PTX code loading
Morris Meyer <morris.meyer@oracle.com>
parents:
diff
changeset
|
56 jboolean is_copy; |
147162b27799
GRAAL-234 - PTX code loading
Morris Meyer <morris.meyer@oracle.com>
parents:
diff
changeset
|
57 jbyte *bytes = env->GetByteArrayElements(code, &is_copy); |
147162b27799
GRAAL-234 - PTX code loading
Morris Meyer <morris.meyer@oracle.com>
parents:
diff
changeset
|
58 jint len = env->GetArrayLength(code); |
147162b27799
GRAAL-234 - PTX code loading
Morris Meyer <morris.meyer@oracle.com>
parents:
diff
changeset
|
59 const char *namestr = env->GetStringUTFChars(name, &is_copy); |
10563
7a3499bf5e2c
PTX kernel get_function return
Morris Meyer <morris.meyer@oracle.com>
parents:
9669
diff
changeset
|
60 void *kernel = gpu::generate_kernel((unsigned char *)bytes, len, namestr); |
10879
d55f24eac4b1
PTX support for Linux
Morris Meyer <morris.meyer@oracle.com>
parents:
10685
diff
changeset
|
61 if (kernel == NULL) { |
d55f24eac4b1
PTX support for Linux
Morris Meyer <morris.meyer@oracle.com>
parents:
10685
diff
changeset
|
62 tty->print_cr("[CUDA] *** Error: Failed to compile kernel"); |
13648
27acedac70b7
added support for @ParallelOver annotation in PTX kernel call wrapper
Doug Simon <doug.simon@oracle.com>
parents:
13638
diff
changeset
|
63 } else if (TraceGPUInteraction) { |
10879
d55f24eac4b1
PTX support for Linux
Morris Meyer <morris.meyer@oracle.com>
parents:
10685
diff
changeset
|
64 tty->print_cr("[CUDA] Generated kernel"); |
d55f24eac4b1
PTX support for Linux
Morris Meyer <morris.meyer@oracle.com>
parents:
10685
diff
changeset
|
65 } |
9430
147162b27799
GRAAL-234 - PTX code loading
Morris Meyer <morris.meyer@oracle.com>
parents:
diff
changeset
|
66 env->ReleaseByteArrayElements(code, bytes, 0); |
147162b27799
GRAAL-234 - PTX code loading
Morris Meyer <morris.meyer@oracle.com>
parents:
diff
changeset
|
67 env->ReleaseStringUTFChars(name, namestr); |
147162b27799
GRAAL-234 - PTX code loading
Morris Meyer <morris.meyer@oracle.com>
parents:
diff
changeset
|
68 |
10563
7a3499bf5e2c
PTX kernel get_function return
Morris Meyer <morris.meyer@oracle.com>
parents:
9669
diff
changeset
|
69 return (jlong)kernel; |
9430
147162b27799
GRAAL-234 - PTX code loading
Morris Meyer <morris.meyer@oracle.com>
parents:
diff
changeset
|
70 C2V_END |
147162b27799
GRAAL-234 - PTX code loading
Morris Meyer <morris.meyer@oracle.com>
parents:
diff
changeset
|
71 |
10577
9c7d9e2c8326
PTX kernel execution - no args or return value
Morris Meyer <morris.meyer@oracle.com>
parents:
10563
diff
changeset
|
72 C2V_VMENTRY(jobject, executeExternalMethodVarargs, (JNIEnv *env, jobject, jobject args, jobject hotspotInstalledCode)) |
9c7d9e2c8326
PTX kernel execution - no args or return value
Morris Meyer <morris.meyer@oracle.com>
parents:
10563
diff
changeset
|
73 ResourceMark rm; |
9c7d9e2c8326
PTX kernel execution - no args or return value
Morris Meyer <morris.meyer@oracle.com>
parents:
10563
diff
changeset
|
74 HandleMark hm; |
9c7d9e2c8326
PTX kernel execution - no args or return value
Morris Meyer <morris.meyer@oracle.com>
parents:
10563
diff
changeset
|
75 |
9c7d9e2c8326
PTX kernel execution - no args or return value
Morris Meyer <morris.meyer@oracle.com>
parents:
10563
diff
changeset
|
76 if (gpu::is_available() == false || gpu::has_gpu_linkage() == false && gpu::is_initialized()) { |
9c7d9e2c8326
PTX kernel execution - no args or return value
Morris Meyer <morris.meyer@oracle.com>
parents:
10563
diff
changeset
|
77 tty->print_cr("executeExternalMethodVarargs - not available / no linkage / not initialized"); |
9c7d9e2c8326
PTX kernel execution - no args or return value
Morris Meyer <morris.meyer@oracle.com>
parents:
10563
diff
changeset
|
78 return NULL; |
9c7d9e2c8326
PTX kernel execution - no args or return value
Morris Meyer <morris.meyer@oracle.com>
parents:
10563
diff
changeset
|
79 } |
9c7d9e2c8326
PTX kernel execution - no args or return value
Morris Meyer <morris.meyer@oracle.com>
parents:
10563
diff
changeset
|
80 jlong nmethodValue = HotSpotInstalledCode::codeBlob(hotspotInstalledCode); |
9c7d9e2c8326
PTX kernel execution - no args or return value
Morris Meyer <morris.meyer@oracle.com>
parents:
10563
diff
changeset
|
81 nmethod* nm = (nmethod*) (address) nmethodValue; |
9c7d9e2c8326
PTX kernel execution - no args or return value
Morris Meyer <morris.meyer@oracle.com>
parents:
10563
diff
changeset
|
82 methodHandle mh = nm->method(); |
9c7d9e2c8326
PTX kernel execution - no args or return value
Morris Meyer <morris.meyer@oracle.com>
parents:
10563
diff
changeset
|
83 Symbol* signature = mh->signature(); |
9c7d9e2c8326
PTX kernel execution - no args or return value
Morris Meyer <morris.meyer@oracle.com>
parents:
10563
diff
changeset
|
84 |
9c7d9e2c8326
PTX kernel execution - no args or return value
Morris Meyer <morris.meyer@oracle.com>
parents:
10563
diff
changeset
|
85 // start value is the kernel |
11381
001c41b01d13
HotSpotInstalledCode: moved getCode to Java and added the ability to get the whole blob
twisti
parents:
11291
diff
changeset
|
86 jlong startValue = HotSpotInstalledCode::codeStart(hotspotInstalledCode); |
10577
9c7d9e2c8326
PTX kernel execution - no args or return value
Morris Meyer <morris.meyer@oracle.com>
parents:
10563
diff
changeset
|
87 |
11485
49bb1bc983c6
Implement several missing PTX codegen features; return value capture and method args passing of java method executed on GPU.
bharadwaj
parents:
11381
diff
changeset
|
88 PTXKernelArguments ptxka(signature, (arrayOop) JNIHandles::resolve(args), mh->is_static()); |
49bb1bc983c6
Implement several missing PTX codegen features; return value capture and method args passing of java method executed on GPU.
bharadwaj
parents:
11381
diff
changeset
|
89 JavaValue result(ptxka.get_ret_type()); |
49bb1bc983c6
Implement several missing PTX codegen features; return value capture and method args passing of java method executed on GPU.
bharadwaj
parents:
11381
diff
changeset
|
90 if (!gpu::execute_kernel((address)startValue, ptxka, result)) { |
11283
1cd1f8ff70a1
CR-20: PTX kernel invocation with arguments - from Bharadwaj
Morris Meyer <morris.meyer@oracle.com>
parents:
10879
diff
changeset
|
91 return NULL; |
1cd1f8ff70a1
CR-20: PTX kernel invocation with arguments - from Bharadwaj
Morris Meyer <morris.meyer@oracle.com>
parents:
10879
diff
changeset
|
92 } |
10577
9c7d9e2c8326
PTX kernel execution - no args or return value
Morris Meyer <morris.meyer@oracle.com>
parents:
10563
diff
changeset
|
93 |
11485
49bb1bc983c6
Implement several missing PTX codegen features; return value capture and method args passing of java method executed on GPU.
bharadwaj
parents:
11381
diff
changeset
|
94 if (ptxka.get_ret_type() == T_VOID) { |
10577
9c7d9e2c8326
PTX kernel execution - no args or return value
Morris Meyer <morris.meyer@oracle.com>
parents:
10563
diff
changeset
|
95 return NULL; |
11485
49bb1bc983c6
Implement several missing PTX codegen features; return value capture and method args passing of java method executed on GPU.
bharadwaj
parents:
11381
diff
changeset
|
96 } else if (ptxka.get_ret_type() == T_OBJECT || ptxka.get_ret_type() == T_ARRAY) { |
10577
9c7d9e2c8326
PTX kernel execution - no args or return value
Morris Meyer <morris.meyer@oracle.com>
parents:
10563
diff
changeset
|
97 return JNIHandles::make_local((oop) result.get_jobject()); |
9c7d9e2c8326
PTX kernel execution - no args or return value
Morris Meyer <morris.meyer@oracle.com>
parents:
10563
diff
changeset
|
98 } else { |
11485
49bb1bc983c6
Implement several missing PTX codegen features; return value capture and method args passing of java method executed on GPU.
bharadwaj
parents:
11381
diff
changeset
|
99 oop o = java_lang_boxing_object::create(ptxka.get_ret_type(), (jvalue *) result.get_value_addr(), CHECK_NULL); |
49bb1bc983c6
Implement several missing PTX codegen features; return value capture and method args passing of java method executed on GPU.
bharadwaj
parents:
11381
diff
changeset
|
100 if (TraceGPUInteraction) { |
11902
67a1e27a8dbb
PTX initial float and double
Morris Meyer <morris.meyer@oracle.com>
parents:
11842
diff
changeset
|
101 switch (ptxka.get_ret_type()) { |
67a1e27a8dbb
PTX initial float and double
Morris Meyer <morris.meyer@oracle.com>
parents:
11842
diff
changeset
|
102 case T_INT: |
12653
1a7e7011a341
* PTX kernel argument buffer now has naturally aligned arguments as required by PTX JIT compiler.
S.Bharadwaj Yadavalli <bharadwaj.yadavalli@oracle.com>
parents:
12490
diff
changeset
|
103 tty->print_cr("GPU execution returned (int) %d", result.get_jint()); |
1a7e7011a341
* PTX kernel argument buffer now has naturally aligned arguments as required by PTX JIT compiler.
S.Bharadwaj Yadavalli <bharadwaj.yadavalli@oracle.com>
parents:
12490
diff
changeset
|
104 break; |
1a7e7011a341
* PTX kernel argument buffer now has naturally aligned arguments as required by PTX JIT compiler.
S.Bharadwaj Yadavalli <bharadwaj.yadavalli@oracle.com>
parents:
12490
diff
changeset
|
105 case T_LONG: |
1a7e7011a341
* PTX kernel argument buffer now has naturally aligned arguments as required by PTX JIT compiler.
S.Bharadwaj Yadavalli <bharadwaj.yadavalli@oracle.com>
parents:
12490
diff
changeset
|
106 tty->print_cr("GPU execution returned (long) %ld", result.get_jlong()); |
11902
67a1e27a8dbb
PTX initial float and double
Morris Meyer <morris.meyer@oracle.com>
parents:
11842
diff
changeset
|
107 break; |
67a1e27a8dbb
PTX initial float and double
Morris Meyer <morris.meyer@oracle.com>
parents:
11842
diff
changeset
|
108 case T_FLOAT: |
12653
1a7e7011a341
* PTX kernel argument buffer now has naturally aligned arguments as required by PTX JIT compiler.
S.Bharadwaj Yadavalli <bharadwaj.yadavalli@oracle.com>
parents:
12490
diff
changeset
|
109 tty->print_cr("GPU execution returned (float) %f", result.get_jfloat()); |
11902
67a1e27a8dbb
PTX initial float and double
Morris Meyer <morris.meyer@oracle.com>
parents:
11842
diff
changeset
|
110 break; |
67a1e27a8dbb
PTX initial float and double
Morris Meyer <morris.meyer@oracle.com>
parents:
11842
diff
changeset
|
111 case T_DOUBLE: |
12653
1a7e7011a341
* PTX kernel argument buffer now has naturally aligned arguments as required by PTX JIT compiler.
S.Bharadwaj Yadavalli <bharadwaj.yadavalli@oracle.com>
parents:
12490
diff
changeset
|
112 tty->print_cr("GPU execution returned (double) %f", result.get_jdouble()); |
11902
67a1e27a8dbb
PTX initial float and double
Morris Meyer <morris.meyer@oracle.com>
parents:
11842
diff
changeset
|
113 break; |
67a1e27a8dbb
PTX initial float and double
Morris Meyer <morris.meyer@oracle.com>
parents:
11842
diff
changeset
|
114 default: |
12653
1a7e7011a341
* PTX kernel argument buffer now has naturally aligned arguments as required by PTX JIT compiler.
S.Bharadwaj Yadavalli <bharadwaj.yadavalli@oracle.com>
parents:
12490
diff
changeset
|
115 tty->print_cr("**** Value returned by GPU not yet handled"); |
11902
67a1e27a8dbb
PTX initial float and double
Morris Meyer <morris.meyer@oracle.com>
parents:
11842
diff
changeset
|
116 break; |
67a1e27a8dbb
PTX initial float and double
Morris Meyer <morris.meyer@oracle.com>
parents:
11842
diff
changeset
|
117 } |
11485
49bb1bc983c6
Implement several missing PTX codegen features; return value capture and method args passing of java method executed on GPU.
bharadwaj
parents:
11381
diff
changeset
|
118 } |
10577
9c7d9e2c8326
PTX kernel execution - no args or return value
Morris Meyer <morris.meyer@oracle.com>
parents:
10563
diff
changeset
|
119 return JNIHandles::make_local(o); |
9c7d9e2c8326
PTX kernel execution - no args or return value
Morris Meyer <morris.meyer@oracle.com>
parents:
10563
diff
changeset
|
120 } |
9c7d9e2c8326
PTX kernel execution - no args or return value
Morris Meyer <morris.meyer@oracle.com>
parents:
10563
diff
changeset
|
121 C2V_END |
9c7d9e2c8326
PTX kernel execution - no args or return value
Morris Meyer <morris.meyer@oracle.com>
parents:
10563
diff
changeset
|
122 |
11822
365d8f385fb5
PTX: one-dimensional parallel warp invocation, ParallelOver annotation
Morris Meyer <morris.meyer@oracle.com>
parents:
11596
diff
changeset
|
123 C2V_VMENTRY(jobject, executeParallelMethodVarargs, (JNIEnv *env, |
365d8f385fb5
PTX: one-dimensional parallel warp invocation, ParallelOver annotation
Morris Meyer <morris.meyer@oracle.com>
parents:
11596
diff
changeset
|
124 jobject, |
365d8f385fb5
PTX: one-dimensional parallel warp invocation, ParallelOver annotation
Morris Meyer <morris.meyer@oracle.com>
parents:
11596
diff
changeset
|
125 jint dimX, jint dimY, jint dimZ, |
365d8f385fb5
PTX: one-dimensional parallel warp invocation, ParallelOver annotation
Morris Meyer <morris.meyer@oracle.com>
parents:
11596
diff
changeset
|
126 jobject args, jobject hotspotInstalledCode)) |
365d8f385fb5
PTX: one-dimensional parallel warp invocation, ParallelOver annotation
Morris Meyer <morris.meyer@oracle.com>
parents:
11596
diff
changeset
|
127 ResourceMark rm; |
365d8f385fb5
PTX: one-dimensional parallel warp invocation, ParallelOver annotation
Morris Meyer <morris.meyer@oracle.com>
parents:
11596
diff
changeset
|
128 HandleMark hm; |
365d8f385fb5
PTX: one-dimensional parallel warp invocation, ParallelOver annotation
Morris Meyer <morris.meyer@oracle.com>
parents:
11596
diff
changeset
|
129 |
365d8f385fb5
PTX: one-dimensional parallel warp invocation, ParallelOver annotation
Morris Meyer <morris.meyer@oracle.com>
parents:
11596
diff
changeset
|
130 if (gpu::is_available() == false || gpu::has_gpu_linkage() == false && gpu::is_initialized()) { |
11842
8d8f63069f58
PTX warp limiter to available GPU processors
Morris Meyer <morris.meyer@oracle.com>
parents:
11822
diff
changeset
|
131 tty->print_cr("executeParallelMethodVarargs - not available / no linkage / not initialized"); |
11822
365d8f385fb5
PTX: one-dimensional parallel warp invocation, ParallelOver annotation
Morris Meyer <morris.meyer@oracle.com>
parents:
11596
diff
changeset
|
132 return NULL; |
365d8f385fb5
PTX: one-dimensional parallel warp invocation, ParallelOver annotation
Morris Meyer <morris.meyer@oracle.com>
parents:
11596
diff
changeset
|
133 } |
365d8f385fb5
PTX: one-dimensional parallel warp invocation, ParallelOver annotation
Morris Meyer <morris.meyer@oracle.com>
parents:
11596
diff
changeset
|
134 jlong nmethodValue = HotSpotInstalledCode::codeBlob(hotspotInstalledCode); |
365d8f385fb5
PTX: one-dimensional parallel warp invocation, ParallelOver annotation
Morris Meyer <morris.meyer@oracle.com>
parents:
11596
diff
changeset
|
135 nmethod* nm = (nmethod*) (address) nmethodValue; |
365d8f385fb5
PTX: one-dimensional parallel warp invocation, ParallelOver annotation
Morris Meyer <morris.meyer@oracle.com>
parents:
11596
diff
changeset
|
136 methodHandle mh = nm->method(); |
365d8f385fb5
PTX: one-dimensional parallel warp invocation, ParallelOver annotation
Morris Meyer <morris.meyer@oracle.com>
parents:
11596
diff
changeset
|
137 Symbol* signature = mh->signature(); |
365d8f385fb5
PTX: one-dimensional parallel warp invocation, ParallelOver annotation
Morris Meyer <morris.meyer@oracle.com>
parents:
11596
diff
changeset
|
138 |
365d8f385fb5
PTX: one-dimensional parallel warp invocation, ParallelOver annotation
Morris Meyer <morris.meyer@oracle.com>
parents:
11596
diff
changeset
|
139 // start value is the kernel |
365d8f385fb5
PTX: one-dimensional parallel warp invocation, ParallelOver annotation
Morris Meyer <morris.meyer@oracle.com>
parents:
11596
diff
changeset
|
140 jlong startValue = HotSpotInstalledCode::codeStart(hotspotInstalledCode); |
365d8f385fb5
PTX: one-dimensional parallel warp invocation, ParallelOver annotation
Morris Meyer <morris.meyer@oracle.com>
parents:
11596
diff
changeset
|
141 |
12743
f1a55428a8d7
more HSAIL support in the C++ layer for executing HSAIL code on the simulator
Doug Simon <doug.simon@oracle.com>
parents:
12653
diff
changeset
|
142 if (UseHSAILSimulator) { |
f1a55428a8d7
more HSAIL support in the C++ layer for executing HSAIL code on the simulator
Doug Simon <doug.simon@oracle.com>
parents:
12653
diff
changeset
|
143 gpu::execute_kernel_void_1d((address)startValue, dimX, args, mh); |
f1a55428a8d7
more HSAIL support in the C++ layer for executing HSAIL code on the simulator
Doug Simon <doug.simon@oracle.com>
parents:
12653
diff
changeset
|
144 return NULL; |
f1a55428a8d7
more HSAIL support in the C++ layer for executing HSAIL code on the simulator
Doug Simon <doug.simon@oracle.com>
parents:
12653
diff
changeset
|
145 } |
f1a55428a8d7
more HSAIL support in the C++ layer for executing HSAIL code on the simulator
Doug Simon <doug.simon@oracle.com>
parents:
12653
diff
changeset
|
146 |
11822
365d8f385fb5
PTX: one-dimensional parallel warp invocation, ParallelOver annotation
Morris Meyer <morris.meyer@oracle.com>
parents:
11596
diff
changeset
|
147 PTXKernelArguments ptxka(signature, (arrayOop) JNIHandles::resolve(args), mh->is_static()); |
365d8f385fb5
PTX: one-dimensional parallel warp invocation, ParallelOver annotation
Morris Meyer <morris.meyer@oracle.com>
parents:
11596
diff
changeset
|
148 JavaValue result(ptxka.get_ret_type()); |
12743
f1a55428a8d7
more HSAIL support in the C++ layer for executing HSAIL code on the simulator
Doug Simon <doug.simon@oracle.com>
parents:
12653
diff
changeset
|
149 if (!gpu::execute_warp(dimX, dimY, dimZ, (address) startValue, ptxka, result)) { |
11822
365d8f385fb5
PTX: one-dimensional parallel warp invocation, ParallelOver annotation
Morris Meyer <morris.meyer@oracle.com>
parents:
11596
diff
changeset
|
150 return NULL; |
365d8f385fb5
PTX: one-dimensional parallel warp invocation, ParallelOver annotation
Morris Meyer <morris.meyer@oracle.com>
parents:
11596
diff
changeset
|
151 } |
365d8f385fb5
PTX: one-dimensional parallel warp invocation, ParallelOver annotation
Morris Meyer <morris.meyer@oracle.com>
parents:
11596
diff
changeset
|
152 |
365d8f385fb5
PTX: one-dimensional parallel warp invocation, ParallelOver annotation
Morris Meyer <morris.meyer@oracle.com>
parents:
11596
diff
changeset
|
153 if (ptxka.get_ret_type() == T_VOID) { |
365d8f385fb5
PTX: one-dimensional parallel warp invocation, ParallelOver annotation
Morris Meyer <morris.meyer@oracle.com>
parents:
11596
diff
changeset
|
154 return NULL; |
365d8f385fb5
PTX: one-dimensional parallel warp invocation, ParallelOver annotation
Morris Meyer <morris.meyer@oracle.com>
parents:
11596
diff
changeset
|
155 } else if (ptxka.get_ret_type() == T_OBJECT || ptxka.get_ret_type() == T_ARRAY) { |
365d8f385fb5
PTX: one-dimensional parallel warp invocation, ParallelOver annotation
Morris Meyer <morris.meyer@oracle.com>
parents:
11596
diff
changeset
|
156 return JNIHandles::make_local((oop) result.get_jobject()); |
365d8f385fb5
PTX: one-dimensional parallel warp invocation, ParallelOver annotation
Morris Meyer <morris.meyer@oracle.com>
parents:
11596
diff
changeset
|
157 } else { |
365d8f385fb5
PTX: one-dimensional parallel warp invocation, ParallelOver annotation
Morris Meyer <morris.meyer@oracle.com>
parents:
11596
diff
changeset
|
158 oop o = java_lang_boxing_object::create(ptxka.get_ret_type(), (jvalue *) result.get_value_addr(), CHECK_NULL); |
365d8f385fb5
PTX: one-dimensional parallel warp invocation, ParallelOver annotation
Morris Meyer <morris.meyer@oracle.com>
parents:
11596
diff
changeset
|
159 if (TraceGPUInteraction) { |
11902
67a1e27a8dbb
PTX initial float and double
Morris Meyer <morris.meyer@oracle.com>
parents:
11842
diff
changeset
|
160 switch (ptxka.get_ret_type()) { |
67a1e27a8dbb
PTX initial float and double
Morris Meyer <morris.meyer@oracle.com>
parents:
11842
diff
changeset
|
161 case T_INT: |
67a1e27a8dbb
PTX initial float and double
Morris Meyer <morris.meyer@oracle.com>
parents:
11842
diff
changeset
|
162 tty->print_cr("GPU execution returned %d", result.get_jint()); |
67a1e27a8dbb
PTX initial float and double
Morris Meyer <morris.meyer@oracle.com>
parents:
11842
diff
changeset
|
163 break; |
67a1e27a8dbb
PTX initial float and double
Morris Meyer <morris.meyer@oracle.com>
parents:
11842
diff
changeset
|
164 case T_FLOAT: |
67a1e27a8dbb
PTX initial float and double
Morris Meyer <morris.meyer@oracle.com>
parents:
11842
diff
changeset
|
165 tty->print_cr("GPU execution returned %f", result.get_jfloat()); |
67a1e27a8dbb
PTX initial float and double
Morris Meyer <morris.meyer@oracle.com>
parents:
11842
diff
changeset
|
166 break; |
67a1e27a8dbb
PTX initial float and double
Morris Meyer <morris.meyer@oracle.com>
parents:
11842
diff
changeset
|
167 case T_DOUBLE: |
67a1e27a8dbb
PTX initial float and double
Morris Meyer <morris.meyer@oracle.com>
parents:
11842
diff
changeset
|
168 tty->print_cr("GPU execution returned %g", result.get_jdouble()); |
67a1e27a8dbb
PTX initial float and double
Morris Meyer <morris.meyer@oracle.com>
parents:
11842
diff
changeset
|
169 break; |
67a1e27a8dbb
PTX initial float and double
Morris Meyer <morris.meyer@oracle.com>
parents:
11842
diff
changeset
|
170 default: |
67a1e27a8dbb
PTX initial float and double
Morris Meyer <morris.meyer@oracle.com>
parents:
11842
diff
changeset
|
171 tty->print_cr("GPU returned unhandled"); |
67a1e27a8dbb
PTX initial float and double
Morris Meyer <morris.meyer@oracle.com>
parents:
11842
diff
changeset
|
172 break; |
67a1e27a8dbb
PTX initial float and double
Morris Meyer <morris.meyer@oracle.com>
parents:
11842
diff
changeset
|
173 } |
11822
365d8f385fb5
PTX: one-dimensional parallel warp invocation, ParallelOver annotation
Morris Meyer <morris.meyer@oracle.com>
parents:
11596
diff
changeset
|
174 } |
365d8f385fb5
PTX: one-dimensional parallel warp invocation, ParallelOver annotation
Morris Meyer <morris.meyer@oracle.com>
parents:
11596
diff
changeset
|
175 return JNIHandles::make_local(o); |
365d8f385fb5
PTX: one-dimensional parallel warp invocation, ParallelOver annotation
Morris Meyer <morris.meyer@oracle.com>
parents:
11596
diff
changeset
|
176 } |
365d8f385fb5
PTX: one-dimensional parallel warp invocation, ParallelOver annotation
Morris Meyer <morris.meyer@oracle.com>
parents:
11596
diff
changeset
|
177 C2V_END |
365d8f385fb5
PTX: one-dimensional parallel warp invocation, ParallelOver annotation
Morris Meyer <morris.meyer@oracle.com>
parents:
11596
diff
changeset
|
178 |
13638
1dabd01a73bd
PTX backend can alter compilation pipeline to offload selected code to the GPU
Doug Simon <doug.simon@oracle.com>
parents:
13624
diff
changeset
|
179 JRT_ENTRY(jlong, invalidLaunchKernel(JavaThread* thread)) |
1dabd01a73bd
PTX backend can alter compilation pipeline to offload selected code to the GPU
Doug Simon <doug.simon@oracle.com>
parents:
13624
diff
changeset
|
180 SharedRuntime::throw_and_post_jvmti_exception(thread, vmSymbols::java_lang_LinkageError(), "invalid kernel launch function"); |
1dabd01a73bd
PTX backend can alter compilation pipeline to offload selected code to the GPU
Doug Simon <doug.simon@oracle.com>
parents:
13624
diff
changeset
|
181 return 0L; |
1dabd01a73bd
PTX backend can alter compilation pipeline to offload selected code to the GPU
Doug Simon <doug.simon@oracle.com>
parents:
13624
diff
changeset
|
182 JRT_END |
1dabd01a73bd
PTX backend can alter compilation pipeline to offload selected code to the GPU
Doug Simon <doug.simon@oracle.com>
parents:
13624
diff
changeset
|
183 |
13624
220ed109bf77
initial code for calling PTX kernel code from Java with parameter marshaling and return value unmarshaling performed by a wrapper specified via manual graph construction
Doug Simon <doug.simon@oracle.com>
parents:
13157
diff
changeset
|
184 C2V_VMENTRY(jlong, getLaunchKernelAddress, (JNIEnv *env, jobject)) |
220ed109bf77
initial code for calling PTX kernel code from Java with parameter marshaling and return value unmarshaling performed by a wrapper specified via manual graph construction
Doug Simon <doug.simon@oracle.com>
parents:
13157
diff
changeset
|
185 if (gpu::get_target_il_type() == gpu::PTX) { |
220ed109bf77
initial code for calling PTX kernel code from Java with parameter marshaling and return value unmarshaling performed by a wrapper specified via manual graph construction
Doug Simon <doug.simon@oracle.com>
parents:
13157
diff
changeset
|
186 return (jlong) gpu::Ptx::execute_kernel_from_vm; |
220ed109bf77
initial code for calling PTX kernel code from Java with parameter marshaling and return value unmarshaling performed by a wrapper specified via manual graph construction
Doug Simon <doug.simon@oracle.com>
parents:
13157
diff
changeset
|
187 } |
13638
1dabd01a73bd
PTX backend can alter compilation pipeline to offload selected code to the GPU
Doug Simon <doug.simon@oracle.com>
parents:
13624
diff
changeset
|
188 return (jlong) invalidLaunchKernel; |
13624
220ed109bf77
initial code for calling PTX kernel code from Java with parameter marshaling and return value unmarshaling performed by a wrapper specified via manual graph construction
Doug Simon <doug.simon@oracle.com>
parents:
13157
diff
changeset
|
189 C2V_END |
220ed109bf77
initial code for calling PTX kernel code from Java with parameter marshaling and return value unmarshaling performed by a wrapper specified via manual graph construction
Doug Simon <doug.simon@oracle.com>
parents:
13157
diff
changeset
|
190 |
9430
147162b27799
GRAAL-234 - PTX code loading
Morris Meyer <morris.meyer@oracle.com>
parents:
diff
changeset
|
191 C2V_VMENTRY(jboolean, deviceInit, (JNIEnv *env, jobject)) |
147162b27799
GRAAL-234 - PTX code loading
Morris Meyer <morris.meyer@oracle.com>
parents:
diff
changeset
|
192 if (gpu::is_available() == false || gpu::has_gpu_linkage() == false) { |
13157
ca10e53c03ab
put warnings about missing GPU device behind TraceGPUInteraction option
Doug Simon <doug.simon@oracle.com>
parents:
12743
diff
changeset
|
193 if (TraceGPUInteraction) { |
ca10e53c03ab
put warnings about missing GPU device behind TraceGPUInteraction option
Doug Simon <doug.simon@oracle.com>
parents:
12743
diff
changeset
|
194 tty->print_cr("deviceInit - not available / no linkage"); |
ca10e53c03ab
put warnings about missing GPU device behind TraceGPUInteraction option
Doug Simon <doug.simon@oracle.com>
parents:
12743
diff
changeset
|
195 } |
9430
147162b27799
GRAAL-234 - PTX code loading
Morris Meyer <morris.meyer@oracle.com>
parents:
diff
changeset
|
196 return false; |
147162b27799
GRAAL-234 - PTX code loading
Morris Meyer <morris.meyer@oracle.com>
parents:
diff
changeset
|
197 } |
147162b27799
GRAAL-234 - PTX code loading
Morris Meyer <morris.meyer@oracle.com>
parents:
diff
changeset
|
198 if (gpu::is_initialized()) { |
147162b27799
GRAAL-234 - PTX code loading
Morris Meyer <morris.meyer@oracle.com>
parents:
diff
changeset
|
199 tty->print_cr("deviceInit - already initialized"); |
147162b27799
GRAAL-234 - PTX code loading
Morris Meyer <morris.meyer@oracle.com>
parents:
diff
changeset
|
200 return true; |
147162b27799
GRAAL-234 - PTX code loading
Morris Meyer <morris.meyer@oracle.com>
parents:
diff
changeset
|
201 } |
147162b27799
GRAAL-234 - PTX code loading
Morris Meyer <morris.meyer@oracle.com>
parents:
diff
changeset
|
202 gpu::initialize_gpu(); |
147162b27799
GRAAL-234 - PTX code loading
Morris Meyer <morris.meyer@oracle.com>
parents:
diff
changeset
|
203 return gpu::is_initialized(); |
147162b27799
GRAAL-234 - PTX code loading
Morris Meyer <morris.meyer@oracle.com>
parents:
diff
changeset
|
204 C2V_END |
147162b27799
GRAAL-234 - PTX code loading
Morris Meyer <morris.meyer@oracle.com>
parents:
diff
changeset
|
205 |
11842
8d8f63069f58
PTX warp limiter to available GPU processors
Morris Meyer <morris.meyer@oracle.com>
parents:
11822
diff
changeset
|
206 C2V_VMENTRY(jint, availableProcessors, (JNIEnv *env, jobject)) |
8d8f63069f58
PTX warp limiter to available GPU processors
Morris Meyer <morris.meyer@oracle.com>
parents:
11822
diff
changeset
|
207 if (gpu::is_available() == false || gpu::has_gpu_linkage() == false) { |
13157
ca10e53c03ab
put warnings about missing GPU device behind TraceGPUInteraction option
Doug Simon <doug.simon@oracle.com>
parents:
12743
diff
changeset
|
208 if (TraceGPUInteraction) { |
ca10e53c03ab
put warnings about missing GPU device behind TraceGPUInteraction option
Doug Simon <doug.simon@oracle.com>
parents:
12743
diff
changeset
|
209 tty->print_cr("deviceInit - not available / no linkage"); |
ca10e53c03ab
put warnings about missing GPU device behind TraceGPUInteraction option
Doug Simon <doug.simon@oracle.com>
parents:
12743
diff
changeset
|
210 } |
11842
8d8f63069f58
PTX warp limiter to available GPU processors
Morris Meyer <morris.meyer@oracle.com>
parents:
11822
diff
changeset
|
211 return false; |
8d8f63069f58
PTX warp limiter to available GPU processors
Morris Meyer <morris.meyer@oracle.com>
parents:
11822
diff
changeset
|
212 } |
8d8f63069f58
PTX warp limiter to available GPU processors
Morris Meyer <morris.meyer@oracle.com>
parents:
11822
diff
changeset
|
213 return gpu::available_processors(); |
8d8f63069f58
PTX warp limiter to available GPU processors
Morris Meyer <morris.meyer@oracle.com>
parents:
11822
diff
changeset
|
214 C2V_END |
8d8f63069f58
PTX warp limiter to available GPU processors
Morris Meyer <morris.meyer@oracle.com>
parents:
11822
diff
changeset
|
215 |
9430
147162b27799
GRAAL-234 - PTX code loading
Morris Meyer <morris.meyer@oracle.com>
parents:
diff
changeset
|
216 C2V_VMENTRY(jboolean, deviceDetach, (JNIEnv *env, jobject)) |
147162b27799
GRAAL-234 - PTX code loading
Morris Meyer <morris.meyer@oracle.com>
parents:
diff
changeset
|
217 return true; |
147162b27799
GRAAL-234 - PTX code loading
Morris Meyer <morris.meyer@oracle.com>
parents:
diff
changeset
|
218 C2V_END |
147162b27799
GRAAL-234 - PTX code loading
Morris Meyer <morris.meyer@oracle.com>
parents:
diff
changeset
|
219 |
147162b27799
GRAAL-234 - PTX code loading
Morris Meyer <morris.meyer@oracle.com>
parents:
diff
changeset
|
220 |
147162b27799
GRAAL-234 - PTX code loading
Morris Meyer <morris.meyer@oracle.com>
parents:
diff
changeset
|
221 #define CC (char*) /*cast a literal from (const char*)*/ |
147162b27799
GRAAL-234 - PTX code loading
Morris Meyer <morris.meyer@oracle.com>
parents:
diff
changeset
|
222 #define FN_PTR(f) CAST_FROM_FN_PTR(void*, &(c2v_ ## f)) |
147162b27799
GRAAL-234 - PTX code loading
Morris Meyer <morris.meyer@oracle.com>
parents:
diff
changeset
|
223 |
147162b27799
GRAAL-234 - PTX code loading
Morris Meyer <morris.meyer@oracle.com>
parents:
diff
changeset
|
224 #define RESOLVED_TYPE "Lcom/oracle/graal/api/meta/ResolvedJavaType;" |
147162b27799
GRAAL-234 - PTX code loading
Morris Meyer <morris.meyer@oracle.com>
parents:
diff
changeset
|
225 #define TYPE "Lcom/oracle/graal/api/meta/JavaType;" |
147162b27799
GRAAL-234 - PTX code loading
Morris Meyer <morris.meyer@oracle.com>
parents:
diff
changeset
|
226 #define METHOD "Lcom/oracle/graal/api/meta/JavaMethod;" |
147162b27799
GRAAL-234 - PTX code loading
Morris Meyer <morris.meyer@oracle.com>
parents:
diff
changeset
|
227 #define FIELD "Lcom/oracle/graal/api/meta/JavaField;" |
147162b27799
GRAAL-234 - PTX code loading
Morris Meyer <morris.meyer@oracle.com>
parents:
diff
changeset
|
228 #define SIGNATURE "Lcom/oracle/graal/api/meta/Signature;" |
147162b27799
GRAAL-234 - PTX code loading
Morris Meyer <morris.meyer@oracle.com>
parents:
diff
changeset
|
229 #define CONSTANT_POOL "Lcom/oracle/graal/api/meta/ConstantPool;" |
147162b27799
GRAAL-234 - PTX code loading
Morris Meyer <morris.meyer@oracle.com>
parents:
diff
changeset
|
230 #define CONSTANT "Lcom/oracle/graal/api/meta/Constant;" |
147162b27799
GRAAL-234 - PTX code loading
Morris Meyer <morris.meyer@oracle.com>
parents:
diff
changeset
|
231 #define KIND "Lcom/oracle/graal/api/meta/Kind;" |
12456
f87c68d79f07
improved support for co-existing, multiple backends (GRAAL-363)
Doug Simon <doug.simon@oracle.com>
parents:
11902
diff
changeset
|
232 #define LOCAL "Lcom/oracle/graal/api/meta/Local;" |
9430
147162b27799
GRAAL-234 - PTX code loading
Morris Meyer <morris.meyer@oracle.com>
parents:
diff
changeset
|
233 #define RUNTIME_CALL "Lcom/oracle/graal/api/code/RuntimeCall;" |
147162b27799
GRAAL-234 - PTX code loading
Morris Meyer <morris.meyer@oracle.com>
parents:
diff
changeset
|
234 #define EXCEPTION_HANDLERS "[Lcom/oracle/graal/api/meta/ExceptionHandler;" |
147162b27799
GRAAL-234 - PTX code loading
Morris Meyer <morris.meyer@oracle.com>
parents:
diff
changeset
|
235 #define REFLECT_METHOD "Ljava/lang/reflect/Method;" |
147162b27799
GRAAL-234 - PTX code loading
Morris Meyer <morris.meyer@oracle.com>
parents:
diff
changeset
|
236 #define REFLECT_CONSTRUCTOR "Ljava/lang/reflect/Constructor;" |
147162b27799
GRAAL-234 - PTX code loading
Morris Meyer <morris.meyer@oracle.com>
parents:
diff
changeset
|
237 #define REFLECT_FIELD "Ljava/lang/reflect/Field;" |
147162b27799
GRAAL-234 - PTX code loading
Morris Meyer <morris.meyer@oracle.com>
parents:
diff
changeset
|
238 #define STRING "Ljava/lang/String;" |
147162b27799
GRAAL-234 - PTX code loading
Morris Meyer <morris.meyer@oracle.com>
parents:
diff
changeset
|
239 #define OBJECT "Ljava/lang/Object;" |
147162b27799
GRAAL-234 - PTX code loading
Morris Meyer <morris.meyer@oracle.com>
parents:
diff
changeset
|
240 #define CLASS "Ljava/lang/Class;" |
147162b27799
GRAAL-234 - PTX code loading
Morris Meyer <morris.meyer@oracle.com>
parents:
diff
changeset
|
241 #define STACK_TRACE_ELEMENT "Ljava/lang/StackTraceElement;" |
147162b27799
GRAAL-234 - PTX code loading
Morris Meyer <morris.meyer@oracle.com>
parents:
diff
changeset
|
242 #define HS_RESOLVED_TYPE "Lcom/oracle/graal/hotspot/meta/HotSpotResolvedObjectType;" |
147162b27799
GRAAL-234 - PTX code loading
Morris Meyer <morris.meyer@oracle.com>
parents:
diff
changeset
|
243 #define HS_RESOLVED_JAVA_TYPE "Lcom/oracle/graal/hotspot/meta/HotSpotResolvedJavaType;" |
147162b27799
GRAAL-234 - PTX code loading
Morris Meyer <morris.meyer@oracle.com>
parents:
diff
changeset
|
244 #define HS_RESOLVED_METHOD "Lcom/oracle/graal/hotspot/meta/HotSpotResolvedJavaMethod;" |
147162b27799
GRAAL-234 - PTX code loading
Morris Meyer <morris.meyer@oracle.com>
parents:
diff
changeset
|
245 #define HS_RESOLVED_FIELD "Lcom/oracle/graal/hotspot/meta/HotSpotResolvedJavaField;" |
9669
ed6202820ecf
renamed HotSpotCompilationResult to HotSpotCompiledCode and added subclasses HotSpotCompiledNmethod and HotSpotCompiledRuntimeStub
Doug Simon <doug.simon@oracle.com>
parents:
9430
diff
changeset
|
246 #define HS_COMPILED_CODE "Lcom/oracle/graal/hotspot/HotSpotCompiledCode;" |
9430
147162b27799
GRAAL-234 - PTX code loading
Morris Meyer <morris.meyer@oracle.com>
parents:
diff
changeset
|
247 #define HS_CONFIG "Lcom/oracle/graal/hotspot/HotSpotVMConfig;" |
147162b27799
GRAAL-234 - PTX code loading
Morris Meyer <morris.meyer@oracle.com>
parents:
diff
changeset
|
248 #define HS_METHOD "Lcom/oracle/graal/hotspot/meta/HotSpotMethod;" |
147162b27799
GRAAL-234 - PTX code loading
Morris Meyer <morris.meyer@oracle.com>
parents:
diff
changeset
|
249 #define HS_INSTALLED_CODE "Lcom/oracle/graal/hotspot/meta/HotSpotInstalledCode;" |
147162b27799
GRAAL-234 - PTX code loading
Morris Meyer <morris.meyer@oracle.com>
parents:
diff
changeset
|
250 #define METHOD_DATA "Lcom/oracle/graal/hotspot/meta/HotSpotMethodData;" |
147162b27799
GRAAL-234 - PTX code loading
Morris Meyer <morris.meyer@oracle.com>
parents:
diff
changeset
|
251 #define METASPACE_METHOD "J" |
147162b27799
GRAAL-234 - PTX code loading
Morris Meyer <morris.meyer@oracle.com>
parents:
diff
changeset
|
252 #define METASPACE_METHOD_DATA "J" |
147162b27799
GRAAL-234 - PTX code loading
Morris Meyer <morris.meyer@oracle.com>
parents:
diff
changeset
|
253 #define NMETHOD "J" |
147162b27799
GRAAL-234 - PTX code loading
Morris Meyer <morris.meyer@oracle.com>
parents:
diff
changeset
|
254 #define GPUSPACE_METHOD "J" |
147162b27799
GRAAL-234 - PTX code loading
Morris Meyer <morris.meyer@oracle.com>
parents:
diff
changeset
|
255 |
147162b27799
GRAAL-234 - PTX code loading
Morris Meyer <morris.meyer@oracle.com>
parents:
diff
changeset
|
256 JNINativeMethod CompilerToGPU_methods[] = { |
11822
365d8f385fb5
PTX: one-dimensional parallel warp invocation, ParallelOver annotation
Morris Meyer <morris.meyer@oracle.com>
parents:
11596
diff
changeset
|
257 {CC"generateKernel", CC"([B" STRING ")"GPUSPACE_METHOD, FN_PTR(generateKernel)}, |
365d8f385fb5
PTX: one-dimensional parallel warp invocation, ParallelOver annotation
Morris Meyer <morris.meyer@oracle.com>
parents:
11596
diff
changeset
|
258 {CC"deviceInit", CC"()Z", FN_PTR(deviceInit)}, |
365d8f385fb5
PTX: one-dimensional parallel warp invocation, ParallelOver annotation
Morris Meyer <morris.meyer@oracle.com>
parents:
11596
diff
changeset
|
259 {CC"deviceDetach", CC"()Z", FN_PTR(deviceDetach)}, |
11842
8d8f63069f58
PTX warp limiter to available GPU processors
Morris Meyer <morris.meyer@oracle.com>
parents:
11822
diff
changeset
|
260 {CC"availableProcessors", CC"()I", FN_PTR(availableProcessors)}, |
11822
365d8f385fb5
PTX: one-dimensional parallel warp invocation, ParallelOver annotation
Morris Meyer <morris.meyer@oracle.com>
parents:
11596
diff
changeset
|
261 {CC"executeExternalMethodVarargs", CC"(["OBJECT HS_INSTALLED_CODE")"OBJECT, FN_PTR(executeExternalMethodVarargs)}, |
365d8f385fb5
PTX: one-dimensional parallel warp invocation, ParallelOver annotation
Morris Meyer <morris.meyer@oracle.com>
parents:
11596
diff
changeset
|
262 {CC"executeParallelMethodVarargs", CC"(III["OBJECT HS_INSTALLED_CODE")"OBJECT, FN_PTR(executeParallelMethodVarargs)}, |
13624
220ed109bf77
initial code for calling PTX kernel code from Java with parameter marshaling and return value unmarshaling performed by a wrapper specified via manual graph construction
Doug Simon <doug.simon@oracle.com>
parents:
13157
diff
changeset
|
263 {CC"getLaunchKernelAddress", CC"()J", FN_PTR(getLaunchKernelAddress)}, |
9430
147162b27799
GRAAL-234 - PTX code loading
Morris Meyer <morris.meyer@oracle.com>
parents:
diff
changeset
|
264 }; |
147162b27799
GRAAL-234 - PTX code loading
Morris Meyer <morris.meyer@oracle.com>
parents:
diff
changeset
|
265 |
147162b27799
GRAAL-234 - PTX code loading
Morris Meyer <morris.meyer@oracle.com>
parents:
diff
changeset
|
266 int CompilerToGPU_methods_count() { |
147162b27799
GRAAL-234 - PTX code loading
Morris Meyer <morris.meyer@oracle.com>
parents:
diff
changeset
|
267 return sizeof(CompilerToGPU_methods) / sizeof(JNINativeMethod); |
147162b27799
GRAAL-234 - PTX code loading
Morris Meyer <morris.meyer@oracle.com>
parents:
diff
changeset
|
268 } |
147162b27799
GRAAL-234 - PTX code loading
Morris Meyer <morris.meyer@oracle.com>
parents:
diff
changeset
|
269 |