# HG changeset patch # User Mick Jordan # Date 1382137160 25200 # Node ID 1499d4d73eeebd94a7fb96cc31aa4ee5b6d069bc # Parent 11f217e8476a140ea84c247072cf2b91b44b32d9# Parent 4dba97fb1a6f87498e0adebbb480cf62368689c1 Merge diff -r 11f217e8476a -r 1499d4d73eee graal/com.oracle.graal.hotspot/src/com/oracle/graal/hotspot/HotSpotGraalRuntime.java --- a/graal/com.oracle.graal.hotspot/src/com/oracle/graal/hotspot/HotSpotGraalRuntime.java Fri Oct 18 15:58:07 2013 -0700 +++ b/graal/com.oracle.graal.hotspot/src/com/oracle/graal/hotspot/HotSpotGraalRuntime.java Fri Oct 18 15:59:20 2013 -0700 @@ -252,16 +252,17 @@ /** * Gets the names of the supported GPU architectures for the purpose of finding the * corresponding {@linkplain HotSpotBackendFactory backend} objects. This method first looks for - * a comma separated list of names in the {@value #GRAAL_GPU_ISALIST_PROPERTY_NAME} system - * property. If this property is not set, then the GPU native support code is queried. + * a comma or {@link java.io.File#pathSeparatorChar} separated list of names in the + * {@value #GRAAL_GPU_ISALIST_PROPERTY_NAME} system property. If this property is not set, then + * the GPU native support code is queried. */ - private String[] getGPUArchitectureNames() { + private static String[] getGPUArchitectureNames() { String gpuList = System.getProperty(GRAAL_GPU_ISALIST_PROPERTY_NAME); - if (gpuList != null) { - String[] gpus = gpuList.split(","); + if (gpuList != null && !gpuList.isEmpty()) { + String[] gpus = gpuList.split("[,:]"); return gpus; } - return compilerToGpu.getAvailableGPUArchitectures(); + return new String[0]; } private static void printConfig(HotSpotVMConfig config) { diff -r 11f217e8476a -r 1499d4d73eee graal/com.oracle.graal.hotspot/src/com/oracle/graal/hotspot/bridge/CompilerToGPU.java --- a/graal/com.oracle.graal.hotspot/src/com/oracle/graal/hotspot/bridge/CompilerToGPU.java Fri Oct 18 15:58:07 2013 -0700 +++ b/graal/com.oracle.graal.hotspot/src/com/oracle/graal/hotspot/bridge/CompilerToGPU.java Fri Oct 18 15:59:20 2013 -0700 @@ -48,11 +48,6 @@ int availableProcessors(); /** - * Gets the architecture names of the available GPUs. - */ - String[] getAvailableGPUArchitectures(); - - /** * Attempts to generate and return a bound function to the loaded method kernel on the GPU. * * @param code the text or binary values for a method kernel diff -r 11f217e8476a -r 1499d4d73eee graal/com.oracle.graal.hotspot/src/com/oracle/graal/hotspot/bridge/CompilerToGPUImpl.java --- a/graal/com.oracle.graal.hotspot/src/com/oracle/graal/hotspot/bridge/CompilerToGPUImpl.java Fri Oct 18 15:58:07 2013 -0700 +++ b/graal/com.oracle.graal.hotspot/src/com/oracle/graal/hotspot/bridge/CompilerToGPUImpl.java Fri Oct 18 15:59:20 2013 -0700 @@ -39,8 +39,6 @@ public native int availableProcessors(); - public native String[] getAvailableGPUArchitectures(); - public native Object executeExternalMethodVarargs(Object[] args, HotSpotInstalledCode hotspotInstalledCode) throws InvalidInstalledCodeException; public native Object executeParallelMethodVarargs(int dimX, int dimY, int dimZ, Object[] args, HotSpotInstalledCode hotspotInstalledCode) throws InvalidInstalledCodeException; diff -r 11f217e8476a -r 1499d4d73eee hotspot/.project --- a/hotspot/.project Fri Oct 18 15:58:07 2013 -0700 +++ b/hotspot/.project Fri Oct 18 15:59:20 2013 -0700 @@ -96,6 +96,11 @@ PARENT-1-PROJECT_LOC/src/cpu/x86/vm + ptx + 2 + PARENT-1-PROJECT_LOC/src/gpu/ptx/vm + + sparc 2 PARENT-1-PROJECT_LOC/src/cpu/sparc/vm @@ -121,6 +126,11 @@ PARENT-1-PROJECT_LOC/src/os_cpu/bsd_x86/vm + bsd_ptx + 2 + PARENT-1-PROJECT_LOC/src/os_gpu/bsd_ptx/vm + + windows 2 PARENT-1-PROJECT_LOC/src/os/windows/vm @@ -141,6 +151,11 @@ PARENT-1-PROJECT_LOC/src/os_cpu/linux_x86/vm + linux_ptx + 2 + PARENT-1-PROJECT_LOC/src/os_gpu/linux_ptx/vm + + linux_sparc 2 PARENT-1-PROJECT_LOC/src/os_cpu/linux_sparc/vm diff -r 11f217e8476a -r 1499d4d73eee src/share/vm/graal/graalCompilerToGPU.cpp --- a/src/share/vm/graal/graalCompilerToGPU.cpp Fri Oct 18 15:58:07 2013 -0700 +++ b/src/share/vm/graal/graalCompilerToGPU.cpp Fri Oct 18 15:59:20 2013 -0700 @@ -190,29 +190,6 @@ return gpu::available_processors(); C2V_END -static objArrayHandle newSingletonStringArray(const char* value, TRAPS) { - objArrayHandle nullRes; - objArrayOop res = oopFactory::new_objArray(SystemDictionary::String_klass(), 1, CHECK_(nullRes)); - objArrayHandle res_h = objArrayHandle(THREAD, res); - Handle valueString = java_lang_String::create_from_str(value, CHECK_(nullRes)); - res_h->obj_at_put(0, valueString()); - return res_h; -} - -C2V_VMENTRY(jobject, getAvailableGPUArchitectures, (JNIEnv *env, jobject)) - if (UseGPU) { - if (gpu::is_available() && gpu::has_gpu_linkage()) { - if (gpu::get_target_il_type() == gpu::PTX) { - return JNIHandles::make_local(newSingletonStringArray("PTX", THREAD)()); - } - if (gpu::get_target_il_type() == gpu::HSAIL) { - return JNIHandles::make_local(newSingletonStringArray("HSAIL", THREAD)()); - } - } - } - return JNIHandles::make_local(oopFactory::new_objArray(SystemDictionary::String_klass(), 0, THREAD)); -C2V_END - C2V_VMENTRY(jboolean, deviceDetach, (JNIEnv *env, jobject)) return true; C2V_END @@ -258,7 +235,6 @@ {CC"deviceInit", CC"()Z", FN_PTR(deviceInit)}, {CC"deviceDetach", CC"()Z", FN_PTR(deviceDetach)}, {CC"availableProcessors", CC"()I", FN_PTR(availableProcessors)}, - {CC"getAvailableGPUArchitectures", CC"()["STRING, FN_PTR(getAvailableGPUArchitectures)}, {CC"executeExternalMethodVarargs", CC"(["OBJECT HS_INSTALLED_CODE")"OBJECT, FN_PTR(executeExternalMethodVarargs)}, {CC"executeParallelMethodVarargs", CC"(III["OBJECT HS_INSTALLED_CODE")"OBJECT, FN_PTR(executeParallelMethodVarargs)}, }; diff -r 11f217e8476a -r 1499d4d73eee src/share/vm/runtime/arguments.cpp --- a/src/share/vm/runtime/arguments.cpp Fri Oct 18 15:58:07 2013 -0700 +++ b/src/share/vm/runtime/arguments.cpp Fri Oct 18 15:59:20 2013 -0700 @@ -35,6 +35,7 @@ #include "prims/jvmtiExport.hpp" #include "runtime/arguments.hpp" #include "runtime/globals_extension.hpp" +#include "runtime/gpu.hpp" #include "runtime/java.hpp" #include "services/management.hpp" #include "services/memTracker.hpp" @@ -130,6 +131,9 @@ SystemProperty *Arguments::_java_home = NULL; SystemProperty *Arguments::_java_class_path = NULL; SystemProperty *Arguments::_sun_boot_class_path = NULL; +#ifdef GRAAL +SystemProperty *Arguments::_graal_gpu_isalist = NULL; +#endif char* Arguments::_meta_index_path = NULL; char* Arguments::_meta_index_dir = NULL; @@ -193,6 +197,9 @@ _sun_boot_class_path = new SystemProperty("sun.boot.class.path", NULL, true); _java_class_path = new SystemProperty("java.class.path", "", true); +#ifdef GRAAL + _graal_gpu_isalist = new SystemProperty("graal.gpu.isalist", NULL, true); +#endif // Add to System Property list. PropertyList_add(&_system_properties, _java_ext_dirs); @@ -202,6 +209,9 @@ PropertyList_add(&_system_properties, _java_home); PropertyList_add(&_system_properties, _java_class_path); PropertyList_add(&_system_properties, _sun_boot_class_path); +#ifdef GRAAL + PropertyList_add(&_system_properties, _graal_gpu_isalist); +#endif // Set OS specific system properties values os::init_system_properties_values(); @@ -3801,6 +3811,24 @@ } } +#ifdef GRAAL + if (_graal_gpu_isalist->value() == NULL) { + // Initialize the graal.gpu.isalist system property if + // a) it was not explicitly defined by the user and + // b) at least one GPU is available. + // GPU offload can be disabled by setting the property + // to the empty string on the command line + if (gpu::is_available() && gpu::has_gpu_linkage()) { + if (gpu::get_target_il_type() == gpu::PTX) { + _graal_gpu_isalist->append_value("PTX"); + } + if (gpu::get_target_il_type() == gpu::HSAIL) { + _graal_gpu_isalist->append_value("HSAIL"); + } + } + } +#endif + return JNI_OK; } diff -r 11f217e8476a -r 1499d4d73eee src/share/vm/runtime/arguments.hpp --- a/src/share/vm/runtime/arguments.hpp Fri Oct 18 15:58:07 2013 -0700 +++ b/src/share/vm/runtime/arguments.hpp Fri Oct 18 15:59:20 2013 -0700 @@ -264,6 +264,9 @@ static SystemProperty *_java_home; static SystemProperty *_java_class_path; static SystemProperty *_sun_boot_class_path; +#ifdef GRAAL + static SystemProperty *_graal_gpu_isalist; +#endif // Meta-index for knowing what packages are in the boot class path static char* _meta_index_path; diff -r 11f217e8476a -r 1499d4d73eee src/share/vm/runtime/globals.hpp --- a/src/share/vm/runtime/globals.hpp Fri Oct 18 15:58:07 2013 -0700 +++ b/src/share/vm/runtime/globals.hpp Fri Oct 18 15:59:20 2013 -0700 @@ -3774,9 +3774,6 @@ product(bool, TraceGPUInteraction, false, \ "Trace external GPU Interaction") \ \ - product(bool, UseGPU, false, \ - "Run code on GPU") \ - \ diagnostic(ccstr, SharedArchiveFile, NULL, \ "Override the default location of the CDS archive file") \ \