Skip to content

[torchci] Read the compiler with torch.__config__._cxx_compiler() - #200716

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

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

Conversation

@georgehong

@georgehong georgehong commented Oct 13, 2026 •

Copy link
Copy Markdown
Contributor

Stack from ghstack (oldest at bottom):

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).

[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/200716

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

✅ No Failures

As of commit 4ce6070 with merge base 45e85ce (image):
💚 Looks good so far! There are no failures yet. 💚

🟡 GREEN LIGHT - PR requires human review:

  • Triviality
    • Single-cause bugfix in production code: _compiler() in torch/testing/_internal/torchci/environment.py stops calling torch.__config__.show() to avoid CUDA init poisoning fork
    • No class fits: this reimplements compiler detection rather than renaming or moving it, and it changes whether the device runtime initializes
  • Tests
    • test_compiler mocks torch.__config__._cxx_compiler and checks only the name/major mapping; nothing checks that capture() no longer initializes CUDA
    • Its values outlive the change: cc_compiler and cc_compiler_version go into the serialized report line that torchci consumes
  • Correctness (no defect found)
    • at::get_cxx_compiler() in aten/src/ATen/Version.cpp uses the same macros and clang-first order as show_config(), so names and majors should match the old parsing
    • A reviewer should still confirm the new fallback when _cxx_compiler is missing, since this module ships with the same torch that defines it

reason: not_trivial
Reviewed commit: 4ce6070

Inference job

🐛 Report a wrong verdict

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

Comment on lines +120 to +122
name, version = cxx_compiler()
# MSVC's version is _MSC_FULL_VER, e.g. 194134120 for 19.41.
return name, version[:2] if name == "msvc" else version.split(".")[0]

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I really do think we should keep it as is. We don't really need similarity of versions between each compiler

Suggested change
name, version = cxx_compiler()
# MSVC's version is _MSC_FULL_VER, e.g. 194134120 for 19.41.
return name, version[:2] if name == "msvc" else version.split(".")[0]
return cxx_compiler()

@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
…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/trunk Trigger trunk jobs on your pull request Merged topic: not user facing topic category

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants