[clang] [Driver][NVPTX] Add a warning that device debug info does not work with optimizations (PR #65327)
@@ -413,13 +413,25 @@ void NVPTX::Assembler::ConstructJob(Compilation , const JobAction , // 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, Artem-B wrote: 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. https://github.com/llvm/llvm-project/pull/65327 ___ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits
[clang] [Driver][NVPTX] Add a warning that device debug info does not work with optimizations (PR #65327)
@@ -28,6 +28,17 @@ // RUN: --offload-arch=sm_35 --cuda-path=%S/Inputs/CUDA/usr/local/cuda \ // RUN: | FileCheck -check-prefixes=CHECK,ARCH64,SM35,RDC %s +// Compiling -O{1,2,3,4,fast,s,z} with -g does not pass -g debug info to ptxas. +// NOTE: This is because ptxas does not support optimized debugging. +// RUN: %clang -### --target=x86_64-linux-gnu -O3 -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,OPT3-DBG %s + +// Compiling -O0 with -g passes -g debug info to ptxas. +// 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 \ Artem-B wrote: 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. https://github.com/llvm/llvm-project/pull/65327 ___ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits
[clang] [Driver][NVPTX] Add a warning that device debug info does not work with optimizations (PR #65327)
GeorgeWeb wrote: @Artem-B Hi, sorry for the direct ping. I was just wondering if it's okay to take a quick look at this patch. (Didn't know how to ping folks subscribed to clang-driver). Thanks! https://github.com/llvm/llvm-project/pull/65327 ___ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits
[clang] [Driver][NVPTX] Add a warning that device debug info does not work with optimizations (PR #65327)
https://github.com/GeorgeWeb edited https://github.com/llvm/llvm-project/pull/65327 ___ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits