-
Notifications
You must be signed in to change notification settings - Fork 798
[SYCL] Kernel submit wrapper functions for unit tests #19884
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
base: sycl
Are you sure you want to change the base?
[SYCL] Kernel submit wrapper functions for unit tests #19884
Conversation
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.
LGTM, overall. Minor comments.
//==-- CommandSubmitWrappers.hpp --- -----==// | ||
// | ||
// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions. | ||
// See https://llvm.org/LICENSE.txt for license information. | ||
// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception | ||
// | ||
//===----------------------------------------------------------------------===// |
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.
//==-- CommandSubmitWrappers.hpp --- -----==// | |
// | |
// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions. | |
// See https://llvm.org/LICENSE.txt for license information. | |
// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception | |
// | |
//===----------------------------------------------------------------------===// | |
//==-- CommandSubmitWrappers.hpp -----------------------------------------==// | |
// | |
// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions. | |
// See https://llvm.org/LICENSE.txt for license information. | |
// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception | |
// | |
//===----------------------------------------------------------------------===// |
#include <sycl/event.hpp> | ||
#include <sycl/handler.hpp> | ||
|
||
using namespace sycl; |
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.
I'd personally avoid using using namespace sycl
here as it will pollute the global namespace of every test that includes this header file.
#include <sycl/handler.hpp> | ||
|
||
using namespace sycl; | ||
|
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.
Can we please add a comment here about why we need this wrapper?
} | ||
|
||
template <typename KernelName, typename KernelType> | ||
event single_task_wrapper(bool ShortcutSubmitFunction, queue &Q, event DepEvent, |
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.
event single_task_wrapper(bool ShortcutSubmitFunction, queue &Q, event DepEvent, | |
event single_task_wrapper(bool ShortcutSubmitFunction, queue &Q, event &DepEvent, |
cgh.single_task<KernelName>(KernelFunc); | ||
}); | ||
} | ||
} |
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.
} | |
} | |
// Check that isolated kernels (i.e. those that don't modify the graph) | ||
// are handled properly during filtering. | ||
sycl::unittest::UrMock<> Mock; | ||
sycl::platform Plt = sycl::platform(); | ||
bool ShortcutSubmitFunction = GetParam(); |
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.
NIT: I'd have used UseShortcutFunction
(or something similar) variable name instead of ShortcutSubmitFunction
.
@@ -190,3 +189,6 @@ TEST_F(SchedulerTest, InOrderQueueNoSchedulerPath) { | |||
} | |||
|
|||
} // anonymous namespace | |||
|
|||
INSTANTIATE_TEST_SUITE_P(SchedulerTestInstance, SchedulerTest, | |||
testing::Values(true, false)); |
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.
testing::Values(true, false)); | |
testing::Values(true, false) /*Whether to use shortcut submission function or not?*/); | |
The new kernel submit wrapper functions allow to select the submission function type between a standard handler-based function and queue shortcut function. This change allows to increase the test coverage and allows for testing no-handler submission path using existing unit tests.