[all-commits] [llvm/llvm-project] 9774d0: [CUDA][HIP] Make template implicitly host device (...

Yaxun (Sam) Liu via All-commits all-commits at lists.llvm.org
Thu Nov 9 17:36:53 PST 2023


  Branch: refs/heads/main
  Home:   https://github.com/llvm/llvm-project
  Commit: 9774d0ce5fbd70288514da77072313b4f45b34bb
      https://github.com/llvm/llvm-project/commit/9774d0ce5fbd70288514da77072313b4f45b34bb
  Author: Yaxun (Sam) Liu <yaxun.liu at amd.com>
  Date:   2023-11-09 (Thu, 09 Nov 2023)

  Changed paths:
    M clang/include/clang/AST/ASTContext.h
    M clang/include/clang/Basic/Features.def
    M clang/include/clang/Basic/LangOptions.def
    M clang/include/clang/Driver/Options.td
    M clang/include/clang/Sema/Sema.h
    M clang/lib/CodeGen/CodeGenModule.cpp
    M clang/lib/Driver/ToolChains/Clang.cpp
    M clang/lib/Sema/SemaCUDA.cpp
    M clang/lib/Sema/SemaExpr.cpp
    A clang/test/CodeGenCUDA/implicit-host-device-fun.cu
    A clang/test/Lexer/has_extension.cu
    A clang/test/SemaCUDA/implicit-host-device-fun.cu

  Log Message:
  -----------
  [CUDA][HIP] Make template implicitly host device (#70369)

Added option -foffload-implicit-host-device-templates which is off by
default.

When the option is on, template functions and specializations without
host/device attributes have implicit host device attributes.

They can be overridden by device template functions with the same
signagure.
They are emitted on device side only if they are used on device side.

This feature is added as an extension.
`__has_extension(cuda_implicit_host_device_templates)` can be used to
check whether it is enabled.

This is to facilitate using standard C++ headers for device.

Fixes: https://github.com/llvm/llvm-project/issues/69956

Fixes: SWDEV-428314




More information about the All-commits mailing list