Skip to content

Add kernel tracing functionality #21

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
wants to merge 2 commits into
base: main
Choose a base branch
from

Conversation

FindHao
Copy link
Member

@FindHao FindHao commented Jun 24, 2025

Summary:

  • Introduced a kernel allowlist feature TRITONPARSE_KERNEL_ALLOWLIST to filter which kernels should be traced based on patterns defined in an environment variable.
  • Added functions to parse the allowlist, extract kernel names, and determine if a kernel should be traced.
  • Updated the initialization process to configure the kernel allowlist and log its status.

This enhancement improves the control over tracing, allowing users to focus on specific kernels of interest.

Test Plan:

% TORCHINDUCTOR_FX_GRAPH_CACHE=0 TRITONPARSE_DEBUG=1 TRITONPARSE_KERNEL_ALLOWLIST="add_kernel,*fused*" python tests/test_add.py
20250624 12:44:54[DEBUG] Kernel allowlist patterns: ['add_kernel', '*fused*']
20250624 12:44:54[INFO] Kernel allowlist enabled with patterns: ['add_kernel', '*fused*']
20250624 12:44:56[DEBUG] Kernel 'add_kernel' matches pattern 'add_kernel', will trace
20250624 12:44:56[DEBUG] Tracing kernel add_kernel
20250624 12:44:56[DEBUG] TritonTraceHandler: logging to /scratch/yhao/pta/tritonparse/logs/dedicated_log_triton_trace_yhao24_.ndjson
Triton kernel executed successfully
20250624 12:44:58[DEBUG] Kernel 'triton_poi_fused_add_0' matches pattern '*fused*', will trace
20250624 12:44:58[DEBUG] Tracing kernel triton_poi_fused_add_0
Torch compiled function executed successfully
tritonparse log file list: /tmp/tmp78fhgxd2/log_file_list.json

FindHao added 2 commits June 24, 2025 11:35
Summary:
- Introduced a kernel allowlist feature to filter which kernels should be traced based on patterns defined in an environment variable.
- Added functions to parse the allowlist, extract kernel names, and determine if a kernel should be traced.
- Updated the initialization process to configure the kernel allowlist and log its status.

This enhancement improves the control over tracing, allowing users to focus on specific kernels of interest.
Summary:
- Updated the debug logging setup to always set the log level to DEBUG when TRITONPARSE_DEBUG is enabled.
- Prevented propagation to the root logger to avoid duplicate messages.
- Added a check to ensure only one debug handler is added, improving logging efficiency.
- Modified the log message format for better readability.

This change improves the clarity and performance of debug logging in the application.
@facebook-github-bot facebook-github-bot added the CLA Signed This label is managed by the Meta Open Source bot. label Jun 24, 2025
@facebook-github-bot
Copy link
Contributor

@FindHao has imported this pull request. If you are a Meta employee, you can view this diff on Phabricator.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
CLA Signed This label is managed by the Meta Open Source bot.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants