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][ESIMD] Move a few math operations to SPIR-V intrinsics and support new functions #13383

Merged
merged 1 commit into from
Jun 3, 2024

Conversation

sarnex
Copy link
Contributor

@sarnex sarnex commented Apr 12, 2024

This PR has three types of changes:

  1. Move some math operations to SPIR-V intrinsics. They are:
__esimd_abs to __spirv_ocl_fabs and __spirv_ocl_s_abs
__esimd_fmin to __spirv_ocl_fmin
__esimd_fmadd to __spirv_ocl_fma
  1. Support three new functions using SPIR-V intrinsics
popcount
clz
ctz

There are some more functions I will move to SPIR-V intrinsincs once driver issues are fixed.

  1. Remove code that breaks up the fmuladd intrinsic generated by the FE as the drivers we support can handle it now.

@v-klochkov v-klochkov requested a review from fineg74 May 8, 2024 18:26
@sarnex sarnex temporarily deployed to WindowsCILock May 9, 2024 16:46 — with GitHub Actions Inactive
@sarnex sarnex force-pushed the genx branch 2 times, most recently from 1acd1b9 to c91df9b Compare May 22, 2024 16:32
@sarnex sarnex temporarily deployed to WindowsCILock May 22, 2024 16:43 — with GitHub Actions Inactive
@sarnex sarnex temporarily deployed to WindowsCILock May 22, 2024 18:45 — with GitHub Actions Inactive
@sarnex sarnex temporarily deployed to WindowsCILock May 22, 2024 20:09 — with GitHub Actions Inactive
@sarnex sarnex temporarily deployed to WindowsCILock May 29, 2024 15:15 — with GitHub Actions Inactive
@sarnex sarnex temporarily deployed to WindowsCILock May 31, 2024 17:53 — with GitHub Actions Inactive
@sarnex sarnex temporarily deployed to WindowsCILock May 31, 2024 19:01 — with GitHub Actions Inactive
@sarnex sarnex temporarily deployed to WindowsCILock May 31, 2024 19:46 — with GitHub Actions Inactive
@sarnex sarnex changed the title [SYCL][ESIMD] Move a few math operations to SPIR-V intrinsics [SYCL][ESIMD] Move a few math operations to SPIR-V intrinsics and support two new functions May 31, 2024
@sarnex sarnex changed the title [SYCL][ESIMD] Move a few math operations to SPIR-V intrinsics and support two new functions [SYCL][ESIMD] Move a few math operations to SPIR-V intrinsics and support new functions May 31, 2024
Signed-off-by: Sarnie, Nick <nick.sarnie@intel.com>
@sarnex
Copy link
Contributor Author

sarnex commented Jun 3, 2024

CUDA fail not related

@sarnex sarnex marked this pull request as ready for review June 3, 2024 14:39
@sarnex sarnex requested a review from a team as a code owner June 3, 2024 14:39
@sarnex sarnex merged commit bcca7a8 into intel:sycl Jun 3, 2024
13 of 14 checks passed
AlexeySachkov added a commit to AlexeySachkov/llvm that referenced this pull request Jul 26, 2024
… 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
sarnex pushed a commit that referenced this pull request Jul 29, 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:
- #14020 is completely reverted
- #13383 is partially reverted to preserve new interfaces and
tests, but stop declaring `__spirv_ocl_*` built-ins

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).
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.

3 participants