[PATCH] D84364: [CUDA][HIP] Defer overloading resolution diagnostics for host device functions

Artem Belevich via Phabricator via cfe-commits cfe-commits at lists.llvm.org
Thu Aug 6 15:38:56 PDT 2020


tra added a comment.

In D84364#2176091 <https://reviews.llvm.org/D84364#2176091>, @yaxunl wrote:

> I added a `Deferrable` bit to the diagnostics which can be specified in td files. This can be added to individual diagnostic defs or added to a bunch of diagnostic defs all together.
>
> This field is used to control whether a diagnostic message can be deferred.

This may be a case of "too much, but not enough". It will be unnecessary for most of the diagnostics we have. Overload resolution is likely to be the primary beneficiary, inline asm and exceptions may be two other classes, but I can't think of anything else ATM. 
At the same time it may not be enough, because we also need to take into account where and when particular diagnostic is emitted. I.e. the same diagnostic may need to be postponed when we emit it from CUDA code, yet we may want to *not* postpone it if it's in the code which has nothing to do with CUDA. E.g. C++ code which has oveloading-related error in an inline function which would not be codegen'ed. I would expect such error to be reported as it would be if the same function was compiled in plain C++ mode.

> For now I enabled this bit for the overloading resolution diagnostics since these have been seen as false alarms in host device functions. We could let more diagnostics be deferrable if we see it is necessary.



> I just saw bugzilla bug https://bugs.llvm.org/show_bug.cgi?id=46922
> my patch https://reviews.llvm.org/D77954 is supposed to fix this issue. However since implicit host device functions often cause overloading resolution diagnostics on the device side which are not deferred, my patch caused regressions and was reverted several times. Currently it was still reverted.
>
> I think to fix this issue we need to make overloading resolution diagnostics deferrable.

I'm missing something here. How would deferred diagnostics help with the issue in the bug 46922? The HD function there is codegen'ed on both sides, so the only difference postponing would make is that we'd emit the diagnostic a bit later.
Do you mean that postponed diags patch is not the fix, but rather a prerequisite for the overload resolution changes patch?


CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D84364/new/

https://reviews.llvm.org/D84364



More information about the cfe-commits mailing list