Mercurial > hg > graal-compiler
diff src/share/vm/runtime/arguments.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 | 359f7e70ae7f |
children | b699233403ad |
line wrap: on
line diff
--- a/src/share/vm/runtime/arguments.cpp Fri Oct 18 21:40:23 2013 +0200 +++ b/src/share/vm/runtime/arguments.cpp Fri Oct 18 23:55:35 2013 +0200 @@ -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; }