Skip to content
This repository was archived by the owner on Mar 28, 2023. It is now read-only.

[SYCL] Adds extensive testing for SYCL2020 implicitly device copyable types. #1583

Merged

Conversation

maarquitos14
Copy link

Signed-off-by: Maronas, Marcos [email protected]

@maarquitos14 maarquitos14 requested a review from a team as a code owner February 8, 2023 16:09
@maarquitos14 maarquitos14 changed the title Adds extensive testing for SYCL2020 implicitly device copyable types. [SYCL] Adds extensive testing for SYCL2020 implicitly device copyable types. Feb 8, 2023
Signed-off-by: Maronas, Marcos <[email protected]>
Comment on lines 42 to 59
{
sycl::buffer<std::pair<int, float>, 1> buf_pair_arr{
result_pair_arr, sycl::range<1>(arr_size)};
sycl::buffer<std::pair<int, float>, 1> buf_pair{&result_pair,
sycl::range<1>(1)};

q.submit([&](sycl::handler &cgh) {
auto acc_pair_arr =
sycl::accessor{buf_pair_arr, cgh, sycl::read_write};
auto acc_pair = sycl::accessor{buf_pair, cgh, sycl::read_write};
cgh.single_task([=]() {
for (auto i = 0; i < arr_size; i++) {
acc_pair_arr[i] = pair_arr[i];
}
acc_pair[0] = pair;
});
}).wait_and_throw();
}
Copy link

@steffenlarsen steffenlarsen Feb 8, 2023

Choose a reason for hiding this comment

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

This looks like it is the same for most of the test cases, except for the type used. Could it be moved to a common function? I'm thinking something like:

template <typename DataT, size_t ArrSize>
void CaptureAndCopy(const DataT *data_arr, const DataT &data_scalar, DataT *result_arr, DataT *result_scalar) {
    sycl::buffer<DataT, 1> buf_arr{result_arr, sycl::range<1>(ArrSize)};
    sycl::buffer<DataT, 1> buf_scalar{&result_scalar, sycl::range<1>(1)};

    q.submit([&](sycl::handler &cgh) {
       auto acc_arr = sycl::accessor{buf_arr, cgh, sycl::read_write};
       auto acc_scalar = sycl::accessor{buf_scalar, cgh, sycl::read_write};
       cgh.single_task([=]() {
         for (auto i = 0; i < ArrSize; i++) {
           acc_arr[i] = data_arr[i];
         }
         acc_scalar[0] = data_scalar;
       });
     });
  }

Signed-off-by: Maronas, Marcos <[email protected]>
Copy link

@steffenlarsen steffenlarsen left a comment

Choose a reason for hiding this comment

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

LGTM!

Signed-off-by: Maronas, Marcos <[email protected]>
Signed-off-by: Maronas, Marcos <[email protected]>
@bader bader merged commit da1df22 into intel:intel Feb 15, 2023
steffenlarsen pushed a commit that referenced this pull request Feb 17, 2023
…1596)

#1583 introduced a clang-format issue. This fixes the issue.

---------

Signed-off-by: Maronas, Marcos <[email protected]>
myler pushed a commit to myler/llvm-test-suite that referenced this pull request Mar 22, 2023
myler pushed a commit to myler/llvm-test-suite that referenced this pull request Mar 22, 2023
…ntel#1596)

intel#1583 introduced a clang-format issue. This fixes the issue.

---------

Signed-off-by: Maronas, Marcos <[email protected]>
aelovikov-intel pushed a commit to aelovikov-intel/llvm that referenced this pull request Mar 27, 2023
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants