@@ -32,8 +32,6 @@ def _substitute_process_id(path: str) -> str:
3232
3333 This is useful for multi-process/multi-GPU environments where each process
3434 needs its own log file.
35-
36- Example: "flashinfer_log_%i.txt" -> "flashinfer_log_12345.txt"
3735 """
3836 if "%i" in path :
3937 return path .replace ("%i" , str (os .getpid ()))
@@ -46,38 +44,6 @@ def _substitute_process_id(path: str) -> str:
4644 os .environ .get ("FLASHINFER_LOGDEST_DBG" , "stdout" )
4745)
4846
49- # Enable cuDNN, cuBLAS, and cuBLASLt API logging when FlashInfer logging level >= 5
50- # Only override if the user hasn't already configured the logging switch
51- # If the switch is not set, we override both the switch and destination as a bundle
52- if _API_LOG_LEVEL >= 5 :
53- # cuBLAS logging: Check switch, set both switch and destination
54- if "CUBLAS_LOGINFO_DBG" not in os .environ :
55- os .environ ["CUBLAS_LOGINFO_DBG" ] = "1"
56- os .environ ["CUBLAS_LOGDEST_DBG" ] = _substitute_process_id (
57- "flashinfer_cublas_log_%i.txt"
58- )
59-
60- # cuBLASLt logging: Check switch, set both switch and destination
61- if "CUBLASLT_LOG_LEVEL" not in os .environ :
62- os .environ ["CUBLASLT_LOG_LEVEL" ] = "2"
63- os .environ ["CUBLASLT_LOG_FILE" ] = _substitute_process_id (
64- "flashinfer_cublaslt_log_%i.txt"
65- )
66-
67- # cuDNN backend logging: Check switch, set both switch and destination
68- if "CUDNN_LOGLEVEL_DBG" not in os .environ :
69- os .environ ["CUDNN_LOGLEVEL_DBG" ] = "2.5"
70- os .environ ["CUDNN_LOGDEST_DBG" ] = _substitute_process_id (
71- "flashinfer_cudnn_backend_log_%i.txt"
72- )
73-
74- # cuDNN frontend logging: Check switch, set both switch and destination
75- if "CUDNN_FRONTEND_LOG_INFO" not in os .environ :
76- os .environ ["CUDNN_FRONTEND_LOG_INFO" ] = "1"
77- os .environ ["CUDNN_FRONTEND_LOG_FILE" ] = _substitute_process_id (
78- "flashinfer_cudnn_frontend_log_%i.txt"
79- )
80-
8147# Create logger using Python's logging library
8248_logger = logging .getLogger ("flashinfer.api" )
8349
@@ -185,28 +151,6 @@ def _log_system_info():
185151 # PyTorch version
186152 lines .append (f"PyTorch version: { torch .__version__ } " )
187153
188- # cuDNN/cuBLAS/cuBLASLt logging status
189- if _API_LOG_LEVEL >= 5 :
190- lines .append ("" )
191- lines .append ("cuDNN/cuBLAS/cuBLASLt Logging: Enabled (Level 5)" )
192- cublas_info = os .environ .get ("CUBLAS_LOGINFO_DBG" , "not set" )
193- cublas_dest = os .environ .get ("CUBLAS_LOGDEST_DBG" , "not set" )
194- cublaslt_level = os .environ .get ("CUBLASLT_LOG_LEVEL" , "not set" )
195- cublaslt_file = os .environ .get ("CUBLASLT_LOG_FILE" , "not set" )
196- cudnn_level = os .environ .get ("CUDNN_LOGLEVEL_DBG" , "not set" )
197- cudnn_dest = os .environ .get ("CUDNN_LOGDEST_DBG" , "not set" )
198- cudnn_fe_info = os .environ .get ("CUDNN_FRONTEND_LOG_INFO" , "not set" )
199- cudnn_fe_file = os .environ .get ("CUDNN_FRONTEND_LOG_FILE" , "not set" )
200-
201- lines .append (f" CUBLAS_LOGINFO_DBG={ cublas_info } " )
202- lines .append (f" CUBLAS_LOGDEST_DBG={ cublas_dest } " )
203- lines .append (f" CUBLASLT_LOG_LEVEL={ cublaslt_level } " )
204- lines .append (f" CUBLASLT_LOG_FILE={ cublaslt_file } " )
205- lines .append (f" CUDNN_LOGLEVEL_DBG={ cudnn_level } " )
206- lines .append (f" CUDNN_LOGDEST_DBG={ cudnn_dest } " )
207- lines .append (f" CUDNN_FRONTEND_LOG_INFO={ cudnn_fe_info } " )
208- lines .append (f" CUDNN_FRONTEND_LOG_FILE={ cudnn_fe_file } " )
209-
210154 except Exception as e :
211155 lines .append (f"Error gathering system information: { e } " )
212156
@@ -519,7 +463,7 @@ def _log_function_outputs(func_name: str, result: Any, level: int) -> None:
519463 _logger .debug ("\n " .join (lines ))
520464
521465
522- def flashinfer_api_log (func : Callable = None ) -> Callable :
466+ def flashinfer_log (func : Callable = None ) -> Callable :
523467 """
524468 Decorator to log FlashInfer API calls using Python's logging library.
525469
@@ -544,7 +488,7 @@ def flashinfer_api_log(func: Callable = None) -> Callable:
544488 --------
545489 Basic usage:
546490
547- >>> @flashinfer_api_log
491+ >>> @flashinfer_log
548492 ... def my_function(x, y):
549493 ... return x + y
550494
@@ -563,13 +507,7 @@ def flashinfer_api_log(func: Callable = None) -> Callable:
563507 - **CUDA Graph Compatibility**: At level 5, tensor statistics (min/max/mean/nan_count)
564508 are automatically skipped during CUDA graph capture to avoid synchronization issues.
565509 The message "[statistics skipped: CUDA graph capture in progress]" will be logged.
566- - **cuDNN/cuBLAS/cuBLASLt Integration**: At level 5, if not already set by the user, the following
567- environment variables are automatically configured to enable cuDNN, cuBLAS, and cuBLASLt logging:
568- - CUBLAS_LOGINFO_DBG=1, CUBLAS_LOGDEST_DBG=flashinfer_cublas_log_%i.txt
569- - CUBLASLT_LOG_LEVEL=2, CUBLASLT_LOG_FILE=flashinfer_cublaslt_log_%i.txt
570- - CUDNN_LOGLEVEL_DBG=2.5, CUDNN_LOGDEST_DBG=flashinfer_cudnn_backend_log_%i.txt
571- - CUDNN_FRONTEND_LOG_INFO=1, CUDNN_FRONTEND_LOG_FILE=flashinfer_cudnn_frontend_log_%i.txt
572- The %i pattern is automatically replaced with the process ID for multi-process environments.
510+ - The %i pattern is automatically replaced with the process ID for multi-process environments.
573511 - The logger does not propagate to the root logger to avoid duplicate logs.
574512 """
575513 # If logging is disabled, return original function with zero overhead
@@ -621,7 +559,6 @@ def wrapper(*args, **kwargs):
621559
622560 return wrapper
623561
624- # Support both @flashinfer_api_log and @flashinfer_api_log()
625562 if func is None :
626563 return decorator
627564 return decorator (func )
0 commit comments