Skip to content

Move nccl checkout from setup.py to CMake - #181450

Closed
zklaus wants to merge 3 commits into
gh/zklaus/57/basefrom
gh/zklaus/57/head
Closed

zklaus wants to merge 3 commits into
gh/zklaus/57/basefrom
gh/zklaus/57/head

Conversation

@zklaus

@zklaus zklaus commented Apr 24, 2026 •

Copy link
Copy Markdown
Collaborator

Stack from ghstack (oldest at bottom):

This PR is part of the work to replace the old setuptools based build system frontend with a modern and easier to maintain scikit-build-core one described in #157807.
It was previously part of #177641, had received approval there and was split off by request to allow more internal testing.

Adds NCCL checkout from the pinned version to cmake/PreBuildSteps.cmake, replacing the equivalent logic in tools/build_pytorch_libs.py's NCCL clone block.

The NCCL checkout uses FetchContent to clone from the tag pinned in .ci/docker/ci_commit_pins/nccl*.txt, with support for CUDA-version-specific pin files. It is skipped when USE_DISTRIBUTED, USE_CUDA, or USE_NCCL is explicitly off, or when the checkout already exists.

The corresponding Python code is removed from setup.py and simplified in tools/build_pytorch_libs.py. The module checks for existing state so it is safe to include unconditionally under both setuptools and scikit-build-core.

Co-Generated with Claude Code

[ghstack-poisoned]
@pytorch-bot

pytorch-bot Bot commented Apr 24, 2026 •

Copy link
Copy Markdown

🔗 Helpful Links

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

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

❗ 1 Active SEVs

There are 1 currently active SEVs. If your PR is affected, please view them below:

✅ No Failures

As of commit 6315c60 with merge base 22790c5 (image):
💚 Looks good so far! There are no failures yet. 💚

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

@pytorch-bot

pytorch-bot Bot commented Apr 24, 2026

Copy link
Copy Markdown

This PR needs a release notes: label

If your changes are user facing and intended to be a part of release notes, please use a label starting with release notes:.

If not, please add the topic: not user facing label.

To add a label, you can comment to pytorchbot, for example
@pytorchbot label "topic: not user facing"

For more information, see
https://github.com/pytorch/pytorch/wiki/PyTorch-AutoLabel-Bot#why-categorize-for-release-notes-and-how-does-it-work.

[ghstack-poisoned]
@zklaus zklaus added ciflow/binaries Trigger all binary build and upload jobs on the PR ciflow/trunk Trigger trunk jobs on your pull request release notes: releng release notes category labels Apr 25, 2026
@zklaus
zklaus requested a review from nWEIdia April 26, 2026 04:48
[ghstack-poisoned]
@zklaus
zklaus requested a review from atalman April 27, 2026 09:05
@zklaus

zklaus commented Apr 27, 2026

Copy link
Copy Markdown
Collaborator Author

@pytorchbot merge

@pytorchmergebot

Copy link
Copy Markdown
Collaborator

Merge started

Your change will be merged once all checks pass (ETA 0-4 Hours).

Learn more about merging in the wiki.

Questions? Feedback? Please reach out to the PyTorch DevX Team

Advanced Debugging
Check the merge workflow status
here

@zklaus

zklaus commented Apr 28, 2026

Copy link
Copy Markdown
Collaborator Author

@pytorchbot merge

@pytorchmergebot

Copy link
Copy Markdown
Collaborator

Merge started

Your change will be merged once all checks pass (ETA 0-4 Hours).

Learn more about merging in the wiki.

Questions? Feedback? Please reach out to the PyTorch DevX Team

Advanced Debugging
Check the merge workflow status
here

zklaus added a commit to zklaus/pytorch that referenced this pull request Apr 29, 2026
pytorchmergebot pushed a commit that referenced this pull request Apr 29, 2026
Adds `cmake/FileMirroring.cmake`, which copies source files into the installed packages so they are included in the wheel. This replaces three blocks of Python code removed from `setup.py`:

- **`mirror_files_into_torchgen()`** — copies ATen native function definitions (`native_functions.yaml`, `tags.yaml`), ATen templates, and autograd files into `torchgen/packaged/` so torchgen can be used standalone.
- **`mirror_inductor_external_kernels()`** — copies the CuTeDSL grouped GEMM kernel from the cutlass submodule into `torch/_inductor/kernel/vendored_templates/`.
- **Symlink-replacement copies** — copies `_utils_internal.py` into `tools/shared/` and valgrind headers into `torch/utils/benchmark/`, replacing the symlink creation that setuptools handled.

Uses `SKBUILD_PLATLIB_DIR` (set by scikit-build-core) to install into the site-packages root, falling back to `PROJECT_SOURCE_DIR` for setuptools builds where `CMAKE_INSTALL_PREFIX` already points at the source tree.

Co-Generated with [Claude Code](https://claude.com/claude-code)
Pull Request resolved: #177642
Approved by: https://github.com/atalman
ghstack dependencies: #181450
Alokksinha00 pushed a commit to Alokksinha00/pytorch that referenced this pull request May 15, 2026
Adds `cmake/FileMirroring.cmake`, which copies source files into the installed packages so they are included in the wheel. This replaces three blocks of Python code removed from `setup.py`:

- **`mirror_files_into_torchgen()`** — copies ATen native function definitions (`native_functions.yaml`, `tags.yaml`), ATen templates, and autograd files into `torchgen/packaged/` so torchgen can be used standalone.
- **`mirror_inductor_external_kernels()`** — copies the CuTeDSL grouped GEMM kernel from the cutlass submodule into `torch/_inductor/kernel/vendored_templates/`.
- **Symlink-replacement copies** — copies `_utils_internal.py` into `tools/shared/` and valgrind headers into `torch/utils/benchmark/`, replacing the symlink creation that setuptools handled.

Uses `SKBUILD_PLATLIB_DIR` (set by scikit-build-core) to install into the site-packages root, falling back to `PROJECT_SOURCE_DIR` for setuptools builds where `CMAKE_INSTALL_PREFIX` already points at the source tree.

Co-Generated with [Claude Code](https://claude.com/claude-code)
Pull Request resolved: pytorch#177642
Approved by: https://github.com/atalman
ghstack dependencies: pytorch#181450
@github-actions
github-actions Bot deleted the gh/zklaus/57/head branch May 29, 2026 02:29
aperson30 pushed a commit to aperson30/pytorch that referenced this pull request Jun 20, 2026
This PR is part of the work to replace the old setuptools based build system frontend with a modern and easier to maintain scikit-build-core one described in pytorch#157807.
It was previously part of pytorch#177641, had received approval there and was split off by request to allow more internal testing.

Adds NCCL checkout from the pinned version to `cmake/PreBuildSteps.cmake`, replacing the equivalent logic in `tools/build_pytorch_libs.py`'s NCCL clone block.

The NCCL checkout uses `FetchContent` to clone from the tag pinned in `.ci/docker/ci_commit_pins/nccl*.txt`, with support for CUDA-version-specific pin files. It is skipped when `USE_DISTRIBUTED`, `USE_CUDA`, or `USE_NCCL` is explicitly off, or when the checkout already exists.

The corresponding Python code is removed from `setup.py` and simplified in `tools/build_pytorch_libs.py`. The module checks for existing state so it is safe to include unconditionally under both setuptools and scikit-build-core.

Co-Generated with [Claude Code](https://claude.com/claude-code)
Pull Request resolved: pytorch#181450
Approved by: https://github.com/atalman
aperson30 pushed a commit to aperson30/pytorch that referenced this pull request Jun 20, 2026
Adds `cmake/FileMirroring.cmake`, which copies source files into the installed packages so they are included in the wheel. This replaces three blocks of Python code removed from `setup.py`:

- **`mirror_files_into_torchgen()`** — copies ATen native function definitions (`native_functions.yaml`, `tags.yaml`), ATen templates, and autograd files into `torchgen/packaged/` so torchgen can be used standalone.
- **`mirror_inductor_external_kernels()`** — copies the CuTeDSL grouped GEMM kernel from the cutlass submodule into `torch/_inductor/kernel/vendored_templates/`.
- **Symlink-replacement copies** — copies `_utils_internal.py` into `tools/shared/` and valgrind headers into `torch/utils/benchmark/`, replacing the symlink creation that setuptools handled.

Uses `SKBUILD_PLATLIB_DIR` (set by scikit-build-core) to install into the site-packages root, falling back to `PROJECT_SOURCE_DIR` for setuptools builds where `CMAKE_INSTALL_PREFIX` already points at the source tree.

Co-Generated with [Claude Code](https://claude.com/claude-code)
Pull Request resolved: pytorch#177642
Approved by: https://github.com/atalman
ghstack dependencies: pytorch#181450
gplutop7 pushed a commit to gplutop7/pytorch that referenced this pull request Jul 15, 2026
This PR is part of the work to replace the old setuptools based build system frontend with a modern and easier to maintain scikit-build-core one described in pytorch#157807.
It was previously part of pytorch#177641, had received approval there and was split off by request to allow more internal testing.

Adds NCCL checkout from the pinned version to `cmake/PreBuildSteps.cmake`, replacing the equivalent logic in `tools/build_pytorch_libs.py`'s NCCL clone block.

The NCCL checkout uses `FetchContent` to clone from the tag pinned in `.ci/docker/ci_commit_pins/nccl*.txt`, with support for CUDA-version-specific pin files. It is skipped when `USE_DISTRIBUTED`, `USE_CUDA`, or `USE_NCCL` is explicitly off, or when the checkout already exists.

The corresponding Python code is removed from `setup.py` and simplified in `tools/build_pytorch_libs.py`. The module checks for existing state so it is safe to include unconditionally under both setuptools and scikit-build-core.

Co-Generated with [Claude Code](https://claude.com/claude-code)
Pull Request resolved: pytorch#181450
Approved by: https://github.com/atalman
gplutop7 pushed a commit to gplutop7/pytorch that referenced this pull request Jul 15, 2026
Adds `cmake/FileMirroring.cmake`, which copies source files into the installed packages so they are included in the wheel. This replaces three blocks of Python code removed from `setup.py`:

- **`mirror_files_into_torchgen()`** — copies ATen native function definitions (`native_functions.yaml`, `tags.yaml`), ATen templates, and autograd files into `torchgen/packaged/` so torchgen can be used standalone.
- **`mirror_inductor_external_kernels()`** — copies the CuTeDSL grouped GEMM kernel from the cutlass submodule into `torch/_inductor/kernel/vendored_templates/`.
- **Symlink-replacement copies** — copies `_utils_internal.py` into `tools/shared/` and valgrind headers into `torch/utils/benchmark/`, replacing the symlink creation that setuptools handled.

Uses `SKBUILD_PLATLIB_DIR` (set by scikit-build-core) to install into the site-packages root, falling back to `PROJECT_SOURCE_DIR` for setuptools builds where `CMAKE_INSTALL_PREFIX` already points at the source tree.

Co-Generated with [Claude Code](https://claude.com/claude-code)
Pull Request resolved: pytorch#177642
Approved by: https://github.com/atalman
ghstack dependencies: pytorch#181450
aws-kingrj pushed a commit to amazon-contributing/upstream-to-pytorch that referenced this pull request Jul 29, 2026
This PR is part of the work to replace the old setuptools based build system frontend with a modern and easier to maintain scikit-build-core one described in pytorch#157807.
It was previously part of pytorch#177641, had received approval there and was split off by request to allow more internal testing.

Adds NCCL checkout from the pinned version to `cmake/PreBuildSteps.cmake`, replacing the equivalent logic in `tools/build_pytorch_libs.py`'s NCCL clone block.

The NCCL checkout uses `FetchContent` to clone from the tag pinned in `.ci/docker/ci_commit_pins/nccl*.txt`, with support for CUDA-version-specific pin files. It is skipped when `USE_DISTRIBUTED`, `USE_CUDA`, or `USE_NCCL` is explicitly off, or when the checkout already exists.

The corresponding Python code is removed from `setup.py` and simplified in `tools/build_pytorch_libs.py`. The module checks for existing state so it is safe to include unconditionally under both setuptools and scikit-build-core.

Co-Generated with [Claude Code](https://claude.com/claude-code)
Pull Request resolved: pytorch#181450
Approved by: https://github.com/atalman
aws-kingrj pushed a commit to amazon-contributing/upstream-to-pytorch that referenced this pull request Jul 29, 2026
Adds `cmake/FileMirroring.cmake`, which copies source files into the installed packages so they are included in the wheel. This replaces three blocks of Python code removed from `setup.py`:

- **`mirror_files_into_torchgen()`** — copies ATen native function definitions (`native_functions.yaml`, `tags.yaml`), ATen templates, and autograd files into `torchgen/packaged/` so torchgen can be used standalone.
- **`mirror_inductor_external_kernels()`** — copies the CuTeDSL grouped GEMM kernel from the cutlass submodule into `torch/_inductor/kernel/vendored_templates/`.
- **Symlink-replacement copies** — copies `_utils_internal.py` into `tools/shared/` and valgrind headers into `torch/utils/benchmark/`, replacing the symlink creation that setuptools handled.

Uses `SKBUILD_PLATLIB_DIR` (set by scikit-build-core) to install into the site-packages root, falling back to `PROJECT_SOURCE_DIR` for setuptools builds where `CMAKE_INSTALL_PREFIX` already points at the source tree.

Co-Generated with [Claude Code](https://claude.com/claude-code)
Pull Request resolved: pytorch#177642
Approved by: https://github.com/atalman
ghstack dependencies: pytorch#181450
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

ciflow/b200-symm-mem ciflow/binaries Trigger all binary build and upload jobs on the PR ciflow/trunk Trigger trunk jobs on your pull request Merged open source release notes: releng release notes category

Projects

None yet

Development

Successfully merging this pull request may close these issues.

5 participants