diff --git a/projects/clr/hipamd/README.md b/projects/clr/hipamd/README.md index f61c3b106a..d54032c6df 100644 --- a/projects/clr/hipamd/README.md +++ b/projects/clr/hipamd/README.md @@ -32,6 +32,7 @@ HIP releases are typically of two types. The tag naming convention is different - [HIP Runtime API (Doxygen)](http://gpuopen-professionalcompute-tools.github.io/HIP) - [HIP Porting Guide](docs/markdown/hip_porting_guide.md) - [HIP Porting Driver Guide](docs/markdown/hip_porting_driver_api.md) +- [HIP Profiling and Debugging](docs/markdown/hip_profiling.md) - [HIP Terminology](docs/markdown/hip_terms.md) (including Rosetta Stone of GPU computing terms across CUDA/HIP/HC/AMP/OpenL) - [hipify-clang](hipify-clang/README.md) - [Developer/CONTRIBUTING Info](CONTRIBUTING.md) diff --git a/projects/clr/hipamd/docs/markdown/hip_profiling.md b/projects/clr/hipamd/docs/markdown/hip_profiling.md index 6e5cde700d..b5c4672464 100644 --- a/projects/clr/hipamd/docs/markdown/hip_profiling.md +++ b/projects/clr/hipamd/docs/markdown/hip_profiling.md @@ -267,6 +267,11 @@ info: check result PASSED! ``` +HIP_TRACE_API supports multiple levels of debug information: + - 0x1 = print all HIP APIs + - 0x2 = print HIP APIs which initiate GPU kernels, copies, or memsets. Includes hipLaunchKernel, hipMemcpy*, hipMemset*. + - 0x4 = print HIP APIs which allocate or free memory. Includes hipMalloc, hipHostMalloc, hipFree, hipHostFree. + #### Color Note this trace mode uses colors. "less -r" can handle raw control characters and will display the debug output in proper colors. diff --git a/projects/clr/hipamd/src/hip_hcc.cpp b/projects/clr/hipamd/src/hip_hcc.cpp index a655e35aa1..07604fe85d 100644 --- a/projects/clr/hipamd/src/hip_hcc.cpp +++ b/projects/clr/hipamd/src/hip_hcc.cpp @@ -1435,7 +1435,7 @@ hipStream_t ihipSyncAndResolveStream(hipStream_t stream) void ihipPrintKernelLaunch(const char *kernelName, const grid_launch_parm *lp, const hipStream_t stream) { - if ((HIP_TRACE_API & (1< dpitch || width > spitch) return ihipLogStatus(hipErrorUnknown); @@ -826,7 +826,7 @@ hipError_t hipMemcpy2D(void* dst, size_t dpitch, const void* src, size_t spitch, hipError_t hipMemcpy2DToArray(hipArray* dst, size_t wOffset, size_t hOffset, const void* src, size_t spitch, size_t width, size_t height, hipMemcpyKind kind) { - HIP_INIT_CMD_API(dst, wOffset, hOffset, src, spitch, width, height, kind); + HIP_INIT_SPECIAL_API((TRACE_MCMD), dst, wOffset, hOffset, src, spitch, width, height, kind); hipStream_t stream = ihipSyncAndResolveStream(hipStreamNull); @@ -879,7 +879,7 @@ hipError_t hipMemcpy2DToArray(hipArray* dst, size_t wOffset, size_t hOffset, con hipError_t hipMemcpyToArray(hipArray* dst, size_t wOffset, size_t hOffset, const void* src, size_t count, hipMemcpyKind kind) { - HIP_INIT_CMD_API(dst, wOffset, hOffset, src, count, kind); + HIP_INIT_SPECIAL_API((TRACE_MCMD), dst, wOffset, hOffset, src, count, kind); hipStream_t stream = ihipSyncAndResolveStream(hipStreamNull); @@ -938,7 +938,7 @@ ihipMemsetKernel(hipStream_t stream, // TODO-sync: function is async unless target is pinned host memory - then these are fully sync. hipError_t hipMemsetAsync(void* dst, int value, size_t sizeBytes, hipStream_t stream ) { - HIP_INIT_CMD_API(dst, value, sizeBytes, stream); + HIP_INIT_SPECIAL_API((TRACE_MCMD), dst, value, sizeBytes, stream); hipError_t e = hipSuccess; @@ -988,7 +988,7 @@ hipError_t hipMemsetAsync(void* dst, int value, size_t sizeBytes, hipStream_t s hipError_t hipMemset(void* dst, int value, size_t sizeBytes ) { - HIP_INIT_CMD_API(dst, value, sizeBytes); + HIP_INIT_SPECIAL_API((TRACE_MCMD), dst, value, sizeBytes); hipError_t e = hipSuccess; @@ -1148,7 +1148,7 @@ hipError_t hipMemPtrGetInfo(void *ptr, size_t *size) hipError_t hipFree(void* ptr) { - HIP_INIT_API(ptr); + HIP_INIT_SPECIAL_API((TRACE_MEM), ptr); hipError_t hipStatus = hipErrorInvalidDevicePointer; @@ -1176,7 +1176,7 @@ hipError_t hipFree(void* ptr) hipError_t hipHostFree(void* ptr) { - HIP_INIT_API(ptr); + HIP_INIT_SPECIAL_API((TRACE_MEM), ptr); // Synchronize to ensure all work has finished. ihipGetTlsDefaultCtx()->locked_waitAllStreams(); // ignores non-blocking streams, this waits for all activity to finish. @@ -1210,7 +1210,7 @@ hipError_t hipFreeHost(void* ptr) hipError_t hipFreeArray(hipArray* array) { - HIP_INIT_API(array); + HIP_INIT_SPECIAL_API((TRACE_MEM), array); hipError_t hipStatus = hipErrorInvalidDevicePointer;