[all-commits] [llvm/llvm-project] 257b72: [clang][Sema][SYCL] Fix MSVC STL usage on AMDGPU (...

Nick Sarnie via All-commits all-commits at lists.llvm.org
Fri Apr 18 08:29:08 PDT 2025


  Branch: refs/heads/main
  Home:   https://github.com/llvm/llvm-project
  Commit: 257b72758424f56103d38e3d016cfb6baa4da613
      https://github.com/llvm/llvm-project/commit/257b72758424f56103d38e3d016cfb6baa4da613
  Author: Nick Sarnie <nick.sarnie at intel.com>
  Date:   2025-04-18 (Fri, 18 Apr 2025)

  Changed paths:
    M clang/lib/Sema/SemaDeclAttr.cpp
    A clang/test/SemaSYCL/Inputs/vectorcall.hpp
    A clang/test/SemaSYCL/sycl-cconv-win.cpp

  Log Message:
  -----------
  [clang][Sema][SYCL] Fix MSVC STL usage on AMDGPU (#135979)

The MSVC STL includes specializations of `_Is_memfunptr` for every
function pointer type, including every calling convention.

The problem is the AMDGPU target doesn't support the x86 `vectorcall`
calling convention so clang sets it to the default CC. This ends up
clashing with the already-existing overload for the default CC, so we
get a duplicate definition error when including `type_traits` (which we
heavily use in the SYCL STL) and compiling for AMDGPU on Windows.

This doesn't happen for pure AMDGPU non-SYCL because it doesn't include
the C++ STL, and it doesn't happen for CUDA/HIP because a similar
workaround was done
[here](https://github.com/llvm/llvm-project/commit/fa49c3a888e816969b5ed68cd5c47efc3eb9419f).

I am not an expert in Sema, so I did a kinda of hardcoded fix, please
let me know if there is a better way to fix this.

As far as I can tell we can't do exactly the same fix that was done for
CUDA because we can't differentiate between device and host code so
easily.

---------

Signed-off-by: Sarnie, Nick <nick.sarnie at intel.com>



To unsubscribe from these emails, change your notification settings at https://github.com/llvm/llvm-project/settings/notifications


More information about the All-commits mailing list