Mercurial > hg > graal-jvmci-8
comparison src/gpu/ptx/vm/gpu_ptx.cpp @ 13683:de839ec35cc7
schedule lambda method compilation and execution on GPU (PTX) when possible; fix a couple of bugs.
author | S.Bharadwaj Yadavalli <bharadwaj.yadavalli@oracle.com> |
---|---|
date | Fri, 17 Jan 2014 16:03:13 -0500 |
parents | fff17b5dff8a |
children | 80cd5c3b8827 |
comparison
equal
deleted
inserted
replaced
13682:c4ff08d2aa0d | 13683:de839ec35cc7 |
---|---|
329 tty->print_cr("[CUDA] *** Error: Failed to get function %s", name); | 329 tty->print_cr("[CUDA] *** Error: Failed to get function %s", name); |
330 return NULL; | 330 return NULL; |
331 } | 331 } |
332 | 332 |
333 if (TraceGPUInteraction) { | 333 if (TraceGPUInteraction) { |
334 tty->print_cr("[CUDA] Got function handle for %s", name); | 334 tty->print_cr("[CUDA] Got function handle for %s kernel address %p", name, cu_function); |
335 } | 335 } |
336 | 336 |
337 return cu_function; | 337 return cu_function; |
338 } | 338 } |
339 | 339 |
373 tty->print_cr("[CUDA] *** Error (%d) Failed to allocate memory for return value pointer on device", status); | 373 tty->print_cr("[CUDA] *** Error (%d) Failed to allocate memory for return value pointer on device", status); |
374 SharedRuntime::throw_and_post_jvmti_exception(thread, vmSymbols::java_lang_RuntimeException(), "[CUDA] Failed to allocate memory for return value pointer on device"); | 374 SharedRuntime::throw_and_post_jvmti_exception(thread, vmSymbols::java_lang_RuntimeException(), "[CUDA] Failed to allocate memory for return value pointer on device"); |
375 return 0L; | 375 return 0L; |
376 } | 376 } |
377 // Push device_return_value to kernelParams | 377 // Push device_return_value to kernelParams |
378 gpu::Ptx::CUdeviceptr* returnValuePtr = (gpu::Ptx::CUdeviceptr*) (address) parametersAndReturnValueBuffer + parametersAndReturnValueBufferSize - sizeof(device_return_value); | 378 gpu::Ptx::CUdeviceptr* returnValuePtr = (gpu::Ptx::CUdeviceptr*) |
379 ((address) parametersAndReturnValueBuffer + | |
380 parametersAndReturnValueBufferSize - sizeof(device_return_value)); | |
379 *returnValuePtr = device_return_value; | 381 *returnValuePtr = device_return_value; |
380 } | 382 } |
381 | 383 |
382 status = _cuda_cu_launch_kernel(cu_function, | 384 status = _cuda_cu_launch_kernel(cu_function, |
383 gridX, gridY, gridZ, | 385 gridX, gridY, gridZ, |
415 SharedRuntime::throw_and_post_jvmti_exception(thread, vmSymbols::java_lang_Exception(), "[CUDA] Failed to copy value from device argument"); | 417 SharedRuntime::throw_and_post_jvmti_exception(thread, vmSymbols::java_lang_Exception(), "[CUDA] Failed to copy value from device argument"); |
416 return 0L; | 418 return 0L; |
417 } | 419 } |
418 thread->set_vm_result(return_val); | 420 thread->set_vm_result(return_val); |
419 } else if (returnTypeSize > 0) { | 421 } else if (returnTypeSize > 0) { |
420 status = gpu::Ptx::_cuda_cu_memcpy_dtoh(&primitiveReturnValue, device_return_value, T_LONG_BYTE_SIZE); | 422 status = gpu::Ptx::_cuda_cu_memcpy_dtoh(&primitiveReturnValue, device_return_value, returnTypeSize); |
421 if (status != GRAAL_CUDA_SUCCESS) { | 423 if (status != GRAAL_CUDA_SUCCESS) { |
422 tty->print_cr("[CUDA] *** Error (%d) Failed to copy value from device argument", status); | 424 tty->print_cr("[CUDA] *** Error (%d) Failed to copy value from device argument", status); |
423 SharedRuntime::throw_and_post_jvmti_exception(thread, vmSymbols::java_lang_Exception(), "[CUDA] Failed to copy value from device argument"); | 425 SharedRuntime::throw_and_post_jvmti_exception(thread, vmSymbols::java_lang_Exception(), "[CUDA] Failed to copy value from device argument"); |
424 return 0L; | 426 return 0L; |
425 } | 427 } |