Skip to content
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

Sort test: split and make it more flexible to reduce execution time #2077

Open
wants to merge 8 commits into
base: main
Choose a base branch
from

Conversation

dmitriy-sobolev
Copy link
Contributor

@dmitriy-sobolev dmitriy-sobolev commented Feb 24, 2025

The main motivation is to reduce the execution time of the test as it takes too much time.
The PR splits sort.pass into four files: stable/unstable sort, interfaces with/without a comparator.

It also more flexibility through filtering into testing to avoid exponential growth of configurations. See SortTestConfig uses, and the table below showing execution times.
It also improves diagnostics, for example:

  • Before: sort.pass.cpp:216 - wrong result from sort without predicate #2 (note: it is misleading - it can be with a predicate).
  • After: utils_sort.h:307 - float, device, custom greater, total size = 50718, mismatch with reference at index 38847

The test was also refactored:

  • :: was removed before std::
  • _ prefix was removed (no uglification needed in the tests)
  • test_default_name_gen function was simplified
  • some function were regrouped.

Below are measurements of ctest times of the sort test(s). main includes sort.pass time, and this PR combines the times of the added four tests.

Device configuration main, s this PR, s
GPU, Intel® Data Center GPU Max 1100 release 310 8
GPU, Intel® Data Center GPU Max 1100 debug 1170 40
       
CPU (Intel(R) Xeon(R) Platinum 8480+, 2 sockets) release 286 20
CPU (Intel(R) Xeon(R) Platinum 8480+, 2 sockets) debug segfault at 127s segfault at 14s in sort_comp.pass, 47s the rest combined
       
CPU (Intel(R) Core(TM) i7-1270P) release 373 186
CPU (Intel(R) Core(TM) i7-1270P) debug >3600 390

Note: utils_sort.h preserves the history of sort.pass, but GitHub shows it as a new file (which is probably because of large number of changes). Let me know if the refactoring changes should be rolled back to simplify revewing.

// TODO: add a test for stability
#endif

return TestUtils::done();
Copy link
Contributor

Choose a reason for hiding this comment

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

Looking to used defines I think it's possible then this test doing nothing.
In this case important to return return TestUtils::done(0);

It's make sense for this test and probably for other added in this PR tests too.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

This combination skips the tests: "test only device policies" (TEST_ONLY_HETERO_POLICIES) and "device backend is not available" (!TEST_DPCPP_BACKEND_PRESENT). I treat it as invalid. I've added a check to stop testing if it happens.

std::vector<std::size_t> extended_sizes = test_sizes(8'000'000);
test_sort<std::uint16_t>(SortTestConfig{cfg, "uint16_t, device, custom greater comparator"}, extended_sizes,
Device<1>{}, Converter<std::uint16_t>{}, ConstGreater{});
#if __SYCL_UNNAMED_LAMBDA__
Copy link
Contributor

Choose a reason for hiding this comment

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

Is there a reason we only care about this name clashing for stable sort with a comparator?
Perhaps this is enough to prevent regression on all APIs, but it relies upon some knowledge of the implementation, and could change (will add JIT time to add this to the other tests).

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
test Test only Change
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants