Skip to content

Conversation

@ethanglaser
Copy link
Contributor

@ethanglaser ethanglaser commented Jun 17, 2025

Description

Fix errors that occur when calling kNN search (ie without responses result_option set). Uses result option indication of whether results are requested, and only runs this logic when it is (previously it was running in all cases because regressor and classifier use responses, but its not needed for search)

Corresponding sklearnex PR adding these interfaces to API: uxlfoundation/scikit-learn-intelex#2557

Checklist to comply with before moving PR from draft:

PR completeness and readability

  • I have reviewed my changes thoroughly before submitting this pull request.
  • I have commented my code, particularly in hard-to-understand areas.
  • I have updated the documentation to reflect the changes or created a separate PR with update and provided its number in the description, if necessary.
  • Git commit message contains an appropriate signed-off-by string (see CONTRIBUTING.md for details).
  • I have added a respective label(s) to PR if I have a permission for that.
  • I have resolved any merge conflicts that might occur with the base branch.

Testing

  • I have run it locally and tested the changes extensively.
  • All CI jobs are green or I have provided justification why they aren't.
  • I have extended testing suite if new functionality was introduced in this PR.

@ethanglaser ethanglaser added enhancement new algorithm New algorithm or method in oneDAL labels Jun 17, 2025
@ethanglaser
Copy link
Contributor Author

/intelci: run

@ethanglaser
Copy link
Contributor Author

/intelci: run

1 similar comment
@ethanglaser
Copy link
Contributor Author

/intelci: run

distances_,
{ select_indc_event, copy_sqrt_event });
return final_event;
if (result_options_.test(result_options::responses)) {
Copy link
Contributor

Choose a reason for hiding this comment

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

you have 2 returns in the same if
return this->output_responses(bounds, indices_, distances_, { select_indc_event, copy_sqrt_event });
and if (this->compute_sqrt_) { return copy_sqrt_event; }
Can they conflict?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

There are 3 cases with 3 return possibilities. If one returns, then the others will not be reached.

@Alexandr-Solovev
Copy link
Contributor

In file included from cpp/oneapi/dal/algo/knn/backend/gpu/infer_kernel_brute_force_dpc.cpp:24:
./cpp/oneapi/dal/algo/knn/backend/gpu/infer_kernel_impl_dpc_distr.hpp:230:14: error: no matching member function for call to 'push_back'
230 | deps.push_back(copy_current_resp_event);
| ~~~~~^~~~~~~~~
/usr/lib/gcc/x86_64-linux-gnu/14/../../../../include/c++/14/bits/stl_vector.h:1283:7: note: candidate function not viable: 'this' argument has type 'const bk::event_vector' (aka 'const vectorsycl::event'), but method is not marked const
1283 | push_back(const value_type& __x)
| ^
/usr/lib/gcc/x86_64-linux-gnu/14/../../../../include/c++/14/bits/stl_vector.h:1300:7: note: candidate function not viable: 'this' argument has type 'const bk::event_vector' (aka 'const vectorsycl::event'), but method is not marked const

@Alexandr-Solovev
Copy link
Contributor

/intelci: run

@ethanglaser
Copy link
Contributor Author

/intelci: run ml-benchmarks
set get-build=f098d02c-9afe-f1fe-b72e-a4bf010d0e2d

@ethanglaser
Copy link
Contributor Author

latest CI with both branches:
http://intel-ci.intel.com/f098d02c-9afe-f1fe-b72e-a4bf010d0e2d

@ethanglaser ethanglaser merged commit cb26da8 into uxlfoundation:main Sep 30, 2025
15 of 18 checks passed
david-cortes-intel pushed a commit to david-cortes-intel/oneDAL that referenced this pull request Oct 8, 2025
* Support spmd knn search

* clang

* further restriction of responses logic based on result_options

* clang

* fix event addition

* add queue waits for experimentation

* trying without split_table

* take 2

* revert debugging

* address comment

* restore last

* debugaboo

* further debugging

* MORE DEBUG

* further debugging

* more

* shared instead of device

* revert last and try wait and throw on copy

* trying wait_or_pass

* push back events

* hotfix: working but suboptimal wait_and_throw in loop

* remove debug

* minor formatting revisions
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

enhancement new algorithm New algorithm or method in oneDAL

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants