diff src/gpu/ptx/vm/gpu_ptx.cpp @ 13683:de839ec35cc7

schedule lambda method compilation and execution on GPU (PTX) when possible; fix a couple of bugs.
author S.Bharadwaj Yadavalli <bharadwaj.yadavalli@oracle.com>
date Fri, 17 Jan 2014 16:03:13 -0500
parents fff17b5dff8a
children 80cd5c3b8827
line wrap: on
line diff
--- a/src/gpu/ptx/vm/gpu_ptx.cpp	Fri Jan 17 17:26:47 2014 +0100
+++ b/src/gpu/ptx/vm/gpu_ptx.cpp	Fri Jan 17 16:03:13 2014 -0500
@@ -331,7 +331,7 @@
   }
 
   if (TraceGPUInteraction) {
-    tty->print_cr("[CUDA] Got function handle for %s", name);
+    tty->print_cr("[CUDA] Got function handle for %s kernel address %p", name, cu_function);
   }
 
   return cu_function;
@@ -375,7 +375,9 @@
       return 0L;
     }
     // Push device_return_value to kernelParams
-    gpu::Ptx::CUdeviceptr* returnValuePtr = (gpu::Ptx::CUdeviceptr*) (address) parametersAndReturnValueBuffer + parametersAndReturnValueBufferSize - sizeof(device_return_value);
+    gpu::Ptx::CUdeviceptr* returnValuePtr = (gpu::Ptx::CUdeviceptr*)
+                                               ((address) parametersAndReturnValueBuffer +
+                                                parametersAndReturnValueBufferSize - sizeof(device_return_value));
     *returnValuePtr = device_return_value;
   }
 
@@ -417,7 +419,7 @@
     }
     thread->set_vm_result(return_val);
   } else if (returnTypeSize > 0) {
-    status = gpu::Ptx::_cuda_cu_memcpy_dtoh(&primitiveReturnValue, device_return_value, T_LONG_BYTE_SIZE);
+    status = gpu::Ptx::_cuda_cu_memcpy_dtoh(&primitiveReturnValue, device_return_value, returnTypeSize);
     if (status != GRAAL_CUDA_SUCCESS) {
       tty->print_cr("[CUDA] *** Error (%d) Failed to copy value from device argument", status);
       SharedRuntime::throw_and_post_jvmti_exception(thread, vmSymbols::java_lang_Exception(), "[CUDA] Failed to copy value from device argument");