-
Notifications
You must be signed in to change notification settings - Fork 10.8k
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
[Driver][NVPTX] Add a warning that device debug info does not work with optimizations #65327
base: main
Are you sure you want to change the base?
[Driver][NVPTX] Add a warning that device debug info does not work with optimizations #65327
Conversation
…th optimizations Passing -g to ptxas with any optimizations enabled is not allowed because, ptxas does not support optimized debugging.
0efb5b6
to
757383f
Compare
@Artem-B Hi, sorry for the direct ping. I was just wondering if it's okay to take a quick look at this patch. |
@@ -413,13 +413,25 @@ void NVPTX::Assembler::ConstructJob(Compilation &C, const JobAction &JA, | |||
// TODO: Perhaps we should map host -O2 to ptxas -O3. -O3 is ptxas's | |||
// default, so it may correspond more closely to the spirit of clang -O2. | |||
|
|||
bool noOptimization = A->getOption().matches(options::OPT_O0); | |||
// Emit a driver diagnostic as warning if any -O option different from -O0, |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This is a bit too aggressive, IMO. E.g. -g1
or -gmlt
works just fine.
The warning should apply only to full debug info. You should probably move the code below to where we check DIKind and issue the warning only if DIKind == FullDebug
.
Then there's a question of whether the warning is useful in general. E.g. in a large project where optimization and debug options are controlled globally, the users will all of a sudden start getting the warnings. The builds with -Werror will be broken and the users will have no easy way to deal with that.
// RUN: %clang -### --target=x86_64-linux-gnu -O0 -g -c %s 2>&1 \ | ||
// RUN: --offload-arch=sm_35 --cuda-path=%S/Inputs/CUDA/usr/local/cuda \ | ||
// RUN: | FileCheck -check-prefixes=CHECK,ARCH64,SM35,OPT0-DBG %s | ||
|
||
// With debugging enabled, ptxas should be run with with no ptxas optimizations. | ||
// RUN: %clang -### --target=x86_64-linux-gnu --cuda-noopt-device-debug -O2 -g -c %s 2>&1 \ |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
We should have a test for the warning, so we're sure we're not spamming users with something they can't do much about.
Passing
-g
toptxas
with any optimizations enabled is not allowed because,ptxas
does not support optimized debugging.