Mercurial > hg > truffle
annotate src/share/vm/runtime/gpu.hpp @ 12481:45daf0d65522
Replace EliminatePartiallyRedundantGuardsPhase with OptimizeGuardAnchors
* OptimizeGuardAnchors implements optimization at control split in a more efficient way
* OptimizeGuardAnchors ensure Guards have their optimal anchor point
***
OptimizeGuardAnchors header
author | Gilles Duboscq <duboscq@ssw.jku.at> |
---|---|
date | Thu, 17 Oct 2013 18:18:05 +0200 |
parents | 8d8f63069f58 |
children | f1a55428a8d7 |
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 |
147162b27799
GRAAL-234 - PTX code loading
Morris Meyer <morris.meyer@oracle.com>
parents:
diff
changeset
|
25 #ifndef SHARE_VM_RUNTIME_GPU_HPP |
147162b27799
GRAAL-234 - PTX code loading
Morris Meyer <morris.meyer@oracle.com>
parents:
diff
changeset
|
26 #define SHARE_VM_RUNTIME_GPU_HPP |
147162b27799
GRAAL-234 - PTX code loading
Morris Meyer <morris.meyer@oracle.com>
parents:
diff
changeset
|
27 |
147162b27799
GRAAL-234 - PTX code loading
Morris Meyer <morris.meyer@oracle.com>
parents:
diff
changeset
|
28 #include "runtime/atomic.hpp" |
11485
49bb1bc983c6
Implement several missing PTX codegen features; return value capture and method args passing of java method executed on GPU.
bharadwaj
parents:
11283
diff
changeset
|
29 #include "oops/symbol.hpp" |
49bb1bc983c6
Implement several missing PTX codegen features; return value capture and method args passing of java method executed on GPU.
bharadwaj
parents:
11283
diff
changeset
|
30 |
49bb1bc983c6
Implement several missing PTX codegen features; return value capture and method args passing of java method executed on GPU.
bharadwaj
parents:
11283
diff
changeset
|
31 class PTXKernelArguments; |
9430
147162b27799
GRAAL-234 - PTX code loading
Morris Meyer <morris.meyer@oracle.com>
parents:
diff
changeset
|
32 |
147162b27799
GRAAL-234 - PTX code loading
Morris Meyer <morris.meyer@oracle.com>
parents:
diff
changeset
|
33 // gpu defines the interface to the graphics processor; this includes traditional |
147162b27799
GRAAL-234 - PTX code loading
Morris Meyer <morris.meyer@oracle.com>
parents:
diff
changeset
|
34 // GPU services such as graphics kernel load and execute. |
147162b27799
GRAAL-234 - PTX code loading
Morris Meyer <morris.meyer@oracle.com>
parents:
diff
changeset
|
35 |
147162b27799
GRAAL-234 - PTX code loading
Morris Meyer <morris.meyer@oracle.com>
parents:
diff
changeset
|
36 |
147162b27799
GRAAL-234 - PTX code loading
Morris Meyer <morris.meyer@oracle.com>
parents:
diff
changeset
|
37 class gpu: AllStatic { |
147162b27799
GRAAL-234 - PTX code loading
Morris Meyer <morris.meyer@oracle.com>
parents:
diff
changeset
|
38 public: |
11606
4f69a5189e77
Create runtime object based on GPUIL type newly added to gpu class; some code refactoring.
bharadwaj
parents:
11485
diff
changeset
|
39 |
4f69a5189e77
Create runtime object based on GPUIL type newly added to gpu class; some code refactoring.
bharadwaj
parents:
11485
diff
changeset
|
40 enum TargetGPUIL { NONE = 0, PTX = 1, HSAIL = 2}; |
9430
147162b27799
GRAAL-234 - PTX code loading
Morris Meyer <morris.meyer@oracle.com>
parents:
diff
changeset
|
41 static void init(void); |
147162b27799
GRAAL-234 - PTX code loading
Morris Meyer <morris.meyer@oracle.com>
parents:
diff
changeset
|
42 |
147162b27799
GRAAL-234 - PTX code loading
Morris Meyer <morris.meyer@oracle.com>
parents:
diff
changeset
|
43 static void probe_gpu(); |
147162b27799
GRAAL-234 - PTX code loading
Morris Meyer <morris.meyer@oracle.com>
parents:
diff
changeset
|
44 |
147162b27799
GRAAL-234 - PTX code loading
Morris Meyer <morris.meyer@oracle.com>
parents:
diff
changeset
|
45 static void initialize_gpu(); |
11842
8d8f63069f58
PTX warp limiter to available GPU processors
Morris Meyer <morris.meyer@oracle.com>
parents:
11822
diff
changeset
|
46 |
8d8f63069f58
PTX warp limiter to available GPU processors
Morris Meyer <morris.meyer@oracle.com>
parents:
11822
diff
changeset
|
47 static int available_processors(); |
9430
147162b27799
GRAAL-234 - PTX code loading
Morris Meyer <morris.meyer@oracle.com>
parents:
diff
changeset
|
48 |
10566
a6632ef9c84d
GPU generate_kernel return for Cuda function
Morris Meyer <morris.meyer@oracle.com>
parents:
9430
diff
changeset
|
49 static void * generate_kernel(unsigned char *code, int code_len, const char *name); |
9430
147162b27799
GRAAL-234 - PTX code loading
Morris Meyer <morris.meyer@oracle.com>
parents:
diff
changeset
|
50 |
11822
365d8f385fb5
PTX: one-dimensional parallel warp invocation, ParallelOver annotation
Morris Meyer <morris.meyer@oracle.com>
parents:
11606
diff
changeset
|
51 static bool execute_warp(int dimX, int dimY, int dimZ, |
365d8f385fb5
PTX: one-dimensional parallel warp invocation, ParallelOver annotation
Morris Meyer <morris.meyer@oracle.com>
parents:
11606
diff
changeset
|
52 address kernel, PTXKernelArguments & ptxka, JavaValue & ret); |
365d8f385fb5
PTX: one-dimensional parallel warp invocation, ParallelOver annotation
Morris Meyer <morris.meyer@oracle.com>
parents:
11606
diff
changeset
|
53 |
11485
49bb1bc983c6
Implement several missing PTX codegen features; return value capture and method args passing of java method executed on GPU.
bharadwaj
parents:
11283
diff
changeset
|
54 static bool execute_kernel(address kernel, PTXKernelArguments & ptxka, JavaValue & ret); |
10577
9c7d9e2c8326
PTX kernel execution - no args or return value
Morris Meyer <morris.meyer@oracle.com>
parents:
10566
diff
changeset
|
55 |
9430
147162b27799
GRAAL-234 - PTX code loading
Morris Meyer <morris.meyer@oracle.com>
parents:
diff
changeset
|
56 static void set_available(bool value) { |
147162b27799
GRAAL-234 - PTX code loading
Morris Meyer <morris.meyer@oracle.com>
parents:
diff
changeset
|
57 _available = value; |
147162b27799
GRAAL-234 - PTX code loading
Morris Meyer <morris.meyer@oracle.com>
parents:
diff
changeset
|
58 } |
147162b27799
GRAAL-234 - PTX code loading
Morris Meyer <morris.meyer@oracle.com>
parents:
diff
changeset
|
59 |
147162b27799
GRAAL-234 - PTX code loading
Morris Meyer <morris.meyer@oracle.com>
parents:
diff
changeset
|
60 static bool is_available() { return _available; } |
147162b27799
GRAAL-234 - PTX code loading
Morris Meyer <morris.meyer@oracle.com>
parents:
diff
changeset
|
61 |
147162b27799
GRAAL-234 - PTX code loading
Morris Meyer <morris.meyer@oracle.com>
parents:
diff
changeset
|
62 static void set_initialized(bool value) { |
147162b27799
GRAAL-234 - PTX code loading
Morris Meyer <morris.meyer@oracle.com>
parents:
diff
changeset
|
63 _initialized = value; |
147162b27799
GRAAL-234 - PTX code loading
Morris Meyer <morris.meyer@oracle.com>
parents:
diff
changeset
|
64 } |
147162b27799
GRAAL-234 - PTX code loading
Morris Meyer <morris.meyer@oracle.com>
parents:
diff
changeset
|
65 |
147162b27799
GRAAL-234 - PTX code loading
Morris Meyer <morris.meyer@oracle.com>
parents:
diff
changeset
|
66 static bool is_initialized() { return _initialized; } |
147162b27799
GRAAL-234 - PTX code loading
Morris Meyer <morris.meyer@oracle.com>
parents:
diff
changeset
|
67 |
147162b27799
GRAAL-234 - PTX code loading
Morris Meyer <morris.meyer@oracle.com>
parents:
diff
changeset
|
68 static void set_gpu_linkage(bool value) { |
147162b27799
GRAAL-234 - PTX code loading
Morris Meyer <morris.meyer@oracle.com>
parents:
diff
changeset
|
69 _gpu_linkage = value; |
147162b27799
GRAAL-234 - PTX code loading
Morris Meyer <morris.meyer@oracle.com>
parents:
diff
changeset
|
70 } |
147162b27799
GRAAL-234 - PTX code loading
Morris Meyer <morris.meyer@oracle.com>
parents:
diff
changeset
|
71 |
147162b27799
GRAAL-234 - PTX code loading
Morris Meyer <morris.meyer@oracle.com>
parents:
diff
changeset
|
72 static bool has_gpu_linkage() { return _gpu_linkage; } |
147162b27799
GRAAL-234 - PTX code loading
Morris Meyer <morris.meyer@oracle.com>
parents:
diff
changeset
|
73 |
11606
4f69a5189e77
Create runtime object based on GPUIL type newly added to gpu class; some code refactoring.
bharadwaj
parents:
11485
diff
changeset
|
74 static void set_target_il_type(TargetGPUIL value) { |
4f69a5189e77
Create runtime object based on GPUIL type newly added to gpu class; some code refactoring.
bharadwaj
parents:
11485
diff
changeset
|
75 _targetIL = value; |
4f69a5189e77
Create runtime object based on GPUIL type newly added to gpu class; some code refactoring.
bharadwaj
parents:
11485
diff
changeset
|
76 } |
4f69a5189e77
Create runtime object based on GPUIL type newly added to gpu class; some code refactoring.
bharadwaj
parents:
11485
diff
changeset
|
77 |
4f69a5189e77
Create runtime object based on GPUIL type newly added to gpu class; some code refactoring.
bharadwaj
parents:
11485
diff
changeset
|
78 static enum gpu::TargetGPUIL get_target_il_type() { |
4f69a5189e77
Create runtime object based on GPUIL type newly added to gpu class; some code refactoring.
bharadwaj
parents:
11485
diff
changeset
|
79 return _targetIL; |
4f69a5189e77
Create runtime object based on GPUIL type newly added to gpu class; some code refactoring.
bharadwaj
parents:
11485
diff
changeset
|
80 } |
4f69a5189e77
Create runtime object based on GPUIL type newly added to gpu class; some code refactoring.
bharadwaj
parents:
11485
diff
changeset
|
81 |
9430
147162b27799
GRAAL-234 - PTX code loading
Morris Meyer <morris.meyer@oracle.com>
parents:
diff
changeset
|
82 protected: |
147162b27799
GRAAL-234 - PTX code loading
Morris Meyer <morris.meyer@oracle.com>
parents:
diff
changeset
|
83 static bool _available; |
147162b27799
GRAAL-234 - PTX code loading
Morris Meyer <morris.meyer@oracle.com>
parents:
diff
changeset
|
84 static bool _gpu_linkage; |
147162b27799
GRAAL-234 - PTX code loading
Morris Meyer <morris.meyer@oracle.com>
parents:
diff
changeset
|
85 static bool _initialized; |
11606
4f69a5189e77
Create runtime object based on GPUIL type newly added to gpu class; some code refactoring.
bharadwaj
parents:
11485
diff
changeset
|
86 static TargetGPUIL _targetIL; |
9430
147162b27799
GRAAL-234 - PTX code loading
Morris Meyer <morris.meyer@oracle.com>
parents:
diff
changeset
|
87 |
147162b27799
GRAAL-234 - PTX code loading
Morris Meyer <morris.meyer@oracle.com>
parents:
diff
changeset
|
88 // Platform dependent stuff |
147162b27799
GRAAL-234 - PTX code loading
Morris Meyer <morris.meyer@oracle.com>
parents:
diff
changeset
|
89 #ifdef TARGET_OS_FAMILY_linux |
10879
d55f24eac4b1
PTX support for Linux
Morris Meyer <morris.meyer@oracle.com>
parents:
10577
diff
changeset
|
90 # include "gpu_linux.hpp" |
9430
147162b27799
GRAAL-234 - PTX code loading
Morris Meyer <morris.meyer@oracle.com>
parents:
diff
changeset
|
91 #endif |
147162b27799
GRAAL-234 - PTX code loading
Morris Meyer <morris.meyer@oracle.com>
parents:
diff
changeset
|
92 #ifdef TARGET_OS_FAMILY_solaris |
147162b27799
GRAAL-234 - PTX code loading
Morris Meyer <morris.meyer@oracle.com>
parents:
diff
changeset
|
93 #endif |
147162b27799
GRAAL-234 - PTX code loading
Morris Meyer <morris.meyer@oracle.com>
parents:
diff
changeset
|
94 #ifdef TARGET_OS_FAMILY_windows |
147162b27799
GRAAL-234 - PTX code loading
Morris Meyer <morris.meyer@oracle.com>
parents:
diff
changeset
|
95 #endif |
147162b27799
GRAAL-234 - PTX code loading
Morris Meyer <morris.meyer@oracle.com>
parents:
diff
changeset
|
96 #ifdef TARGET_OS_FAMILY_bsd |
147162b27799
GRAAL-234 - PTX code loading
Morris Meyer <morris.meyer@oracle.com>
parents:
diff
changeset
|
97 # include "gpu_bsd.hpp" |
147162b27799
GRAAL-234 - PTX code loading
Morris Meyer <morris.meyer@oracle.com>
parents:
diff
changeset
|
98 #endif |
147162b27799
GRAAL-234 - PTX code loading
Morris Meyer <morris.meyer@oracle.com>
parents:
diff
changeset
|
99 |
11485
49bb1bc983c6
Implement several missing PTX codegen features; return value capture and method args passing of java method executed on GPU.
bharadwaj
parents:
11283
diff
changeset
|
100 public: |
10879
d55f24eac4b1
PTX support for Linux
Morris Meyer <morris.meyer@oracle.com>
parents:
10577
diff
changeset
|
101 # include "ptx/vm/gpu_ptx.hpp" |
9430
147162b27799
GRAAL-234 - PTX code loading
Morris Meyer <morris.meyer@oracle.com>
parents:
diff
changeset
|
102 |
147162b27799
GRAAL-234 - PTX code loading
Morris Meyer <morris.meyer@oracle.com>
parents:
diff
changeset
|
103 }; |
147162b27799
GRAAL-234 - PTX code loading
Morris Meyer <morris.meyer@oracle.com>
parents:
diff
changeset
|
104 |
147162b27799
GRAAL-234 - PTX code loading
Morris Meyer <morris.meyer@oracle.com>
parents:
diff
changeset
|
105 |
147162b27799
GRAAL-234 - PTX code loading
Morris Meyer <morris.meyer@oracle.com>
parents:
diff
changeset
|
106 #endif // SHARE_VM_RUNTIME_GPU_HPP |