Refactor trace code for hipLaunchKernel.

- Use standard print functions for streams.
- Add HIP_INIT macro, for cases where we want to initialize HIP but not
  log an API (ihipPreKernelLaunch).

Change-Id: If43cf8a363d918bcd3722a2e6a965d4cfa2e03e7


[ROCm/clr commit: fa9b95838a]
This commit is contained in:
Ben Sander
2016-08-29 18:37:57 -05:00
parent f538d2e510
commit 78cfa5f6d6
3 changed files with 23 additions and 12 deletions
+8 -1
View File
@@ -1314,13 +1314,20 @@ hipStream_t ihipSyncAndResolveStream(hipStream_t stream)
}
}
void ihipPrintKernelLaunch(const char *kernelName, const grid_launch_parm *lp, const hipStream_t stream)
{
std::string streamString = ToString(stream);
fprintf(stderr, KGRN "<<hip-api: hipLaunchKernel '%s' gridDim:(%d,%d,%d) groupDim:(%d,%d,%d) groupMem:+%d %s\n" KNRM, \
kernelName, lp->grid_dim.x, lp->grid_dim.y, lp->grid_dim.z, lp->group_dim.x, lp->group_dim.y, lp->group_dim.z,
lp->dynamic_group_mem_bytes, streamString.c_str());\
}
// TODO - data-up to data-down:
// Called just before a kernel is launched from hipLaunchKernel.
// Allows runtime to track some information about the stream.
hipStream_t ihipPreLaunchKernel(hipStream_t stream, dim3 grid, dim3 block, grid_launch_parm *lp)
{
HIP_INIT_API(stream, grid, block, lp);
HIP_INIT();
stream = ihipSyncAndResolveStream(stream);
#if USE_GRID_LAUNCH_20
lp->grid_dim.x = grid.x;