[all-commits] [llvm/llvm-project] e03394: [CUDA][HIP] Workaround for resolving host device f...

Yaxun (Sam) Liu via All-commits all-commits at lists.llvm.org
Tue May 12 05:28:28 PDT 2020


  Branch: refs/heads/master
  Home:   https://github.com/llvm/llvm-project
  Commit: e03394c6a6ff5832aa43259d4b8345f40ca6a22c
      https://github.com/llvm/llvm-project/commit/e03394c6a6ff5832aa43259d4b8345f40ca6a22c
  Author: Yaxun (Sam) Liu <yaxun.liu at amd.com>
  Date:   2020-05-12 (Tue, 12 May 2020)

  Changed paths:
    M clang/include/clang/Sema/Sema.h
    M clang/lib/Sema/SemaCUDA.cpp
    M clang/lib/Sema/SemaOverload.cpp
    M clang/test/SemaCUDA/function-overload.cu

  Log Message:
  -----------
  [CUDA][HIP] Workaround for resolving host device function against wrong-sided function

recommit c77a4078e01033aa2206c31a579d217c8a07569b with fix

https://reviews.llvm.org/D77954 caused regressions due to diagnostics in implicit
host device functions.

For now, it seems the most feasible workaround is to treat implicit host device function and explicit host
device function differently. Basically in device compilation for implicit host device functions, keep the
old behavior, i.e. give host device candidates and wrong-sided candidates equal preference. For explicit
host device functions, favor host device candidates against wrong-sided candidates.

The rationale is that explicit host device functions are blessed by the user to be valid host device functions,
that is, they should not cause diagnostics in both host and device compilation. If diagnostics occur, user is
able to fix them. However, there is no guarantee that implicit host device function can be compiled in
device compilation, therefore we need to preserve its overloading resolution in device compilation.

Differential Revision: https://reviews.llvm.org/D79526




More information about the All-commits mailing list