Creates an NVTX range annotation for debugging purposes. Similar to nvtx_range, but only creates the range if specific environment variables are set, making it suitable for debug profiling. Args: msg (str): The message/name for the NVTX range. color (str, optional)
(msg: str,
color: str = "grey",
domain: str = "TensorRT-LLM",
category: Optional[str] = None)
| 920 | |
| 921 | |
| 922 | def nvtx_range_debug(msg: str, |
| 923 | color: str = "grey", |
| 924 | domain: str = "TensorRT-LLM", |
| 925 | category: Optional[str] = None): |
| 926 | """ |
| 927 | Creates an NVTX range annotation for debugging purposes. |
| 928 | |
| 929 | Similar to nvtx_range, but only creates the range if specific environment |
| 930 | variables are set, making it suitable for debug profiling. |
| 931 | |
| 932 | Args: |
| 933 | msg (str): The message/name for the NVTX range. |
| 934 | color (str, optional): The color to use for the range in the profiler. Defaults to "grey". |
| 935 | domain (str, optional): The domain name for the range. Defaults to "TensorRT-LLM". |
| 936 | category (str, optional): The category for the range. Defaults to None. |
| 937 | |
| 938 | Returns: |
| 939 | contextmanager: A context manager that either marks the NVTX range if enabled, |
| 940 | or a null context manager that does nothing if disabled. |
| 941 | """ |
| 942 | if os.getenv("TLLM_LLMAPI_ENABLE_NVTX", "0") == "1" or \ |
| 943 | os.getenv("TLLM_NVTX_DEBUG", "0") == "1": |
| 944 | return nvtx_range(msg, color=color, domain=domain, category=category) |
| 945 | else: |
| 946 | return _null_context_manager() |
| 947 | |
| 948 | |
| 949 | def nvtx_mark_debug(msg: str, |
no test coverage detected