Skip to content

[SYCL] Add prototype of ExtendedAtomics features #1826

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 13 commits into from
Jun 26, 2020

Conversation

Pennycook
Copy link
Contributor

@Pennycook Pennycook commented Jun 5, 2020

Features:

  • atomic_ref with integral and floating-point specializations
  • atomic_fence

Tests:

  • exchange
  • compare_exchange
  • fetch_add, +=, ++
  • fetch_sub, -=, --
  • fetch_min
  • fetch_max

Signed-off-by: John Pennycook [email protected]
Co-authored-by: Alexey Sachkov [email protected]
Co-authored-by: Roland Schulz [email protected]

Pennycook added 4 commits June 5, 2020 15:26
Features:
- atomic_ref with integral and floating-point specializations
- atomic_fence

Tests:
- exchange
- compare_exchange
- fetch_add, +=, ++
- fetch_sub, -=, --
- fetch_min
- fetch_max

Signed-off-by: John Pennycook <[email protected]>
@Pennycook Pennycook added the spec extension All issues/PRs related to extensions specifications label Jun 5, 2020
@Pennycook Pennycook requested review from AlexeySachkov, jbrodman, mkinsner and a team as code owners June 5, 2020 22:29
@Pennycook Pennycook requested a review from againull June 5, 2020 22:29
@Pennycook
Copy link
Contributor Author

@bader What version of clang-format should I be using now? Is there a way to check that I'm using the right one? My local version (built from intel/llvm) doesn't format the same way as clang-format-patch.

@bader
Copy link
Contributor

bader commented Jun 8, 2020

CI check is using clang-format-9.

@Pennycook
Copy link
Contributor Author

CI check is using clang-format-9.

Perfect, thanks!

Two of the atomic tests are failing with the CUDA backend right now, so I've marked them as XFAIL.

@Pennycook
Copy link
Contributor Author

We need more internal investigation to work out why the accelerator target is failing. I've removed it from the tests for now and marked the extension as CPU- and GPU- only, to unblock this PR and enable people to experiment with it on the systems where it works as intended.

@Pennycook
Copy link
Contributor Author

@AlexeySachkov, @brodman, @againull: I expect all the tests to pass with this latest version, so it should be ready for review.

@bader
Copy link
Contributor

bader commented Jun 16, 2020

@jbrodman, @mkinsner, @AlexeySachkov, @intel/llvm-reviewers-runtime, please, review.

@againull
Copy link
Contributor

@Pennycook , I am very sorry for being so late with review.

@@ -155,6 +155,7 @@ extern SYCL_EXTERNAL TempRetT __spirv_ImageSampleExplicitLod(SampledType,
macro(__attribute__((opencl_local)), Arg)

__SPIRV_ATOMICS(__SPIRV_ATOMIC_FLOAT, float)
__SPIRV_ATOMICS(__SPIRV_ATOMIC_FLOAT, double)
Copy link
Contributor

Choose a reason for hiding this comment

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

Just a question: Is 'half' type expected to be supported too eventually?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Good question. OpenCL only defines atomics for 32- and 64-bit types, which is what I've started with here.

C++ allows an atomic_ref to be constructed from any TriviallyCopyable type, and I think eventually that's where we'd like to end up. Whether the atomic_ref for a given type is implemented on top of native instructions, a compare-exchange loop, a global lock, etc, would then be implementation-defined and device-specific.

We haven't yet defined exactly what sort of device queries we'll want to support for testing atomic functionality. If you have any ideas for what the feature sets should look like, or if there are any queries that would be useful for implementing reductions, please let me know!

Copy link
Contributor

@jbrodman jbrodman left a comment

Choose a reason for hiding this comment

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

LGTM

@v-klochkov
Copy link
Contributor

This PR requires approval from @AlexeySachkov and @mkinsner as code-owners.

@jbrodman
Copy link
Contributor

I should be able to approve for @mkinsner.

@jbrodman
Copy link
Contributor

@bader - how can we get this out of review hell?

@bader
Copy link
Contributor

bader commented Jun 26, 2020

@AlexeySachkov, could you take a look, please?

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.

I don't have any objections

@jbrodman
Copy link
Contributor

Thank you. Please merge ASAP.

@bader
Copy link
Contributor

bader commented Jun 26, 2020

Thank you. Please merge ASAP.

I think we should run the tests again. This PR was tested 9 days ago. I'd to make sure it still passes the tests.
I'll try to re-run the tests and merge if they pass.

@jbrodman
Copy link
Contributor

Thank you. Please merge ASAP.

I think we should run the tests again. This PR was tested 9 days ago. I'd to make sure it still passes the tests.
I'll try to re-run the tests and merge if they pass.

Makes sense.

@bader bader merged commit fdf44d4 into intel:sycl Jun 26, 2020
@Pennycook Pennycook deleted the extended-atomics-prototype branch June 30, 2020 17:29
KornevNikita pushed a commit to KornevNikita/llvm that referenced this pull request Feb 2, 2023
KornevNikita pushed a commit to KornevNikita/llvm that referenced this pull request Feb 20, 2023
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.

6 participants