Skip to content

[ESIMD] Refactor esimd intrinsic mapping to BE intrinsics. #4720

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

Merged
merged 5 commits into from
Oct 11, 2021

Conversation

kbobrovs
Copy link
Contributor

@kbobrovs kbobrovs commented Oct 7, 2021

This patch

  • makes names and parameter lists of __esimd* intrinsics match their
    @llvm.genx counterparts. The benefits are:
    • this removes the extra logical translation layer between __esimd* and
      @llvm.genx thus simplifying overall user-level esimd intrinsic translation
    • allows to reuse lots of functionality between SLM and surface memory
      accesses
  • moves some of the translations and argument setting (like accessor field to
    surface index, setting scale) from LowerESIMD.cpp to the ESIMD headers, which
    simplifies code base.
  • for all memory intrinsics moves host and device implementations to the same
    intrinsic function prototype separating them via SYCL_DEVICE_ONLY macro
    thus avoiding duplication of the prototypes
  • removes certain redundant __esimd* intrinsics, such as SLM memory accesses
    (which are normal surface accesses with special surface index 254), and
    __esimd_reduced_fmax,... which have the same functionality as usual fmax,...

This is also a preparatory step for fixing SLM memory accesses (revising vector
lengths, element types restirictions)

Signed-off-by: Konstantin S Bobrovsky [email protected]

@kbobrovs kbobrovs force-pushed the fix_intrin_names branch 2 times, most recently from c3aaa91 to cf61023 Compare October 9, 2021 07:58
@kbobrovs kbobrovs changed the title [WIP][ESIMD] Refactor esimd intrinsic mapping to BE intrinsics. [ESIMD] Refactor esimd intrinsic mapping to BE intrinsics. Oct 10, 2021
This patch
- makes names and parameter lists of __esimd* intrinsics match their
  @llvm.genx counterparts. The benefits are:
  * this removes the extra logical translation layer between __esimd* and
    @llvm.genx thus simplifying overall user-level esimd intrinsic translation
  * allows to reuse lots of functionality between SLM and surface memory
    accesses
- moves some of the translations and argument setting (like accessor field to
  surface index, setting scale) from LowerESIMD.cpp to the ESIMD headers, which
  simplifies code base.
- for all memory intrinsics moves host and device implementations to the same
  intrinsic function prototype separating them via __SYCL_DEVICE_ONLY__ macro
  thus avoiding duplication of the prototypes
- removes certain redundant __esimd* intrinsics, such as SLM memory accesses
  (which are normal surface accesses with special surface index 254), and
  __esimd_reduced_fmax,... which have the same functionality as usual fmax,...

This is also a preparatory step for fixing SLM memory accesses (revising vector
lengths, element types restirictions)

Signed-off-by: Konstantin S Bobrovsky <[email protected]>
Signed-off-by: Konstantin S Bobrovsky <[email protected]>
Signed-off-by: Konstantin S Bobrovsky <[email protected]>
@kbobrovs
Copy link
Contributor Author

@vladimirlaz, @bader - for some reason buildbot/sycl-ubu-x64-pr testing can't proceed. Can you please take a look?

@vladimirlaz
Copy link
Contributor

@vladimirlaz, @bader - for some reason buildbot/sycl-ubu-x64-pr testing can't proceed. Can you please take a look?

@tfzhu, @DoyleLi could you please have a look?

@bader
Copy link
Contributor

bader commented Oct 11, 2021

@vladimirlaz, @bader - for some reason buildbot/sycl-ubu-x64-pr testing can't proceed. Can you please take a look?

@kbobrovs, please, contact tools team for the issues with Buildbot/Jenkins CI testing.

@kbobrovs kbobrovs merged commit e5cc9b7 into intel:sycl Oct 11, 2021
@kbobrovs kbobrovs deleted the fix_intrin_names branch October 11, 2021 15:20
template <typename AccessorTy>
ESIMD_INLINE ESIMD_NODEBUG SurfaceIndex get_surface_index(AccessorTy acc) {
#ifdef __SYCL_DEVICE_ONLY__
if constexpr (std::is_same_v<detail::LocalAccessorMarker, AccessorTy>) {
Copy link
Contributor

Choose a reason for hiding this comment

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

While trying to revise memory_intrin.hpp (#4748) for ESIMD_EMU support, I cannot find out how SLM_BTI value can be passed to SLM feature implementation for ESIMD_EMU support (host mode currently). Am I missing something?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

SLM_BTI can be passed to __esimd* memory intrinsics w/o problems.

Copy link
Contributor

@dongkyunahn-intel dongkyunahn-intel Oct 13, 2021

Choose a reason for hiding this comment

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

HOW can SLM_BTI be passed to SLM intrinsic implementations for host mode? The only return detail::SLM_BTI line is enclosed by #ifdef __SYCL_DEVICE_ONLY - line 52 of this file.

And, in line 66 of this file, the wrapping macro is dummy one for host mode compilation. This means

const auto si = __ESIMD_GET_SURF_HANDLE(detail::LocalAccessorMarker()); at line 793 becomes

const auto si = detail::LocalAccessorMarker(); for host mode.

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.

6 participants