llvm icon indicating copy to clipboard operation
llvm copied to clipboard

[SYCL] Add tests for atomic operations on malloc_shared-allocated memory

Open pasaulais opened this issue 1 year ago • 6 comments

This duplicates existing SYCL atomic tests that use buffers with identical tests that use USM and memory allocated using sycl::malloc_shared. The motivation behind exercising atomics on malloc_shared-allocated memory is to catch issues such as https://github.com/ROCm/ROCm/issues/848 where native atomic instructions may fail when crossing the PCIe bus.

pasaulais avatar Jan 24 '24 14:01 pasaulais

This PR so far only contains changes to the 'add' atomic tests to get initial feedback. I will add other tests later so that review feedback won't potentially require all tests to be changed.

pasaulais avatar Jan 24 '24 14:01 pasaulais

:white_check_mark: With the latest revision this PR passed the C/C++ code formatter.

github-actions[bot] avatar Jan 24 '24 14:01 github-actions[bot]

This PR so far only contains changes to the 'add' atomic tests to get initial feedback. I will add other tests later so that review feedback won't potentially require all tests to be changed.

The changes so far look good to me. Only one nit: comments are supposed to be written in proper English, i.e. with proper punctuation. I noticed that you simply copy-pasted the comments from existing tests into the new tests, but can you add the . at the end of the sentence for each of them? Just for the newly added ones.

maarquitos14 avatar Jan 25 '24 09:01 maarquitos14

This PR so far only contains changes to the 'add' atomic tests to get initial feedback. I will add other tests later so that review feedback won't potentially require all tests to be changed.

The changes so far look good to me. Only one nit: comments are supposed to be written in proper English, i.e. with proper punctuation. I noticed that you simply copy-pasted the comments from existing tests into the new tests, but can you add the . at the end of the sentence for each of them? Just for the newly added ones.

No problem. I've clang-formatted my changes and added . to the comments in the new code. I can do it for the existing code as well as I go. Is there any reason not to, like keeping the diff simple?

pasaulais avatar Jan 25 '24 11:01 pasaulais

No problem. I've clang-formatted my changes and added . to the comments in the new code. I can do it for the existing code as well as I go. Is there any reason not to, like keeping the diff simple?

Yes, that's exactly it, we want to keep the diff simple.

maarquitos14 avatar Jan 25 '24 11:01 maarquitos14

@maarquitos14 I have completed the tests for all atomic operations present in the test-e2e/AtomicRef folder, using the same approach as the 'add' test you've already reviewed. Could you take another look at it?

pasaulais avatar Feb 19 '24 15:02 pasaulais

Thanks for your comments @maarquitos14, I think I've addressed all of them.

pasaulais avatar Feb 28 '24 17:02 pasaulais

All atomic tests now seem to be failing on CI (AMD HIP only as far as I can see) with:

# | terminate called after throwing an instance of 'sycl::_V1::exception'
# |   what():  Device does not support shared USM allocations!

This seems to have been introduced by https://github.com/intel/llvm/pull/12700. I'm not sure why this is not supported on AMD HIP, but either way the tests need to be modified to check for shared USM support.

pasaulais avatar Feb 28 '24 17:02 pasaulais