-
Notifications
You must be signed in to change notification settings - Fork 2k
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
drop deprecated TBB components #6590
Conversation
Quite some time ago, many of the TBB components were deprecated in favor of their near-equivalents in the STL or, in the case of task_scheduler_init, were broken up and reconstituted under a less ad-hoc logic. Every time a header file marked deprecated gets included, a rather loud warning is emitted, which leads to a complete TBB's domination over the stderr stream during build time, making it harder to notice _legitimate_ warnings. Instead of merely muting the output with TBB_SUPPRESS_DEPRECATED_MESSAGES, perform a genuine migration away from the deprecated components with the added benefit of achieving a source compatibility with oneTBB, the successor to TBB which has dropped the deprecated API for good. What got replaced for what? | Deprecated | Replacement | | ------------------------------------- | --------------------------------------------- | | `tbb::atomic` | `std::atomic` | | `tbb::mutex` | `std::mutex` | | `tbb::mutex::scoped_lock` | `std::scoped_lock<std::mutex>` | | `tbb::mutex::scoped_lock` (empty) | `std::unique_lock<std::mutex>` (deferred) | | `tbb::task_scheduler_init` | `tbb::global_control` | | `tbb::this_thread` | `std::this_thread` | Signed-off-by: Roman Beranek <[email protected]>
Thanks. Regarding tbb::mutex vs std::mutex, this may be a performance
sensitive change, because the std::mutex implementation may or may not use
atomics and spin locks before resorting to a kernel object. For example,
tbb::mutex is based on Win32 CRITICAL_SECTION object. What is the
std::mutex implementation on various platforms? Is it stable? We are
building on some older Linux distro, over which std::mutex implementation
we have no control.
čt 3. 6. 2021 v 23:14 odesílatel Roman Beránek ***@***.***>
napsal:
… Quite some time ago, many of the TBB components were deprecated in favor
of their near-equivalents in the STL or, in the case of
task_scheduler_init, were broken up and reconstituted under a less ad-hoc
logic. Every time a header file marked deprecated gets included, a rather
loud warning is emitted, which leads to a complete TBB's domination over
the stderr stream during build time, making it harder to notice
*legitimate* warnings.
Instead of merely muting the output with TBB_SUPPRESS_DEPRECATED_MESSAGES,
perform a genuine migration away from the deprecated components with the
added benefit of achieving source compatibility with oneTBB, the successor
to TBB, which has dropped the deprecated API for good.
------------------------------
Applied mapping
Deprecated Replacement
tbb::atomic std::atomic
tbb::mutex std::mutex
tbb::mutex::scoped_lock std::scoped_lock<std::mutex>
tbb::mutex::scoped_lock (empty) std::unique_lock<std::mutex> (deferred)
tbb::task_scheduler_init tbb::global_control
tbb::this_thread std::this_thread
------------------------------
Signed-off-by: Roman Beranek ***@***.***
------------------------------
You can view, comment on, or merge this pull request online at:
#6590
Commit Summary
- drop deprecated TBB components
File Changes
- *M* src/libslic3r/Execution/ExecutionTBB.hpp
<https://github.com/prusa3d/PrusaSlicer/pull/6590/files#diff-f702cd3840b6e4d6305fe2e4e1cfb7de972308b1e1baa7af495f3f2cc73ab77d>
(5)
- *M* src/libslic3r/Print.cpp
<https://github.com/prusa3d/PrusaSlicer/pull/6590/files#diff-6a6d0a3d3ce08babafde7b52f3743d7b9b599df0bd1b62b3a962e3096c311a8e>
(4)
- *M* src/libslic3r/PrintApply.cpp
<https://github.com/prusa3d/PrusaSlicer/pull/6590/files#diff-3174ce21ddf26221a623a4621c7cdef23cac3f9d5d12cd8292ca1f3179edbdad>
(2)
- *M* src/libslic3r/PrintBase.cpp
<https://github.com/prusa3d/PrusaSlicer/pull/6590/files#diff-6e04a6759389e092a6d0e37604d31d7ab665e25752226af7cf146863d88baced>
(2)
- *M* src/libslic3r/PrintBase.hpp
<https://github.com/prusa3d/PrusaSlicer/pull/6590/files#diff-a06fe811177c1395f21bd929d2887c7e6f526ece9ed015ba60ae246df2285d48>
(40)
- *M* src/libslic3r/PrintObject.cpp
<https://github.com/prusa3d/PrusaSlicer/pull/6590/files#diff-3ec83cd4f72e61c92f69178305a0298e90e2d8b43a3d88ca2f8edccde4e02c7a>
(1)
- *M* src/libslic3r/SLA/SupportTree.cpp
<https://github.com/prusa3d/PrusaSlicer/pull/6590/files#diff-e84203f92c751773cd024496147eed08948e35b30c4183de9f4988d8a7c85fb0>
(3)
- *M* src/libslic3r/SLAPrint.cpp
<https://github.com/prusa3d/PrusaSlicer/pull/6590/files#diff-05d6c79e10cfcdee9e3a75ce1f57aadbdd62ecb3f12aff83af22a4ecf58fbe2a>
(10)
- *M* src/libslic3r/SupportMaterial.cpp
<https://github.com/prusa3d/PrusaSlicer/pull/6590/files#diff-82e7d28696fdad644d38748bfaa0811c1d910866f8c118053e60a06419764f44>
(1)
- *M* src/libslic3r/Thread.cpp
<https://github.com/prusa3d/PrusaSlicer/pull/6590/files#diff-0864edfb00259800c839a7be44d05ea5faf97608788a2ba12402bf00c17b3b7e>
(12)
- *M* src/libslic3r/pchheader.hpp
<https://github.com/prusa3d/PrusaSlicer/pull/6590/files#diff-f8b0d32a62c9c87d26b11b49d7058f3398084cad9df5486f699916d5dcd78bcf>
(3)
- *M* src/libslic3r/utils.cpp
<https://github.com/prusa3d/PrusaSlicer/pull/6590/files#diff-399957930cfdaf41f80253e701ff0bb2d103da4fb4b486ed390f7376d425e7b6>
(6)
- *M* src/slic3r/GUI/BackgroundSlicingProcess.cpp
<https://github.com/prusa3d/PrusaSlicer/pull/6590/files#diff-7ec4021982c900f2661938185d9efd0004c8ff03e0a72902cb295aa3f45d535c>
(6)
- *M* src/slic3r/GUI/InstanceCheck.hpp
<https://github.com/prusa3d/PrusaSlicer/pull/6590/files#diff-5b320fa4eaa90ebb5bc9ee74dd42212a25bf95c143d832dc3fbf1771839a87eb>
(2)
- *M* src/slic3r/GUI/Mouse3DController.cpp
<https://github.com/prusa3d/PrusaSlicer/pull/6590/files#diff-1a08b9c4bafba0cc21340abce59edb6680b160abdd7c3b73136db14bebe2e95b>
(38)
- *M* src/slic3r/GUI/Mouse3DController.hpp
<https://github.com/prusa3d/PrusaSlicer/pull/6590/files#diff-06f9fcbcd5de734f811cbcb93ef585ac0c0fb4ed18a92cf2684f890dec4208fe>
(10)
- *M* src/slic3r/GUI/RemovableDriveManager.cpp
<https://github.com/prusa3d/PrusaSlicer/pull/6590/files#diff-32d7e003b2958d63a0f6a82b0098084d5c62fea19d182b5203b48416fdc9754f>
(24)
- *M* src/slic3r/GUI/RemovableDriveManager.hpp
<https://github.com/prusa3d/PrusaSlicer/pull/6590/files#diff-0de44456f17e4e54b73364cdb54d28e014ef027d66928f7e00dd7da54df6a724>
(6)
Patch Links:
- https://github.com/prusa3d/PrusaSlicer/pull/6590.patch
- https://github.com/prusa3d/PrusaSlicer/pull/6590.diff
—
You are receiving this because you are subscribed to this thread.
Reply to this email directly, view it on GitHub
<#6590>, or unsubscribe
<https://github.com/notifications/unsubscribe-auth/ABMPSIY3B63W6HOYIW5OUODTQ7WCLANCNFSM46BQ34TA>
.
|
Wouldn't it be weird if a C++ standard library implementation shipped with threading primitives of a suboptimal performance? (Not for Microsoft, I guess.) Moreover, these interfaces were deprecated in the TBB once they had literally become a part of the STL (with some little changes here and there) in 2011. However, both of the links point to somewhat dated content. Nowadays, it seems like, on Windows 10 with a recent-enough (2017+) STL, And as far as other platforms are concerned: On POSIX systems the Thread support library wraps around POSIX Threads and it's been this way basically since around forever (i.e. the first draft from 2007 [3]). [1] https://github.com/microsoft/STL/blob/main/stl/src/primitives.hpp#L124 |
Wouldn't it be weird if a C++ standard library implementation shipped
with threading primitives of a suboptimal performance?
For example, some GCC std::unordered_map implementations were pretty bad,
much worse than std::set.
Trust, but verify - Wikipedia
<https://en.wikipedia.org/wiki/Trust,_but_verify>
pá 4. 6. 2021 v 11:36 odesílatel Roman Beránek ***@***.***>
napsal:
… Wouldn't it be weird if a C++ standard library implementation shipped with
threading primitives of a suboptimal performance? (Not for Microsoft, I
guess.) Moreover, these interfaces were deprecated in the TBB once they had
literally become a part of the STL (with some little changes here and
there) in 2011.
However, both of the links point to somewhat dated content. Nowadays, it
seems like, on Windows 10 with a recent-enough (2017+) STL, std::mutex
should actually perform better in the high contention conditions than
tbb::mutex as Microsoft's std::mutex now uses SRWLock [1], while the
CRITICAL_SECTION Win32 API now itself by default does some spinning[2].
(Possibly to improve latency? A reminder that from the user's perspective,
some overhead might be good, actually.)
And as far as other platforms are concerned: On POSIX systems the Thread
support library wraps around POSIX Threads and it's been this way basically
since around forever (i.e. the first draft from 2007 [3]).
[1] https://github.com/microsoft/STL/blob/main/stl/src/primitives.hpp#L124
[2] https://stackoverflow.com/q/52170665/3763673
[3] http://www.open-std.org/jtc1/sc22/wg21/docs/papers/2007/n2178.html
—
You are receiving this because you commented.
Reply to this email directly, view it on GitHub
<#6590 (comment)>,
or unsubscribe
<https://github.com/notifications/unsubscribe-auth/ABMPSI7XKOOYBUSZROBV5GDTRCNCBANCNFSM46BQ34TA>
.
|
Trusted, but verified. Thanks for your contribution. |
It should be fine now. |
thansk, I'll sync up and try again! |
That did it thanks! |
https://build.opensuse.org/request/show/933584 by user bnavigator + dimstar_suse - Make compatible with TBB 2021 * add FindTBB.cmake -- gh#prusa3d/PrusaSlicer#7332 * add PrusaSlicer-pr6590-updateTBB.patch gh#prusa3d/PrusaSlicer#6590
Quite some time ago, many of the TBB components were deprecated in favor of their near-equivalents in the STL or, in the case of task_scheduler_init, were broken up and reconstituted under a less ad-hoc logic. Every time a header file marked deprecated gets included, a rather loud warning is emitted, which leads to a complete TBB's domination over the stderr stream during build time, making it harder to notice legitimate warnings.
Instead of merely muting the output with
TBB_SUPPRESS_DEPRECATED_MESSAGES
, perform a genuine migration away from the deprecated components with the added benefit of achieving source compatibility with oneTBB, the successor to TBB, which has dropped the deprecated API for good.Applied mapping
tbb::atomic
std::atomic
tbb::mutex
std::mutex
tbb::mutex::scoped_lock
std::scoped_lock<std::mutex>
tbb::mutex::scoped_lock
(empty)std::unique_lock<std::mutex>
(deferred)tbb::task_scheduler_init
tbb::global_control
tbb::this_thread
std::this_thread
UPDATE
Unbeknownst to me, people at Intel released have compiled their own comprehensive replacements table.
Signed-off-by: Roman Beranek [email protected]