P4 to Git Change 2024454 by axie@axie-hip-rocm on 2019/11/04 14:38:31
SWDEV-198863 - Options for hip-clang-vdi path to provide the chicken bits, or functional equivalents to HCC_DB (phase 1) 1. The log macros is turned off for release build. So log functions has zero impact to release build. 2. The log macros have level, mask, condition control. So we can have more control to avoid log flooding. I also adjusted some existing log to use new log functions. 1. To excercise and test the new log functions. 2. To improve performance slightly. 3. The change is mainly for HIP-ROCM, we can move more in next phases for PAL or ORCA. 4. I make these log feature unavailable for release build. We can revert to old log functions for release build in a case by case method. Tests: 1. http://ocltc.amd.com:8111/viewModification.html?modId=128289&personal=true&tab=vcsModificationBuilds http://ocltc.amd.com:8111/viewModification.html?modId=128358&personal=true&tab=vcsModificationBuilds 2. release build, run hip program, there is no log 3. fastdebug build, run hip program, export LOG_LEVEL=3 export GPU_LOG_MASK=4294967295 There was a lot of logs. 4. fastdebug build, run hip program, export LOG_LEVEL=2 export GPU_LOG_MASK=4294967295 There was no logs. 5. fastdebug build, run hip program, export LOG_LEVEL=3 export GPU_LOG_MASK=4294967294 There was much less logs. 6. fastdebug build, run hip program, export LOG_LEVEL=3 export GPU_LOG_MASK=47102 There was even much less logs. The logs was expected according to the mask. 7. Tested step 2 to 6 similarily in Windows and Linux ReviewBoard: http://ocltc.amd.com/reviews/r/18215 Affected files ... ... //depot/stg/opencl/drivers/opencl/api/hip/hip_internal.hpp#46 edit ... //depot/stg/opencl/drivers/opencl/api/hip/hip_memory.cpp#82 edit ... //depot/stg/opencl/drivers/opencl/api/hip/hip_stream.cpp#26 edit ... //depot/stg/opencl/drivers/opencl/api/hip/hiprtc_internal.hpp#2 edit ... //depot/stg/opencl/drivers/opencl/api/opencl/amdocl/cl_svm.cpp#29 edit ... //depot/stg/opencl/drivers/opencl/runtime/device/comgrctx.cpp#6 edit ... //depot/stg/opencl/drivers/opencl/runtime/device/devkernel.cpp#29 edit ... //depot/stg/opencl/drivers/opencl/runtime/device/devprogram.cpp#68 edit ... //depot/stg/opencl/drivers/opencl/runtime/device/rocm/rocdevice.cpp#137 edit ... //depot/stg/opencl/drivers/opencl/runtime/device/rocm/rocvirtual.cpp#91 edit ... //depot/stg/opencl/drivers/opencl/runtime/platform/command.cpp#100 edit ... //depot/stg/opencl/drivers/opencl/runtime/platform/commandqueue.cpp#32 edit ... //depot/stg/opencl/drivers/opencl/runtime/platform/runtime.cpp#40 edit ... //depot/stg/opencl/drivers/opencl/runtime/utils/debug.hpp#10 edit ... //depot/stg/opencl/drivers/opencl/runtime/utils/flags.hpp#323 edit
This commit is contained in:
@@ -14,6 +14,26 @@ namespace amd { /*@{*/
|
||||
|
||||
enum LogLevel { LOG_NONE = 0, LOG_ERROR = 1, LOG_WARNING = 2, LOG_INFO = 3, LOG_DEBUG = 4 };
|
||||
|
||||
enum LogMask {
|
||||
LOG_API = 0x00000001, //!< API call
|
||||
LOG_CMD = 0x00000002, //!< Kernel and Copy Commands and Barriers
|
||||
LOG_WAIT = 0x00000004, //!< Synchronization and waiting for commands to finish
|
||||
LOG_AQL = 0x00000008, //!< Decode and display AQL packets
|
||||
LOG_QUEUE = 0x00000010, //!< Queue commands and queue contents
|
||||
LOG_SIG = 0x00000020, //!< Signal creation, allocation, pool
|
||||
LOG_LOCK = 0x00000040, //!< Locks and thread-safety code.
|
||||
LOG_KERN = 0x00000080, //!< kernel creations and arguments, etc.
|
||||
LOG_COPY = 0x00000100, //!< Copy debug
|
||||
LOG_COPY2 = 0x00000200, //!< Detailed copy debug
|
||||
LOG_RESOURCE = 0x00000400, //!< Resource allocation, performance-impacting events.
|
||||
LOG_INIT = 0x00000800, //!< Initialization and shutdown
|
||||
LOG_MISC = 0x00001000, //!< misc debug, not yet classified
|
||||
LOG_AQL2 = 0x00002000, //!< Show raw bytes of AQL packet
|
||||
LOG_CODE = 0x00004000, //!< Show code creation debug
|
||||
LOG_CMD2 = 0x00008000, //!< More detailed command info, including barrier commands
|
||||
LOG_ALWAYS = 0xFFFFFFFF, //!< Log always even mask flag is zero
|
||||
};
|
||||
|
||||
//! \cond ignore
|
||||
extern "C" void breakpoint();
|
||||
//! \endcond
|
||||
@@ -137,4 +157,35 @@ inline void warning(const char* msg) { amd::report_warning(msg); }
|
||||
|
||||
#define DebugInfoGuarantee(cond) LogGuarantee(cond, amd::LOG_INFO, "Warning")
|
||||
|
||||
#ifndef NDEBUG
|
||||
#define CL_LOG
|
||||
#endif
|
||||
// You may define CL_LOG to enable following log functions even for release build
|
||||
#ifdef CL_LOG
|
||||
#define ClPrint(level, mask, format, ...) \
|
||||
do { \
|
||||
if (LOG_LEVEL >= level) { \
|
||||
if (GPU_LOG_MASK & mask || mask == amd::LOG_ALWAYS) { \
|
||||
amd::log_printf(level, __FILE__, __LINE__, format, ##__VA_ARGS__); \
|
||||
} \
|
||||
} \
|
||||
} while (false)
|
||||
|
||||
#define ClCondPrint(level, mask, condition, format, ...) \
|
||||
do { \
|
||||
if (LOG_LEVEL >= level && (condition)) { \
|
||||
if (GPU_LOG_MASK & mask || mask == amd::LOG_ALWAYS) { \
|
||||
amd::log_printf(level, __FILE__, __LINE__, format, ##__VA_ARGS__); \
|
||||
} \
|
||||
} \
|
||||
} while (false)
|
||||
|
||||
#define ClTrace(level, mask) ClPrint(level, mask, "%s", __func__)
|
||||
|
||||
#else /*CL_LOG*/
|
||||
#define ClPrint(level, mask, format, ...) (void)(0)
|
||||
#define ClCondPrint(level, mask, condition, format, ...) (void)(0)
|
||||
#define ClTrace(level, mask) (void)(0)
|
||||
#endif /*CL_LOG*/
|
||||
|
||||
#endif /*DEBUG_HPP_*/
|
||||
|
||||
Reference in New Issue
Block a user