[Lldb-commits] [PATCH] D136959: clang: Improve errors for DiagnosticInfoResourceLimit

Matt Arsenault via Phabricator via lldb-commits lldb-commits at lists.llvm.org
Fri Oct 28 08:45:53 PDT 2022


arsenm created this revision.
arsenm added reviewers: nickdesaulniers, yaxunl, aaron.ballman, qcolombet, aeubanks, olista01, dnovillo, echristo, MaskRay.
Herald added subscribers: kosarev, StephenFan, tpr.
Herald added a project: All.
arsenm requested review of this revision.
Herald added a subscriber: wdng.

Print source location info and demangle the name, compared
to the default behavior.

      

Several observations:

1. Specially handling this seems to give source locations

without enabling debug info, and also gives columns compared
to the backend diagnostic. This seems like a bug?

     

2. We're duplicating diagnostic effort in DiagnosticInfo

and clang. This feels wrong, but clang can demangle and I guess
have better debug info available? Should clang really have any of this
code? For the purposes of this diagnostic, the important piece
is just reading the source location out of the llvm::Function.

      

3. lld is not duplicating the same effort as clang with LTO, and just

directly printing the DiagnosticInfo as-is. e.g.

    
  $ clang -fgpu-rdc
        lld: error: local memory (480000) exceeds limit (65536) in function '_Z12use_huge_ldsIiEvv'
        lld: error: local memory (960000) exceeds limit (65536) in function '_Z12use_huge_ldsIdEvv'
    
  $ clang -fno-gpu-rdc
        backend-resource-limit-diagnostics.hip:8:17: error: local memory (480000) exceeds limit (65536) in 'void use_huge_lds<int>()'
         __global__ void use_huge_lds() {
                    ^
        backend-resource-limit-diagnostics.hip:8:17: error: local memory (960000) exceeds limit (65536) in 'void use_huge_lds<double>()'
        2 errors generated when compiling for gfx90a.
    

4. Backend errors are not observed with -save-temps and -fno-gpu-rdc or -flto,

and the compile incorrectly succeeds.

      

5. The backend version prints error: <location info>; clang prints <location info>: error:

6. -emit-codegen-only is totally broken for AMDGPU. MC

gets a null target streamer. I do not understand why this
is a thing. This just creates a horrible edge case.
Just work around this by emitting actual code instead of blocking
this patch.


https://reviews.llvm.org/D136959

Files:
  clang/include/clang/Basic/DiagnosticFrontendKinds.td
  clang/lib/CodeGen/CodeGenAction.cpp
  clang/test/Misc/backend-resource-limit-diagnostics.cl
  clang/test/Misc/backend-resource-limit-diagnostics.hip

-------------- next part --------------
A non-text attachment was scrubbed...
Name: D136959.471568.patch
Type: text/x-patch
Size: 4892 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/lldb-commits/attachments/20221028/55482984/attachment.bin>


More information about the lldb-commits mailing list