comparison src/share/vm/runtime/gpu.hpp @ 13819:49db2c1e3bee

added support for co-existing GPU backends (JBS:GRAAL-1)
author Doug Simon <doug.simon@oracle.com>
date Thu, 30 Jan 2014 00:52:33 +0100
parents f1a55428a8d7
children b97e2515d392
comparison
equal deleted inserted replaced
13818:d2f520f46180 13819:49db2c1e3bee
25 #ifndef SHARE_VM_RUNTIME_GPU_HPP 25 #ifndef SHARE_VM_RUNTIME_GPU_HPP
26 #define SHARE_VM_RUNTIME_GPU_HPP 26 #define SHARE_VM_RUNTIME_GPU_HPP
27 27
28 #include "runtime/atomic.hpp" 28 #include "runtime/atomic.hpp"
29 #include "oops/symbol.hpp" 29 #include "oops/symbol.hpp"
30 #include "utilities/array.hpp"
30 31
31 class PTXKernelArguments; 32 class PTXKernelArguments;
32 33
33 // gpu defines the interface to the graphics processor; this includes traditional 34 // Defines the interface to the graphics processor(s).
34 // GPU services such as graphics kernel load and execute. 35 class gpu : AllStatic {
36 private:
37 static int _initialized_gpus;
35 38
39 // Notifies that a GPU device has been initialized.
40 static void initialized_gpu(const char* name);
36 41
37 class gpu: AllStatic { 42 public:
38 public:
39 43
40 enum TargetGPUIL { NONE = 0, PTX = 1, HSAIL = 2}; 44 // Gets a comma separated list of supported GPU architecture names.
41 static void init(void); 45 static jobject probe_gpus(JNIEnv* env);
46
47 static int initialized_gpus() { return _initialized_gpus; }
42 48
43 static void probe_gpu();
44
45 static void initialize_gpu();
46
47 static int available_processors();
48
49 static void * generate_kernel(unsigned char *code, int code_len, const char *name);
50
51 static bool execute_warp(int dimX, int dimY, int dimZ,
52 address kernel, PTXKernelArguments & ptxka, JavaValue & ret);
53
54 static bool execute_kernel(address kernel, PTXKernelArguments & ptxka, JavaValue & ret);
55
56 // No return value from HSAIL kernels
57 static bool execute_kernel_void_1d(address kernel, int dimX, jobject args, methodHandle& mh);
58
59 static void set_available(bool value) {
60 _available = value;
61 }
62
63 static bool is_available() { return _available; }
64
65 static void set_initialized(bool value) {
66 _initialized = value;
67 }
68
69 static bool is_initialized() { return _initialized; }
70
71 static void set_gpu_linkage(bool value) {
72 _gpu_linkage = value;
73 }
74
75 static bool has_gpu_linkage() { return _gpu_linkage; }
76
77 static void set_target_il_type(TargetGPUIL value) {
78 _targetIL = value;
79 }
80
81 static enum gpu::TargetGPUIL get_target_il_type() {
82 return _targetIL;
83 }
84
85 protected:
86 static bool _available;
87 static bool _gpu_linkage;
88 static bool _initialized;
89 static TargetGPUIL _targetIL;
90
91 // Platform dependent stuff
92 #ifdef TARGET_OS_FAMILY_linux
93 # include "gpu_linux.hpp"
94 #endif
95 #ifdef TARGET_OS_FAMILY_solaris
96 #endif
97 #ifdef TARGET_OS_FAMILY_windows
98 # include "gpu_windows.hpp"
99 #endif
100 #ifdef TARGET_OS_FAMILY_bsd
101 # include "gpu_bsd.hpp"
102 #endif
103
104 public:
105 # include "ptx/vm/gpu_ptx.hpp" 49 # include "ptx/vm/gpu_ptx.hpp"
106 # include "hsail/vm/gpu_hsail.hpp" 50 # include "hsail/vm/gpu_hsail.hpp"
107 51
108 }; 52 };
109 53
110
111 #endif // SHARE_VM_RUNTIME_GPU_HPP 54 #endif // SHARE_VM_RUNTIME_GPU_HPP