Skip to content
New issue

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

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

Already on GitHub? Sign in to your account

[SYCL] Fix using some of math built-ins when ESIMD is included #14793

Merged
merged 3 commits into from
Jul 29, 2024

Conversation

AlexeySachkov
Copy link
Contributor

@AlexeySachkov AlexeySachkov commented Jul 26, 2024

ESIMD headers declare some of __spirv_ocl_* built-ins as template functions, but those built-ins are also automatically declared by the compiler implicitly when used.

On Windows, redeclarations in headers cause compilation issues, because by some reason they take priority, but template arguments for them couldn't be inferred.

This commit effectively introduces new tests to cover affected scenarios and reverts a couple of ESIMD commits to fix the issue:

I suppose that both PRs were made in attempt to move away from custom ESIMD intrinsic to standard SPIR-V ones, but that should be done without manually declaring the latter. A bigger refactoring might be needed to use auto-declared SPIR-V built-ins in ESIMD because of presence and usage of single-element vectors in ESIMD (which do not exist in SPIR-V).

… and support new functions (intel#13383)"

This is a partial revert of bcca7a8.

Notable changes:
- new tests for `popcount`, `clz` and `ctz` built-ins were preserved
- public definitions of those ESIMD APIs were preserved
- the implementation of the latter was changed, though:
  - drop template args around `__spirv_ocl_*` intrinsics to use ones
    that are auto-declared by the compiler
  - added `#ifdef __SYCL_DEVICE_ONLY__`, because the compiler only
    declares `__spirv_ocl_*` intrinsics for device compilation
@AlexeySachkov AlexeySachkov force-pushed the private/asachkov/revert-13383 branch from 1b00cda to 97abb43 Compare July 26, 2024 09:43
@AlexeySachkov AlexeySachkov changed the title Add new regression tests [SYCL] Fix using some of math built-ins when ESIMD is included Jul 26, 2024
@AlexeySachkov AlexeySachkov marked this pull request as ready for review July 26, 2024 12:14
@AlexeySachkov AlexeySachkov requested a review from a team as a code owner July 26, 2024 12:14
@@ -72,23 +72,6 @@ template <typename T, int N>
__ESIMD_INTRIN __ESIMD_raw_vec_t(T, N)
__spirv_ocl_native_powr(__ESIMD_raw_vec_t(T, N), __ESIMD_raw_vec_t(T, N));

template <typename T, int N>
__ESIMD_INTRIN __ESIMD_raw_vec_t(T, N)
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

instead what if we SFINAE these to only work when N==1, so we use the compiler generated ones by default?

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Whatever, I'll deal with this later. Will approve/merge for now.

@sarnex sarnex merged commit 0228c23 into intel:sycl Jul 29, 2024
15 checks passed
sarnex added a commit to sarnex/llvm that referenced this pull request Jul 29, 2024
sarnex added a commit to sarnex/llvm that referenced this pull request Aug 5, 2024
@AlexeySachkov AlexeySachkov deleted the private/asachkov/revert-13383 branch October 9, 2024 08:00
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants