Always decompose nvcc compilations#2300
Merged
sylvestre merged 1 commit intomozilla:mainfrom Dec 21, 2024
Merged
Conversation
…usted). Always decompose via `nvcc --dryrun`, then cache and report the host compiler call as a CUDA compilation
1 task
trxcllnt
commented
Dec 21, 2024
Comment on lines
+464
to
+477
| Ok(( | ||
| command, | ||
| None, | ||
| // Never assume the outer `nvcc` call is cacheable. We must decompose the nvcc call into | ||
| // its constituent subcommands with `--dryrun` and only cache the final build product. | ||
| // | ||
| // Always decomposing `nvcc --dryrun` is the only way to ensure caching nvcc invocations | ||
| // is fully sound, because the `nvcc -E` preprocessor output is not sufficient to detect | ||
| // all source code changes. | ||
| // | ||
| // Specifically, `nvcc -E` always defines __CUDA_ARCH__, which means changes to host-only | ||
| // code guarded by an `#ifndef __CUDA_ARCH__` will _not_ be captured in `nvcc -E` output. | ||
| Cacheable::No, | ||
| )) |
Contributor
Author
There was a problem hiding this comment.
We might now be able to get away with doing less in the preprocess() function, since we effectively don't care about most of what it does.
Codecov ReportAll modified and coverable lines are covered by tests ✅
Additional details and impacted files@@ Coverage Diff @@
## main #2300 +/- ##
==========================================
- Coverage 30.91% 0 -30.92%
==========================================
Files 53 0 -53
Lines 20112 0 -20112
Branches 9755 0 -9755
==========================================
- Hits 6217 0 -6217
+ Misses 7922 0 -7922
+ Partials 5973 0 -5973 ☔ View full report in Codecov by Sentry. |
Merged
wdvr
added a commit
to pytorch/pytorch
that referenced
this pull request
Jan 16, 2025
pytorchmergebot
pushed a commit
to pytorch/pytorch
that referenced
this pull request
Jan 17, 2025
pytorchmergebot
pushed a commit
to pytorch/pytorch
that referenced
this pull request
Jan 17, 2025
sccache 0.9.1 should be dealing with `nvcc -E` correctly see mozilla/sccache#2300 If this works as expected, we can get rid of this code: https://github.com/pytorch/pytorch/pull/142813/files Pull Request resolved: #145012 Approved by: https://github.com/malfet
tottoto
added a commit
to tottoto/sccache
that referenced
this pull request
Feb 6, 2026
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Never cache the outer CUDA compilation (because
nvcc -Ecan't be trusted).Always decompose via
nvcc --dryrun, then cache and report the host compiler call as a CUDA compilation.Fixes #2299.