Skip to content

[SYCL] Align sub-group implementation and docs #1922

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 14 commits into from
Jun 30, 2020

Conversation

Pennycook
Copy link
Contributor

@Pennycook Pennycook commented Jun 18, 2020

  • Deprecate two-input shuffles
  • Fix linear_id type (size_t => uint32_t)
  • Add linear ID queries
  • Remove fence_space from barrier

Signed-off-by: John Pennycook [email protected]


Brings the sub-group implementation closer in line with the specification update from #1565. Includes some minor refactoring to simplify the implementation of requested features (e.g. #1885 and #1916).

- Remove previously deprecated functions
- Deprecate two-input shuffles
- Fix linear_id type (size_t => uint32_t)

Signed-off-by: John Pennycook <[email protected]>
Preparation for updated sub-group features.
Combining files to avoid accidental interface differences.

Signed-off-by: John Pennycook <[email protected]>
- get_group_range() changed from uint32_t to range<1>
- get_uniform_group_range() no longer supported

Signed-off-by: John Pennycook <[email protected]>
@Pennycook Pennycook added the spec extension All issues/PRs related to extensions specifications label Jun 18, 2020
@Pennycook Pennycook requested a review from AlexeySachkov June 18, 2020 17:32
@Pennycook Pennycook requested a review from a team as a code owner June 18, 2020 17:32
@Pennycook Pennycook requested a review from vladimirlaz June 18, 2020 17:32
@Pennycook
Copy link
Contributor Author

@bader Could you please take a look at the failing tests for me? I can't see how the failure relates to these changes.

@bader
Copy link
Contributor

bader commented Jun 19, 2020

@bader Could you please take a look at the failing tests for me? I can't see how the failure relates to these changes.

I think these failures are caused by your changes:

D:\BuildBot\Product_worker_intel\sycl-win-x64-pr\llvm.src\sycl\include\CL/sycl/intel/sub_group.hpp(281): error C2491: 'cl::sycl::intel::sub_group::shuffle': definition of dllimport function not allowed
D:\BuildBot\Product_worker_intel\sycl-win-x64-pr\llvm.src\sycl\include\CL/sycl/intel/sub_group.hpp(295): error C2491: 'cl::sycl::intel::sub_group::shuffle_down': definition of dllimport function not allowed
D:\BuildBot\Product_worker_intel\sycl-win-x64-pr\llvm.src\sycl\include\CL/sycl/intel/sub_group.hpp(309): error C2491: 'cl::sycl::intel::sub_group::shuffle_up': definition of dllimport function not allowed

If you think internal testing failures are not related to your patch, please, file a bug report.

@Pennycook
Copy link
Contributor Author

I think these failures are caused by your changes:

Sorry, you're right. I was focusing on the traceback and somehow missed those three lines. Thanks for the help!

@Pennycook
Copy link
Contributor Author

Pennycook commented Jun 19, 2020

@alexbatashev : The failures seem related to your change in 1280554, which replaced __SYCL_DEPRECATED__ with __SYCL_EXPORT_DEPRECATED. This patch deprecates three new functions, which correspond to the three build failures on Windows.

Have I made a mistake here, or is there something wrong with using __SYCL_EXPORT_DEPRECATED in this header? I'm not very familiar with compiling for Windows, so I'm not sure why defining these three functions as dllimport is problematic.

@alexey-bataev
Copy link
Contributor

@alexey-bataev: The failures seem related to your change in 1280554, which replaced __SYCL_DEPRECATED__ with __SYCL_EXPORT_DEPRECATED. This patch deprecates three new functions, which correspond to the three build failures on Windows.

Have I made a mistake here, or is there something wrong with using __SYCL_EXPORT_DEPRECATED in this header? I'm not very familiar with compiling for Windows, so I'm not sure why defining these three functions as dllimport is problematic.

The author is Alexander Batashev, not Alexey Bataev.

@bader
Copy link
Contributor

bader commented Jun 19, 2020

@alexey-bataev: The failures seem related to your change in 1280554, which replaced __SYCL_DEPRECATED__ with __SYCL_EXPORT_DEPRECATED. This patch deprecates three new functions, which correspond to the three build failures on Windows.
Have I made a mistake here, or is there something wrong with using __SYCL_EXPORT_DEPRECATED in this header? I'm not very familiar with compiling for Windows, so I'm not sure why defining these three functions as dllimport is problematic.

The author is Alexander Batashev, not Alexey Bataev.

I've updated the account id to @alexbatashev in the original comment. Sorry for inconvenience.

@Pennycook
Copy link
Contributor Author

Sorry about the mix-up.

@jbrodman
Copy link
Contributor

The comp fails seem like we need to bring back __SYCL_DEPRECATED.

__SYCL_EXPORT_DEPRECATED adding __dllimport is breaking things.

I'm fine with going ahead with that.

__SYCL_EXPORT_DEPRECATED() should not apply to header-only functions.

Signed-off-by: John Pennycook <[email protected]>
@Pennycook
Copy link
Contributor Author

The comp fails seem like we need to bring back __SYCL_DEPRECATED.

Thanks, @jbrodman. I've reintroduced __SYCL_DEPRECATED in 90d5156.

@alexbatashev
Copy link
Contributor

@alexbatashev : The failures seem related to your change in 1280554, which replaced __SYCL_DEPRECATED__ with __SYCL_EXPORT_DEPRECATED. This patch deprecates three new functions, which correspond to the three build failures on Windows.

Have I made a mistake here, or is there something wrong with using __SYCL_EXPORT_DEPRECATED in this header? I'm not very familiar with compiling for Windows, so I'm not sure why defining these three functions as dllimport is problematic.

The original __SYCL_DEPRECATED__ was removed, because there was no use for it. @jbrodman's answer is correct.

vladimirlaz
vladimirlaz previously approved these changes Jun 22, 2020
@vladimirlaz vladimirlaz self-requested a review June 22, 2020 07:14
AlexeySachkov
AlexeySachkov previously approved these changes Jun 22, 2020
Copy link
Contributor

@AlexeySachkov AlexeySachkov left a comment

Choose a reason for hiding this comment

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

LGTM

Meaning of barrier() was ambiguous, and could have meant:
- New barrier() with no fence_space argument
- Old barrier() with default fence_space argument

Signed-off-by: John Pennycook <[email protected]>
@Pennycook Pennycook dismissed stale reviews from AlexeySachkov and vladimirlaz via 048dca0 June 23, 2020 13:47
@vladimirlaz
Copy link
Contributor

please resolve conflict.

@vladimirlaz
Copy link
Contributor

One more conflict in place...

@Pennycook
Copy link
Contributor Author

Removing the sub-group collectives is leading to CI failures, so I've put them back in for now to help us close this PR. We should revisit and remove the deprecated functions later.

AlexeySachkov
AlexeySachkov previously approved these changes Jun 29, 2020
@Pennycook
Copy link
Contributor Author

Really sorry @AlexeySachkov; the previous commit didn't include all of my local changes, and I didn't catch it until buildbot failed. To save you from having to review this over and over, I'll ping you when the tests have passed.

@Pennycook
Copy link
Contributor Author

@AlexeySachkov, @vladimirlaz: The tests all passed this time, so I think this is ready for merge. Thanks for your help with this.

@jbrodman jbrodman requested a review from AlexeySachkov June 30, 2020 01:04
@bader bader merged commit bea6aa2 into intel:sycl Jun 30, 2020
@Pennycook Pennycook deleted the sub-group-tidy branch June 30, 2020 17:29
bb-sycl pushed a commit that referenced this pull request Apr 18, 2023
Optimized LLVM IR started to contain this intrinsic recently after InstCombine updates, like:
"Fold and/or of fcmp into class" ( 08f0388 )
There is no direct counterpart for it in SPIR-V, so testing is mapped on a sequence of SPIR-V instructions:

test for both qnan and snan -> OpIsNan
test for either of qnan and snan -> isquiet(V) ==> abs(V) >= (unsigned(Inf) | quiet_bit)
issignaling(V) ==> isnan(V) && !isquiet(V)
test for neg/pos inf -> OpIsInf + OpSignBitSet
test for neg/pos normal -> OpIsNormal + OpSignBitSet
test for neg/pos subnormal -> issubnormal(V) ==> unsigned(abs(V) - 1) < (all mantissa bits set)
test for neg/pos zero -> compare bitcasted to int float with 0 + OpSignBitSet

Signed-off-by: Sidorov, Dmitry <[email protected]>

Original commit:
KhronosGroup/SPIRV-LLVM-Translator@0617edd
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
spec extension All issues/PRs related to extensions specifications
Projects
None yet
Development

Successfully merging this pull request may close these issues.

7 participants