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

[SYCL][ESIMD] Add simd::copy* E2E tests. #236

Merged
merged 5 commits into from
May 31, 2021
Merged

[SYCL][ESIMD] Add simd::copy* E2E tests. #236

merged 5 commits into from
May 31, 2021

Conversation

kbobrovs
Copy link

Tests for new ESIMD API, see intel/llvm#3572

Signed-off-by: kbobrovs [email protected]


std::cout << (passed ? "=== Test passed\n" : "=== Test FAILED\n");
return passed ? 0 : 1;
}

Choose a reason for hiding this comment

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

nit: would it become more readable if we just split USM- and accessor-based tests into separate files? Some if constexpr would go away.

Copy link
Author

Choose a reason for hiding this comment

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

Yes, it might. But I'd prefer to have this in a single file to avoid code duplication and reduce maintenance burden.

int main(int argc, char **argv) {
size_t size = 32 * 7;

if (argc > 1) {

Choose a reason for hiding this comment

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

Do we need that code? Is it left intentionally for debugging purposes?

Copy link
Author

Choose a reason for hiding this comment

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

it is left intentionally, to be able to run with different size.

}

int main(int argc, char **argv) {
size_t size = 32 * 7;

Choose a reason for hiding this comment

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

Is it intentionally 32 * 7, not 32 << 7 ?

Copy link
Author

Choose a reason for hiding this comment

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

Yes

const uint32_t ii = static_cast<uint32_t>(i.get(0));
simd<T, N> v;
const auto offset = ii * sizeof(v);
v.copy_from(acc, offset);

Choose a reason for hiding this comment

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

We copy the source data into the original destination. If the copy_from and copy_to would be unimplemented the test will pass as well. Maybe we can test introduce a separate destination buffer and test copying A -> B?

Copy link
Author

Choose a reason for hiding this comment

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

That is a good point!

Copy link
Author

Choose a reason for hiding this comment

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

Actually, not quite. The test does:

    v.copy_from(ptr + offset);
    v += simd<T, N>(ii * N, 1);
    v.copy_to(ptr + offset);

I.e. the written value depends both on the original value. So if either does not work test should fail. But the choice of '0' as the initial value is bad indeed, as there is a chance v can be initialized to zeroes even if copy_from does not work. I'll fix that.

Copy link
Author

@kbobrovs kbobrovs May 6, 2021

Choose a reason for hiding this comment

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

I mean, the point is still good :), as it lead to problem discovery, but it is not fully valid.

@vladimirlaz
Copy link

@kbobrovs, could you address comments?

@kbobrovs
Copy link
Author

kbobrovs commented May 6, 2021

@kbobrovs, could you address comments?

Yes, this somehow went off the radar.

DenisBakhvalov
DenisBakhvalov previously approved these changes May 6, 2021
@vladimirlaz
Copy link

@kbobrovs should we modify namespaces? They have been changed in compiler...

@vladimirlaz
Copy link

vladimirlaz commented May 13, 2021

@kbobrovs could you please fix CI failures?

Copy link

@vladimirlaz vladimirlaz left a comment

Choose a reason for hiding this comment

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

could you please fix CI failures?

@kbobrovs
Copy link
Author

could you please fix CI failures?

@vladimirlaz - fixed. sorry for delay

@kbobrovs
Copy link
Author

@vladimirlaz, this one is ready to merge.

@vladimirlaz vladimirlaz merged commit 935e810 into intel:intel May 31, 2021
smaslov-intel pushed a commit to smaslov-intel/llvm-test-suite that referenced this pull request Aug 12, 2021
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