Skip to content
Snippets Groups Projects
  • Yaxun (Sam) Liu's avatar
    d4144511
    [CUDA][HIP] Fix hostness check with -fopenmp · d4144511
    Yaxun (Sam) Liu authored
    CUDA/HIP determines whether a function can be called based on
    the device/host attributes of callee and caller. Clang assumes the
    caller is CurContext. This is correct in most cases, however, it is
    not correct in OpenMP parallel region when CUDA/HIP program
    is compiled with -fopenmp. This causes incorrect overloading
    resolution and missed diagnostics.
    
    To get the correct caller, clang needs to chase the parent chain
    of DeclContext starting from CurContext until a function decl
    or a lambda decl is reached. Sema API is adapted to achieve that
    and used to determine the caller in hostness check.
    
    Reviewed by: Artem Belevich, Richard Smith
    
    Differential Revision: https://reviews.llvm.org/D121765
    d4144511
    History
    [CUDA][HIP] Fix hostness check with -fopenmp
    Yaxun (Sam) Liu authored
    CUDA/HIP determines whether a function can be called based on
    the device/host attributes of callee and caller. Clang assumes the
    caller is CurContext. This is correct in most cases, however, it is
    not correct in OpenMP parallel region when CUDA/HIP program
    is compiled with -fopenmp. This causes incorrect overloading
    resolution and missed diagnostics.
    
    To get the correct caller, clang needs to chase the parent chain
    of DeclContext starting from CurContext until a function decl
    or a lambda decl is reached. Sema API is adapted to achieve that
    and used to determine the caller in hostness check.
    
    Reviewed by: Artem Belevich, Richard Smith
    
    Differential Revision: https://reviews.llvm.org/D121765
Code owners
Assign users and groups as approvers for specific file changes. Learn more.