Mercurial > hg > graal-jvmci-8
annotate src/gpu/ptx/vm/gpu_ptx.cpp @ 11283:1cd1f8ff70a1
CR-20: PTX kernel invocation with arguments - from Bharadwaj
author | Morris Meyer <morris.meyer@oracle.com> |
---|---|
date | Sat, 10 Aug 2013 14:38:30 -0400 |
parents | fe49e5121768 |
children | d876002b98e6 |
rev | line source |
---|---|
10879 | 1 /* |
2 * Copyright (c) 2013, Oracle and/or its affiliates. All rights reserved. | |
3 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. | |
4 * | |
5 * This code is free software; you can redistribute it and/or modify it | |
6 * under the terms of the GNU General Public License version 2 only, as | |
7 * published by the Free Software Foundation. | |
8 * | |
9 * This code is distributed in the hope that it will be useful, but WITHOUT | |
10 * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or | |
11 * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License | |
12 * version 2 for more details (a copy is included in the LICENSE file that | |
13 * accompanied this code). | |
14 * | |
15 * You should have received a copy of the GNU General Public License version | |
16 * 2 along with this work; if not, write to the Free Software Foundation, | |
17 * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. | |
18 * | |
19 * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA | |
20 * or visit www.oracle.com if you need additional information or have any | |
21 * questions. | |
22 * | |
23 */ | |
24 | |
25 #include "precompiled.hpp" | |
26 #include "runtime/gpu.hpp" | |
27 #include "utilities/globalDefinitions.hpp" | |
28 #include "utilities/ostream.hpp" | |
10883
5fcb30bcb90a
Fix compilation without precompiled headers.
Roland Schatz <roland.schatz@oracle.com>
parents:
10882
diff
changeset
|
29 #include "memory/allocation.hpp" |
5fcb30bcb90a
Fix compilation without precompiled headers.
Roland Schatz <roland.schatz@oracle.com>
parents:
10882
diff
changeset
|
30 #include "memory/allocation.inline.hpp" |
10879 | 31 |
32 void * gpu::Ptx::_device_context; | |
33 | |
34 gpu::Ptx::cuda_cu_init_func_t gpu::Ptx::_cuda_cu_init; | |
35 gpu::Ptx::cuda_cu_ctx_create_func_t gpu::Ptx::_cuda_cu_ctx_create; | |
36 gpu::Ptx::cuda_cu_ctx_detach_func_t gpu::Ptx::_cuda_cu_ctx_detach; | |
37 gpu::Ptx::cuda_cu_ctx_synchronize_func_t gpu::Ptx::_cuda_cu_ctx_synchronize; | |
38 gpu::Ptx::cuda_cu_device_get_count_func_t gpu::Ptx::_cuda_cu_device_get_count; | |
39 gpu::Ptx::cuda_cu_device_get_name_func_t gpu::Ptx::_cuda_cu_device_get_name; | |
40 gpu::Ptx::cuda_cu_device_get_func_t gpu::Ptx::_cuda_cu_device_get; | |
41 gpu::Ptx::cuda_cu_device_compute_capability_func_t gpu::Ptx::_cuda_cu_device_compute_capability; | |
42 gpu::Ptx::cuda_cu_device_get_attribute_func_t gpu::Ptx::_cuda_cu_device_get_attribute; | |
43 gpu::Ptx::cuda_cu_launch_kernel_func_t gpu::Ptx::_cuda_cu_launch_kernel; | |
44 gpu::Ptx::cuda_cu_module_get_function_func_t gpu::Ptx::_cuda_cu_module_get_function; | |
45 gpu::Ptx::cuda_cu_module_load_data_ex_func_t gpu::Ptx::_cuda_cu_module_load_data_ex; | |
46 | |
47 void gpu::probe_linkage() { | |
48 #if defined(__APPLE__) || defined(LINUX) | |
49 set_gpu_linkage(gpu::Ptx::probe_linkage()); | |
50 #else | |
51 set_gpu_linkage(false); | |
52 #endif | |
53 } | |
54 | |
55 void gpu::initialize_gpu() { | |
56 if (gpu::has_gpu_linkage()) { | |
57 set_initialized(gpu::Ptx::initialize_gpu()); | |
58 } | |
59 } | |
60 | |
61 void * gpu::generate_kernel(unsigned char *code, int code_len, const char *name) { | |
62 if (gpu::has_gpu_linkage()) { | |
63 return (gpu::Ptx::generate_kernel(code, code_len, name)); | |
64 } else { | |
65 return NULL; | |
66 } | |
67 } | |
68 | |
11283
1cd1f8ff70a1
CR-20: PTX kernel invocation with arguments - from Bharadwaj
Morris Meyer <morris.meyer@oracle.com>
parents:
10884
diff
changeset
|
69 bool gpu::execute_kernel(address kernel, JavaCallArguments * jca) { |
10879 | 70 if (gpu::has_gpu_linkage()) { |
11283
1cd1f8ff70a1
CR-20: PTX kernel invocation with arguments - from Bharadwaj
Morris Meyer <morris.meyer@oracle.com>
parents:
10884
diff
changeset
|
71 return (gpu::Ptx::execute_kernel(kernel, jca)); |
10879 | 72 } else { |
73 return false; | |
74 } | |
75 } | |
76 | |
77 bool gpu::Ptx::initialize_gpu() { | |
78 | |
79 /* Initialize CUDA driver API */ | |
80 int status = _cuda_cu_init(0); | |
81 if (status != GRAAL_CUDA_SUCCESS) { | |
82 tty->print_cr("Failed to initialize CUDA device"); | |
83 return false; | |
84 } | |
85 | |
86 if (TraceGPUInteraction) { | |
87 tty->print_cr("CUDA driver initialization: Success"); | |
88 } | |
89 | |
90 /* Get the number of compute-capable device count */ | |
91 int device_count = 0; | |
92 status = _cuda_cu_device_get_count(&device_count); | |
93 if (status != GRAAL_CUDA_SUCCESS) { | |
94 tty->print_cr("[CUDA] Failed to get compute-capable device count"); | |
95 return false; | |
96 } | |
97 | |
98 if (device_count == 0) { | |
99 tty->print_cr("[CUDA] Found no device supporting CUDA"); | |
100 return false; | |
101 } | |
102 | |
103 if (TraceGPUInteraction) { | |
104 tty->print_cr("[CUDA] Number of compute-capable devices found: %d", device_count); | |
105 } | |
106 | |
107 /* Get the handle to the first compute device */ | |
108 int device_id = 0; | |
109 /* Compute-capable device handle */ | |
110 int cu_device = 0; | |
111 status = _cuda_cu_device_get(&cu_device, device_id); | |
112 | |
113 if (status != GRAAL_CUDA_SUCCESS) { | |
114 tty->print_cr("[CUDA] Failed to get handle of first compute-capable device i.e., the one at ordinal: %d", device_id); | |
115 return false; | |
116 } | |
117 | |
118 if (TraceGPUInteraction) { | |
119 tty->print_cr("[CUDA] Got the handle of first compute-device"); | |
120 } | |
121 | |
122 /* Get device attributes */ | |
11283
1cd1f8ff70a1
CR-20: PTX kernel invocation with arguments - from Bharadwaj
Morris Meyer <morris.meyer@oracle.com>
parents:
10884
diff
changeset
|
123 int minor, major, unified_addressing; |
10879 | 124 status = _cuda_cu_device_get_attribute(&minor, GRAAL_CU_DEVICE_ATTRIBUTE_COMPUTE_CAPABILITY_MINOR, cu_device); |
125 | |
126 if (status != GRAAL_CUDA_SUCCESS) { | |
127 tty->print_cr("[CUDA] Failed to get minor attribute of device: %d", cu_device); | |
128 return false; | |
129 } | |
130 | |
131 status = _cuda_cu_device_get_attribute(&major, GRAAL_CU_DEVICE_ATTRIBUTE_COMPUTE_CAPABILITY_MAJOR, cu_device); | |
132 | |
133 if (status != GRAAL_CUDA_SUCCESS) { | |
134 tty->print_cr("[CUDA] Failed to get major attribute of device: %d", cu_device); | |
135 return false; | |
136 } | |
137 | |
138 if (TraceGPUInteraction) { | |
139 tty->print_cr("[CUDA] Compatibility version of device %d: %d.%d", cu_device, major, minor); | |
140 } | |
141 | |
11283
1cd1f8ff70a1
CR-20: PTX kernel invocation with arguments - from Bharadwaj
Morris Meyer <morris.meyer@oracle.com>
parents:
10884
diff
changeset
|
142 status = _cuda_cu_device_get_attribute(&unified_addressing, GRAAL_CU_DEVICE_ATTRIBUTE_UNIFIED_ADDRESSING, cu_device); |
1cd1f8ff70a1
CR-20: PTX kernel invocation with arguments - from Bharadwaj
Morris Meyer <morris.meyer@oracle.com>
parents:
10884
diff
changeset
|
143 |
1cd1f8ff70a1
CR-20: PTX kernel invocation with arguments - from Bharadwaj
Morris Meyer <morris.meyer@oracle.com>
parents:
10884
diff
changeset
|
144 if (status != GRAAL_CUDA_SUCCESS) { |
1cd1f8ff70a1
CR-20: PTX kernel invocation with arguments - from Bharadwaj
Morris Meyer <morris.meyer@oracle.com>
parents:
10884
diff
changeset
|
145 tty->print_cr("[CUDA] Failed to query unified addressing mode of device: %d", cu_device); |
1cd1f8ff70a1
CR-20: PTX kernel invocation with arguments - from Bharadwaj
Morris Meyer <morris.meyer@oracle.com>
parents:
10884
diff
changeset
|
146 return false; |
1cd1f8ff70a1
CR-20: PTX kernel invocation with arguments - from Bharadwaj
Morris Meyer <morris.meyer@oracle.com>
parents:
10884
diff
changeset
|
147 } |
1cd1f8ff70a1
CR-20: PTX kernel invocation with arguments - from Bharadwaj
Morris Meyer <morris.meyer@oracle.com>
parents:
10884
diff
changeset
|
148 |
1cd1f8ff70a1
CR-20: PTX kernel invocation with arguments - from Bharadwaj
Morris Meyer <morris.meyer@oracle.com>
parents:
10884
diff
changeset
|
149 if (TraceGPUInteraction) { |
1cd1f8ff70a1
CR-20: PTX kernel invocation with arguments - from Bharadwaj
Morris Meyer <morris.meyer@oracle.com>
parents:
10884
diff
changeset
|
150 tty->print_cr("[CUDA] Unified addressing support on device %d: %d", cu_device, unified_addressing); |
1cd1f8ff70a1
CR-20: PTX kernel invocation with arguments - from Bharadwaj
Morris Meyer <morris.meyer@oracle.com>
parents:
10884
diff
changeset
|
151 } |
1cd1f8ff70a1
CR-20: PTX kernel invocation with arguments - from Bharadwaj
Morris Meyer <morris.meyer@oracle.com>
parents:
10884
diff
changeset
|
152 |
1cd1f8ff70a1
CR-20: PTX kernel invocation with arguments - from Bharadwaj
Morris Meyer <morris.meyer@oracle.com>
parents:
10884
diff
changeset
|
153 |
10879 | 154 /* Get device name */ |
155 char device_name[256]; | |
156 status = _cuda_cu_device_get_name(device_name, 256, cu_device); | |
157 | |
158 if (status != GRAAL_CUDA_SUCCESS) { | |
159 tty->print_cr("[CUDA] Failed to get name of device: %d", cu_device); | |
160 return false; | |
161 } | |
162 | |
163 if (TraceGPUInteraction) { | |
164 tty->print_cr("[CUDA] Using %s", device_name); | |
165 } | |
166 | |
167 /* Create CUDA context */ | |
168 status = _cuda_cu_ctx_create(&_device_context, 0, cu_device); | |
169 | |
170 if (status != GRAAL_CUDA_SUCCESS) { | |
171 tty->print_cr("[CUDA] Failed to create CUDA context for device: %d", cu_device); | |
172 return false; | |
173 } | |
174 | |
175 if (TraceGPUInteraction) { | |
176 tty->print_cr("[CUDA] Success: Created context for device: %d", cu_device); | |
177 } | |
178 | |
179 return true; | |
180 } | |
181 | |
182 void *gpu::Ptx::generate_kernel(unsigned char *code, int code_len, const char *name) { | |
183 | |
184 struct CUmod_st * cu_module; | |
185 // Use three JIT compiler options | |
186 const unsigned int jit_num_options = 3; | |
187 int *jit_options = NEW_C_HEAP_ARRAY(int, jit_num_options, mtCompiler); | |
188 void **jit_option_values = NEW_C_HEAP_ARRAY(void *, jit_num_options, mtCompiler); | |
189 | |
190 // Set up PTX JIT compiler options | |
191 // 1. set size of compilation log buffer | |
192 int jit_log_buffer_size = 1024; | |
193 jit_options[0] = GRAAL_CU_JIT_INFO_LOG_BUFFER_SIZE_BYTES; | |
194 jit_option_values[0] = (void *)(size_t)jit_log_buffer_size; | |
195 | |
196 // 2. set pointer to compilation log buffer | |
197 char *jit_log_buffer = NEW_C_HEAP_ARRAY(char, jit_log_buffer_size, mtCompiler); | |
198 jit_options[1] = GRAAL_CU_JIT_INFO_LOG_BUFFER; | |
199 jit_option_values[1] = jit_log_buffer; | |
200 | |
201 // 3. set pointer to set the Maximum # of registers (32) for the kernel | |
202 int jit_register_count = 32; | |
203 jit_options[2] = GRAAL_CU_JIT_MAX_REGISTERS; | |
204 jit_option_values[2] = (void *)(size_t)jit_register_count; | |
205 | |
206 if (TraceGPUInteraction) { | |
207 tty->print_cr("[CUDA] PTX Kernel\n%s", code); | |
208 tty->print_cr("[CUDA] Function name : %s", name); | |
209 | |
210 } | |
211 | |
212 /* Load module's data with compiler options */ | |
213 int status = _cuda_cu_module_load_data_ex(&cu_module, code, jit_num_options, | |
214 jit_options, (void **)jit_option_values); | |
215 if (status != GRAAL_CUDA_SUCCESS) { | |
216 if (status == GRAAL_CUDA_ERROR_NO_BINARY_FOR_GPU) { | |
217 tty->print_cr("[CUDA] Check for malformed PTX kernel or incorrect PTX compilation options"); | |
218 } | |
219 tty->print_cr("[CUDA] *** Error (%d) Failed to load module data with online compiler options for method %s", | |
220 status, name); | |
221 return NULL; | |
222 } | |
223 | |
224 if (TraceGPUInteraction) { | |
225 tty->print_cr("[CUDA] Loaded data for PTX Kernel"); | |
226 } | |
227 | |
228 struct CUfunc_st * cu_function; | |
229 | |
230 status = _cuda_cu_module_get_function(&cu_function, cu_module, name); | |
231 | |
232 if (status != GRAAL_CUDA_SUCCESS) { | |
11283
1cd1f8ff70a1
CR-20: PTX kernel invocation with arguments - from Bharadwaj
Morris Meyer <morris.meyer@oracle.com>
parents:
10884
diff
changeset
|
233 tty->print_cr("[CUDA] *** Error: Failed to get function %s", name); |
10879 | 234 return NULL; |
235 } | |
236 | |
237 if (TraceGPUInteraction) { | |
238 tty->print_cr("[CUDA] Got function handle for %s", name); | |
239 } | |
240 return cu_function; | |
241 } | |
242 | |
11283
1cd1f8ff70a1
CR-20: PTX kernel invocation with arguments - from Bharadwaj
Morris Meyer <morris.meyer@oracle.com>
parents:
10884
diff
changeset
|
243 bool gpu::Ptx::execute_kernel(address kernel, JavaCallArguments * jca) { |
10879 | 244 // grid dimensionality |
245 unsigned int gridX = 1; | |
246 unsigned int gridY = 1; | |
247 unsigned int gridZ = 1; | |
248 | |
249 // thread dimensionality | |
250 unsigned int blockX = 1; | |
251 unsigned int blockY = 1; | |
252 unsigned int blockZ = 1; | |
253 | |
254 int *cu_function = (int *)kernel; | |
255 | |
11283
1cd1f8ff70a1
CR-20: PTX kernel invocation with arguments - from Bharadwaj
Morris Meyer <morris.meyer@oracle.com>
parents:
10884
diff
changeset
|
256 char * paramBuffer = (char *) jca->parameters(); |
1cd1f8ff70a1
CR-20: PTX kernel invocation with arguments - from Bharadwaj
Morris Meyer <morris.meyer@oracle.com>
parents:
10884
diff
changeset
|
257 size_t paramBufferSz = (size_t) jca->size_of_parameters(); |
1cd1f8ff70a1
CR-20: PTX kernel invocation with arguments - from Bharadwaj
Morris Meyer <morris.meyer@oracle.com>
parents:
10884
diff
changeset
|
258 |
1cd1f8ff70a1
CR-20: PTX kernel invocation with arguments - from Bharadwaj
Morris Meyer <morris.meyer@oracle.com>
parents:
10884
diff
changeset
|
259 void * config[] = { |
1cd1f8ff70a1
CR-20: PTX kernel invocation with arguments - from Bharadwaj
Morris Meyer <morris.meyer@oracle.com>
parents:
10884
diff
changeset
|
260 GRAAL_CU_LAUNCH_PARAM_BUFFER_POINTER, paramBuffer, |
1cd1f8ff70a1
CR-20: PTX kernel invocation with arguments - from Bharadwaj
Morris Meyer <morris.meyer@oracle.com>
parents:
10884
diff
changeset
|
261 GRAAL_CU_LAUNCH_PARAM_BUFFER_SIZE, ¶mBufferSz, |
1cd1f8ff70a1
CR-20: PTX kernel invocation with arguments - from Bharadwaj
Morris Meyer <morris.meyer@oracle.com>
parents:
10884
diff
changeset
|
262 GRAAL_CU_LAUNCH_PARAM_END |
1cd1f8ff70a1
CR-20: PTX kernel invocation with arguments - from Bharadwaj
Morris Meyer <morris.meyer@oracle.com>
parents:
10884
diff
changeset
|
263 }; |
1cd1f8ff70a1
CR-20: PTX kernel invocation with arguments - from Bharadwaj
Morris Meyer <morris.meyer@oracle.com>
parents:
10884
diff
changeset
|
264 |
10879 | 265 if (kernel == NULL) { |
266 return false; | |
267 } | |
268 | |
269 if (TraceGPUInteraction) { | |
270 tty->print_cr("[CUDA] launching kernel"); | |
271 } | |
272 int status = _cuda_cu_launch_kernel(cu_function, | |
273 gridX, gridY, gridZ, | |
274 blockX, blockY, blockZ, | |
11283
1cd1f8ff70a1
CR-20: PTX kernel invocation with arguments - from Bharadwaj
Morris Meyer <morris.meyer@oracle.com>
parents:
10884
diff
changeset
|
275 0, NULL, NULL, config); |
10879 | 276 if (status != GRAAL_CUDA_SUCCESS) { |
277 tty->print_cr("[CUDA] Failed to launch kernel"); | |
278 return false; | |
279 } | |
280 | |
281 if (TraceGPUInteraction) { | |
282 tty->print_cr("[CUDA] Success: Kernel Launch"); | |
283 } | |
284 return status == 0; // GRAAL_CUDA_SUCCESS | |
285 } | |
286 | |
287 #if defined(LINUX) | |
288 static const char cuda_library_name[] = "libcuda.so"; | |
289 #elif defined(__APPLE__) | |
290 static char const cuda_library_name[] = "/usr/local/cuda/lib/libcuda.dylib"; | |
291 #else | |
292 static char const cuda_library_name[] = ""; | |
293 #endif | |
294 | |
10882
6a2d65cb5d7d
fix: gpu_ptx.cpp did not compile on windows
Christian Wirth <christian.wirth@oracle.com>
parents:
10879
diff
changeset
|
295 #define STD_BUFFER_SIZE 1024 |
6a2d65cb5d7d
fix: gpu_ptx.cpp did not compile on windows
Christian Wirth <christian.wirth@oracle.com>
parents:
10879
diff
changeset
|
296 |
10879 | 297 bool gpu::Ptx::probe_linkage() { |
298 if (cuda_library_name != NULL) { | |
10882
6a2d65cb5d7d
fix: gpu_ptx.cpp did not compile on windows
Christian Wirth <christian.wirth@oracle.com>
parents:
10879
diff
changeset
|
299 char *buffer = (char*)malloc(STD_BUFFER_SIZE); |
6a2d65cb5d7d
fix: gpu_ptx.cpp did not compile on windows
Christian Wirth <christian.wirth@oracle.com>
parents:
10879
diff
changeset
|
300 void *handle = os::dll_load(cuda_library_name, buffer, STD_BUFFER_SIZE); |
6a2d65cb5d7d
fix: gpu_ptx.cpp did not compile on windows
Christian Wirth <christian.wirth@oracle.com>
parents:
10879
diff
changeset
|
301 free(buffer); |
10879 | 302 if (handle != NULL) { |
303 _cuda_cu_init = | |
10882
6a2d65cb5d7d
fix: gpu_ptx.cpp did not compile on windows
Christian Wirth <christian.wirth@oracle.com>
parents:
10879
diff
changeset
|
304 CAST_TO_FN_PTR(cuda_cu_init_func_t, os::dll_lookup(handle, "cuInit")); |
10879 | 305 _cuda_cu_ctx_create = |
10882
6a2d65cb5d7d
fix: gpu_ptx.cpp did not compile on windows
Christian Wirth <christian.wirth@oracle.com>
parents:
10879
diff
changeset
|
306 CAST_TO_FN_PTR(cuda_cu_ctx_create_func_t, os::dll_lookup(handle, "cuCtxCreate")); |
10879 | 307 _cuda_cu_ctx_detach = |
10882
6a2d65cb5d7d
fix: gpu_ptx.cpp did not compile on windows
Christian Wirth <christian.wirth@oracle.com>
parents:
10879
diff
changeset
|
308 CAST_TO_FN_PTR(cuda_cu_ctx_detach_func_t, os::dll_lookup(handle, "cuCtxDetach")); |
10879 | 309 _cuda_cu_ctx_synchronize = |
10882
6a2d65cb5d7d
fix: gpu_ptx.cpp did not compile on windows
Christian Wirth <christian.wirth@oracle.com>
parents:
10879
diff
changeset
|
310 CAST_TO_FN_PTR(cuda_cu_ctx_synchronize_func_t, os::dll_lookup(handle, "cuCtxSynchronize")); |
10879 | 311 _cuda_cu_device_get_count = |
10882
6a2d65cb5d7d
fix: gpu_ptx.cpp did not compile on windows
Christian Wirth <christian.wirth@oracle.com>
parents:
10879
diff
changeset
|
312 CAST_TO_FN_PTR(cuda_cu_device_get_count_func_t, os::dll_lookup(handle, "cuDeviceGetCount")); |
10879 | 313 _cuda_cu_device_get_name = |
10882
6a2d65cb5d7d
fix: gpu_ptx.cpp did not compile on windows
Christian Wirth <christian.wirth@oracle.com>
parents:
10879
diff
changeset
|
314 CAST_TO_FN_PTR(cuda_cu_device_get_name_func_t, os::dll_lookup(handle, "cuDeviceGetName")); |
10879 | 315 _cuda_cu_device_get = |
10882
6a2d65cb5d7d
fix: gpu_ptx.cpp did not compile on windows
Christian Wirth <christian.wirth@oracle.com>
parents:
10879
diff
changeset
|
316 CAST_TO_FN_PTR(cuda_cu_device_get_func_t, os::dll_lookup(handle, "cuDeviceGet")); |
10879 | 317 _cuda_cu_device_compute_capability = |
10882
6a2d65cb5d7d
fix: gpu_ptx.cpp did not compile on windows
Christian Wirth <christian.wirth@oracle.com>
parents:
10879
diff
changeset
|
318 CAST_TO_FN_PTR(cuda_cu_device_compute_capability_func_t, os::dll_lookup(handle, "cuDeviceComputeCapability")); |
10879 | 319 _cuda_cu_device_get_attribute = |
10882
6a2d65cb5d7d
fix: gpu_ptx.cpp did not compile on windows
Christian Wirth <christian.wirth@oracle.com>
parents:
10879
diff
changeset
|
320 CAST_TO_FN_PTR(cuda_cu_device_get_attribute_func_t, os::dll_lookup(handle, "cuDeviceGetAttribute")); |
10879 | 321 _cuda_cu_module_get_function = |
10882
6a2d65cb5d7d
fix: gpu_ptx.cpp did not compile on windows
Christian Wirth <christian.wirth@oracle.com>
parents:
10879
diff
changeset
|
322 CAST_TO_FN_PTR(cuda_cu_module_get_function_func_t, os::dll_lookup(handle, "cuModuleGetFunction")); |
10879 | 323 _cuda_cu_module_load_data_ex = |
10882
6a2d65cb5d7d
fix: gpu_ptx.cpp did not compile on windows
Christian Wirth <christian.wirth@oracle.com>
parents:
10879
diff
changeset
|
324 CAST_TO_FN_PTR(cuda_cu_module_load_data_ex_func_t, os::dll_lookup(handle, "cuModuleLoadDataEx")); |
10879 | 325 _cuda_cu_launch_kernel = |
10882
6a2d65cb5d7d
fix: gpu_ptx.cpp did not compile on windows
Christian Wirth <christian.wirth@oracle.com>
parents:
10879
diff
changeset
|
326 CAST_TO_FN_PTR(cuda_cu_launch_kernel_func_t, os::dll_lookup(handle, "cuLaunchKernel")); |
10879 | 327 if (TraceGPUInteraction) { |
328 tty->print_cr("[CUDA] Success: library linkage"); | |
329 } | |
330 return true; | |
331 } else { | |
332 // Unable to dlopen libcuda | |
333 return false; | |
334 } | |
335 } else { | |
336 tty->print_cr("Unsupported CUDA platform"); | |
337 return false; | |
338 } | |
339 tty->print_cr("Failed to find CUDA linkage"); | |
340 return false; | |
341 } | |
342 |