diff src/gpu/hsail/vm/gpu_hsail.cpp @ 16878:bbb987aec58d

HSAIL: pass the number of argument to the JavaCallArguments constructor. Add TraceTime for kernel creation. Contributed-by: Eric Caspole <eric.caspole@amd.com>
author Gilles Duboscq <duboscq@ssw.jku.at>
date Thu, 21 Aug 2014 11:12:38 +0200
parents a29e6e7b7a86
children 2d6dd2eebd51
line wrap: on
line diff
--- a/src/gpu/hsail/vm/gpu_hsail.cpp	Wed Aug 20 17:10:13 2014 +0200
+++ b/src/gpu/hsail/vm/gpu_hsail.cpp	Thu Aug 21 11:12:38 2014 +0200
@@ -140,6 +140,8 @@
                                                 jint num_tlabs, int allocBytesPerWorkitem, jobject oop_map_array, TRAPS) {
   ResourceMark rm(THREAD);
   objArrayOop argsArray = (objArrayOop) JNIHandles::resolve(args);
+  // Note this length does not include the iteration variable since it is replaced by the HSA workitemid
+  int argsArrayLength = argsArray->length();
   assert(THREAD->is_Java_thread(), "must be a JavaThread");
 
   // We avoid HSAILAllocationInfo logic if kernel does not allocate
@@ -296,7 +298,8 @@
             KlassHandle methKlass = mh->method_holder();
             Thread* THREAD = Thread::current();
             JavaValue result(T_VOID);
-            JavaCallArguments javaArgs;
+            // Add the iteration variable to the HSA args length
+            JavaCallArguments javaArgs(argsArrayLength + 1);
             // re-resolve the args_handle here
             objArrayOop resolvedArgsArray = (objArrayOop) JNIHandles::resolve(args);
 
@@ -344,8 +347,11 @@
   // The kernel entrypoint is always run for the time being  
   const char* entryPointName = "&run";
   jlong okra_kernel;
-  jint okra_status = _okra_create_kernel(_device_context, code, entryPointName, (void**)&okra_kernel);
-  guarantee(okra_status==0, "_okra_create_kernel failed");
+  {
+    TraceTime t("generate kernel ", TraceGPUInteraction);
+    jint okra_status = _okra_create_kernel(_device_context, code, entryPointName, (void**)&okra_kernel);
+    guarantee(okra_status==0, "_okra_create_kernel failed");
+  }
   return (jlong) okra_kernel;
 GPU_END