Skip to content

feature: switch threader_for to int64 indices#3471

Open
Alexandr-Solovev wants to merge 7 commits intouxlfoundation:mainfrom
Alexandr-Solovev:dev/asolovev_threader_for_upd
Open

feature: switch threader_for to int64 indices#3471
Alexandr-Solovev wants to merge 7 commits intouxlfoundation:mainfrom
Alexandr-Solovev:dev/asolovev_threader_for_upd

Conversation

@Alexandr-Solovev
Copy link
Contributor

@Alexandr-Solovev Alexandr-Solovev commented Jan 7, 2026

Description

ABI change: threader functions use 64-bit indices

This change updates the exported threading functions to use int64_t instead of int / int32_t:

  • _onedal_threader_for
  • _daal_threader_for

The legacy helper _onedal_threader_for_int64 was removed since the implementation is now unified on 64-bit indices.

Impact

This is an ABI-breaking change:

  • Function parameter types changed from 32-bit to 64-bit
  • One exported function was removed

All downstream binaries must be rebuilt.

Release plan

This change is intended for the next major release, where ABI changes are allowed.


Checklist:

Completeness and readability

  • 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 updates 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 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.

Performance

  • I have measured performance for affected algorithms using scikit-learn_bench and provided at least a summary table with measured data, if performance change is expected.
  • I have provided justification why performance and/or quality metrics have changed or why changes are not expected.
  • I have extended the benchmarking suite and provided a corresponding scikit-learn_bench PR if new measurable functionality was introduced in this PR.

@david-cortes-intel
Copy link
Contributor

/intelci: run

@Vika-F
Copy link
Contributor

Vika-F commented Jan 8, 2026

The changes look good to me. Please also update the .github/.abignore file, as threading layer is not a part of our ABI, as those functions are not available to users, they are only available internally in oneDAL.

Please add the following section and list the threading symbols there:

;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
;;;; DAAL THREADING LAYER DESELECTIONS ;;;;
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
; deselect threading layer functions

[suppress_function]
symbol_name = _daal_threader_for
drop = yes

...

@Alexandr-Solovev Alexandr-Solovev changed the title init commit for replace threader_for feature: switch threader_for to int64 indices Feb 5, 2026
@Alexandr-Solovev Alexandr-Solovev marked this pull request as ready for review February 5, 2026 12:12
Copilot AI review requested due to automatic review settings February 5, 2026 12:12
Copy link
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

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

Pull request overview

This PR implements an ABI-breaking change that migrates threading functions to use 64-bit indices (int64_t) instead of 32-bit (int32_t). The change consolidates the separate threader_for and threader_for_int64 functions into a single unified implementation.

Changes:

  • Updated _onedal_threader_for and _daal_threader_for function signatures to use int64_t parameters
  • Removed the deprecated _onedal_threader_for_int64 and _daal_threader_for_int64 functions
  • Updated all call sites to use the unified threader_for with explicit count parameter

Reviewed changes

Copilot reviewed 9 out of 9 changed files in this pull request and generated 3 comments.

Show a summary per file
File Description
cpp/oneapi/dal/detail/threading.hpp Updated function signatures and removed int64-specific variants
cpp/oneapi/dal/backend/interop/threading.cpp Updated implementation to use int64_t parameters
cpp/daal/src/threading/threading.h Changed exported function signatures to int64_t
cpp/daal/src/threading/threading.cpp Consolidated implementation to single int64_t version
cpp/daal/src/externals/core_threading_win_dll.cpp Updated Windows DLL function pointer types
cpp/oneapi/dal/table/backend/convert/copy_convert_impl_cpu.cpp Updated call sites to new API
cpp/oneapi/dal/io/csv/detail/read_graph_kernel_impl.hpp Updated call sites to new API
cpp/oneapi/dal/algo/basic_statistics/backend/cpu/apply_weights_cpu.cpp Updated call site to new API
.github/.abignore Added suppression for removed function in ABI compatibility checks

const std::int64_t col_count = shape.second;

detail::threader_for_int64(row_count, [&](std::int64_t i) -> void {
detail::threader_for(row_count, row_count, [&](std::int64_t i) -> void {
Copy link

Copilot AI Feb 5, 2026

Choose a reason for hiding this comment

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

The second parameter appears redundant - passing row_count twice suggests the API might benefit from clearer parameter naming or documentation. Consider whether threads_request should match the iteration count or if this represents a threading hint that should be calculated differently.

Suggested change
detail::threader_for(row_count, row_count, [&](std::int64_t i) -> void {
const std::int64_t threads_request = detail::threader_get_max_threads();
detail::threader_for(row_count, threads_request, [&](std::int64_t i) -> void {

Copilot uses AI. Check for mistakes.
}

/// Pass a function to be executed in a for loop to the threading layer.
/// The maximal number of iterations in the loop is 2^31 - 1.
Copy link

Copilot AI Feb 5, 2026

Choose a reason for hiding this comment

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

The documentation comment is now incorrect - it states the maximum is 2^31 - 1, but the function now accepts int64_t which allows up to 2^63 - 1 iterations. This comment should be updated to reflect the new 64-bit limit.

Copilot generated this review using guidance from repository custom instructions.
Copy link
Contributor

Choose a reason for hiding this comment

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

Bot is right here.

@@ -266,34 +265,13 @@ inline void threader_func_break(int i, bool & needBreak, const void * a)
/// @param[in] reserved Parameter reserved for the future. Currently unused.
Copy link

Copilot AI Feb 5, 2026

Choose a reason for hiding this comment

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

The parameter name 'reserved' in the documentation no longer accurately describes the second parameter, which is now 'threads_request' with a specific purpose. The documentation should be updated to reflect that this parameter controls the number of threads requested for parallel execution.

Copilot generated this review using guidance from repository custom instructions.
Copy link
Contributor

Choose a reason for hiding this comment

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

There is a mismatch between the headers and the C++ files regarding the names of the parameters.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Actually, it's a common issue for all threader functions. WIll be update all of the functions

Copy link
Contributor

@david-cortes-intel david-cortes-intel left a comment

Choose a reason for hiding this comment

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

Please address the issues from copilot.

@Vika-F
Copy link
Contributor

Vika-F commented Feb 6, 2026

I do not agree with Copilot that those changes are ABI breaking.
Because libonedal_thread.so contains only internal APIs. Those APIs are not linked directly to user's applications, they are only used internally by libonedal_core.so.

So, changing the APIs/ABI of the threading layer cannot impact the end user.
I propose either to ignore threading APIs in ABI check or exclude threading library entirely from the ABI check.

@Alexandr-Solovev , @david-cortes-intel what do you think?

@david-cortes-intel
Copy link
Contributor

I do not agree with Copilot that those changes are ABI breaking. Because libonedal_thread.so contains only internal APIs. Those APIs are not linked directly to user's applications, they are only used internally by libonedal_core.so.

So, changing the APIs/ABI of the threading layer cannot impact the end user. I propose either to ignore threading APIs in ABI check or exclude threading library entirely from the ABI check.

@Alexandr-Solovev , @david-cortes-intel what do you think?

I think copilot took that from the description which states that it's ABI breaking due to removal of an exported function.

@Vika-F
Copy link
Contributor

Vika-F commented Feb 6, 2026

I think copilot took that from the description which states that it's ABI breaking due to removal of an exported function.

@david-cortes-intel But this function is again removed from libonedal_thread.so library, which is not used directly by users.
So, it does break the ABI of the threading lib, but it does not break the ABI of the whole oneDAL as a product.

@david-cortes-intel
Copy link
Contributor

I think copilot took that from the description which states that it's ABI breaking due to removal of an exported function.

@david-cortes-intel But this function is again removed from libonedal_thread.so library, which is not used directly by users. So, it does break the ABI of the threading lib, but it does not break the ABI of the whole oneDAL as a product.

Then I guess @Alexandr-Solovev might want to edit the description.

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.

3 participants