Mercurial > hg > graal-compiler
diff src/share/vm/runtime/gpu.cpp @ 12743:f1a55428a8d7
more HSAIL support in the C++ layer for executing HSAIL code on the simulator
Contributed-by: Eric Caspole <eric.caspole@amd.com>
author | Doug Simon <doug.simon@oracle.com> |
---|---|
date | Sun, 10 Nov 2013 13:18:09 +0100 |
parents | 8d8f63069f58 |
children | 49db2c1e3bee |
line wrap: on
line diff
--- a/src/share/vm/runtime/gpu.cpp Sun Nov 10 11:42:31 2013 +0100 +++ b/src/share/vm/runtime/gpu.cpp Sun Nov 10 13:18:09 2013 +0100 @@ -24,6 +24,7 @@ #include "precompiled.hpp" #include "runtime/gpu.hpp" +#include "runtime/handles.hpp" bool gpu::_available = false; // does the hardware exist? bool gpu::_gpu_linkage = false; // is the driver library to access the GPU installed @@ -31,10 +32,12 @@ gpu::TargetGPUIL gpu::_targetIL = gpu::NONE; // No GPU detected yet. void gpu::init() { -#if defined(TARGET_OS_FAMILY_bsd) || defined(TARGET_OS_FAMILY_linux) +#if defined(TARGET_OS_FAMILY_bsd) || defined(TARGET_OS_FAMILY_linux) || defined(TARGET_OS_FAMILY_windows) gpu::probe_gpu(); if (gpu::get_target_il_type() == gpu::PTX) { set_gpu_linkage(gpu::Ptx::probe_linkage()); + } else if (gpu::get_target_il_type() == gpu::HSAIL) { + set_gpu_linkage(gpu::Hsail::probe_linkage()); } else { set_gpu_linkage(false); } @@ -45,8 +48,9 @@ if (gpu::has_gpu_linkage()) { if (gpu::get_target_il_type() == gpu::PTX) { set_initialized(gpu::Ptx::initialize_gpu()); + } else if (gpu::get_target_il_type() == gpu::HSAIL) { + set_initialized(gpu::Hsail::initialize_gpu()); } - // Add initialization of other GPUs here } } @@ -54,8 +58,9 @@ if (gpu::has_gpu_linkage()) { if (gpu::get_target_il_type() == gpu::PTX) { return (gpu::Ptx::generate_kernel(code, code_len, name)); + } else if (gpu::get_target_il_type() == gpu::HSAIL) { + return (gpu::Hsail::generate_kernel(code, code_len, name)); } - // Add kernel generation functionality of other GPUs here } return NULL; } @@ -70,6 +75,18 @@ return false; } +// This is HSAIL specific to work with Sumatra JDK +bool gpu::execute_kernel_void_1d(address kernel, int dimX, jobject args, methodHandle& mh) { + if (gpu::has_gpu_linkage()) { + if (gpu::get_target_il_type() == gpu::HSAIL) { + return (gpu::Hsail::execute_kernel_void_1d(kernel, dimX, args, mh)); + } + } + return false; + +} + + bool gpu::execute_warp(int dimX, int dimY, int dimZ, address kernel, PTXKernelArguments & ptxka, JavaValue& ret) { if (gpu::has_gpu_linkage()) {