Skip to content

ci(pt): use PyTorch 2.13 for Python 3.11+ CPU tests - #6123

Open
njzjz-bot wants to merge 3 commits into
deepmodeling:masterfrom
njzjz:ci/pytorch-215-cpu-py311-plus-5802
Open

njzjz-bot wants to merge 3 commits into
deepmodeling:masterfrom
njzjz:ci/pytorch-215-cpu-py311-plus-5802

Conversation

@njzjz-bot

@njzjz-bot njzjz-bot commented Nov 3, 2026 •

Copy link
Copy Markdown
Contributor

Problem

The merge queue for #5802 failed in Python 3.13's CPU DPA4C automatic-freeze test when AOTInductor emitted references to undeclared int_array_N variables. The original job is 124523329062.

The first revision of this PR selected PyTorch 2.15, but actual C++ and wheel jobs exposed an unsatisfiable dependency combination: the required vesin-torch==0.6.2 declares torch<2.15. That revision is replaced here.

Changes

Validation

Using Python 3.13.17 and torch==2.13.0+cpu:

  • Built the actual PT native extensions and verified custom-op loading.
  • Installed .[torch] with the CPU pin group through the normal resolver; the test-plus-Torch dependency dry run resolved 102 packages.
  • Ran the exact failed case, source/tests/pt_expt/test_calculator.py::test_automatic_freeze_single_artifact_matches_eager[cpu-dpa4c], twice in separate processes with separate fresh Inductor caches: 1 passed in 44.82 s, then 1 passed in 21.86 s, with no skips. Both runs compiled and loaded the AOTI artifact and compared energy, force and stress.
  • Checked 15 Python/platform marker combinations.
  • Full Ruff 0.16 lint/format and whitespace checks passed.

The complete platform CI on this pushed head is still required before merge.

Agent: ChatGPT
Model: GPT-6 Astra Pro

Windows compiler follow-up

The first 2.13 CI run exposed MSVC errors in Torch headers: designated initializers and bit-field defaults require C++20. Commit cd035fc extends the existing standard selector to MSVC with Torch >=2.13, retaining the existing >=2.14 rule for other compilers and preserving higher user-selected standards.

Twelve exact-production CMake selector cases pass. The installed Torch 2.13 headers reproduce the relevant strict-C++17 failures and compile with C++20; cmake-format 0.6.13 and whitespace checks pass. Actual Windows execution of this new revision awaits hosted CI. The twice-passing Python 3.13 CPU AOTI regression recorded above remains the runtime evidence for selecting the compatible 2.13 pin.

Agent: ChatGPT
Model: GPT-6 Astra Pro

Summary by CodeRabbit

  • Bug Fixes
    • Updated CPU-based PyTorch version selection: Python versions below 3.11 use PyTorch 2.11.0, while Python 3.11 and newer use PyTorch 2.13.0. These pins apply outside x86_64 macOS, where installation remains unpinned.
  • Compatibility
    • Updated build settings to use the required C++20 standard when building with MSVC and PyTorch 2.13.x.

Keep the PyTorch 2.11 pin for Python 3.10 and preserve the macOS
Intel fallback and GPU test pin. This exercises upstream AOTInductor
int_array codegen fixes without dropping Python 3.10 coverage.

Agent: ChatGPT
Model: GPT-6
@coderabbitai

coderabbitai Bot commented Nov 3, 2026 •

Copy link
Copy Markdown
Contributor

Review in Change Stack →

No actionable comments were generated in the recent review.

Walkthrough

PyTorch CPU pins now vary by Python version on platforms other than x86_64 macOS. The MSVC C++ standard selection now uses C++20 for PyTorch 2.13.x.

Changes: PyTorch 2.13 support

Layer / File(s) Summary
Set Python-version-specific pins
pyproject.toml
Python versions below 3.11 use PyTorch 2.11.0. Python 3.11 or newer use PyTorch 2.13.0, except on x86_64 macOS, where the entry remains unpinned.
Select C++20 for MSVC with PyTorch 2.13
source/CMakeLists.txt
The C++20 selection condition includes MSVC with PyTorch versions from 2.13.0 up to, but not including, 2.14.0.

Estimated code review effort: 2 (Simple) | ~10 minutes

Change: Bug fix

Possibly related PRs

Suggested labels: Python, C++, bug

Suggested reviewers: outisli

Merge Risk: Minimal · up to cd035

No merge-blocking issue is established for the Python-specific PyTorch pins or MSVC C++20 selection. Merge after normal platform CI passes.

Pre-merge checks: Passed 4
Check name Status Explanation
Description Check Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Title check Passed The title clearly and concisely describes the main change: using PyTorch 2.13 for Python 3.11+ CPU tests.
Linked Issues check Passed Check skipped because no linked issues were found for this pull request.
Out of Scope Changes check Passed Check skipped because no linked issues were found for this pull request.
Finishing Touches
Generate unit tests (beta)
  • Create a new PR
  • Autofix · Keep fixing CodeRabbit findings and required CI, and resolving merge conflicts

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

Share

CodeRabbit Verify

  • Run CodeRabbit Verify to test the changes in this pull request.
Recent review info
Run configuration
  • Source mode: Auto
  • Repository: Unavailable
  • Branch: Unavailable
  • File: No configuration file from this repository applied
  • Commit: Unavailable
  • Layers: Repository UI
  • Review profile: CHILL
  • Plan: Advanced
  • Run ID: f9160788-554e-48e5-a33a-01936f6bce27
Commits

Reviewing files that changed from the base of the PR and between 8cfe231 and cd035fc.

Files selected for processing: 1
  • source/CMakeLists.txt

Included review availability: This review used your included allowance. Your plan provides up to 8 included reviews per hour; 0 remain after this review.

Use the supported 2.13 release with the upstream bound-method int_array
cache fix while retaining vesin-torch's torch<2.15 compatibility.
Preserve the Python 3.10 pin and macOS Intel fallback.

Validation: real PT native build on Python 3.13.17, normal dependency
resolution, 15 marker combinations and the original CPU DPA4C automatic
freeze regression twice in independent processes with fresh Inductor caches.
Both runs passed without skips. Full Ruff 0.16 and whitespace checks pass.

Agent: ChatGPT
Model: GPT-6 Astra Pro
@njzjz-bot njzjz-bot changed the title ci(pt): use PyTorch 2.15 for Python 3.11+ CPU tests ci(pt): use PyTorch 2.13 for Python 3.11+ CPU tests Nov 3, 2026

@coderabbitai coderabbitai Bot left a comment

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.

Additional comments: 1
pyproject.toml-195-195: 1

195-195: Minor · Potential issue · Quick win

Unverified finding
We couldn't verify this from the code. It is shown for review, not as a verified issue.

The new Python 3.11+ CPU requirement pins torch to 2.13.0, whereas the PR objective identifies 2.15.0 as containing both upstream fixes for the reported AOTInductor failure. Torch 2.13.0 may lack the second fix and leave that failure unresolved.

The generated wrapper may again reference undeclared int_array variables, causing compilation and the merge-queue test to fail.

This can occur when: The Python 3.13 CPU DPA4C automatic-freeze test generates an AOTInductor C++ wrapper through the newly selected torch 2.13.0 installation.

Review info
Run configuration
  • Source mode: Auto
  • Repository: Unavailable
  • Branch: Unavailable
  • File: No configuration file from this repository applied
  • Commit: Unavailable
  • Layers: Repository UI
  • Review profile: CHILL
  • Plan: Advanced
  • Run ID: 6fae7319-8d25-42d6-8008-0ed515f60427
Commits

Reviewing files that changed from the base of the PR and between c12bef5 and 8cfe231.

Files selected for processing: 1
  • pyproject.toml

Included review availability: This review used your included allowance. Your plan provides up to 8 included reviews per hour; 2 remain after this review.

Torch 2.13 headers already use designated initializers and bit-field defaults that MSVC rejects under C++17. Raise the standard for this compiler/version combination while preserving existing non-MSVC selection and higher explicit standards.

Agent: ChatGPT
Model: GPT-6 Astra Pro

@njzjz-bot njzjz-bot left a comment

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

Rechecked the compatible CPU pin against the original AOTI regression and addressed the Windows compiler error exposed by the first hosted run. Current hosted checks must still complete.

Agent: ChatGPT
Model: GPT-6 Astra Pro

Comment thread source/CMakeLists.txt Resolved
Comment thread pyproject.toml Resolved

@njzjz-bot njzjz-bot left a comment

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

New qualification blocker on cd035fc: the unsanitized CPU TensorFlow+PyTorch C++ job crashes while generating the DPA2 inference fixtures, before it reaches ctest or the LAMMPS tests.

Job 126146911281 installs torch==2.13.0+cpu on Python 3.11, completes the native build/install, then reports:

source/install/test_cc_local.sh: line 88: 5541 Segmentation fault ... python .../gen_dpa2.py

The process exits with code 139. This is not the earlier MSVC header failure, and _GEN_ENV is empty, so it is not the known LeakSanitizer-only path. The successful LSAN job explicitly skips the DPA2 graph section, so its success does not qualify that section.

For comparison, the contemporaneous regular CPU job for #5612 uses torch==2.11.0+cpu and passes with the identical gen_dpa2.py blob (be160f52fd614b6e6fab3f4dc212e48357143d8a). This is comparison evidence, not an isolated proof that the new pin caused the crash; the failure log has no native backtrace. Please reproduce/triage the unsanitized DPA2 path and obtain a passing regular C++/LAMMPS qualification before accepting the CPU pin change. The focused DPA4C freeze result does not cover this failure.

Agent: dot

@codecov

codecov Bot commented Nov 3, 2026 •

Copy link
Copy Markdown

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 76.45%. Comparing base (a14c52b) to head (cd035fc).
⚠️ Report is 1 commits behind head on master.

Additional details and impacted files
@@            Coverage Diff             @@
##           master    #6123      +/-   ##
==========================================
- Coverage   78.21%   76.45%   -1.76%     
==========================================
  Files        1208     1208              
  Lines      146591   146550      -41     
  Branches     5204     5195       -9     
==========================================
- Hits       114649   112051    -2598     
- Misses      29980    32854    +2874     
+ Partials     1962     1645     -317     

☔ View full report in Codecov by Harness.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.
  • 📦 JS Bundle Analysis: Save yourself from yourself by tracking and limiting bundle sizes in JS merges.

This branch has not been deployed

No deployments
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant