fix(ci): use subprocess for Triton compile helpers - #28775
Merged
Conversation
…ith 'import' and 'import from'' Co-authored-by: Copilot Autofix powered by AI <62310815+github-advanced-security[bot]@users.noreply.github.com>
Contributor
There was a problem hiding this comment.
Pull request overview
This PR updates the Triton AoT compile helper to execute external tooling (objcopy, ar) via subprocess.run() instead of shelling out with os.system(), and adds unit tests intended to regression-test that behavior in CI.
Changes:
- Replaced shell-based
objcopy/arinvocations withsubprocess.run(..., cwd=..., check=True)incompile_triton.py. - Added a new unittest module to validate
subprocess.runusage (and thatos.systemis not used). - Hardened output directory handling for
--obj_filepaths with no directory component.
Reviewed changes
Copilot reviewed 2 out of 2 changed files in this pull request and generated 6 comments.
| File | Description |
|---|---|
| tools/ci_build/compile_triton.py | Switches external command execution to subprocess.run() and tweaks output directory creation. |
| tools/ci_build/test_compile_triton.py | Adds regression tests to validate subprocess-based command execution behavior. |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
skottmckay
approved these changes
Jun 4, 2026
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
This PR replaces shell-based command execution in the Triton compile helper with
subprocess.run(), and adds regression tests to lock in that behavior.Key Changes
tools/ci_build/compile_triton.pyto usesubprocess.run()forobjcopyandarexecution instead ofos.system().tools/ci_build/test_compile_triton.pyto verify the helper functions invoke subprocess-based command execution and preserve the expected working directory and error handling.os.makedirs(..., exist_ok=True).Why
The previous shell-based implementation was fragile and harder to test. Using
subprocess.run()makes the command execution path explicit, easier to validate, and safer for CI and cross-platform invocation.Testing
source .venv/bin/activate && python -m unittest tools.ci_build.test_compile_tritonsource .venv/bin/activate && lintrunner -a