diff src/gpu/ptx/vm/ptxKernelArguments.cpp @ 11902:67a1e27a8dbb

PTX initial float and double
author Morris Meyer <morris.meyer@oracle.com>
date Sun, 06 Oct 2013 22:07:23 -0400
parents 61767ccd4600
children cfba4fd3d616
line wrap: on
line diff
--- a/src/gpu/ptx/vm/ptxKernelArguments.cpp	Sun Oct 06 18:15:56 2013 -0400
+++ b/src/gpu/ptx/vm/ptxKernelArguments.cpp	Sun Oct 06 22:07:23 2013 -0400
@@ -104,6 +104,39 @@
     return;
 }
 
+void PTXKernelArguments::do_double() {
+    if (is_after_invocation()) {
+        return;
+    }
+    // If the parameter is a return value,
+    jvalue doubleval;
+    if (is_return_type()) {
+        // Allocate device memory for T_INT return value pointer on device. Size in bytes
+        int status = gpu::Ptx::_cuda_cu_memalloc(&_return_value_ptr, T_DOUBLE_BYTE_SIZE);
+        if (status != GRAAL_CUDA_SUCCESS) {
+            tty->print_cr("[CUDA] *** Error (%d) Failed to allocate memory for return value pointer on device", status);
+            _success = false;
+            return;
+        }
+        // Push _return_value_ptr to _kernelBuffer
+        *((gpu::Ptx::CUdeviceptr*) &_kernelArgBuffer[_bufferOffset]) = _return_value_ptr;
+        // _bufferOffset += sizeof(_return_value_ptr);
+        _bufferOffset += sizeof(doubleval.d);
+    } else {
+        // Get the next java argument and its value which should be a T_INT
+        oop arg = next_arg(T_FLOAT);
+        // Copy the java argument value to kernelArgBuffer
+        if (java_lang_boxing_object::get_value(arg, &doubleval) != T_DOUBLE) {
+            tty->print_cr("[CUDA] *** Error: Unexpected argument type; expecting T_INT");
+            _success = false;
+            return;
+        }
+        *((gpu::Ptx::CUdeviceptr*) &_kernelArgBuffer[_bufferOffset]) = doubleval.d;
+        _bufferOffset += sizeof(doubleval.d);
+    }
+    return;
+}
+
 void PTXKernelArguments::do_long() {
   if (is_after_invocation()) {
     return;