changeset 10563:7a3499bf5e2c

PTX kernel get_function return
author Morris Meyer <morris.meyer@oracle.com>
date Thu, 27 Jun 2013 19:22:42 -0400
parents 12d134c0aa8d
children 1b864a1552e0
files src/gpu/ptx/gpu_ptx.cpp src/gpu/ptx/gpu_ptx.hpp src/share/vm/graal/graalCompilerToGPU.cpp
diffstat 3 files changed, 5 insertions(+), 4 deletions(-) [+]
line wrap: on
line diff
--- a/src/gpu/ptx/gpu_ptx.cpp	Thu Jun 27 22:00:18 2013 +0200
+++ b/src/gpu/ptx/gpu_ptx.cpp	Thu Jun 27 19:22:42 2013 -0400
@@ -102,7 +102,7 @@
   return status == 0;  // CUDA_SUCCESS
 }
 
-void gpu::Ptx::generate_kernel(unsigned char *code, int code_len, const char *name) {
+void *gpu::Ptx::generate_kernel(unsigned char *code, int code_len, const char *name) {
 
   void *cu_module;
   const unsigned int jit_num_options = 3;
@@ -134,6 +134,7 @@
   if (TraceWarpLoading) {
     tty->print_cr("gpu_ptx::_cuda_cu_module_get_function(%s):%x %d", name, cu_function, status);
   }
+  return cu_function;
 }
 
 
--- a/src/gpu/ptx/gpu_ptx.hpp	Thu Jun 27 22:00:18 2013 +0200
+++ b/src/gpu/ptx/gpu_ptx.hpp	Thu Jun 27 19:22:42 2013 -0400
@@ -34,7 +34,7 @@
   static bool probe_linkage_apple();
 #endif
   static bool initialize_gpu();
-  static void generate_kernel(unsigned char *code, int code_len, const char *name);
+  static void * generate_kernel(unsigned char *code, int code_len, const char *name);
   
 private:
   typedef int (*cuda_cu_init_func_t)(unsigned int, int);
--- a/src/share/vm/graal/graalCompilerToGPU.cpp	Thu Jun 27 22:00:18 2013 +0200
+++ b/src/share/vm/graal/graalCompilerToGPU.cpp	Thu Jun 27 19:22:42 2013 -0400
@@ -52,11 +52,11 @@
   jbyte *bytes = env->GetByteArrayElements(code, &is_copy);
   jint len = env->GetArrayLength(code);
   const char *namestr = env->GetStringUTFChars(name, &is_copy);
-  gpu::generate_kernel((unsigned char *)bytes, len, namestr);
+  void *kernel = gpu::generate_kernel((unsigned char *)bytes, len, namestr);
   env->ReleaseByteArrayElements(code, bytes, 0);
   env->ReleaseStringUTFChars(name, namestr);
 
-  return 42;
+  return (jlong)kernel;
 C2V_END
 
 C2V_VMENTRY(jboolean, deviceInit, (JNIEnv *env, jobject))