-
Notifications
You must be signed in to change notification settings - Fork 787
SYCL ext one api launch queries implementation #16709
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
SYCL ext one api launch queries implementation #16709
Conversation
[SYCL] fix formatting
3b47f16
to
f98a316
Compare
sycl/source/detail/kernel_impl.hpp
Outdated
getSyclObjImpl(Queue.get_device())->getHandleRef(); | ||
|
||
size_t KernelWGSize = 0; | ||
if (auto Result = Adapter->call_nocheck<UrApiKind::urKernelGetGroupInfo>( |
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.
Documentation for urKernelGetGroupInfo
does not list UR_RESULT_ERROR_UNSUPPORTED_FEATURE
as a possible error code, meaning that this API should be supported by every adapter.
Therefore, we should be able to simplify this code and other queries which use the same API call
ext::oneapi::experimental::info::kernel_queue_specific::num_sub_groups>( | ||
queue Queue, const range<2> &) const; | ||
|
||
template __SYCL_EXPORT typename ext::oneapi::experimental::info:: |
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.
Lots of repeated code here, I would suggest that we hide it under a macro like it is done for max_num_work_groups
below
@@ -0,0 +1,86 @@ | |||
// REQUIRES aspect-subgroup |
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.
There is no dedicated aspect for sub-groups (SYCL 2020 spec) and the same goes for the launch queries extension spec - it does not say that any of those queries require any aspects to be supported by a device, i.e. they should work on every device.
This test would have been always skipped if not for missing :
which is required for a LIT directive to work.
The concept is required to be supported by every device, but device can say that it only provides a single sub-group per work-group, or say that maximum sub-group size is equal to 1 to indicate lack of support for the feature.
#include <sycl/detail/info_desc_helpers.hpp> | ||
#include <sycl/kernel.hpp> | ||
#include <sycl/kernel_bundle.hpp> | ||
#include <sycl/sycl.hpp> |
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.
You must not include sycl.hpp
in E2E tests, it is way to heavy. Instead, you should you specific headers you need directly
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 would also move this file into a separate sub-directory under test-e2e
. SYCL extensions are not basic functionality. Personally, I don't like us having tests for non-standard things in Basic
folder
auto bundle = sycl::get_kernel_bundle<sycl::bundle_state::executable>(ctx); | ||
auto kernel = bundle.template get_kernel<kernels::TestKernel>(); | ||
|
||
// get value to compare with |
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.
Here you submit a distinct kernel, which is different from the one described by TestKernel
functor. There is no guarantee that maximum sub-group size you get here is the same the one you will get for TestKernel
.
[SYCL] fix windows dump test
[SYCL] fix max work group size e2e test
@AlexeySachkov @intel/llvm-reviewers-runtime @cperkinsintel Please, review it. Some of the tests fail due to other problems, which are not related to these changes - it was checked 2-3 last precommit checks. |
UR_KERNEL_SUB_GROUP_INFO_MAX_NUM_SUB_GROUPS) | ||
ADD_TEMPLATE_METHOD_SPEC(num_sub_groups, 2, urKernelGetSubGroupInfo, | ||
UR_KERNEL_SUB_GROUP_INFO_MAX_NUM_SUB_GROUPS) | ||
ADD_TEMPLATE_METHOD_SPEC(num_sub_groups, 1, urKernelGetSubGroupInfo, |
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; Looks like they all use urKernelGetSubGroupInfo
as their Kind
argument. I think it would be easier to read if you just inline it instead.
sycl/test-e2e/Experimental/launch_queries/max_sub_group_size.cpp
Outdated
Show resolved
Hide resolved
sycl/test-e2e/Experimental/launch_queries/max_work_item_sizes.cpp
Outdated
Show resolved
Hide resolved
Co-authored-by: Steffen Larsen <[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.
https://github.com/intel/llvm/pull/16709/files#r1965532820 is still applicable, but it's not critical, so you have my approval. Additionally, great work on the tests! 🚀
/// \param Queue is a valid SYCL queue. | ||
/// \param WG is a work group size | ||
/// \return depends on information being queried. | ||
template <typename Param> |
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.
Should we perhaps use some kind of SFINAE here to explicitly check that Param
has the value defined in the spec?
It seems like at the moment we are doing SFINAE only on the return type by saying Param::return_type
but there could be other descriptors that will have this type defined and we will end up instantiating declarations for them if the user supplies an invalid Param
by mistake. This could lead to some weird linker errors or some runtime bug.
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.
This isn't user-visible API. Don't we have proper constraints there?
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.
The user-visible API in kernel.hpp
which calls this one also does something similar with typename detail::is_kernel_queue_specific_info_desc<Param>::return_type
which again, could potentially allow other Param
types to slip through the cracks. Ideally, we'd like to follow the spec to the letter and mandate Param
to be as required by the spec through SFINAE, in this case for example, to be max_num_work_groups
.
@dklochkov-emb Failing in postcommit on FPGA:
Please fix it ASAP and if not possible disable the test/revert the change. Thx |
Considering that we are dropping FPGA support, I would say let's just XFAIL the test on this platform for now |
max_work_item_sizes,
max_work_group_size,
max_sub_group_size,
num_sub_groups
see docs