Skip to content

[clang][Sema][SYCL] Fix MSVC STL usage on AMDGPU (#135979) #18097

New issue

Have a question about this project? # for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “#”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? # to your account

Open
wants to merge 1 commit into
base: sycl
Choose a base branch
from

Conversation

sarnex
Copy link
Contributor

@sarnex sarnex commented Apr 18, 2025

Cherry pick upstream commit llvm/llvm-project@257b727

Closes: #7738

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](llvm/llvm-project@fa49c3a).

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@intel.com>
@sarnex sarnex temporarily deployed to WindowsCILock April 18, 2025 15:44 — with GitHub Actions Inactive
@sarnex sarnex temporarily deployed to WindowsCILock April 18, 2025 16:05 — with GitHub Actions Inactive
@sarnex sarnex temporarily deployed to WindowsCILock April 18, 2025 16:17 — with GitHub Actions Inactive
@sarnex sarnex temporarily deployed to WindowsCILock April 18, 2025 17:31 — with GitHub Actions Inactive
@sarnex sarnex marked this pull request as ready for review April 18, 2025 17:52
@sarnex sarnex requested a review from a team as a code owner April 18, 2025 17:52
@sarnex sarnex requested a review from Fznamznon April 18, 2025 17:52
# for free to join this conversation on GitHub. Already have an account? # to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

-fsycl disregards __vectorcall, breaking parse of type_traits on Windows
2 participants