changeset 14040:2d95cf7a29c8

Fixes PTX test failure and a crash when TraceGPUInteraction flag is specified.
author S.Bharadwaj Yadavalli <bharadwaj.yadavalli@oracle.com>
date Fri, 28 Feb 2014 14:01:31 -0500
parents 692452c4cfb6
children 67d2c95bfa43
files graal/com.oracle.graal.compiler.ptx/src/com/oracle/graal/compiler/ptx/PTXLIRGenerator.java src/gpu/ptx/vm/gpu_ptx.cpp
diffstat 2 files changed, 12 insertions(+), 5 deletions(-) [+]
line wrap: on
line diff
--- a/graal/com.oracle.graal.compiler.ptx/src/com/oracle/graal/compiler/ptx/PTXLIRGenerator.java	Fri Feb 28 14:25:27 2014 +0100
+++ b/graal/com.oracle.graal.compiler.ptx/src/com/oracle/graal/compiler/ptx/PTXLIRGenerator.java	Fri Feb 28 14:01:31 2014 -0500
@@ -164,9 +164,9 @@
             }
             Warp warpAnnotation = parameterIndex >= 0 ? MetaUtil.getParameterAnnotation(Warp.class, parameterIndex, graph.method()) : null;
             if (warpAnnotation != null) {
-                setResult(param, emitWarpParam(paramValue.getKind(), warpAnnotation));
+                setResult(param, emitWarpParam(paramValue.getKind().getStackKind(), warpAnnotation));
             } else {
-                setResult(param, emitLoadParam(paramValue.getKind(), paramValue, null));
+                setResult(param, emitLoadParam(paramValue.getKind().getStackKind(), paramValue, null));
             }
         }
     }
--- a/src/gpu/ptx/vm/gpu_ptx.cpp	Fri Feb 28 14:25:27 2014 +0100
+++ b/src/gpu/ptx/vm/gpu_ptx.cpp	Fri Feb 28 14:01:31 2014 -0500
@@ -234,13 +234,18 @@
     tty->print_cr("[CUDA] Failed to query unified addressing mode of device: %d", _cu_device);
     return false;
   }
+  /* The CUDA driver runtime interaction and generated code as implemented requires
+     that the device supports Unified Addressing.
+  */
+  if (unified_addressing == 0) {
+    tty->print_cr("[CUDA] CUDA device %d does NOT have required Unified Addressing support.", _cu_device);
+    return false;
+  }
 
   if (TraceGPUInteraction) {
-    tty->print_cr("[CUDA] Device %d %s unified addressing support", _cu_device,
-                  ((unified_addressing == 0) ? "does not have" : "has"));
+    tty->print_cr("[CUDA] Device %d has Unified Addressing support", _cu_device);
   }
 
-
   /* Get device name */
   char device_name[256];
   status = _cuda_cu_device_get_name(device_name, 256, _cu_device);
@@ -461,6 +466,7 @@
   bool check(int status, const char *action) {
     if (status != GRAAL_CUDA_SUCCESS) {
       Thread* THREAD = _thread;
+      ResourceMark rm(THREAD);
       char* message = NEW_RESOURCE_ARRAY_IN_THREAD(THREAD, char, O_BUFLEN + 1);
       jio_snprintf(message, O_BUFLEN, "[CUDA] *** Error (status=%d): %s", status, action);
       if (TraceGPUInteraction) {
@@ -662,6 +668,7 @@
   for (vframeStream vfst(thread); !vfst.at_end(); vfst.next()) {
     Method* m = vfst.method();
     if (m != NULL) {
+      ResourceMark rm;
       stringStream st(O_BUFLEN);
       st.print("[CUDA] Call: %s.%s(", m->method_holder()->name()->as_C_string(), m->name()->as_C_string());
       KernelArgumentsPrinter kap(m, buffer, &st);