Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Support nvcc's --threads flag #1571

Merged
merged 5 commits into from Jan 29, 2023
Merged

Conversation

trxcllnt
Copy link
Contributor

This PR adds support for nvcc's --threads flag.

@codecov-commenter
Copy link

codecov-commenter commented Jan 19, 2023

Codecov Report

Base: 30.85% // Head: 31.00% // Increases project coverage by +0.15% 🎉

Coverage data is based on head (b88e123) compared to base (b9f221b).
Patch coverage: 29.68% of modified lines in pull request are covered.

Additional details and impacted files
@@            Coverage Diff             @@
##             main    #1571      +/-   ##
==========================================
+ Coverage   30.85%   31.00%   +0.15%     
==========================================
  Files          48       48              
  Lines       16557    16625      +68     
  Branches     7934     7976      +42     
==========================================
+ Hits         5109     5155      +46     
- Misses       6062     6063       +1     
- Partials     5386     5407      +21     
Impacted Files Coverage Δ
src/compiler/c.rs 38.67% <0.00%> (+0.14%) ⬆️
src/compiler/diab.rs 48.11% <0.00%> (-0.40%) ⬇️
src/compiler/tasking_vx.rs 42.10% <25.71%> (-1.58%) ⬇️
src/compiler/msvc.rs 43.25% <33.33%> (-0.08%) ⬇️
src/compiler/nvcc.rs 35.64% <41.66%> (+0.38%) ⬆️
src/compiler/gcc.rs 55.32% <42.85%> (+0.11%) ⬆️
src/cache/disk.rs 35.61% <0.00%> (-1.37%) ⬇️
src/server.rs 30.96% <0.00%> (-0.11%) ⬇️
src/lib.rs 10.85% <0.00%> (+0.08%) ⬆️
... and 11 more

Help us with your feedback. Take ten seconds to tell us how you rate us. Have a feature suggestion? Share it here.

☔ View full report at Codecov.
📢 Do you have feedback about the report comment? Let us know in this issue.

@sylvestre
Copy link
Collaborator

could you please run rustfmt on your change? thanks

@trxcllnt
Copy link
Contributor Author

@sylvestre done, thanks.

About this PR, the --threads flag doesn't affect anything about the output (just how many device architectures nvcc compiles in parallel under the hood). Is there an elegant way to pass this flag through to nvcc, but not allow it to affect the computed hash?

This would prevent existing caches from being invalidated, but more importantly, it would allow devs (and CI machines) with different values for --threads to still share the same cache.

@trxcllnt
Copy link
Contributor Author

I added a new unhashed_args vector + Unhashed arg type. Need to investigate how to test the new behavior besides running locally.

@@ -100,6 +100,8 @@ pub struct ParsedArguments {
pub common_args: Vec<OsString>,
/// Commandline arguments for the compiler that specify the architecture given
pub arch_args: Vec<OsString>,
/// Commandline arguments for the preprocessor or the compiler that don't affect the computed hash.
pub unhashed_args: Vec<OsString>,
Copy link
Collaborator

@drahnr drahnr Jan 29, 2023

Choose a reason for hiding this comment

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

I'd like to have another statement, that none of these arguments listed may in any circumstance change the resulting artifact.

Copy link
Collaborator

@drahnr drahnr left a comment

Choose a reason for hiding this comment

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

I think this is a good structural change.

Thank you!

@sylvestre sylvestre merged commit 8b11e89 into mozilla:main Jan 29, 2023
xxchan pushed a commit to xxchan/sccache that referenced this pull request Jan 30, 2023
* support the nvcc --threads flag

* fix lint

* add unhashed_args vec to ParsedArguments struct for compiler arguments that shouldn't affect the hash key

* add test to check unhashed args make it into the compile command
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.

None yet

5 participants