Skip to content

Conversation

Vika-F
Copy link
Contributor

@Vika-F Vika-F commented Jul 25, 2025

Description

The error handling in the global object that defines CPU topology in oneDAL/DAAL and in global daal::services::Environment object was improved.
Several related bugs were fixed.

  • cpp/daal/src/services/service_topo.h and cpp/daal/src/services/service_topo.cpp files re-worked to make it less error prone.
  • The logic in setChkProcessAffinityConsistency() was changed to allow affinity masks that contain zeros. Previously having the process affinity mask with zeros lead to undefined behavior because the global object that defines CPU topology ended up in non-initialized state in that case.
  • Out-of-bound memory access issue was fixed in analyzeEachCHierarchy() function. Previously pDetectedEachCIDs and pDetectThreadIDsperEachC were invalidly writing the memory after the end of arrays in the branch if (!CacheMarked).
  • The constructor of daal::services::Environment class was updated to always call getCpuId() method which initializes the Environment instance. Without this call an uninitialized version of Environment might be used.
  • The behavior of daal::services::Environment::getInstance() function that returns the pointer to a global DAAL's Environment object was changed. Now the function returns nullptr in case the global Environment object is uninitialized. The respective null pointer checks were added into the calling code.

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.

Performance

not applicable

@Vika-F Vika-F added the bug label Jul 25, 2025
// Call to `getCpuId` changes global settings, in particular,
// changes default number of threads in the threading layer
const int cpuid = env->getCpuId();
sys_info_["top_enabled_cpu_extension"] = std::make_any<cpu_extension>(from_daal_cpu_type(cpuid));
Copy link
Contributor

Choose a reason for hiding this comment

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

Could this be converted into a struct instead? Looks like the fields are always the same.

Copy link
Contributor Author

@Vika-F Vika-F Jul 28, 2025

Choose a reason for hiding this comment

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

Yes, it could. It also might help to fix the other part of the issue.

@david-cortes-intel
Copy link
Contributor

@Vika-F I can confirm that something in this PR is indeed fixing issues with undefined memory access, at the very least on ice lake, as confirmed by memsan no longer reporting incorrect accesses, and by asan no longer reporting leaked memory from a corrupted glktsn object.

It still segfaults if sklearnex is imported but not used, and there might still be other issues causing segfaults upon import in other scenarios, but this at least solves the main problem.

I still see issues like this reported from tysan when running the C++ examples though:

WRITE of size 8 at 0x7fb6a9d64fd0 with type p1 int (in daal::services::internal::Dyn2Arr_str at offset 8) accesses part of an existing object of type daal::services::internal::glktsn that starts at offset -64

.. but guess there's some chance that they might be due to some unrelated memory corruption that coincidentally happens to affect that object at that point.

@Vika-F
Copy link
Contributor Author

Vika-F commented Jul 30, 2025

/intelci: run

@Vika-F
Copy link
Contributor Author

Vika-F commented Jul 31, 2025

/intelci: run

@Vika-F Vika-F requested a review from Copilot July 31, 2025 08:25
Copy link
Contributor

@Copilot 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 improves error handling and fixes bugs in CPU topology initialization in oneDAL/DAAL. The changes focus on making the global CPU topology detection more robust and preventing undefined behavior when the Environment object is uninitialized.

  • Fixed null pointer safety by adding checks for uninitialized Environment instances
  • Improved error handling in CPU topology detection functions
  • Fixed memory safety issues in CPU topology analysis functions

Reviewed Changes

Copilot reviewed 12 out of 13 changed files in this pull request and generated 2 comments.

Show a summary per file
File Description
cpp/oneapi/dal/detail/parameters/system_parameters_impl.hpp Changed class to struct and updated map key type from string to const char*
cpp/oneapi/dal/detail/parameters/system_parameters_impl.cpp Added null pointer checks for Environment and improved parameter initialization
cpp/oneapi/dal/detail/parameters/system_parameters.cpp Simplified smart pointer construction
cpp/oneapi/dal/detail/cpu.hpp Updated CPU feature map key type and moved architecture defines
cpp/oneapi/dal/common.hpp Added architecture detection defines moved from cpu.hpp
cpp/daal/src/services/service_topo.h Removed large amounts of platform-specific code and type definitions
cpp/daal/src/services/library_version_info.cpp Added null pointer check for Environment instance
cpp/daal/src/services/env_detect.cpp Enhanced Environment initialization with error handling and null checks
cpp/daal/src/externals/service_service_mkl.h Added error checking for CPU topology status
cpp/daal/src/data_management/data_conversion.cpp Added null pointer check for Environment instance
cpp/daal/src/algorithms/k_nearest_neighbors/kdtree_knn_classification_train_dense_default_impl.i Added null pointer check for Environment instance
cpp/daal/include/algorithms/algorithm_base_common.h Added null pointer check for Environment instance

@Vika-F Vika-F marked this pull request as ready for review July 31, 2025 15:03

private:
unsigned dim[2] = { 0, 0 }; // xdim and ydim
unsigned * data = nullptr; // data array to be malloc'd
Copy link
Contributor

Choose a reason for hiding this comment

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

Could it use std::unique_ptr or std::vector instead?

@david-cortes-intel
Copy link
Contributor

Thanks. I can confirm that this fixed at least one memory corruption.

But it seems there's one more file that might need to be revisited - see trace from msan:

==352865==WARNING: MemorySanitizer: use-of-uninitialized-value
    #0 0x7f2e3934f8f8 in run_cpuid(unsigned int, unsigned int, unsigned int*) /export/users/dcortes/repos/onedal-clang-memsan/./cpp/daal/src/services/compiler/generic/env_detect_features.cpp:65:5
    #1 0x7f2e38cbf4dd in daal::services::internal::__internal_daal_getCpuidInfo(daal::services::internal::CPUIDinfo*, unsigned int, unsigned int) /export/users/dcortes/repos/onedal-clang-memsan/./cpp/daal/src/services/service_topo.cpp:878:5
    #2 0x7f2e38caf057 in daal::services::internal::__internal_daal_cpuid_(daal::services::internal::CPUIDinfo*, unsigned int, unsigned int) /export/users/dcortes/repos/onedal-clang-memsan/./cpp/daal/src/services/service_topo.cpp:899:5
    #3 0x7f2e38cb37a1 in daal::services::internal::glktsn::cpuTopologyParams() /export/users/dcortes/repos/onedal-clang-memsan/./cpp/daal/src/services/service_topo.cpp:1431:5
    #4 0x7f2e38cabf5f in daal::services::internal::glktsn::buildSystemTopologyTables() /export/users/dcortes/repos/onedal-clang-memsan/./cpp/daal/src/services/service_topo.cpp:1954:13
    #5 0x7f2e38cab231 in daal::services::internal::glktsn::glktsn() /export/users/dcortes/repos/onedal-clang-memsan/./cpp/daal/src/services/service_topo.cpp:658:5
    #6 0x7f2e38cc06af in __cxx_global_var_init /export/users/dcortes/repos/onedal-clang-memsan/./cpp/daal/src/services/service_topo.cpp:499:15
    #7 0x7f2e38cc0708 in _GLOBAL__sub_I_service_topo.cpp /export/users/dcortes/repos/onedal-clang-memsan/cpp/daal/src/services/service_topo.cpp
    #8 0x7f2e47ffa8b9 in call_init.part.0 (/lib64/ld-linux-x86-64.so.2+0xf8b9) (BuildId: 33d30c20d175357a3497081e95f0fa482c840b40)
    #9 0x7f2e47ffa9b9 in _dl_init (/lib64/ld-linux-x86-64.so.2+0xf9b9) (BuildId: 33d30c20d175357a3497081e95f0fa482c840b40)
    #10 0x7f2e47febfd9  (/lib64/ld-linux-x86-64.so.2+0xfd9) (BuildId: 33d30c20d175357a3497081e95f0fa482c840b40)

Besides that one, I still see issues like these when executing the C++ oneAPI examples which suggest that the global object is getting corrupted:

==350402==ERROR: TypeSanitizer: type-aliasing-violation on address 0x7f62c47dcb18 (pc 0x7f627d7e7b3d bp 0x7fff2e7c3470 sp 0x7fff2e7c2c18 tid 350402)
WRITE of size 4 at 0x7f62c47dcb18 with type int accesses part of an existing object of type daal::services::internal::glktsn that starts at offset -8
    #0 0x7f627d7e7b3c in daal::services::internal::Dyn1Arr_str::Dyn1Arr_str() /export/users/dcortes/repos/onedal-clang-tysan/./cpp/daal/src/services/service_topo.cpp:378:23

And I still see a segfault now happening on the hyperparameters initialization, but it looks like this is solving some of the uninitialized memory issues at least.

@david-cortes-intel
Copy link
Contributor

Also since these are being revisited - much more minor thing, but bit-shifting negative integers is technically undefined behavior:

cpp/daal/src/services/service_topo.cpp:1071:40: runtime error: left shift of negative value -1
SUMMARY: UndefinedBehaviorSanitizer: undefined-behavior cpp/daal/src/services/service_topo.cpp:1071:40 
cpp/daal/src/services/service_topo.cpp:1077:41: runtime error: left shift of negative value -1
SUMMARY: UndefinedBehaviorSanitizer: undefined-behavior cpp/daal/src/services/service_topo.cpp:1077:41

Could it perhaps be done with a full unsigned integer instead?

@david-cortes-intel
Copy link
Contributor

In case it helps, here's a different usage of what I guess is the same detection logic:
https://chromium.googlesource.com/chromium/src/+/HEAD/base/cpu.cc#120

And this is where memsan reports an undefined memory usage:

__asm__("cpuid" : "+b"(ebx), "+a"(eax), "+c"(ecx), "=d"(edx));

Also that file is converting pointers int* <-> uint32_t* interchangeably on windows, which is technically non-compliant with the C++ standard.

@david-cortes-intel
Copy link
Contributor

david-cortes-intel commented Aug 1, 2025

And looks like clang provides a built-in to extract this info:
https://reviews.llvm.org/D121653
https://clang.llvm.org/doxygen/cpuid_8h_source.html

.. but unfortunately doesn't appear to be available under GCC. Correction: GCC does offer similar functionalities, but they name them slightly differently: https://gcc.gnu.org/git/?p=gcc.git;a=blob;f=gcc/config/i386/cpuid.h

@Vika-F
Copy link
Contributor Author

Vika-F commented Aug 1, 2025

@david-cortes-intel I'll try to replace it with __cpuidex for all compilers.

@david-cortes-intel
Copy link
Contributor

Thanks, can confirm that the changes here fixed the undefined access on the cpuid call, and the undefined negative bit shifting.

I still see some hints of memory corruption with tysan like these:

==575524==ERROR: TypeSanitizer: type-aliasing-violation on address 0x7fcb8f294b18 (pc 0x7fcb482351cb bp 0x7fffed0a4720 sp 0x7fffed0a3ec8 tid 575524)
WRITE of size 4 at 0x7fcb8f294b18 with type int accesses part of an existing object of type daal::services::internal::glktsn that starts at offset -8
    #0 0x7fcb482351ca in daal::services::internal::Dyn1Arr_str::Dyn1Arr_str(unsigned int, unsigned int) /export/users/dcortes/repos/onedal-clang-tysan/./cpp/daal/src/services/service_topo.cpp:1447:11

.. but they might be coming from somewhere else.


private:
unsigned dim[2] = { 0, 0 }; // xdim and ydim
std::unique_ptr<unsigned[], void (*)(unsigned *)> data; // data array to be malloc'd
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 benefit in using oneDAL's custom allocators and deallocators? I understand the advantage is that they return aligned memory and can thus use SIMD instructions on them, but does it matter here? Aren't the dispatchers for SIMD-enabled things meant to work only after all of the info here has been collected?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

I think this is done mostly not to have an aligned memory here, but because we believe that custom malloc is faster.

Copy link
Contributor

Choose a reason for hiding this comment

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

I have a feeling that we might find out it actually isn't faster if it's behind 3 function calls, for a very small size, and requires returning aligned memory. But maybe you could add it as a comment then that it is due to being faster than standard malloc.

};

// Global CPU topology object
static glktsn globalCPUTopology;

static char scratch[BLOCKSIZE_4K]; // scratch space large enough for OS to write SYSTEM_LOGICAL_PROCESSOR_INFORMATION_EX
Copy link
Contributor

Choose a reason for hiding this comment

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

Suggested change
static char scratch[BLOCKSIZE_4K]; // scratch space large enough for OS to write SYSTEM_LOGICAL_PROCESSOR_INFORMATION_EX
static std::array<char, BLOCKSIZE_4K> scratch; // scratch space large enough for OS to write SYSTEM_LOGICAL_PROCESSOR_INFORMATION_EX

For more debuggability.

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.

PR is in a mergeable state. Remainder of the unsolved issues will be left for follow-up PRs. Actually there's now some issues popping up in riscv:

malloc_consolidate(): unaligned fastbin chunk detected

@david-cortes-intel
Copy link
Contributor

david-cortes-intel commented Aug 28, 2025

I just realized I had been using sanitizers incorrectly. I can actually see a lot more issues now popping up about uninitialized memory.

For example, there appears to be an issue in this specific line:

pApicAffOrdMapping[EnumeratedThreadCount++] = idAffMskOrdMapping_t(i, hasLeafB, PkgSelectMask, PkgSelectMaskShift, CoreSelectMask,

Here's the first two things that pop out of MSan as of the latest commit here:

Uninitialized bytes in MemcmpInterceptorCommon at offset 0 inside [0x7ffd25783f50, 256)
==489091==WARNING: MemorySanitizer: use-of-uninitialized-value
    #0 0x564028d1f8cc in memcmp /usr/local/src/conda/compiler-rt-packages-20.1.7/compiler-rt/lib/msan/../sanitizer_common/sanitizer_common_interceptors.inc:879:33
    #1 0x564028d8ec54 in std::ctype<char>::_M_widen_init() const /home/conda/feedstock_root/build_artifacts/gcc_compilers_1750804933539/work/build/x86_64-conda-linux-gnu/libstdc++-v3/src/c++11/../../../../../libstdc++-v3/src/c++11/ctype.cc:98:25
    #2 0x564028d9aefe in std::ctype<char>::widen(char) const /home/conda/feedstock_root/build_artifacts/gcc_compilers_1750804933539/work/build/x86_64-conda-linux-gnu/libstdc++-v3/include/bits/locale_facets.h:886:21
    #3 0x564028db3b23 in std::basic_ios<char, std::char_traits<char> >::init(std::basic_streambuf<char, std::char_traits<char> >*) /home/conda/feedstock_root/build_artifacts/gcc_compilers_1750804933539/work/build/x86_64-conda-linux-gnu/libstdc++-v3/include/bits/basic_ios.tcc:155:29
    #4 0x564028dcab49 in std::basic_ostream<char, std::char_traits<char> >::basic_ostream(std::basic_streambuf<char, std::char_traits<char> >*) /home/conda/feedstock_root/build_artifacts/gcc_compilers_1750804933539/work/build/x86_64-conda-linux-gnu/libstdc++-v3/include/bits/ostream.h:93:19
    #5 0x564028d8ae9a in std::ios_base::Init::Init() /home/conda/feedstock_root/build_artifacts/gcc_compilers_1750804933539/work/build/x86_64-conda-linux-gnu/libstdc++-v3/src/c++98/../../../../../libstdc++-v3/src/c++98/ios_init.cc:91:36
    #6 0x564028d8ae9a in std::ios_base_library_init() /home/conda/feedstock_root/build_artifacts/gcc_compilers_1750804933539/work/build/x86_64-conda-linux-gnu/libstdc++-v3/src/c++98/../../../../../libstdc++-v3/src/c++98/ios_init.cc:78:3
    #7 0x564028d8addd in _GLOBAL__sub_I.00090_globals_io.cc /home/conda/feedstock_root/build_artifacts/gcc_compilers_1750804933539/work/build/x86_64-conda-linux-gnu/libstdc++-v3/src/c++98/../../../../../libstdc++-v3/src/c++98/globals_io.cc:80:65
    #8 0x564028dde66c in __libc_csu_init (/localdisk2/mkl/dcortes/repos/oneDAL/__release_lnx_clang/daal/latest/examples/oneapi/cpp/_cmake_results/intel_intel64_so/kmeans_init_dense+0x1d266c)
    #9 0x7f6ea459241d in __libc_start_main (/lib64/libc.so.6+0x2341d) (BuildId: a91d7b51b23a64e86b82a91511c446c137d3ec8e)
    #10 0x564028cbe52d in _start (/localdisk2/mkl/dcortes/repos/oneDAL/__release_lnx_clang/daal/latest/examples/oneapi/cpp/_cmake_results/intel_intel64_so/kmeans_init_dense+0xb252d)

  Uninitialized value was created by an allocation of 'ref.tmp' in the stack frame
    #0 0x7f6ea662a4e7 in daal::services::internal::glktsn::initEnumeratedThreadCountAndParseAPICIDs() /export/users/dcortes/repos/oneDAL/./cpp/daal/src/services/service_topo.cpp:1609:59

SUMMARY: MemorySanitizer: use-of-uninitialized-value /home/conda/feedstock_root/build_artifacts/gcc_compilers_1750804933539/work/build/x86_64-conda-linux-gnu/libstdc++-v3/src/c++11/../../../../../libstdc++-v3/src/c++11/ctype.cc:98:25 in std::ctype<char>::_M_widen_init() const
==489091==WARNING: MemorySanitizer: use-of-uninitialized-value
    #0 0x7f6eb49d0b3c in std::_Rb_tree<std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> >, std::pair<std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> > const, std::any>, std::_Select1st<std::pair<std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> > const, std::any> >, std::less<std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> > >, std::allocator<std::pair<std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> > const, std::any> > >::_M_lower_bound(std::_Rb_tree_node_base*, std::_Rb_tree_node_base*, std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> > const&) const /localdisk2/mkl/dcortes/miniforge3/envs/llvmenv/lib/gcc/x86_64-conda-linux-gnu/15.1.0/../../../gcc/x86_64-conda-linux-gnu/15.1.0/include/c++/bits/stl_tree.h:2603:7
    #1 0x7f6eb49d0b3c in std::_Rb_tree<std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> >, std::pair<std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> > const, std::any>, std::_Select1st<std::pair<std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> > const, std::any> >, std::less<std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> > >, std::allocator<std::pair<std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> > const, std::any> > >::lower_bound(std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> > const&) /localdisk2/mkl/dcortes/miniforge3/envs/llvmenv/lib/gcc/x86_64-conda-linux-gnu/15.1.0/../../../gcc/x86_64-conda-linux-gnu/15.1.0/include/c++/bits/stl_tree.h:1894:25
    #2 0x7f6eb49d0b3c in std::map<std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> >, std::any, std::less<std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> > >, std::allocator<std::pair<std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> > const, std::any> > >::lower_bound(std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> > const&) /localdisk2/mkl/dcortes/miniforge3/envs/llvmenv/lib/gcc/x86_64-conda-linux-gnu/15.1.0/../../../gcc/x86_64-conda-linux-gnu/15.1.0/include/c++/bits/stl_map.h:1349:21
    #3 0x7f6eb49d0b3c in std::map<std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> >, std::any, std::less<std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> > >, std::allocator<std::pair<std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> > const, std::any> > >::operator[](std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> >&&) /localdisk2/mkl/dcortes/miniforge3/envs/llvmenv/lib/gcc/x86_64-conda-linux-gnu/15.1.0/../../../gcc/x86_64-conda-linux-gnu/15.1.0/include/c++/bits/stl_map.h:552:17
    #4 0x7f6eb49d020d in oneapi::dal::detail::v1::cpu_info_x86::cpu_info_x86() /export/users/dcortes/repos/oneDAL/./cpp/oneapi/dal/detail/cpu_info_x86_impl.hpp:30:9
    #5 0x7f6eb49cdb68 in std::__detail::_MakeUniq<oneapi::dal::detail::v1::cpu_info_x86>::__single_object std::make_unique<oneapi::dal::detail::v1::cpu_info_x86>() /localdisk2/mkl/dcortes/miniforge3/envs/llvmenv/lib/gcc/x86_64-conda-linux-gnu/15.1.0/../../../gcc/x86_64-conda-linux-gnu/15.1.0/include/c++/bits/unique_ptr.h:1085:34
    #6 0x7f6eb49cdb68 in oneapi::dal::detail::v1::cpu_info::cpu_info() /export/users/dcortes/repos/oneDAL/cpp/oneapi/dal/detail/cpu_info.cpp:34:43
    #7 0x7f6eb49cb8a0 in oneapi::dal::detail::v1::global_context_impl::global_context_impl() /export/users/dcortes/repos/oneDAL/cpp/oneapi/dal/detail/global_context_impl.cpp:25:22
    #8 0x7f6eb49d86f7 in oneapi::dal::detail::v1::global_context::get_global_context() /export/users/dcortes/repos/oneDAL/cpp/oneapi/dal/detail/global_context.cpp:24:57
    #9 0x7f6eb4a1a194 in oneapi::dal::backend::context_cpu::context_cpu(oneapi::dal::detail::v1::host_policy const&) /export/users/dcortes/repos/oneDAL/./cpp/oneapi/dal/backend/dispatcher.hpp:95:9
    #10 0x7f6eb4a1a194 in auto oneapi::dal::backend::kernel_dispatcher<oneapi::dal::backend::kernel_spec<oneapi::dal::backend::single_node_cpu_kernel, oneapi::dal::kmeans_init::backend::compute_kernel_cpu<float, oneapi::dal::kmeans_init::method::v1::plus_plus_dense, oneapi::dal::kmeans_init::task::v1::init> > >::operator()<oneapi::dal::kmeans_init::detail::v1::descriptor_base<oneapi::dal::kmeans_init::task::v1::init> const&, oneapi::dal::kmeans_init::v1::compute_input<oneapi::dal::kmeans_init::task::v1::init> const&>(oneapi::dal::detail::v1::host_policy const&, oneapi::dal::kmeans_init::detail::v1::descriptor_base<oneapi::dal::kmeans_init::task::v1::init> const&, oneapi::dal::kmeans_init::v1::compute_input<oneapi::dal::kmeans_init::task::v1::init> const&) const /export/users/dcortes/repos/oneDAL/./cpp/oneapi/dal/backend/dispatcher.hpp:185:28
    #11 0x7f6eb4a1a06c in oneapi::dal::kmeans_init::detail::v1::compute_ops_dispatcher<oneapi::dal::detail::v1::host_policy, float, oneapi::dal::kmeans_init::method::v1::plus_plus_dense, oneapi::dal::kmeans_init::task::v1::init>::operator()(oneapi::dal::detail::v1::host_policy const&, oneapi::dal::kmeans_init::detail::v1::descriptor_base<oneapi::dal::kmeans_init::task::v1::init> const&, oneapi::dal::kmeans_init::v1::compute_input<oneapi::dal::kmeans_init::task::v1::init> const&) const /export/users/dcortes/repos/oneDAL/cpp/oneapi/dal/algo/kmeans_init/detail/compute_ops.cpp:33:16
    #12 0x564028d80210 in auto oneapi::dal::kmeans_init::detail::v1::compute_ops<oneapi::dal::kmeans_init::v1::descriptor<float, oneapi::dal::kmeans_init::method::v1::plus_plus_dense, oneapi::dal::kmeans_init::task::v1::init> >::operator()<oneapi::dal::detail::v1::host_policy>(oneapi::dal::detail::v1::host_policy const&, oneapi::dal::kmeans_init::v1::descriptor<float, oneapi::dal::kmeans_init::method::v1::plus_plus_dense, oneapi::dal::kmeans_init::task::v1::init> const&, oneapi::dal::kmeans_init::v1::compute_input<oneapi::dal::kmeans_init::task::v1::init> const&) const /localdisk2/mkl/dcortes/repos/oneDAL/__release_lnx_clang/daal/latest/include/oneapi/dal/algo/kmeans_init/detail/compute_ops.hpp:73:13
    #13 0x564028d7fca9 in auto oneapi::dal::detail::v1::ops_input_dispatcher<oneapi::dal::v1::csr_table, oneapi::dal::detail::v1::compute_ops<oneapi::dal::kmeans_init::v1::descriptor<float, oneapi::dal::kmeans_init::method::v1::plus_plus_dense, oneapi::dal::kmeans_init::task::v1::init>, oneapi::dal::kmeans_init::detail::v1::descriptor_tag>, false, false>::operator()<oneapi::dal::detail::v1::host_policy const&, oneapi::dal::kmeans_init::v1::descriptor<float, oneapi::dal::kmeans_init::method::v1::plus_plus_dense, oneapi::dal::kmeans_init::task::v1::init> const&, oneapi::dal::v1::csr_table const&>(oneapi::dal::detail::v1::host_policy const&, oneapi::dal::kmeans_init::v1::descriptor<float, oneapi::dal::kmeans_init::method::v1::plus_plus_dense, oneapi::dal::kmeans_init::task::v1::init> const&, oneapi::dal::v1::csr_table const&)::'lambda'()::operator()() const /localdisk2/mkl/dcortes/repos/oneDAL/__release_lnx_clang/daal/latest/include/oneapi/dal/detail/ops_dispatcher.hpp:97:20
    #14 0x564028d618d1 in auto oneapi::dal::detail::v1::ops_error_handling_dispatcher::operator()<oneapi::dal::detail::v1::host_policy const&, auto oneapi::dal::detail::v1::ops_input_dispatcher<oneapi::dal::v1::csr_table, oneapi::dal::detail::v1::compute_ops<oneapi::dal::kmeans_init::v1::descriptor<float, oneapi::dal::kmeans_init::method::v1::plus_plus_dense, oneapi::dal::kmeans_init::task::v1::init>, oneapi::dal::kmeans_init::detail::v1::descriptor_tag>, false, false>::operator()<oneapi::dal::detail::v1::host_policy const&, oneapi::dal::kmeans_init::v1::descriptor<float, oneapi::dal::kmeans_init::method::v1::plus_plus_dense, oneapi::dal::kmeans_init::task::v1::init> const&, oneapi::dal::v1::csr_table const&>(oneapi::dal::detail::v1::host_policy const&, oneapi::dal::kmeans_init::v1::descriptor<float, oneapi::dal::kmeans_init::method::v1::plus_plus_dense, oneapi::dal::kmeans_init::task::v1::init> const&, oneapi::dal::v1::csr_table const&)::'lambda'()>(oneapi::dal::detail::v1::host_policy const&, oneapi::dal::kmeans_init::v1::descriptor<float, oneapi::dal::kmeans_init::method::v1::plus_plus_dense, oneapi::dal::kmeans_init::task::v1::init> const&) /localdisk2/mkl/dcortes/repos/oneDAL/__release_lnx_clang/daal/latest/include/oneapi/dal/detail/ops_dispatcher.hpp:47:20
    #15 0x564028d618d1 in auto oneapi::dal::detail::v1::ops_input_dispatcher<oneapi::dal::v1::csr_table, oneapi::dal::detail::v1::compute_ops<oneapi::dal::kmeans_init::v1::descriptor<float, oneapi::dal::kmeans_init::method::v1::plus_plus_dense, oneapi::dal::kmeans_init::task::v1::init>, oneapi::dal::kmeans_init::detail::v1::descriptor_tag>, false, false>::operator()<oneapi::dal::detail::v1::host_policy const&, oneapi::dal::kmeans_init::v1::descriptor<float, oneapi::dal::kmeans_init::method::v1::plus_plus_dense, oneapi::dal::kmeans_init::task::v1::init> const&, oneapi::dal::v1::csr_table const&>(oneapi::dal::detail::v1::host_policy const&, oneapi::dal::kmeans_init::v1::descriptor<float, oneapi::dal::kmeans_init::method::v1::plus_plus_dense, oneapi::dal::kmeans_init::task::v1::init> const&, oneapi::dal::v1::csr_table const&) /localdisk2/mkl/dcortes/repos/oneDAL/__release_lnx_clang/daal/latest/include/oneapi/dal/detail/ops_dispatcher.hpp:96:16
    #16 0x564028d618d1 in auto oneapi::dal::detail::v1::ops_parameter_dispatcher<oneapi::dal::v1::csr_table, oneapi::dal::detail::v1::compute_ops<oneapi::dal::kmeans_init::v1::descriptor<float, oneapi::dal::kmeans_init::method::v1::plus_plus_dense, oneapi::dal::kmeans_init::task::v1::init>, oneapi::dal::kmeans_init::detail::v1::descriptor_tag>, false>::operator()<oneapi::dal::detail::v1::host_policy const&, oneapi::dal::kmeans_init::v1::descriptor<float, oneapi::dal::kmeans_init::method::v1::plus_plus_dense, oneapi::dal::kmeans_init::task::v1::init> const&, oneapi::dal::v1::csr_table const&>(oneapi::dal::detail::v1::host_policy const&, oneapi::dal::kmeans_init::v1::descriptor<float, oneapi::dal::kmeans_init::method::v1::plus_plus_dense, oneapi::dal::kmeans_init::task::v1::init> const&, oneapi::dal::v1::csr_table const&) /localdisk2/mkl/dcortes/repos/oneDAL/__release_lnx_clang/daal/latest/include/oneapi/dal/detail/ops_dispatcher.hpp:148:16
    #17 0x564028d618d1 in auto oneapi::dal::detail::v1::ops_policy_dispatcher<oneapi::dal::kmeans_init::v1::descriptor<float, oneapi::dal::kmeans_init::method::v1::plus_plus_dense, oneapi::dal::kmeans_init::task::v1::init>, oneapi::dal::detail::v1::tagged_compute_ops, false>::operator()<oneapi::dal::kmeans_init::v1::descriptor<float, oneapi::dal::kmeans_init::method::v1::plus_plus_dense, oneapi::dal::kmeans_init::task::v1::init> const&, oneapi::dal::v1::csr_table const&>(oneapi::dal::kmeans_init::v1::descriptor<float, oneapi::dal::kmeans_init::method::v1::plus_plus_dense, oneapi::dal::kmeans_init::task::v1::init> const&, oneapi::dal::v1::csr_table const&) /localdisk2/mkl/dcortes/repos/oneDAL/__release_lnx_clang/daal/latest/include/oneapi/dal/detail/ops_dispatcher.hpp:177:16
    #18 0x564028d618d1 in auto oneapi::dal::detail::v1::compute_dispatch<oneapi::dal::kmeans_init::v1::descriptor<float, oneapi::dal::kmeans_init::method::v1::plus_plus_dense, oneapi::dal::kmeans_init::task::v1::init> const&, oneapi::dal::v1::csr_table const&>(oneapi::dal::kmeans_init::v1::descriptor<float, oneapi::dal::kmeans_init::method::v1::plus_plus_dense, oneapi::dal::kmeans_init::task::v1::init> const&, oneapi::dal::v1::csr_table const&) /localdisk2/mkl/dcortes/repos/oneDAL/__release_lnx_clang/daal/latest/include/oneapi/dal/detail/compute_ops.hpp:33:12
    #19 0x564028d618d1 in auto oneapi::dal::v1::compute<oneapi::dal::kmeans_init::v1::descriptor<float, oneapi::dal::kmeans_init::method::v1::plus_plus_dense, oneapi::dal::kmeans_init::task::v1::init> const&, oneapi::dal::v1::csr_table const&>(oneapi::dal::kmeans_init::v1::descriptor<float, oneapi::dal::kmeans_init::method::v1::plus_plus_dense, oneapi::dal::kmeans_init::task::v1::init> const&, oneapi::dal::v1::csr_table const&) /localdisk2/mkl/dcortes/repos/oneDAL/__release_lnx_clang/daal/latest/include/oneapi/dal/compute.hpp:28:12
    #20 0x564028d618d1 in void run<oneapi::dal::kmeans_init::method::v1::plus_plus_dense, oneapi::dal::v1::csr_table>(oneapi::dal::v1::csr_table const&, std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> > const&) /export/users/dcortes/repos/oneDAL/__release_lnx_clang/daal/latest/examples/oneapi/cpp/source/kmeans_init/kmeans_init_dense.cpp:45:30
    #21 0x564028d5d6b1 in main /export/users/dcortes/repos/oneDAL/__release_lnx_clang/daal/latest/examples/oneapi/cpp/source/kmeans_init/kmeans_init_dense.cpp:144:5
    #22 0x7f6ea4592492 in __libc_start_main (/lib64/libc.so.6+0x23492) (BuildId: a91d7b51b23a64e86b82a91511c446c137d3ec8e)
    #23 0x564028cbe52d in _start (/localdisk2/mkl/dcortes/repos/oneDAL/__release_lnx_clang/daal/latest/examples/oneapi/cpp/_cmake_results/intel_intel64_so/kmeans_init_dense+0xb252d)

  Uninitialized value was created by a heap allocation
    #0 0x564028d5712c in operator new(unsigned long) /usr/local/src/conda/compiler-rt-packages-20.1.7/compiler-rt/lib/msan/msan_new_delete.cpp:51:35
    #1 0x7f6eb49d196e in std::__new_allocator<std::_Rb_tree_node<std::pair<std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> > const, std::any> > >::allocate(unsigned long, void const*) /localdisk2/mkl/dcortes/miniforge3/envs/llvmenv/lib/gcc/x86_64-conda-linux-gnu/15.1.0/../../../gcc/x86_64-conda-linux-gnu/15.1.0/include/c++/bits/new_allocator.h:151:27
    #2 0x7f6eb49d196e in std::allocator_traits<std::allocator<std::_Rb_tree_node<std::pair<std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> > const, std::any> > > >::allocate(std::allocator<std::_Rb_tree_node<std::pair<std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> > const, std::any> > >&, unsigned long) /localdisk2/mkl/dcortes/miniforge3/envs/llvmenv/lib/gcc/x86_64-conda-linux-gnu/15.1.0/../../../gcc/x86_64-conda-linux-gnu/15.1.0/include/c++/bits/alloc_traits.h:614:20
    #3 0x7f6eb49d196e in std::_Rb_tree<std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> >, std::pair<std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> > const, std::any>, std::_Select1st<std::pair<std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> > const, std::any> >, std::less<std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> > >, std::allocator<std::pair<std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> > const, std::any> > >::_M_get_node() /localdisk2/mkl/dcortes/miniforge3/envs/llvmenv/lib/gcc/x86_64-conda-linux-gnu/15.1.0/../../../gcc/x86_64-conda-linux-gnu/15.1.0/include/c++/bits/stl_tree.h:1170:9
    #4 0x7f6eb49d196e in std::_Rb_tree_node<std::pair<std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> > const, std::any> >* std::_Rb_tree<std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> >, std::pair<std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> > const, std::any>, std::_Select1st<std::pair<std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> > const, std::any> >, std::less<std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> > >, std::allocator<std::pair<std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> > const, std::any> > >::_M_create_node<std::piecewise_construct_t const&, std::tuple<std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> >&&>, std::tuple<> >(std::piecewise_construct_t const&, std::tuple<std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> >&&>&&, std::tuple<>&&) /localdisk2/mkl/dcortes/miniforge3/envs/llvmenv/lib/gcc/x86_64-conda-linux-gnu/15.1.0/../../../gcc/x86_64-conda-linux-gnu/15.1.0/include/c++/bits/stl_tree.h:1253:22
    #5 0x7f6eb49d196e in std::_Rb_tree<std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> >, std::pair<std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> > const, std::any>, std::_Select1st<std::pair<std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> > const, std::any> >, std::less<std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> > >, std::allocator<std::pair<std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> > const, std::any> > >::_Auto_node::_Auto_node<std::piecewise_construct_t const&, std::tuple<std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> >&&>, std::tuple<> >(std::_Rb_tree<std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> >, std::pair<std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> > const, std::any>, std::_Select1st<std::pair<std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> > const, std::any> >, std::less<std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> > >, std::allocator<std::pair<std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> > const, std::any> > >&, std::piecewise_construct_t const&, std::tuple<std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> >&&>&&, std::tuple<>&&) /localdisk2/mkl/dcortes/miniforge3/envs/llvmenv/lib/gcc/x86_64-conda-linux-gnu/15.1.0/../../../gcc/x86_64-conda-linux-gnu/15.1.0/include/c++/bits/stl_tree.h:2285:18
    #6 0x7f6eb49d196e in std::_Rb_tree_iterator<std::pair<std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> > const, std::any> > std::_Rb_tree<std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> >, std::pair<std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> > const, std::any>, std::_Select1st<std::pair<std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> > const, std::any> >, std::less<std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> > >, std::allocator<std::pair<std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> > const, std::any> > >::_M_emplace_hint_unique<std::piecewise_construct_t const&, std::tuple<std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> >&&>, std::tuple<> >(std::_Rb_tree_const_iterator<std::pair<std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> > const, std::any> >, std::piecewise_construct_t const&, std::tuple<std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> >&&>&&, std::tuple<>&&) /localdisk2/mkl/dcortes/miniforge3/envs/llvmenv/lib/gcc/x86_64-conda-linux-gnu/15.1.0/../../../gcc/x86_64-conda-linux-gnu/15.1.0/include/c++/bits/stl_tree.h:3084:13
    #7 0x7f6eb49d0fa3 in std::map<std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> >, std::any, std::less<std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> > >, std::allocator<std::pair<std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> > const, std::any> > >::operator[](std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> >&&) /localdisk2/mkl/dcortes/miniforge3/envs/llvmenv/lib/gcc/x86_64-conda-linux-gnu/15.1.0/../../../gcc/x86_64-conda-linux-gnu/15.1.0/include/c++/bits/stl_map.h:555:15
    #8 0x7f6eb49d0064 in oneapi::dal::detail::v1::cpu_info_x86::cpu_info_x86() /export/users/dcortes/repos/oneDAL/./cpp/oneapi/dal/detail/cpu_info_x86_impl.hpp:29:9
    #9 0x7f6eb49cdb68 in std::__detail::_MakeUniq<oneapi::dal::detail::v1::cpu_info_x86>::__single_object std::make_unique<oneapi::dal::detail::v1::cpu_info_x86>() /localdisk2/mkl/dcortes/miniforge3/envs/llvmenv/lib/gcc/x86_64-conda-linux-gnu/15.1.0/../../../gcc/x86_64-conda-linux-gnu/15.1.0/include/c++/bits/unique_ptr.h:1085:34
    #10 0x7f6eb49cdb68 in oneapi::dal::detail::v1::cpu_info::cpu_info() /export/users/dcortes/repos/oneDAL/cpp/oneapi/dal/detail/cpu_info.cpp:34:43
    #11 0x7f6eb49cb8a0 in oneapi::dal::detail::v1::global_context_impl::global_context_impl() /export/users/dcortes/repos/oneDAL/cpp/oneapi/dal/detail/global_context_impl.cpp:25:22
    #12 0x7f6eb49d86f7 in oneapi::dal::detail::v1::global_context::get_global_context() /export/users/dcortes/repos/oneDAL/cpp/oneapi/dal/detail/global_context.cpp:24:57
    #13 0x7f6eb4a1a194 in oneapi::dal::backend::context_cpu::context_cpu(oneapi::dal::detail::v1::host_policy const&) /export/users/dcortes/repos/oneDAL/./cpp/oneapi/dal/backend/dispatcher.hpp:95:9
    #14 0x7f6eb4a1a194 in auto oneapi::dal::backend::kernel_dispatcher<oneapi::dal::backend::kernel_spec<oneapi::dal::backend::single_node_cpu_kernel, oneapi::dal::kmeans_init::backend::compute_kernel_cpu<float, oneapi::dal::kmeans_init::method::v1::plus_plus_dense, oneapi::dal::kmeans_init::task::v1::init> > >::operator()<oneapi::dal::kmeans_init::detail::v1::descriptor_base<oneapi::dal::kmeans_init::task::v1::init> const&, oneapi::dal::kmeans_init::v1::compute_input<oneapi::dal::kmeans_init::task::v1::init> const&>(oneapi::dal::detail::v1::host_policy const&, oneapi::dal::kmeans_init::detail::v1::descriptor_base<oneapi::dal::kmeans_init::task::v1::init> const&, oneapi::dal::kmeans_init::v1::compute_input<oneapi::dal::kmeans_init::task::v1::init> const&) const /export/users/dcortes/repos/oneDAL/./cpp/oneapi/dal/backend/dispatcher.hpp:185:28
    #15 0x7f6eb4a1a06c in oneapi::dal::kmeans_init::detail::v1::compute_ops_dispatcher<oneapi::dal::detail::v1::host_policy, float, oneapi::dal::kmeans_init::method::v1::plus_plus_dense, oneapi::dal::kmeans_init::task::v1::init>::operator()(oneapi::dal::detail::v1::host_policy const&, oneapi::dal::kmeans_init::detail::v1::descriptor_base<oneapi::dal::kmeans_init::task::v1::init> const&, oneapi::dal::kmeans_init::v1::compute_input<oneapi::dal::kmeans_init::task::v1::init> const&) const /export/users/dcortes/repos/oneDAL/cpp/oneapi/dal/algo/kmeans_init/detail/compute_ops.cpp:33:16
    #16 0x564028d80210 in auto oneapi::dal::kmeans_init::detail::v1::compute_ops<oneapi::dal::kmeans_init::v1::descriptor<float, oneapi::dal::kmeans_init::method::v1::plus_plus_dense, oneapi::dal::kmeans_init::task::v1::init> >::operator()<oneapi::dal::detail::v1::host_policy>(oneapi::dal::detail::v1::host_policy const&, oneapi::dal::kmeans_init::v1::descriptor<float, oneapi::dal::kmeans_init::method::v1::plus_plus_dense, oneapi::dal::kmeans_init::task::v1::init> const&, oneapi::dal::kmeans_init::v1::compute_input<oneapi::dal::kmeans_init::task::v1::init> const&) const /localdisk2/mkl/dcortes/repos/oneDAL/__release_lnx_clang/daal/latest/include/oneapi/dal/algo/kmeans_init/detail/compute_ops.hpp:73:13

@Vika-F
Copy link
Contributor Author

Vika-F commented Sep 3, 2025

Looks like the CPU detection is now broken on AMD runners. The investigation is in progress.

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

Successfully merging this pull request may close these issues.

2 participants