Mercurial > hg > truffle
comparison src/share/vm/graal/graalCompilerToGPU.cpp @ 12490:4dba97fb1a6f
available GPUs are exposed to Graal only by the graal.gpu.isalist system property which is set up during command line argument parsing
author | Doug Simon <doug.simon@oracle.com> |
---|---|
date | Fri, 18 Oct 2013 23:55:35 +0200 |
parents | bb5a7574ae81 |
children | 1a7e7011a341 |
comparison
equal
deleted
inserted
replaced
12489:0c651af30cc8 | 12490:4dba97fb1a6f |
---|---|
186 if (gpu::is_available() == false || gpu::has_gpu_linkage() == false) { | 186 if (gpu::is_available() == false || gpu::has_gpu_linkage() == false) { |
187 tty->print_cr("deviceInit - not available / no linkage"); | 187 tty->print_cr("deviceInit - not available / no linkage"); |
188 return false; | 188 return false; |
189 } | 189 } |
190 return gpu::available_processors(); | 190 return gpu::available_processors(); |
191 C2V_END | |
192 | |
193 static objArrayHandle newSingletonStringArray(const char* value, TRAPS) { | |
194 objArrayHandle nullRes; | |
195 objArrayOop res = oopFactory::new_objArray(SystemDictionary::String_klass(), 1, CHECK_(nullRes)); | |
196 objArrayHandle res_h = objArrayHandle(THREAD, res); | |
197 Handle valueString = java_lang_String::create_from_str(value, CHECK_(nullRes)); | |
198 res_h->obj_at_put(0, valueString()); | |
199 return res_h; | |
200 } | |
201 | |
202 C2V_VMENTRY(jobject, getAvailableGPUArchitectures, (JNIEnv *env, jobject)) | |
203 if (UseGPU) { | |
204 if (gpu::is_available() && gpu::has_gpu_linkage()) { | |
205 if (gpu::get_target_il_type() == gpu::PTX) { | |
206 return JNIHandles::make_local(newSingletonStringArray("PTX", THREAD)()); | |
207 } | |
208 if (gpu::get_target_il_type() == gpu::HSAIL) { | |
209 return JNIHandles::make_local(newSingletonStringArray("HSAIL", THREAD)()); | |
210 } | |
211 } | |
212 } | |
213 return JNIHandles::make_local(oopFactory::new_objArray(SystemDictionary::String_klass(), 0, THREAD)); | |
214 C2V_END | 191 C2V_END |
215 | 192 |
216 C2V_VMENTRY(jboolean, deviceDetach, (JNIEnv *env, jobject)) | 193 C2V_VMENTRY(jboolean, deviceDetach, (JNIEnv *env, jobject)) |
217 return true; | 194 return true; |
218 C2V_END | 195 C2V_END |
256 JNINativeMethod CompilerToGPU_methods[] = { | 233 JNINativeMethod CompilerToGPU_methods[] = { |
257 {CC"generateKernel", CC"([B" STRING ")"GPUSPACE_METHOD, FN_PTR(generateKernel)}, | 234 {CC"generateKernel", CC"([B" STRING ")"GPUSPACE_METHOD, FN_PTR(generateKernel)}, |
258 {CC"deviceInit", CC"()Z", FN_PTR(deviceInit)}, | 235 {CC"deviceInit", CC"()Z", FN_PTR(deviceInit)}, |
259 {CC"deviceDetach", CC"()Z", FN_PTR(deviceDetach)}, | 236 {CC"deviceDetach", CC"()Z", FN_PTR(deviceDetach)}, |
260 {CC"availableProcessors", CC"()I", FN_PTR(availableProcessors)}, | 237 {CC"availableProcessors", CC"()I", FN_PTR(availableProcessors)}, |
261 {CC"getAvailableGPUArchitectures", CC"()["STRING, FN_PTR(getAvailableGPUArchitectures)}, | |
262 {CC"executeExternalMethodVarargs", CC"(["OBJECT HS_INSTALLED_CODE")"OBJECT, FN_PTR(executeExternalMethodVarargs)}, | 238 {CC"executeExternalMethodVarargs", CC"(["OBJECT HS_INSTALLED_CODE")"OBJECT, FN_PTR(executeExternalMethodVarargs)}, |
263 {CC"executeParallelMethodVarargs", CC"(III["OBJECT HS_INSTALLED_CODE")"OBJECT, FN_PTR(executeParallelMethodVarargs)}, | 239 {CC"executeParallelMethodVarargs", CC"(III["OBJECT HS_INSTALLED_CODE")"OBJECT, FN_PTR(executeParallelMethodVarargs)}, |
264 }; | 240 }; |
265 | 241 |
266 int CompilerToGPU_methods_count() { | 242 int CompilerToGPU_methods_count() { |