comparison 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
comparison
equal deleted inserted replaced
16877:6adb14d2320c 16878:bbb987aec58d
138 138
139 jboolean Hsail::execute_kernel_void_1d_internal(address kernel, int dimX, jobject args, methodHandle& mh, nmethod* nm, 139 jboolean Hsail::execute_kernel_void_1d_internal(address kernel, int dimX, jobject args, methodHandle& mh, nmethod* nm,
140 jint num_tlabs, int allocBytesPerWorkitem, jobject oop_map_array, TRAPS) { 140 jint num_tlabs, int allocBytesPerWorkitem, jobject oop_map_array, TRAPS) {
141 ResourceMark rm(THREAD); 141 ResourceMark rm(THREAD);
142 objArrayOop argsArray = (objArrayOop) JNIHandles::resolve(args); 142 objArrayOop argsArray = (objArrayOop) JNIHandles::resolve(args);
143 // Note this length does not include the iteration variable since it is replaced by the HSA workitemid
144 int argsArrayLength = argsArray->length();
143 assert(THREAD->is_Java_thread(), "must be a JavaThread"); 145 assert(THREAD->is_Java_thread(), "must be a JavaThread");
144 146
145 // We avoid HSAILAllocationInfo logic if kernel does not allocate 147 // We avoid HSAILAllocationInfo logic if kernel does not allocate
146 // in which case the num_tlabs passed in will be 0 148 // in which case the num_tlabs passed in will be 0
147 HSAILAllocationInfo* allocInfo = (num_tlabs == 0 ? NULL : new HSAILAllocationInfo(num_tlabs, dimX, allocBytesPerWorkitem)); 149 HSAILAllocationInfo* allocInfo = (num_tlabs == 0 ? NULL : new HSAILAllocationInfo(num_tlabs, dimX, allocBytesPerWorkitem));
294 if (never_ran_array[k]) { 296 if (never_ran_array[k]) {
295 // run it as a javaCall 297 // run it as a javaCall
296 KlassHandle methKlass = mh->method_holder(); 298 KlassHandle methKlass = mh->method_holder();
297 Thread* THREAD = Thread::current(); 299 Thread* THREAD = Thread::current();
298 JavaValue result(T_VOID); 300 JavaValue result(T_VOID);
299 JavaCallArguments javaArgs; 301 // Add the iteration variable to the HSA args length
302 JavaCallArguments javaArgs(argsArrayLength + 1);
300 // re-resolve the args_handle here 303 // re-resolve the args_handle here
301 objArrayOop resolvedArgsArray = (objArrayOop) JNIHandles::resolve(args); 304 objArrayOop resolvedArgsArray = (objArrayOop) JNIHandles::resolve(args);
302 305
303 // This object sets up the javaCall arguments. The way 306 // This object sets up the javaCall arguments. The way
304 // argsArray is set up, this should work for instance 307 // argsArray is set up, this should work for instance
342 env->GetStringUTFRegion(name_handle, 0, name_len, name); 345 env->GetStringUTFRegion(name_handle, 0, name_len, name);
343 346
344 // The kernel entrypoint is always run for the time being 347 // The kernel entrypoint is always run for the time being
345 const char* entryPointName = "&run"; 348 const char* entryPointName = "&run";
346 jlong okra_kernel; 349 jlong okra_kernel;
347 jint okra_status = _okra_create_kernel(_device_context, code, entryPointName, (void**)&okra_kernel); 350 {
348 guarantee(okra_status==0, "_okra_create_kernel failed"); 351 TraceTime t("generate kernel ", TraceGPUInteraction);
352 jint okra_status = _okra_create_kernel(_device_context, code, entryPointName, (void**)&okra_kernel);
353 guarantee(okra_status==0, "_okra_create_kernel failed");
354 }
349 return (jlong) okra_kernel; 355 return (jlong) okra_kernel;
350 GPU_END 356 GPU_END
351 357
352 #if defined(LINUX) 358 #if defined(LINUX)
353 static const char* okra_library_name = "libokra_x86_64.so"; 359 static const char* okra_library_name = "libokra_x86_64.so";