Skip to content

Removal ExecutionPolicy from submitters and etc. stuff #2161

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

SergeyKopienko
Copy link
Contributor

@SergeyKopienko SergeyKopienko commented Apr 3, 2025

Attention!

Now this PR still include all changes from

UPD: #2153 has been merged into main branch and this PR now contains actual state of main branch.

Before future work with this PR required to merge into main branch the next PRs (otherwise we will have a lot of differences in this PR):

The goal of this PR - pass into submitters sycl::queue& __q instead of _ExecutionPolicy&& __exec - so we remove one template parameter and decrease possible instantiations of template submitter classes / functions.

This is the main and final step to use ExecutionPolicy in oneDPL algorithm calls independently from their category values (when unnamed lambda is switched off or Kernel name is specified in the users code directly).

Note about parallel_for- and parallel_for-based submitters

Now we still need to have ExecutionPolicy in parallel_for- and in parallel_for-based submitters.
I going to fix that in the separate PR #2192

Note about clang-format check for this PR

Example (1) of incorrect clang-format:

         // 2. Apply work group carry outs, calculate output indices, and load results into correct indices.
-        __q.submit([&](sycl::handler& __cgh) {
+        __q
+            .submit([&](sycl::handler& __cgh) {
                 oneapi::dpl::__ranges::__require_access(__cgh, __keys, __out_values);

Example (2) of incorrect clang-format:

 template <typename _KernelName, ::std::uint32_t __radix_bits, bool __is_ascending, typename _ValRange,
           typename _CountBuf, typename _Proj
 #if _ONEDPL_COMPILE_KERNEL
-          , typename _Kernel
+          ,
+          typename _Kernel
 #endif
           >

Example (3) of incorrect clang-format:

 sycl::event
__radix_sort_count_submit(sycl::queue& __q, ::std::size_t __segments, ::std::siz
                           ::std::uint32_t __radix_offset, _ValRange&& __val_rng, _CountBuf& __count_buf,
                           sycl::event __dependency_event, _Proj __proj
 #if _ONEDPL_COMPILE_KERNEL
-                          , _Kernel& __kernel
+                          ,
+                          _Kernel& __kernel
 #endif
 )

…remove _ExecutionPolicy template param from oneapi::dpl::__internal::__device_info
…remove _ExecutionPolicy template param from oneapi::dpl::__internal::__max_work_group_size
…remove _ExecutionPolicy template param from oneapi::dpl::__internal::__slm_adjusted_work_group_size
…remove _ExecutionPolicy template param from oneapi::dpl::__internal::__max_sub_group_size
…remove _ExecutionPolicy template param from oneapi::dpl::__internal::__max_compute_units
…remove _ExecutionPolicy template param from oneapi::dpl::__internal::__supports_sub_group_size
…remove _ExecutionPolicy template param from oneapi::dpl::__internal::__kernel_work_group_size
…remove _ExecutionPolicy template param from oneapi::dpl::__internal::__kernel_sub_group_size
…remove _ExecutionPolicy template param from oneapi::dpl::__internal::__kernel_compiler::__compile
…remove _ExecutionPolicy template param from oneapi::dpl::__par_backend_hetero::__result_and_scratch_storage
…remove _ExecutionPolicy template param from oneapi::dpl::__par_backend_hetero::__internal::__print_device_debug_info
…d_hetero::__internal::__print_device_debug_info
…remove template alias __result_and_scratch_storage and rename __result_and_scratch_storage_impl to __result_and_scratch_storage
@mmichel11
Copy link
Contributor

mmichel11 commented Apr 16, 2025

I looked through the PR and think it's near ready to merge.

There are a few clang-format suggestions from the ::std -> std changes I think. I suggest addressing those and am then ready to approve. The other clang-format suggestions I agree with ignoring.

@SergeyKopienko
Copy link
Contributor Author

There are a few clang-format suggestions from the ::std -> std changes I think. I suggest addressing those and am then ready to approve. The other clang-format suggestions I agree with ignoring.

I propose to stop this changes here. I don't think that it is real reason to not land this PR into main branch.

…_submitters

# Conflicts:
#	include/oneapi/dpl/pstl/hetero/dpcpp/parallel_backend_sycl_reduce.h
Copy link
Contributor

@mmichel11 mmichel11 left a comment

Choose a reason for hiding this comment

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

LGTM

Copy link
Member

@adamfidel adamfidel left a comment

Choose a reason for hiding this comment

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

Thanks for applying most of the suggestions. I agree where it doesn't make sense to change things that I suggested.

LGTM.

@SergeyKopienko SergeyKopienko merged commit 14c97e0 into main Apr 17, 2025
18 of 19 checks passed
@SergeyKopienko SergeyKopienko deleted the dev/skopienko/remove_execution_policy_from_submitters branch April 17, 2025 15:04
SergeyKopienko added a commit that referenced this pull request Apr 17, 2025
…tuff (#2161)"

This reverts commit 14c97e0.

# Conflicts:
#	include/oneapi/dpl/pstl/hetero/dpcpp/parallel_backend_sycl_fpga.h
#	include/oneapi/dpl/pstl/hetero/dpcpp/parallel_backend_sycl_histogram.h
#	include/oneapi/dpl/pstl/hetero/histogram_impl_hetero.h
@rarutyun
Copy link
Contributor

Sorry guys, but this PR violates our agreements about oneDPL architecture. We cannot get execution policy on the patterns level (aglorithm_impl_hetero.h) because this is not a backend specific code. Yes, it's hetero specific but not the backend one. During our technical meetings Alexey and I explained that ExecutionPolicy is a backend property. So, going from policy to a sycl::queue should happen after we entered the backend. As the way to check yourself: one should call backend specific API on policy when the dispatch happened by backend tag (e.g., device_backend_tag) and should NOT call backend specific API when dispatch is done by hetero_tag.

@adamfidel, @mmichel11, I suggest you to be more careful in the future and ask if you are not sure what decisions were made.

@danhoeflinger, @MikeDvorskiy, I expect you to take a lead and scrutinize the PRs with architectural changes (like this one) if neither Alexey, not myself are in reviewers list.

It needs to be fixed before oneDPL release. It's either rolling back this change and making another one after rollback. Or it's just fix on top of that. I don't know what is the safest way because I didn't participate in the review, so I'll let you guys to decide.

@SergeyKopienko
Copy link
Contributor Author

Sorry guys, but this PR violates our agreements about oneDPL architecture. We cannot get execution policy on the patterns level (aglorithm_impl_hetero.h) because this is not a backend specific code. Yes, it's hetero specific but not the backend one. During our technical meetings Alexey and I explained that ExecutionPolicy is a backend property. So, going from policy to a sycl::queue should happen after we entered the backend. As the way to check yourself: one should call backend specific API on policy when the dispatch happened by backend tag (e.g., device_backend_tag) and should NOT call backend specific API when dispatch is done by hetero_tag.

@adamfidel, @mmichel11, I suggest you to be more careful in the future and ask if you are not sure what decisions were made.

@danhoeflinger, @MikeDvorskiy, I expect you to take a lead and scrutinize the PRs with architectural changes (like this one) if neither Alexey, not myself are in reviewers list.

It needs to be fixed before oneDPL release. It's either rolling back this change and making another one after rollback. Or it's just fix on top of that. I don't know what is the safest way because I didn't participate in the review, so I'll let you guys to decide.

I propose to rollback this PR right now.
PR prepared: #2197

@SergeyKopienko SergeyKopienko restored the dev/skopienko/remove_execution_policy_from_submitters branch April 17, 2025 18:03
SergeyKopienko added a commit that referenced this pull request Apr 17, 2025
@SergeyKopienko
Copy link
Contributor Author

Sorry guys, but this PR violates our agreements about oneDPL architecture. We cannot get execution policy on the patterns level (aglorithm_impl_hetero.h) because this is not a backend specific code. Yes, it's hetero specific but not the backend one. During our technical meetings Alexey and I explained that ExecutionPolicy is a backend property. So, going from policy to a sycl::queue should happen after we entered the backend. As the way to check yourself: one should call backend specific API on policy when the dispatch happened by backend tag (e.g., device_backend_tag) and should NOT call backend specific API when dispatch is done by hetero_tag.

@adamfidel, @mmichel11, I suggest you to be more careful in the future and ask if you are not sure what decisions were made.

@danhoeflinger, @MikeDvorskiy, I expect you to take a lead and scrutinize the PRs with architectural changes (like this one) if neither Alexey, not myself are in reviewers list.

It needs to be fixed before oneDPL release. It's either rolling back this change and making another one after rollback. Or it's just fix on top of that. I don't know what is the safest way because I didn't participate in the review, so I'll let you guys to decide.

PR with new implementation prepared: #2198

@SergeyKopienko SergeyKopienko deleted the dev/skopienko/remove_execution_policy_from_submitters branch April 29, 2025 20:21
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Some __kernel_name_generator usages doesn't depends from _ExecutionPolicy type
5 participants