[HIP] Reclaiming hipLaunchKernel API (#1353)
* [HIP] Reclaiming hipLaunchKernel API * Reclaiming hipLaunchKernel : Incorporated review comments * Incorporated review comments * Removed hipLaunchKernel Macro from nvcc path
Этот коммит содержится в:
коммит произвёл
Maneesh Gupta
родитель
d2df21e58c
Коммит
1ae43cbeba
@@ -1238,3 +1238,31 @@ hipError_t hipOccupancyMaxActiveBlocksPerMultiprocessorWithFlags(
|
||||
return ihipLogStatus(ihipOccupancyMaxActiveBlocksPerMultiprocessor(
|
||||
tls, numBlocks, f, blockSize, dynSharedMemPerBlk));
|
||||
}
|
||||
|
||||
hipError_t hipLaunchKernel(
|
||||
const void* func_addr, dim3 numBlocks, dim3 dimBlocks, void** args,
|
||||
size_t sharedMemBytes, hipStream_t stream)
|
||||
{
|
||||
HIP_INIT_API(hipLaunchKernel,func_addr,numBlocks,dimBlocks,args,sharedMemBytes,stream);
|
||||
|
||||
hipFunction_t kd = hip_impl::get_program_state().kernel_descriptor((std::uintptr_t)func_addr,
|
||||
hip_impl::target_agent(stream));
|
||||
|
||||
if(kd == nullptr || kd->_header == nullptr)
|
||||
return ihipLogStatus(hipErrorInvalidValue);
|
||||
|
||||
size_t szKernArg = kd->_header->kernarg_segment_byte_size;
|
||||
|
||||
if(args == NULL && szKernArg != 0)
|
||||
return ihipLogStatus(hipErrorInvalidValue);
|
||||
|
||||
void* config[]{
|
||||
HIP_LAUNCH_PARAM_BUFFER_POINTER,
|
||||
args,
|
||||
HIP_LAUNCH_PARAM_BUFFER_SIZE,
|
||||
&szKernArg,
|
||||
HIP_LAUNCH_PARAM_END};
|
||||
|
||||
return ihipLogStatus(ihipModuleLaunchKernel(tls, kd, numBlocks.x * dimBlocks.x, numBlocks.y * dimBlocks.y, numBlocks.z * dimBlocks.z,
|
||||
dimBlocks.x, dimBlocks.y, dimBlocks.z, sharedMemBytes, stream, nullptr, (void**)&config, nullptr, nullptr, 0));
|
||||
}
|
||||
|
||||
Ссылка в новой задаче
Block a user