Skip to content

Conversation

SergeyKopienko
Copy link
Contributor

@SergeyKopienko SergeyKopienko commented Mar 13, 2025

In this PR we simplify new_kernel_name implementation in tests.
The goal - to make generated new Kernel names more short and simple.

Example

Let's take a look to the code (for example):

auto new_policy = make_new_policy<new_kernel_name<Policy, 0>>(exec);
  • before this PR, the type of new_policy is
oneapi::dpl::execution::__dpl::device_policy<TestUtils::unique_kernel_name<oneapi::dpl::execution::__dpl::device_policy<TestUtils::unique_kernel_name<test_binary_search<unsigned long long>,0>>,0>>
  • after this PR, the type of new_policy is
oneapi::dpl::execution::__dpl::device_policy<TestUtils::unique_kernel_name<TestUtils::unique_kernel_name<test_binary_search<unsigned long long>,0>,0>>

@SergeyKopienko SergeyKopienko added enhancement test Test only Change labels Mar 13, 2025
@SergeyKopienko SergeyKopienko added this to the 2022.9.0 milestone Mar 13, 2025
@SergeyKopienko SergeyKopienko force-pushed the dev/skopienko/simplify_tests_new_kernel_name_impl branch from eae40da to fc30465 Compare March 13, 2025 15:08
Copy link
Contributor

@danhoeflinger danhoeflinger left a comment

Choose a reason for hiding this comment

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

Can we take this opportunity to consolidate this to a single instance of this implementation?

@danhoeflinger
Copy link
Contributor

Is there a reason there are 2 nested copies of TestUtils::unique_kernel_name here?
Are they redundant? If we change the number from 0 to 1, in your code, do both copies of the TestUtils::unique_kernel_name change their number? If so, there is some other issue we can fix I think.

@SergeyKopienko
Copy link
Contributor Author

Is there a reason there are 2 nested copies of TestUtils::unique_kernel_name here? Are they redundant? If we change the number from 0 to 1, in your code, do both copies of the TestUtils::unique_kernel_name change their number? If so, there is some other issue we can fix I think.

In any case now new_kernel_name is implemented in this PR exactly as

template <typename Policy>
using __policy_kernel_name = typename ::std::decay_t<Policy>::kernel_name;

@danhoeflinger
Copy link
Contributor

In any case now new_kernel_name is implemented in this PR exactly as

template <typename Policy>
using __policy_kernel_name = typename ::std::decay_t<Policy>::kernel_name;

Yes, but in your "after" result, we still have 2 nested TestUtils::unique_kernel_name. Perhaps that is because of nesting in the test function you are using to generate the "before" and "after", and is required and intentional.

@SergeyKopienko
Copy link
Contributor Author

SergeyKopienko commented Mar 13, 2025

In any case now new_kernel_name is implemented in this PR exactly as

template <typename Policy>
using __policy_kernel_name = typename ::std::decay_t<Policy>::kernel_name;

Yes, but in your "after" result, we still have 2 nested TestUtils::unique_kernel_name. Perhaps that is because of nesting in the test function you are using to generate the "before" and "after", and is required and intentional.

As example I have used the policy creation at

auto new_policy = make_new_policy<new_kernel_name<Policy, 0>>(exec);
:

auto new_policy = make_new_policy<new_kernel_name<Policy, 0>>(exec);

at this point the type of exec is oneapi::dpl::execution::__dpl::device_policy<TestUtils::unique_kernel_name<test_binary_search<unsigned long long>,0>> &
and the type of new_policy is
oneapi::dpl::execution::__dpl::device_policy<TestUtils::unique_kernel_name<TestUtils::unique_kernel_name<test_binary_search<unsigned long long>,0>,0>>

So I think it's the question for test environment staff, not for new_kernel_name :

  • this type name starts from
template <::std::size_t CallNumber = 0>
struct invoke_on_all_hetero_policies::operator()(Op op, Args&&... rest)

@SergeyKopienko SergeyKopienko force-pushed the dev/skopienko/simplify_tests_new_kernel_name_impl branch 2 times, most recently from 9ea0453 to d3cff9c Compare March 26, 2025 08:47
@SergeyKopienko SergeyKopienko force-pushed the dev/skopienko/simplify_tests_new_kernel_name_impl branch 2 times, most recently from d19308f to 592fc8c Compare March 27, 2025 19:00
@SergeyKopienko SergeyKopienko modified the milestones: 2022.9.0, 2022.10.0 Apr 3, 2025
@SergeyKopienko SergeyKopienko force-pushed the dev/skopienko/simplify_tests_new_kernel_name_impl branch 3 times, most recently from eae2814 to db08779 Compare April 4, 2025 13:06
@SergeyKopienko SergeyKopienko force-pushed the dev/skopienko/simplify_tests_new_kernel_name_impl branch from db08779 to b2f1493 Compare April 8, 2025 14:55
@SergeyKopienko SergeyKopienko modified the milestones: 2022.10.0, 2022.11.0 Aug 12, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

enhancement test Test only Change

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants