Skip to content

[SYCL] Introduce a fully-mocked PI plugin for unit tests #6684

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

Conversation

AlexeySachkov
Copy link
Contributor

@AlexeySachkov AlexeySachkov commented Sep 1, 2022

The idea behind this PR is to introduce an infrastructure which allows to write unit-tests, which are not dependent on a presence of actual backends (like OpenCL, L0, etc.) or devices (like CPU, GPU, etc.).

Motivation for the patch: host device is going to be removed and we have a number of in-tree LIT tests, which can't pass if there are no devices available, so they are likely to be removed/disabled in short-term (#6683), unless we move them into llvm-test-suite or unit-tests with new infrastructure suggested here.

Signed-off-by: Larsen, Steffen <steffen.larsen@intel.com>
Signed-off-by: Larsen, Steffen <steffen.larsen@intel.com>
Signed-off-by: Larsen, Steffen <steffen.larsen@intel.com>
Signed-off-by: Larsen, Steffen <steffen.larsen@intel.com>
Signed-off-by: Larsen, Steffen <steffen.larsen@intel.com>
@steffenlarsen
Copy link
Contributor

Newest work changes PiMock to always use the mock plugin. This means the unittests should be fully independent of which plugins and devices are available on the system. Additionally, this means all tests that were previously requiring a specific backend (mostly opencl previously) will no longer skip the tests silently.

As the next steps, documentation should be expanded to detail this, then I believe this can be ready for review.

…eing selected

Signed-off-by: Larsen, Steffen <steffen.larsen@intel.com>
Signed-off-by: Larsen, Steffen <steffen.larsen@intel.com>
@steffenlarsen steffenlarsen marked this pull request as ready for review September 9, 2022 10:42
@steffenlarsen steffenlarsen requested a review from a team as a code owner September 9, 2022 10:42
@steffenlarsen
Copy link
Contributor

This is ready for review.

@steffenlarsen steffenlarsen changed the title [POC] Introduce a fully-mocked PI plugin for unit tests [SYCL] Introduce a fully-mocked PI plugin for unit tests Sep 9, 2022
@steffenlarsen
Copy link
Contributor

@romanovvlad & @kbobrovs & @smaslov-intel - Friendly ping.

kbobrovs
kbobrovs previously approved these changes Sep 13, 2022
@@ -30,35 +29,22 @@ pi_result redefinedMemBufferCreate(pi_context, pi_mem_flags, size_t size,

class EventDestructionTest : public ::testing::Test {
public:
EventDestructionTest() : Plt{default_selector()} {}
EventDestructionTest() : Mock{}, Plt{Mock.getPlatform()} {}
Copy link
Contributor

Choose a reason for hiding this comment

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

Maybe for another PR - it seems this a common pattern that we can factor out into a base class MockTest.

Copy link
Contributor

Choose a reason for hiding this comment

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

I think that would be good, but I would prefer that to be a separate that into another patch. This patch is already quite large.

@aelovikov-intel
Copy link
Contributor

LGTM, but I'll leave SYCL RT approval to Vlad.

romanovvlad
romanovvlad previously approved these changes Sep 15, 2022
Copy link
Contributor

@romanovvlad romanovvlad left a comment

Choose a reason for hiding this comment

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

LGTM. Minor comments:

Signed-off-by: Larsen, Steffen <steffen.larsen@intel.com>
@steffenlarsen steffenlarsen dismissed stale reviews from romanovvlad and kbobrovs via 4b42464 September 15, 2022 11:14
Signed-off-by: Larsen, Steffen <steffen.larsen@intel.com>
@steffenlarsen
Copy link
Contributor

unexpected pass in spec_const/spec_const_double.cpp is known. Merging.

@steffenlarsen steffenlarsen merged commit 9a59ef5 into intel:sycl Sep 15, 2022
@pvchupin
Copy link
Contributor

@steffenlarsen
Copy link
Contributor

#6798 should fix the issue.

@AlexeySachkov AlexeySachkov deleted the private/asachkov/mock-all-pi-entry-points branch May 22, 2024 09:51
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

6 participants