-
Notifications
You must be signed in to change notification settings - Fork 788
[SYCL] Enable PI unit testing on multiple plugins. #1647
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
Conversation
Enable CUDA + OpenCL PI unit tests. Signed-off-by: Stuart Adams <[email protected]>
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Approve to start tests
@StuartDAdams, could you please:
|
Signed-off-by: Stuart Adams <[email protected]>
Right now the tests operate on all plugins returned by https://github.com/intel/llvm/pull/1647/files#diff-c2020da2ebb84661f358e463c350b60aR103 This vector is then passed to the test fixture through Regarding logging, I could create a new function that returns a string literal for the plugin type. When an assertion fails, it will print the appropriate message and the plugin type that it failed on. Would this be sufficient? |
|
Signed-off-by: Stuart Adams <[email protected]>
I've updated the PR so that the name of the PI plugin is now printed for each test run. The output looks like this: [----------] 12 tests from EventTestImpl/EventTest
[ RUN ] EventTestImpl/EventTest.PICreateEvent/opencl
[ OK ] EventTestImpl/EventTest.PICreateEvent/opencl (81 ms)
[ RUN ] EventTestImpl/EventTest.PICreateEvent/cuda
[ OK ] EventTestImpl/EventTest.PICreateEvent/cuda (58 ms)
[ RUN ] EventTestImpl/EventTest.piEventSetCallback/opencl
Event callback 0 of type 2 triggered
Event callback 1 of type 1 triggered
Event callback 2 of type 0 triggered
[ OK ] EventTestImpl/EventTest.piEventSetCallback/opencl (69 ms)
[ RUN ] EventTestImpl/EventTest.piEventSetCallback/cuda
Event callback 0 of type 2 triggered
Event callback 1 of type 1 triggered
Event callback 2 of type 0 triggered
[ OK ] EventTestImpl/EventTest.piEventSetCallback/cuda (31 ms)
[ RUN ] EventTestImpl/EventTest.piEventGetInfo/opencl
[ OK ] EventTestImpl/EventTest.piEventGetInfo/opencl (0 ms)
[ RUN ] EventTestImpl/EventTest.piEventGetInfo/cuda
[ OK ] EventTestImpl/EventTest.piEventGetInfo/cuda (52 ms)
[ RUN ] EventTestImpl/EventTest.piEventSetStatus/opencl
[ OK ] EventTestImpl/EventTest.piEventSetStatus/opencl (0 ms)
[ RUN ] EventTestImpl/EventTest.piEventSetStatus/cuda
[ OK ] EventTestImpl/EventTest.piEventSetStatus/cuda (50 ms)
[ RUN ] EventTestImpl/EventTest.WaitForManualEventOnOtherThread/opencl
[ OK ] EventTestImpl/EventTest.WaitForManualEventOnOtherThread/opencl (0 ms)
[ RUN ] EventTestImpl/EventTest.WaitForManualEventOnOtherThread/cuda
[ OK ] EventTestImpl/EventTest.WaitForManualEventOnOtherThread/cuda (51 ms)
[ RUN ] EventTestImpl/EventTest.piEnqueueEventsWait/opencl
[ OK ] EventTestImpl/EventTest.piEnqueueEventsWait/opencl (0 ms)
[ RUN ] EventTestImpl/EventTest.piEnqueueEventsWait/cuda
[ OK ] EventTestImpl/EventTest.piEnqueueEventsWait/cuda (28 ms)
[----------] 12 tests from EventTestImpl/EventTest (420 ms total) |
Some tests take 0 ms on opencl backend (50+ms on cuda) it it expected or test is skipped. What is the source or overhead on cuda? |
This output is from a debug build, so there could be a number of things increasing the overhead of the tests. In the interest of keeping this PR focused, I think it should only enable the disabled PI API unit tests, and leave any potential performance issues for future issues and PRs. |
Signed-off-by: Stuart Adams <[email protected]>
6a600b7
to
39a85a8
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
A couple of style comments.
Signed-off-by: Stuart Adams <[email protected]>
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks!
@StuartDAdams, 7 tests are failing on the systems w/o OpenCL. From: https://github.com/intel/llvm/runs/673664063 Failing Tests (7): Testing Time: 810.52s |
@StuartDAdams, more serious problem seems to be exposed here: #1675 (comment). I think it's more serious because it impacts pre-commit testing and we need to fix this ASAP. |
Why is the OpenCL plugin returned by pi::initialize() when the systems do not have OpenCL? These tests simply run for all plugins returned by that pi::initialize(). If that function returns invalid plugins, then it needs to be fixed. This should probably be opened as a seperate issue. |
Looks like a bug to me. Tagging @romanovvlad and @smaslov-intel. |
Looking more closely at the code of |
My understanding was this: if it has not been called previously, it looks at what backends are available and inititalises them, then returns their plugin tables so that you may choose which you would like to use. If it has been called previously, it returns the plugins that it previously initialized. While I have not looked at the code yet, it sounds like the function is hard-coded to return an OpenCL plugin even if one is not available. If that is the case, I think the function should be updated so that it only returns the available plugins. |
Discussion is continuted here: #1693 |
The plug-in is "available" i.e. it's loaded and it might be that even OpenCL ICD loader is available. The problem is |
The pi::initialize finds (currently hard-coded library names), loads (does dlopen of those libraries), and binds (call piPluginInit entry in those libraries). Only those plugins that successfully passed all the steps above are returned, and I think this is the correct behavior. If the issue is that OpenCL lacks any platforms it can operate, then it would just return 0 platforms in piPlatformsGet later. Why is this causing any issues? We may consider enhancing the "bind" step to check for non-0 platforms available. Currently it just does this: https://github.com/intel/llvm/blob/sycl/sycl/plugins/opencl/pi_opencl.cpp#L1076 |
We need to define the behavior for all plug-ins and I think we should keep existing behavior. Otherwise we might open Pandora's box with questions like "okay we check a platform, but what about device?", etc. |
I think this is an acceptable workaround for now. I will update the open PR. |
This PR re-enables all disabled PI API unit tests.
Backend-agnostic unit tests have been refactored using value-parameterized tests, allowing the same set of unit tests to be ran on a set of PI plugins.
Signed-off-by: Stuart Adams [email protected]