Using logging and heuristics#
This topic contains information about debugging and improving the application performance when using the hipBLASLt APIs.
Logging#
You can enable the hipBLASLt logging mechanism by setting the following environment variables before launching the target application:
HIPBLASLT_LOG_LEVEL=<level>: Thelevelcan be one of the following values:Value
Setting
Description
0Off
Logging is disabled (default)
1Error
Only errors are logged
2Trace
API calls that launch HIP kernels log their parameters and important information
3Hints
Hints that can potentially improve the application’s performance
4Info
Provides general information about the library execution and can contain details about the heuristic status
5API trace
API calls log their parameters and important information
HIPBLASLT_LOG_MASK=<mask>: Themaskis a combination of the following flags:Value
Description
0Off
1Error
2Trace
4Hints
8Info
16API trace
32Bench
64Profile
128Extended profile
The levels are cumulative: level
4also enables errors, trace and hints, and level5enables everything above it.HIPBLASLT_LOG_MASKis only consulted whenHIPBLASLT_LOG_LEVELis unset, and unlike a level it selects exactly the flags you list.HIPBLASLT_LOG_FILE=<file_name>: Thefile_nameis a path to a logging file. The file name can contain%i, which is replaced with the process ID, for example,<file_name>_%i.log. IfHIPBLASLT_LOG_FILEis not defined, the log messages are printed to stderr. This variable has no effect on its own: the log file is opened only whenHIPBLASLT_LOG_LEVELorHIPBLASLT_LOG_MASKhas enabled logging.HIPBLASLT_ENABLE_MARKER=1: SettingHIPBLASLT_ENABLE_MARKERto1enables marker trace for ROCProfiler profiling.
Heuristics cache#
hipBLASLt uses heuristics to pick the most suitable matmul kernel for execution based on the problem sizes, GPU configuration, and other parameters. This requires performing some computations on the host CPU, which could take tens of microseconds. To overcome this overhead, it’s recommended that you query the heuristics once using hipblasLtMatmulAlgoGetHeuristic(), then reuse the result for subsequent computations using hipblasLtMatmul().