Skip to content

cudnnFindEx - #1594

Closed
aromnvidia wants to merge 12 commits into
pytorch:masterfrom
aromnvidia:cudnnFindEx
Closed

aromnvidia wants to merge 12 commits into
pytorch:masterfrom
aromnvidia:cudnnFindEx

Conversation

@aromnvidia

Copy link
Copy Markdown
Contributor

Thank you guys again for your comments and recommendations on my prev. pull request.
Here is updated version of my implementation.

size_t large = 0;
return THCudaMemGetInfo1(state, freeBytes, totalBytes, &large);
}

This comment was marked as off-topic.

This comment was marked as off-topic.

Comment thread torch/lib/THC/THCGeneral.h.in Outdated
THC_API void THCudaHostRecord(THCState *state, void *ptr);

THC_API cudaError_t THCudaMemGetInfo(THCState *state, size_t* freeBytes, size_t* totalBytes);
THC_API cudaError_t THCudaMemGetInfo1(THCState *state, size_t* freeBytes, size_t* totalBytes, size_t* large);

This comment was marked as off-topic.

This comment was marked as off-topic.

This comment was marked as off-topic.

Comment thread torch/csrc/cudnn/Conv.cpp Outdated
CUDNN_CONVOLUTION_FWD_ALGO_IMPLICIT_PRECOMP_GEMM,
CUDNN_CONVOLUTION_FWD_ALGO_DIRECT,
CUDNN_CONVOLUTION_FWD_ALGO_WINOGRAD,
CUDNN_CONVOLUTION_FWD_ALGO_WINOGRAD_NONFUSED

This comment was marked as off-topic.

This comment was marked as off-topic.

@apaszke apaszke 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.

The PR looks good now. We only need one more change so we don't make the allocator cache unnecessarily large.

Comment thread torch/csrc/cudnn/Conv.cpp

CHECK(cudnnFindConvolutionForwardAlgorithmEx(handle, conv.idesc.desc, in,
conv.wdesc.desc, wght, conv.cdesc.desc, conv.odesc.desc, out, 1, &algoCount,
&perfResults, ws.data, ws.size));

This comment was marked as off-topic.

@aromnvidia

Copy link
Copy Markdown
Contributor Author

Sorry, Adam. Removed your comment by mistake. I thought I remove mine.

I thought it's not the right place to call emptyCache after CHECK(cudnnFindConvolutionForwardAlgorithmEx(handle, conv.idesc.desc, in... We will fall into deadlock on cuda_free_mutex. I'd suggested to flush the cache in chooseAlgorithm() after findAlgorithm(state, handle, conv, benchmark, in, out, wght, algo);

@apaszke

apaszke commented May 24, 2017 •

Copy link
Copy Markdown
Contributor

Yeah sure. Everything is ok as long as the cache is going to be flushed only when benchmarks are run (this should only happen a few times during training).

Actually I've just started wondering if it wouldn't be simpler to limit the max workspace size to max(largest_cached_free_block, free_device_memory) and use use cudaMalloc (without using THC) to allocate the benchmarks workspace. This shouldn't change the state of cache at all, and wouldn't require the flush.

@ngimel

ngimel commented May 24, 2017

Copy link
Copy Markdown
Collaborator

You can't cudaMalloc largest_cached_free_block without first emptying cache, right? And in some unfortunate cases subsequent cudaFree'ing can interfere with nccl (though in some unfortunate cases that may happen also when caching allocator can't allocate requested block and starts cleaning up). Grrr, this is so hard to solve cleanly.

@apaszke

apaszke commented May 24, 2017 •

Copy link
Copy Markdown
Contributor

Right, I meant to use the max and:

  • if there's more free space on the device then use cudaMalloc,
  • if the largest cached (and free!) block is larger, use that amount with the caching allocator. This shouldn't alter its state (no mallocs/frees called).

cudnnFind (no ex) used to call cudaFree too, and this part is already guarded by a free mutex.

@colesbury

Copy link
Copy Markdown
Contributor

We discussed this earlier and I don't think these heuristics are a good idea. If you're worried that the caching allocator will unnecessarily hold on to large blocks, call THCCachingAllocator_emptyCache after benchmarking.

@apaszke

apaszke commented May 25, 2017

Copy link
Copy Markdown
Contributor

@pytorchbot test this please

@soumith

soumith commented May 25, 2017

Copy link
Copy Markdown
Collaborator

@aromnvidia looks like you haven't tested the GPU builds after you pushed your latest commits? They actually fail with basic compiler errors.
https://build.pytorch.org/job/pytorch-PR-py2-linux/38//console

@soumith

soumith commented May 26, 2017

Copy link
Copy Markdown
Collaborator

@pytorchbot test this please

@soumith

soumith commented May 26, 2017

Copy link
Copy Markdown
Collaborator

@pytorchbot add to whitelist

@apaszke apaszke closed this Jun 1, 2017
@apaszke apaszke reopened this Jun 1, 2017
@soumith

soumith commented Jun 2, 2017

Copy link
Copy Markdown
Collaborator

this is now merged into master.

houseroad added a commit to houseroad/pytorch that referenced this pull request Nov 29, 2018
…002d19

Summary:
Previous import was 882c5283c54345d131e8fe5c859e4844dcf7ca8e

Included changes:
- **[f461f7a](onnx/onnx@f461f7a)**: Show the op's type and name when the shape inference is failed. (pytorch#1623) <Jerry>
- **[ab8aaf9](onnx/onnx@ab8aaf9)**: Add scan test case (pytorch#1586) <G. Ramalingam>
- **[c95357e](onnx/onnx@c95357e)**: link the tutorial (pytorch#1650) <Lu Fang>
- **[d7e2420](onnx/onnx@d7e2420)**: Upgrade label encoder to support more input types (pytorch#1596) <Wei-Sheng Chin>
- **[6425108](onnx/onnx@6425108)**: Add Doc about Adding New Operator into ONNX (pytorch#1647) <Lu Fang>
- **[295889c](onnx/onnx@295889c)**: use an empty initializer to create map (pytorch#1643) <Lu Fang>
- **[e38f3ec](onnx/onnx@e38f3ec)**: Remove redundant const (pytorch#1639) <daquexian>
- **[ea694bf](onnx/onnx@ea694bf)**: implement fuse reduce->unsqueeze + fix assumption in nop_dropout pass (pytorch#1565) <Armen>
- **[6db386e](onnx/onnx@6db386e)**: make output shape clear enough for Softmax family (pytorch#1634) <Lu Fang>
- **[2b67c6e](onnx/onnx@2b67c6e)**: fix batchnorm doc (pytorch#1633) <Lu Fang>
- **[c901784](onnx/onnx@c901784)**: remove inappropriate consts (pytorch#1632) <Lu Fang>
- **[de82119](onnx/onnx@de82119)**: Shape inference fix for broadcast, concat and scan (pytorch#1594) <KeDengMS>
- **[d7ffe3b](onnx/onnx@d7ffe3b)**: Update Optimizer Docs (pytorch#1607) <Armen>
- **[d09d139](onnx/onnx@d09d139)**: mark PROTOBUF_INCLUDE_DIRS as BUILD_INTERFACE (pytorch#1466) <Yuta Okamoto>
- **[eb4b7c2](onnx/onnx@eb4b7c2)**: allow variadic parameters of different types (pytorch#1615) <G. Ramalingam>
- **[4166246](onnx/onnx@4166246)**: Fix onnxifi test (pytorch#1617) <Yinghai Lu>
- **[6706a4d](onnx/onnx@6706a4d)**: Fix a bug in vector address access (pytorch#1598) <Raymond Yang>
- **[ae39866](onnx/onnx@ae39866)**: Separate types of inputs 1 and 2 in OneHot op. (pytorch#1610) <Spandan Tiwari>
- **[45ba661](onnx/onnx@45ba661)**: Handle new types in the switch. (pytorch#1608) <Dmitri Smirnov>
- **[14853b6](onnx/onnx@14853b6)**: Bump docker image version to 230 used in CircleCI (pytorch#1606) <bddppq>
- **[e0993b8](onnx/onnx@e0993b8)**: [onnxifi] Make sure that backend handles run async. (pytorch#1599) <Roman Dzhabarov>
- **[e6965cc](onnx/onnx@e6965cc)**: Introduce SparseTensor ML proto (pytorch#1554) <Dmitri Smirnov>
- **[75b782f](onnx/onnx@75b782f)**: In driver test check the return status of onnxGetBackendIDs (pytorch#1597) <bddppq>
- **[c05b364](onnx/onnx@c05b364)**: Make CI log less verbose (pytorch#1595) <bddppq>
- **[fa568e4](onnx/onnx@fa568e4)**: Loop type shape inferencing (pytorch#1591) <Scott McKay>
- **[937e64c](onnx/onnx@937e64c)**: add uint8 (pytorch#1590) <Lu Fang>
- **[f86e951](onnx/onnx@f86e951)**: Add domain as an optional parameter for make_node function (pytorch#1588) <Young Kim>
- **[ff45588](onnx/onnx@ff45588)**: Remove unreachable code in shape_inference.h (pytorch#1585) <Changming Sun>
- **[f7dcad0](onnx/onnx@f7dcad0)**: Add several hyperbolic function ops. (pytorch#1499) <Sergii Dymchenko>
- **[a60ac7d](onnx/onnx@a60ac7d)**: Add OneHot op to ONNX. (pytorch#1567) <Spandan Tiwari>
- **[f6c3a7e](onnx/onnx@f6c3a7e)**: [compiler flag] Issue a warning if class has virtual method but missing virtual dtor. (pytorch#1583) <Roman Dzhabarov>
- **[88d1784](onnx/onnx@88d1784)**: Fix MaxUnpool shape inference when output_shape is provided as input (pytorch#1578) <Spandan Tiwari>
- **[20041b7](onnx/onnx@20041b7)**: Add type shape inferencing for the If operator (pytorch#1571) <Scott McKay>
- **[d6c4c75](onnx/onnx@d6c4c75)**: Add a virtual destructor to GraphInferencer (pytorch#1574) <Changming Sun>
- **[a339598](onnx/onnx@a339598)**: fix ConvTranspose spec (pytorch#1566) <Wenhao Hu>

Differential Revision: D13263831

fbshipit-source-id: 0c158dd12c45d704b6f37f63f3d74ed34ef2f534
facebook-github-bot pushed a commit that referenced this pull request Nov 30, 2018
…002d19 (#14568)

Summary:
Pull Request resolved: #14568

Previous import was 882c5283c54345d131e8fe5c859e4844dcf7ca8e

Included changes:
- **[f461f7a](onnx/onnx@f461f7a)**: Show the op's type and name when the shape inference is failed. (#1623) <Jerry>
- **[ab8aaf9](onnx/onnx@ab8aaf9)**: Add scan test case (#1586) <G. Ramalingam>
- **[c95357e](onnx/onnx@c95357e)**: link the tutorial (#1650) <Lu Fang>
- **[d7e2420](onnx/onnx@d7e2420)**: Upgrade label encoder to support more input types (#1596) <Wei-Sheng Chin>
- **[6425108](onnx/onnx@6425108)**: Add Doc about Adding New Operator into ONNX (#1647) <Lu Fang>
- **[295889c](onnx/onnx@295889c)**: use an empty initializer to create map (#1643) <Lu Fang>
- **[e38f3ec](onnx/onnx@e38f3ec)**: Remove redundant const (#1639) <daquexian>
- **[ea694bf](onnx/onnx@ea694bf)**: implement fuse reduce->unsqueeze + fix assumption in nop_dropout pass (#1565) <Armen>
- **[6db386e](onnx/onnx@6db386e)**: make output shape clear enough for Softmax family (#1634) <Lu Fang>
- **[2b67c6e](onnx/onnx@2b67c6e)**: fix batchnorm doc (#1633) <Lu Fang>
- **[c901784](onnx/onnx@c901784)**: remove inappropriate consts (#1632) <Lu Fang>
- **[de82119](onnx/onnx@de82119)**: Shape inference fix for broadcast, concat and scan (#1594) <KeDengMS>
- **[d7ffe3b](onnx/onnx@d7ffe3b)**: Update Optimizer Docs (#1607) <Armen>
- **[d09d139](onnx/onnx@d09d139)**: mark PROTOBUF_INCLUDE_DIRS as BUILD_INTERFACE (#1466) <Yuta Okamoto>
- **[eb4b7c2](onnx/onnx@eb4b7c2)**: allow variadic parameters of different types (#1615) <G. Ramalingam>
- **[4166246](onnx/onnx@4166246)**: Fix onnxifi test (#1617) <Yinghai Lu>
- **[6706a4d](onnx/onnx@6706a4d)**: Fix a bug in vector address access (#1598) <Raymond Yang>
- **[ae39866](onnx/onnx@ae39866)**: Separate types of inputs 1 and 2 in OneHot op. (#1610) <Spandan Tiwari>
- **[45ba661](onnx/onnx@45ba661)**: Handle new types in the switch. (#1608) <Dmitri Smirnov>
- **[14853b6](onnx/onnx@14853b6)**: Bump docker image version to 230 used in CircleCI (#1606) <bddppq>
- **[e0993b8](onnx/onnx@e0993b8)**: [onnxifi] Make sure that backend handles run async. (#1599) <Roman Dzhabarov>
- **[e6965cc](onnx/onnx@e6965cc)**: Introduce SparseTensor ML proto (#1554) <Dmitri Smirnov>
- **[75b782f](onnx/onnx@75b782f)**: In driver test check the return status of onnxGetBackendIDs (#1597) <bddppq>
- **[c05b364](onnx/onnx@c05b364)**: Make CI log less verbose (#1595) <bddppq>
- **[fa568e4](onnx/onnx@fa568e4)**: Loop type shape inferencing (#1591) <Scott McKay>
- **[937e64c](onnx/onnx@937e64c)**: add uint8 (#1590) <Lu Fang>
- **[f86e951](onnx/onnx@f86e951)**: Add domain as an optional parameter for make_node function (#1588) <Young Kim>
- **[ff45588](onnx/onnx@ff45588)**: Remove unreachable code in shape_inference.h (#1585) <Changming Sun>
- **[f7dcad0](onnx/onnx@f7dcad0)**: Add several hyperbolic function ops. (#1499) <Sergii Dymchenko>
- **[a60ac7d](onnx/onnx@a60ac7d)**: Add OneHot op to ONNX. (#1567) <Spandan Tiwari>
- **[f6c3a7e](onnx/onnx@f6c3a7e)**: [compiler flag] Issue a warning if class has virtual method but missing virtual dtor. (#1583) <Roman Dzhabarov>
- **[88d1784](onnx/onnx@88d1784)**: Fix MaxUnpool shape inference when output_shape is provided as input (#1578) <Spandan Tiwari>
- **[20041b7](onnx/onnx@20041b7)**: Add type shape inferencing for the If operator (#1571) <Scott McKay>
- **[d6c4c75](onnx/onnx@d6c4c75)**: Add a virtual destructor to GraphInferencer (#1574) <Changming Sun>
- **[a339598](onnx/onnx@a339598)**: fix ConvTranspose spec (#1566) <Wenhao Hu>

Reviewed By: zrphercule

Differential Revision: D13263831

fbshipit-source-id: a2ff22c6454e2430429e5a7d18d21661a7ffb0cb
zklaus added a commit to zklaus/pytorch that referenced this pull request Oct 14, 2026
…rsistent tree

The build-system floor moves from 1.0 to 1.1.1, together with the CI pins
(.ci/docker/requirements-ci.txt, the Windows installer scripts, the riscv
cross image), so this rebuilds the Docker images. Two features of the new
release are switched on at the same time; the Import-Name metadata (PEP 794)
that 1.1 can also emit is left for a follow-up, since it raises the wheels'
Metadata-Version to 2.5 and deserves its own compatibility check.

Editable installs now use editable.rebuild-dir = "build/install/{wheel_tag}"
with rebuild = false. The compiled artifacts are installed into a persistent
tree under build/ and the editable wheel shrinks to the redirect. Before,
every `pip install -e .` zipped the whole install tree into a wheel that pip
unpacked and discarded, several GB and about five minutes on a debug build
(pytorch#196619). The tree is keyed by wheel tag so editable installs for several
interpreters can share one checkout, and `spin clean` removes it with the
rest of build/. Rebuild-on-import stays off; torch.__loader__.rebuild()
refreshes the tree on demand. CONTRIBUTING.md describes the new location.

The sdist build sets sdist.resolve-symlinks = "error", so a symlink among the
included files fails the build by name instead of being silently copied.
Every tracked symlink is handled explicitly: seven are excluded
(.dockerignore, the three AGENTS.md links, XNNPACK's xngen alias, the
cudnn_frontend .claude directory link that the old default duplicated, and a
flatbuffers test fixture), and docs/requirements.txt is force-included from
its target in .ci. The release workflow used to make that replacement in the
working tree before both of its archives were built; it now does so only on
the staged copy that becomes the plain tarball, so the PEP 517 sdist is built
from the pristine checkout and the local `python -m build --sdist` and the
release sdist are produced the same way. The sdist member list changes by
exactly those eight entries.

1.1.0 and 1.1.1 also carry the nested-.gitignore walk fix (pytorch#194945,
scikit-build/scikit-build-core#1542), repository-boundary handling for ignore
rules (scikit-build-core#1585, pytorch#1594) and the deterministic, install-first
__path__ with a public __loader__.paths for redirect-mode packages (pytorch#1566,
pytorch#1567), which the resolution helpers from pytorch#195587 use.

Not in this change: the blanket third_party/** include block in sdist.include
stays. Without it, 1.1.1 drops 389 more tracked files, among them cpuinfo's
deps/clog sources and PeachPy's instruction tables that NNPACK's code
generation imports, so retiring it needs targeted includes and a
build-from-sdist test of its own.

Requires pytorch#195587: before it, get_file_path found the editable install tree
through the distribution's location under site-packages; with rebuild-dir
that tree moves to build/install/<wheel tag>/, where only the import-system
anchor finds it.

Fixes pytorch#194945. Fixes pytorch#196619.

Test Plan

On top of main at the pytorch#195587 merge (7402bdb) with scikit-build-core
1.1.1, CPU-only Release build on Linux, Python 3.10:

```
python -m build --sdist --no-isolation
python -m pip wheel . -v --no-build-isolation --no-deps -w /tmp/wheel
python -m pip install -e . -v --no-build-isolation
python -m pytest test/test_utils.py -k "PathResolution or cmake_prefix_path or get_file_path"
spin lint
```

The sdist builds with the symlink check on; of the six tracked symlinks only
docs/requirements.txt appears among its members, as a regular file copied
from its .ci target. The editable install takes 22 s from an existing
build directory, puts the artifacts under
build/install/cp310-cp310-linux_x86_64/ with nothing but the redirect in
site-packages; `import torch` from outside the checkout loads _C from that
tree, torch.__loader__.paths lists it first, and torch.utils.cmake_prefix_path
resolves into it with TorchConfig.cmake present. The six path-resolution
tests pass against that editable install.

Authored with an AI assistant; the diff was reviewed by hand.

🤖 Generated with [Claude Code](https://claude.com/claude-code)
zklaus added a commit to zklaus/pytorch that referenced this pull request Oct 16, 2026
…rsistent tree

The build-system floor moves from 1.0 to 1.1.1, together with the CI pins
(.ci/docker/requirements-ci.txt, the Windows installer scripts, the riscv
cross image), so this rebuilds the Docker images. Two features of the new
release are switched on at the same time; the Import-Name metadata (PEP 794)
that 1.1 can also emit is left for a follow-up, since it raises the wheels'
Metadata-Version to 2.5 and deserves its own compatibility check.

Editable installs now use editable.rebuild-dir = "build/install/{wheel_tag}"
with rebuild = false. The compiled artifacts are installed into a persistent
tree under build/ and the editable wheel shrinks to the redirect. Before,
every `pip install -e .` zipped the whole install tree into a wheel that pip
unpacked and discarded, several GB and about five minutes on a debug build
(pytorch#196619). The tree is keyed by wheel tag so editable installs for several
interpreters can share one checkout, and `spin clean` removes it with the
rest of build/. Rebuild-on-import stays off; torch.__loader__.rebuild()
refreshes the tree on demand. CONTRIBUTING.md describes the new location.

The tree is keyed by wheel tag only: scikit-build-core formats rebuild-dir
with the same keys as build-dir and has no `{build_dir}` key, so a second
build tree selected through `SKBUILD_BUILD_DIR` (another CUDA toolkit, a Debug
build) shares `build/install/<wheel tag>/` with the first and the last
editable install wins. Setting `SKBUILD_EDITABLE_REBUILD_DIR` to a directory
under that build tree keeps them apart; CONTRIBUTING.md says so. The proper
fix is a `{build_dir}` template key upstream, which we will ask for
separately.

The sdist build sets sdist.resolve-symlinks = "error", so a symlink among the
included files fails the build by name instead of being silently copied.
Every tracked symlink is handled explicitly: seven are excluded
(.dockerignore, the three AGENTS.md links, XNNPACK's xngen alias, the
cudnn_frontend .claude directory link that the old default duplicated, and a
flatbuffers test fixture), and docs/requirements.txt is force-included from
its target in .ci. The release workflow used to make that replacement in the
working tree before both of its archives were built; it now does so only on
the staged copy that becomes the plain tarball, so the PEP 517 sdist is built
from the pristine checkout and the local `python -m build --sdist` and the
release sdist are produced the same way. The sdist member list changes by
exactly those eight entries.

1.1.0 and 1.1.1 also carry the nested-.gitignore walk fix (pytorch#194945,
scikit-build/scikit-build-core#1542), repository-boundary handling for ignore
rules (scikit-build-core#1585, pytorch#1594) and the deterministic, install-first
__path__ with a public __loader__.paths for redirect-mode packages (pytorch#1566,

Not in this change: the blanket third_party/** include block in sdist.include
stays. Without it, 1.1.1 drops 389 more tracked files, among them cpuinfo's
deps/clog sources and PeachPy's instruction tables that NNPACK's code
generation imports, so retiring it needs targeted includes and a
build-from-sdist test of its own.

Requires pytorch#195587: before it, get_file_path found the editable install tree
through the distribution's location under site-packages; with rebuild-dir
that tree moves to build/install/<wheel tag>/, where only the import-system
anchor finds it.

Fixes pytorch#194945. Fixes pytorch#196619.

Test Plan

On top of main at the pytorch#195587 merge (7402bdb) with scikit-build-core
1.1.1, CPU-only Release build on Linux, Python 3.10:

```
python -m build --sdist --no-isolation
python -m pip wheel . -v --no-build-isolation --no-deps -w /tmp/wheel
python -m pip install -e . -v --no-build-isolation
python -m pytest test/test_utils.py -k "PathResolution or cmake_prefix_path or get_file_path"
spin lint
```

The sdist builds with the symlink check on; of the six tracked symlinks only
docs/requirements.txt appears among its members, as a regular file copied
from its .ci target. The editable install takes 22 s from an existing
build directory, puts the artifacts under
build/install/cp310-cp310-linux_x86_64/ with nothing but the redirect in
site-packages; `import torch` from outside the checkout loads _C from that
tree, torch.__loader__.paths lists it first, and torch.utils.cmake_prefix_path
resolves into it with TorchConfig.cmake present. The six path-resolution
tests pass against that editable install.

Authored with an AI assistant; the diff was reviewed by hand.

🤖 Generated with [Claude Code](https://claude.com/claude-code)
pytorchmergebot pushed a commit that referenced this pull request Oct 22, 2026
Go through the following checklist
- [x] Passes lint (`spin fixlint`)
- [x] ~Added/updated tests~
- [x] Updated documentation (if applicable)
- [x] ~Included benchmark results (for PRs impacting perf)~

---

## Linked issue or supporting maintainer

<!-- Keep the one line that applies and delete the others. Link an issue labeled "actionable", or name the maintainer who agreed to this change beforehand. PRs with neither will be automatically closed, unless the author has write access to the repo. -->

Fixes #194945. Fixes #196619.

## BC-breaking?

<!-- If this change breaks backward compatibility, describe the impact and migration path. Otherwise, write "No". -->
No. Wheels and sdists are produced with the same contents and metadata as before (the sdist loses eight symlinks that nothing consumes; docs/requirements.txt has the same content). For developers, an editable install now keeps its compiled artifacts in build/install/<wheel tag>/ instead of site-packages, so deleting build/ removes them, and code that located the install tree through the distribution's site-packages path has to use the import-system anchor from #195587 instead (in-tree code already does). Building from source needs scikit-build-core 1.1.1, available on PyPI and conda-forge.

## Summary (human written only)

<!-- Point to the issue for relevant design discussion. If not discussed there (rare), add up to one paragraph. Overly verbose descriptions will be considered spam. -->

This PR raises the floor for scikit-build-core from 1.0 to 1.1.1, which is a release that includes a number of improvements that target issues specifically surfaced from Pytorch.

## Agent details (if applicable)

<!-- You can add here the details from your agent related to this PR. -->

The build-system floor moves from 1.0 to 1.1.1, together with the CI pins (.ci/docker/requirements-ci.txt, the Windows installer scripts, the riscv cross image), so this rebuilds the Docker images. Two features of the new release are switched on at the same time; the Import-Name metadata (PEP 794) that 1.1 can also emit is left for a follow-up, since it raises the wheels' Metadata-Version to 2.5 and deserves its own compatibility check.

Editable installs now use editable.rebuild-dir = "build/install/{wheel_tag}" with rebuild = false. The compiled artifacts are installed into a persistent tree under build/ and the editable wheel shrinks to the redirect. Before, every `pip install -e .` zipped the whole install tree into a wheel that pip unpacked and discarded, several GB and about five minutes on a debug build (#196619). The tree is keyed by wheel tag so editable installs for several interpreters can share one checkout, and `spin clean` removes it with the rest of build/. Rebuild-on-import stays off; torch.__loader__.rebuild() refreshes the tree on demand. CONTRIBUTING.md describes the new location.
The tree is keyed by wheel tag only: scikit-build-core formats rebuild-dir with the same keys as build-dir and has no `{build_dir}` key, so a second build tree selected through `SKBUILD_BUILD_DIR` (another CUDA toolkit, a Debug build) shares `build/install/<wheel tag>/` with the first and the last editable install wins. Setting `SKBUILD_EDITABLE_REBUILD_DIR` to a directory under that build tree keeps them apart; CONTRIBUTING.md says so. The proper fix is a `{build_dir}` template key upstream, which we will ask for separately.

The sdist build sets sdist.resolve-symlinks = "error", so a symlink among the included files fails the build by name instead of being silently copied. Every tracked symlink is handled explicitly: seven are excluded (.dockerignore, the three AGENTS.md links, XNNPACK's xngen alias, the cudnn_frontend .claude directory link that the old default duplicated, and a flatbuffers test fixture), and docs/requirements.txt is force-included from its target in .ci. The release workflow used to make that replacement in the working tree before both of its archives were built; it now does so only on the staged copy that becomes the plain tarball, so the PEP 517 sdist is built from the pristine checkout and the local `python -m build --sdist` and the release sdist are produced the same way. The sdist member list changes by exactly those eight entries.

1.1.0 and 1.1.1 also carry the nested-.gitignore walk fix (#194945, scikit-build/scikit-build-core#1542), repository-boundary handling for ignore rules (scikit-build-core#1585, #1594) and the deterministic, install-first __path__ with a public __loader__.paths for redirect-mode packages (#1566, #1567), which the resolution helpers from #195587 use.

Not in this change: the blanket third_party/** include block in sdist.include stays. Without it, 1.1.1 drops 389 more tracked files, among them cpuinfo's deps/clog sources and PeachPy's instruction tables that NNPACK's code generation imports, so retiring it needs targeted includes and a build-from-sdist test of its own.

Requires #195587: before it, get_file_path found the editable install tree through the distribution's location under site-packages; with rebuild-dir that tree moves to build/install/<wheel tag>/, where only the import-system anchor finds it.

### Test Plan

On top of main at the #195587 merge (7402bdb) with scikit-build-core 1.1.1, CPU-only Release build on Linux, Python 3.10:

```
python -m build --sdist --no-isolation
python -m pip wheel . -v --no-build-isolation --no-deps -w /tmp/wheel
python -m pip install -e . -v --no-build-isolation
python -m pytest test/test_utils.py -k "PathResolution or cmake_prefix_path or get_file_path"
spin lint
```

The sdist builds with the symlink check on; of the six tracked symlinks only docs/requirements.txt appears among its members, as a regular file copied from its .ci target. The editable install takes 22 s from an existing build directory, puts the artifacts under
build/install/cp310-cp310-linux_x86_64/ with nothing but the redirect in site-packages; `import torch` from outside the checkout loads _C from that tree, torch.__loader__.paths lists it first, and torch.utils.cmake_prefix_path resolves into it with TorchConfig.cmake present. The six path-resolution tests pass against that editable install.

Authored with an AI assistant; the diff was reviewed by hand.

🤖 Generated with [Claude Code](https://claude.com/claude-code)
Pull Request resolved: #200913
Approved by: https://github.com/Skylion007, https://github.com/benjaminglass1, https://github.com/atalman
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

6 participants