Skip to content

Support nvcc --device-debug flag #2384

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

Open
wants to merge 9 commits into
base: main
Choose a base branch
from

Conversation

trxcllnt
Copy link
Contributor

This PR extracts the changes to support nvcc --device-debug from #2356 per @drahnr's request.

This PR branched from/is a follow-up to #2383. See the diff of the two branches here.

This PR adds support for nvcc -G/nvcc --device-debug. Presently -G is interpreted as a GCC argument that expects a numeric value. nvcc doesn't support that, so instead it should be intercepted and passed to the nvcc --dryrun commands.

@trxcllnt
Copy link
Contributor Author

cc: @robertmaynard for review

@drahnr
Copy link
Collaborator

drahnr commented Apr 22, 2025

Can you take a look into the CI tests. This might have some overlap with the CI failures in #2382

@trxcllnt
Copy link
Contributor Author

@drahnr
Copy link
Collaborator

drahnr commented Apr 28, 2025

@trxcllnt could you rebase your PRs since the CI fixup landed in main

These changes ensure cache hits for compilations which are subsets of previously cached compilations

* Normalize cudafe++, ptx, and cubin names regardless of whether the compilation flag is `-c`, `-ptx`, `-cubin`, or whether there are one or many `-gencode` flags
* Include the compiler `hash_key` in the output dir for internal nvcc files to guarantee stability and uniqueness
* Fix cache error due to hash collision from not hashing all the PTX and cubin flags
add more multi-arch tests to ensure combining cached/new PTX and cubins doesn't produce corrupted objects
@trxcllnt trxcllnt force-pushed the fea/nvcc-device-debug branch from 1960f9b to 29cc48d Compare April 28, 2025 18:57
@codecov-commenter
Copy link

codecov-commenter commented Apr 28, 2025

Codecov Report

Attention: Patch coverage is 29.91573% with 499 lines in your changes missing coverage. Please review.

Project coverage is 69.50%. Comparing base (9fb942e) to head (63e9d72).

Files with missing lines Patch % Lines
src/compiler/nvcc.rs 7.75% 464 Missing ⚠️
src/compiler/cicc.rs 0.00% 24 Missing ⚠️
src/compiler/msvc.rs 0.00% 5 Missing ⚠️
src/compiler/cudafe.rs 0.00% 1 Missing ⚠️
src/compiler/diab.rs 0.00% 1 Missing ⚠️
src/compiler/nvhpc.rs 0.00% 1 Missing ⚠️
src/compiler/ptxas.rs 0.00% 1 Missing ⚠️
src/compiler/tasking_vx.rs 0.00% 1 Missing ⚠️
tests/harness/client.rs 99.25% 1 Missing ⚠️
Additional details and impacted files
@@            Coverage Diff             @@
##             main    #2384      +/-   ##
==========================================
- Coverage   71.41%   69.50%   -1.92%     
==========================================
  Files          65       45      -20     
  Lines       36349    26611    -9738     
==========================================
- Hits        25960    18496    -7464     
+ Misses      10389     8115    -2274     

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.

@@ -118,7 +119,7 @@ where
let mut take_next = false;
let mut outputs = HashMap::new();
let mut extra_dist_files = vec![];
let mut gen_module_id_file = false;
// let mut gen_module_id_file = false;
Copy link
Collaborator

Choose a reason for hiding this comment

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

Could you delete the comment?

@@ -146,7 +161,7 @@ where
}
Some(GenModuleIdFileFlag) => {
take_next = false;
gen_module_id_file = true;
// gen_module_id_file = true;
Copy link
Collaborator

Choose a reason for hiding this comment

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

Please delete commented code

);
} else {
extra_dist_files.push(module_id_path);
if module_id_path.exists() {
Copy link
Collaborator

Choose a reason for hiding this comment

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

If the generated file doesn't exist, does this exhibit an issue or is it ok to silently ignore?

@@ -158,24 +173,6 @@ where
take_next = false;
&mut unhashed_args
}
Some(UnhashedOutput(o)) => {
Copy link
Collaborator

Choose a reason for hiding this comment

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

Any particular reason to rename as part of this PR?

m.update(cwd.join(output).as_os_str().as_encoded_bytes());
m.finish()
});
fs::create_dir_all(&out_dir).ok();
Copy link
Collaborator

Choose a reason for hiding this comment

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

The above line is odd. Do we not want to bail if the IO operation fails?


#[allow(unused)]
impl SccacheClient {
pub fn new_no_cfg() -> Self {
Copy link
Collaborator

Choose a reason for hiding this comment

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

Could use a comment or two

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 have a few small questions, it's still a significant changeset to review

@trxcllnt
Copy link
Contributor Author

The changes in this PR are related to the --device-debug flag (full diff here), your comments are on the changes I split into #2382 and #2383.

Do you want to review and merge each of these separately, or do everything in this PR?

@trxcllnt trxcllnt force-pushed the fea/nvcc-device-debug branch 2 times, most recently from 4535e5a to 63e9d72 Compare April 29, 2025 15:53
@trxcllnt trxcllnt force-pushed the fea/nvcc-device-debug branch from 63e9d72 to 4765772 Compare April 29, 2025 16:28
@trxcllnt trxcllnt force-pushed the fea/nvcc-device-debug branch from 4765772 to 9d4e3c9 Compare April 29, 2025 22:54
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.

4 participants