Fix cpp build (#162774)

Fixes #ISSUE_NUMBER

Pull Request resolved: https://github.com/pytorch/pytorch/pull/162774
Approved by: https://github.com/malfet, https://github.com/atalman
This commit is contained in:
Svetlana Karslioglu
2025-09-25 18:21:41 +00:00
committed by PyTorch MergeBot
parent 3dd89a079f
commit b61bdc7cc4
3 changed files with 45 additions and 3 deletions

View File

@ -58,7 +58,7 @@ time python tools/setup_helpers/generate_code.py \
# Build the docs # Build the docs
pushd docs/cpp pushd docs/cpp
time make VERBOSE=1 html -j time make VERBOSE=1 html
popd popd
popd popd

View File

@ -67,7 +67,7 @@ jobs:
# an OOM issue when running the job, so this upgrades the runner from 4xlarge # an OOM issue when running the job, so this upgrades the runner from 4xlarge
# to the next available tier of 12xlarge. So much memory just to generate cpp # to the next available tier of 12xlarge. So much memory just to generate cpp
# doc # doc
runner: ${{ inputs.runner_prefix }}linux.12xlarge runner: ${{ inputs.runner_prefix }}linux.12xlarge.memory
# TODO: Nightly cpp docs take longer and longer to finish (more than 3h now) # TODO: Nightly cpp docs take longer and longer to finish (more than 3h now)
# Let's try to figure out how this can be improved # Let's try to figure out how this can be improved
timeout-minutes: 360 timeout-minutes: 360

View File

@ -40,7 +40,34 @@ extensions = [
"sphinx.ext.intersphinx", "sphinx.ext.intersphinx",
] + (["breathe", "exhale"] if run_doxygen else []) ] + (["breathe", "exhale"] if run_doxygen else [])
intersphinx_mapping = {"pytorch": ("https://pytorch.org/docs/main", None)} intersphinx_mapping = {"pytorch": ("https://docs.pytorch.org/docs/main", None)}
# Configure Sphinx warnings and error handling
suppress_warnings = [
"ref.citation",
"ref.footnote",
"ref.doc",
"toc.excluded",
"toc.not_readable",
"misc.highlighting_failure",
]
# Configure Breathe
breathe_show_define_initializer = True
breathe_show_enumvalue_initializer = True
breathe_default_members = ("members", "undoc-members")
# Fix for Python 3.10+ compatibility with exhale 2.3.0
# MutableMapping was moved from collections to collections.abc in Python 3.10
try:
import collections
from collections.abc import MutableMapping
if not hasattr(collections, "MutableMapping"):
collections.MutableMapping = MutableMapping
except ImportError:
pass
# Setup absolute paths for communicating with breathe / exhale where # Setup absolute paths for communicating with breathe / exhale where
# items are expected / should be trimmed by. # items are expected / should be trimmed by.
@ -101,6 +128,21 @@ exhale_args = {
Welcome to the developer reference for the PyTorch C++ API. Welcome to the developer reference for the PyTorch C++ API.
""" """
), ),
############################################################################
# Duplicate handling and error management. #
############################################################################
# Note: Using Doxyfile instead of stdin configuration
# "exhaleDoxygenStdin" is not compatible with "exhaleUseDoxyfile"
# Handle unresolved references more gracefully
"unabridgedOrphanKinds": {
"function",
"define",
"enum",
"enumvalue",
"typedef",
"variable",
},
"fullToctreeMaxDepth": 2,
} }
# Tell sphinx what the primary language being documented is. # Tell sphinx what the primary language being documented is.