Skip to content

nvcc: accept the --diag-error/--diag-suppress/--diag-warn family - #2816

Open
Kataglyphis wants to merge 2 commits into
mozilla:mainfrom
Kataglyphis:fix/nvcc-diag-suppress-separated
Open

nvcc: accept the --diag-error/--diag-suppress/--diag-warn family#2816
Kataglyphis wants to merge 2 commits into
mozilla:mainfrom
Kataglyphis:fix/nvcc-diag-suppress-separated

Conversation

@Kataglyphis

Copy link
Copy Markdown
Contributor

While trying to get OpenCV's CUDA build cached on Windows I noticed that none of its .cu files ever got cache hits. The server log shows every single compile being rejected with:

CannotCache(multiple input files)

OpenCV passes -Xcudafe --display_error_number --diag-suppress 1394,1388 on every CUDA file. The problem: --diag-suppress (and its siblings --diag-error / --diag-warn) are missing from the nvcc argument table. nvcc accepts the value either attached (--diag-suppress=1394,1388) or as a separate argument, and CMake/OpenCV happen to emit the separated form - so sccache parses 1394,1388 as a bare token, takes it for a second input file and refuses the compile.

Easy to reproduce with any single nvcc compile: add --diag-suppress 1394,1388 and the request is forwarded uncached (requests executed 0 in the stats), switch to --diag-suppress=1394,1388 and the same compile caches fine.

This adds the three flags in both their single- and double-dash forms (CanBeSeparated, PassThrough) plus a regression test for the separated form. With the patch applied, OpenCV's CUDA compiles (155 files in our build) all cache. Same kind of table gap #2708 filled for --dependency-output.

Possibly related: #2726 hits the same multiple input files rejection, but from the MSVC-side parsing of nvcc's host sub-compile - I reproduced it on current main and verified this PR does not change it.

nvcc's diagnostic-control options take an error-number list and accept the
SEPARATED form (--diag-suppress 1394,1388). None of the family was in the
argument table, so the separated value parsed as a bare token, was taken
for a second input file, and the whole compile was rejected as
CannotCache(multiple input files). Measured on OpenCV 5.0.0 with CUDA:
every one of its 155 .cu compiles carries exactly this flag pair (via
-Xcudafe --display_error_number --diag-suppress 1394,1388) and was
forwarded uncached; with the entries added the same command is cached.

Adds double- and single-dash forms, CanBeSeparated('='), PassThrough, plus
a regression test for the separated shape.
@codecov-commenter

codecov-commenter commented Aug 19, 2026

Copy link
Copy Markdown

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 73.65%. Comparing base (bf75727) to head (9acb9e7).

Additional details and impacted files
@@            Coverage Diff             @@
##             main    #2816      +/-   ##
==========================================
+ Coverage   73.64%   73.65%   +0.01%     
==========================================
  Files          72       72              
  Lines       37814    37831      +17     
==========================================
+ Hits        27849    27866      +17     
  Misses       9965     9965              

☔ View full report in Codecov by Harness.
📢 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.

@Kataglyphis
Kataglyphis marked this pull request as ready for review August 19, 2026 13:00
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.

2 participants