-
Notifications
You must be signed in to change notification settings - Fork 168
[TRITON] Add script to select Triton tests based on diff content #1682
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
base: main
Are you sure you want to change the base?
Conversation
brunomazzottiamd
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
All of my comments need to be resolved before merging this PR.
aiter/jit/core.py
Outdated
| from cpp_extension import _jit_compile, get_hip_version | ||
| from file_baton import FileBaton | ||
| from torch_guard import torch_compile_guard # noqa: E402 | ||
| from .utils.chip_info import get_gfx, get_gfx_list |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
FIXME: Changes in aiter/jit/core.py broke AITER compilation,
| from pathlib import Path | ||
|
|
||
| # Third party libraries. | ||
| import networkx as nx |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
networkx is a third-party dependency. How can we be sure to have it installed before running the script?
|
|
||
|
|
||
| def git_filename_diff(source_branch: str, target_branch: str) -> set[Path]: | ||
| # FIXME: The statement bellow only works if the script is invoked in AITER |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Resolve this FIXME comment before merging.
242d8f4 to
c26fc58
Compare
This reverts commit 45bca63.
Motivation
Triton test step of AITER CI is taking too long and becoming a bottleneck for PR merging. We should programmatically select which Triton tests to run, based on the diff content of a given PR. The full test suite can be executed periodically on
mainbranch only.This PR proposes a Python script that given
automatically selects which Triton tests validate the changes to be merged.
Technical Details
Script help text:
Implementation details:
subprocessmodule to rungitcommands and find out what has changed between source and target branches.pathlibmodule to list all Triton source files in AITER code base (kernels, kernel configurations, unit tests, benchmark scripts).astmodule to recursively parse the Triton source files, tracking all dependency relations. These dependency relations can be between two source files or between a kernel configuration file and a kernel source file.networkxdirected graph. Later, the graph is traversed starting from the diff content until we reach unit tests. All unit tests that are reachable should be executed to validate the proposed changes.Test Plan
Tested locally with two scenarios:
aiter/ops/triton/_triton_kernels/mha.py→ MHA forward kernelaiter/ops/triton/_triton_kernels/mha_onekernel_bwd.py→ MHA backward kernelaiter/ops/triton/_triton_kernels/rope.py→ RoPE kernelaiter/ops/triton/configs/gfx942-GMM.json→ GMM kernel configurationop_tests/op_benchmarks/triton/bench_topk.py→ Top-k benchmark scriptTest Result
Summarized script output:
Test case A:
Test case B:
TODO before merging
IMPORTANT NOTICE!
mainbranch.Submission Checklist