-
Notifications
You must be signed in to change notification settings - Fork 1.1k
Description
Summary
Similar to #1638.
At least task_group::wait()
and parallel_for_each()
crash when the app is compiled with clang-cl and -flto -fwhole-program-vtables -fvirtual-function-elimination
.
The flag that causes crashes is -fvirtual-function-elimination
. Without it, everything works (except task_group::wait()
if #1644 is not applied).
Note that even if the oneTBB library is compiled without this flag, but the actual app is, it will still crash.
Version
575948b + #1644 to fix -fwhole-program-vtables
issue with task groups.
Environment
Windows 11 26120.5761
Windows SDK 10.0.26100.0
Visual Studio Community 17.14.13 Preview 1.0
LLVM 21.1.0 (official binaries)
Observed Behavior
The app crashes. Stacktrace extracted from the minidump when parallel_for_each()
is called:
Unhandled exception at 0x0000000000000000: 0xC0000005: Access violation executing location 0x0000000000000000.
[Inline Frame] tbb12.dll!tbb::detail::r1::task_dispatcher::local_wait_for_all(tbb::detail::d1::task * t, tbb::detail::r1::external_waiter & waiter) Line 573
at D:\modding\nlc\engine\reaper-engine\3rd_party\Src\oneTBB\oneTBB\src\tbb\task_dispatcher.h(573)
[Inline Frame] tbb12.dll!tbb::detail::r1::task_dispatcher::local_wait_for_all(tbb::detail::d1::task * t, tbb::detail::r1::external_waiter & waiter) Line 481
at D:\modding\nlc\engine\reaper-engine\3rd_party\Src\oneTBB\oneTBB\src\tbb\task_dispatcher.h(481)
tbb12.dll!tbb::detail::r1::task_dispatcher::execute_and_wait(tbb::detail::d1::task * t, tbb::detail::d1::wait_context & wait_ctx, tbb::detail::d1::task_group_context & w_ctx) Line 168
at D:\modding\nlc\engine\reaper-engine\3rd_party\Src\oneTBB\oneTBB\src\tbb\task_dispatcher.cpp(168)
[Inline Frame] xrEngine.exe!tbb::detail::d1::execute_and_wait(tbb::detail::d1::task & t, tbb::detail::d1::task_group_context & t_ctx, tbb::detail::d1::wait_context & wait_ctx, tbb::detail::d1::task_group_context & w_ctx) Line 236
at D:\modding\nlc\engine\reaper-engine\3rd_party\Src\oneTBB\oneTBB\include\oneapi\tbb\detail\_task.h(236)
[Inline Frame] xrEngine.exe!tbb::detail::d2::run_parallel_for_each(absl::container_internal::raw_hash_set<absl::container_internal::FlatHashMapPolicy<shared_str,shared_str>,absl::container_internal::StringHash,absl::container_internal::StringEq,std::__2::allocator<std::__2::pair<const shared_str,shared_str>>>::iterator first, absl::container_internal::raw_hash_set<absl::container_internal::FlatHashMapPolicy<shared_str,shared_str>,absl::container_internal::StringHash,absl::container_internal::StringEq,std::__2::allocator<std::__2::pair<const shared_str,shared_str>>>::iterator last, const CTextureDescrMngr::LoadLTX::<lambda_0> & body, tbb::detail::d1::task_group_context & context) Line 633
at D:\modding\nlc\engine\reaper-engine\3rd_party\Src\oneTBB\oneTBB\include\oneapi\tbb\parallel_for_each.h(633)
[Inline Frame] xrEngine.exe!tbb::detail::d2::parallel_for_each(absl::container_internal::raw_hash_set<absl::container_internal::FlatHashMapPolicy<shared_str,shared_str>,absl::container_internal::StringHash,absl::container_internal::StringEq,std::__2::allocator<std::__2::pair<const shared_str,shared_str>>>::iterator first, absl::container_internal::raw_hash_set<absl::container_internal::FlatHashMapPolicy<shared_str,shared_str>,absl::container_internal::StringHash,absl::container_internal::StringEq,std::__2::allocator<std::__2::pair<const shared_str,shared_str>>>::iterator last, const CTextureDescrMngr::LoadLTX::<lambda_0> & body) Line 665
at D:\modding\nlc\engine\reaper-engine\3rd_party\Src\oneTBB\oneTBB\include\oneapi\tbb\parallel_for_each.h(665)
[Inline Frame] xrEngine.exe!tbb::detail::d2::parallel_for_each(absl::flat_hash_map<shared_str,shared_str,absl::container_internal::StringHash,absl::container_internal::StringEq,std::__2::allocator<std::__2::pair<const shared_str,shared_str>>> & rng, const CTextureDescrMngr::LoadLTX::<lambda_0> & body) Line 671
at D:\modding\nlc\engine\reaper-engine\3rd_party\Src\oneTBB\oneTBB\include\oneapi\tbb\parallel_for_each.h(671)
...
There's no line 573 in task_dispatcher.h
from the first line -- should be line 248?
When using task groups, it also crashes on local_wait_for_all()
at the same place.
Expected Behavior
It shouldn't crash.
If -fvirtual-function-elimination
is officially unsupported, it should be mentioned somewhere.
Steps To Reproduce
It's enough to compile the TBB examples with clang-cl and -flto -fwhole-program-vtables -fvirtual-function-elimination
and run e.g. sudoku.exe
.