Skip to content

[ATen] Add torch.__config__._cxx_compiler() - #200715

Closed
georgehong wants to merge 1 commit into
gh/georgehong/23/basefrom
gh/georgehong/23/head
Closed

georgehong wants to merge 1 commit into
gh/georgehong/23/basefrom
gh/georgehong/23/head

Conversation

@georgehong

@georgehong georgehong commented Oct 13, 2026 •

Copy link
Copy Markdown
Contributor

Stack from ghstack (oldest at bottom):

Summary:
Adds torch.__config__._cxx_compiler(), which returns the compiler that built PyTorch and its version, e.g. ("gcc", "11.4"), ("clang", "21.1.0") or ("msvc", "194134120"). The values come from the same macros torch.__config__.show() prints, without show()'s device checks.

The test run report writer (#200470) records the compiler, and today parses it out of show(). However, show() calls hasCUDA(), which initializes the CUDA driver and poisons fork in the test process. With this, the writer can read the compiler without touching the device.

Test Plan:

python test/test_torch.py -k test_cxx_compiler

test_cxx_compiler checks the result against the compiler line show() prints.

Authored with the help of an AI assistant (Claude).

cc @voznesenskym @penguinwu @EikanWang @jgong5 @Guobing-Chen @XiaobingSuper @zhuhaozhe @blzheng @wenzhe-nrv @jiayisunx @kadeng @chauhang @amjames @jataylo @azahed98

[ghstack-poisoned]
@pytorch-bot

pytorch-bot Bot commented Oct 13, 2026 •

Copy link
Copy Markdown

🔗 Helpful Links

🧪 See artifacts and rendered test results at hud.pytorch.org/pr/200715

Note: Links to docs will display an error until the docs builds have been completed.

✅ You can merge normally! (1 Unrelated Failure)

As of commit bf2f98a with merge base 45e85ce (image):

🟡 GREEN LIGHT - PR requires human review:

  • Triviality
    • Adds a new C++ API at::get_cxx_compiler in aten/src/ATen/Version.h and a Python binding torch._C._cxx_compiler in torch/csrc/Module.cpp
    • New functionality fits no trivial class: not a no-op, doc, additive test, refactor, or single-cause bugfix
  • Design questions for a reviewer
    • Return shape (gcc major.minor only, msvc as raw _MSC_FULL_VER, empty pair fallback) becomes a format that #​200716's report writer records
    • Exports a new TORCH_API symbol from ATen, a surface others may start to depend on
  • Correctness
    • Macro order (clang, then MSVC, then GCC) and version formats match the show_config lines in aten/src/ATen/Version.cpp
    • test_cxx_compiler in test/test_torch.py checks the result against the line torch.__config__.show() prints

reason: not_trivial
Reviewed commit: bf2f98a

Inference job

🐛 Report a wrong verdict

BROKEN TRUNK - The following job failed but were present on the merge base:

👉 Rebase onto the `viable/strict` branch to avoid these failures

This comment was automatically generated by Dr. CI and updates every 15 minutes.

@pytorchmergebot

Copy link
Copy Markdown
Collaborator

Starting merge as part of PR stack under #200470

pytorchmergebot pushed a commit that referenced this pull request Oct 13, 2026
…00716)

**Summary:**
The test run report writer now reads the compiler from `torch.__config__._cxx_compiler()` instead of parsing `torch.__config__.show()`. `show()` calls `hasCUDA()`, which initializes the CUDA driver and poisons fork in the test process.

**Test Plan:**
```
python test/torchci/test_testing.py
```
`test_compiler` mocks `torch.__config__._cxx_compiler()`, and the DNM PR on top (#200471) writes reports from a torch built with it.

Authored with the help of an AI assistant (Claude).

Pull Request resolved: #200716
Approved by: https://github.com/jathu
ghstack dependencies: #200715
pytorchmergebot pushed a commit that referenced this pull request Oct 13, 2026
…ructure (#200470)

Uploads jsonl reports in a flat directory structure:
```
s3://gha-artifacts/torchci-reports/<org>/<repo>/<run id>/<job id>/<file>-<uuid>.report.jsonl
```

This allows for us to lookup original report sources more easily, without having to unzip targets. If the ClickHouse user has a report UUID and job info, S3 lookup can be done through the above path. This means per-object writes are more frequent, but this also matches existing examples of test-jsons-while-running granularity.

ROCm jobs skip S3 (`skip-s3`), so they upload their reports as a GitHub artifact, `torchci-reports-runattempt<N>-<job id>.zip`, as does any job whose junit S3 upload fails. When the attempt completes, upload-test-stats runs `tools/stats/upload_artifacts.py`, which copies each report to the same S3 path. The copy is best effort, so a failed download or upload can't skip the test stats upload. It also skips other attempts' artifacts: the run's artifact list includes them, but their own attempt already uploaded them.

Authored with the help of an AI assistant (Claude).
Pull Request resolved: #200470
Approved by: https://github.com/jathu
ghstack dependencies: #200715, #200716
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

ciflow/inductor ciflow/torchtitan Run TorchTitan integration tests ciflow/trunk Trigger trunk jobs on your pull request Merged module: dynamo topic: not user facing topic category

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants