comparison src/gpu/ptx/vm/gpu_ptx.cpp @ 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 0995dcbd6dd8
children 66e3af78ea96
comparison
equal deleted inserted replaced
14039:692452c4cfb6 14040:2d95cf7a29c8
232 232
233 if (status != GRAAL_CUDA_SUCCESS) { 233 if (status != GRAAL_CUDA_SUCCESS) {
234 tty->print_cr("[CUDA] Failed to query unified addressing mode of device: %d", _cu_device); 234 tty->print_cr("[CUDA] Failed to query unified addressing mode of device: %d", _cu_device);
235 return false; 235 return false;
236 } 236 }
237 237 /* The CUDA driver runtime interaction and generated code as implemented requires
238 if (TraceGPUInteraction) { 238 that the device supports Unified Addressing.
239 tty->print_cr("[CUDA] Device %d %s unified addressing support", _cu_device, 239 */
240 ((unified_addressing == 0) ? "does not have" : "has")); 240 if (unified_addressing == 0) {
241 } 241 tty->print_cr("[CUDA] CUDA device %d does NOT have required Unified Addressing support.", _cu_device);
242 242 return false;
243 }
244
245 if (TraceGPUInteraction) {
246 tty->print_cr("[CUDA] Device %d has Unified Addressing support", _cu_device);
247 }
243 248
244 /* Get device name */ 249 /* Get device name */
245 char device_name[256]; 250 char device_name[256];
246 status = _cuda_cu_device_get_name(device_name, 256, _cu_device); 251 status = _cuda_cu_device_get_name(device_name, 256, _cu_device);
247 252
459 bool _gc_locked; // denotes when execution has locked GC 464 bool _gc_locked; // denotes when execution has locked GC
460 465
461 bool check(int status, const char *action) { 466 bool check(int status, const char *action) {
462 if (status != GRAAL_CUDA_SUCCESS) { 467 if (status != GRAAL_CUDA_SUCCESS) {
463 Thread* THREAD = _thread; 468 Thread* THREAD = _thread;
469 ResourceMark rm(THREAD);
464 char* message = NEW_RESOURCE_ARRAY_IN_THREAD(THREAD, char, O_BUFLEN + 1); 470 char* message = NEW_RESOURCE_ARRAY_IN_THREAD(THREAD, char, O_BUFLEN + 1);
465 jio_snprintf(message, O_BUFLEN, "[CUDA] *** Error (status=%d): %s", status, action); 471 jio_snprintf(message, O_BUFLEN, "[CUDA] *** Error (status=%d): %s", status, action);
466 if (TraceGPUInteraction) { 472 if (TraceGPUInteraction) {
467 tty->print_cr(message); 473 tty->print_cr(message);
468 } 474 }
660 666
661 static void printKernelArguments(JavaThread* thread, address buffer) { 667 static void printKernelArguments(JavaThread* thread, address buffer) {
662 for (vframeStream vfst(thread); !vfst.at_end(); vfst.next()) { 668 for (vframeStream vfst(thread); !vfst.at_end(); vfst.next()) {
663 Method* m = vfst.method(); 669 Method* m = vfst.method();
664 if (m != NULL) { 670 if (m != NULL) {
671 ResourceMark rm;
665 stringStream st(O_BUFLEN); 672 stringStream st(O_BUFLEN);
666 st.print("[CUDA] Call: %s.%s(", m->method_holder()->name()->as_C_string(), m->name()->as_C_string()); 673 st.print("[CUDA] Call: %s.%s(", m->method_holder()->name()->as_C_string(), m->name()->as_C_string());
667 KernelArgumentsPrinter kap(m, buffer, &st); 674 KernelArgumentsPrinter kap(m, buffer, &st);
668 tty->print_cr("%s)", st.as_string()); 675 tty->print_cr("%s)", st.as_string());
669 return; 676 return;