Skip to content

Commit

Permalink
TBB: Add waitpkg target feature.
Browse files Browse the repository at this point in the history
  • Loading branch information
furby-tm committed Mar 16, 2024
1 parent 69b388f commit 54b2952
Show file tree
Hide file tree
Showing 2 changed files with 20 additions and 1 deletion.
15 changes: 15 additions & 0 deletions Sources/OneTBB/include/OneTBB/oneapi/tbb/detail/_config.h
Original file line number Diff line number Diff line change
Expand Up @@ -338,6 +338,21 @@
#define __TBB_WAITPKG_INTRINSICS_PRESENT ((__INTEL_COMPILER >= 1900 || __TBB_GCC_VERSION >= 110000 || __TBB_CLANG_VERSION >= 120000) \
&& (_WIN32 || _WIN64 || __unix__ || __APPLE__) && (__TBB_x86_32 || __TBB_x86_64) && !__ANDROID__)

/*
* OCIO_TARGET_ATTRIBUTE(attrs) - override the compilation target for a function.
*
* This accepts one or more comma-separated suffixes to the -m prefix jointly
* forming the name of a machine-dependent option. On gcc-like compilers, this
* enables codegen for the given targets, including arbitrary compiler-generated
* code as well as the corresponding intrinsics. On other compilers this macro
* expands to nothing, though MSVC allows intrinsics to be used anywhere anyway.
*/
#if defined(__GNUC__) || __has_attribute(target)
# define __TBB_TARGET_ATTRIBUTE(attrs) __attribute__((target(attrs)))
#else
# define __TBB_TARGET_ATTRIBUTE(attrs)
#endif

/** Internal TBB features & modes **/

/** __TBB_SOURCE_DIRECTLY_INCLUDED is a mode used in whitebox testing when
Expand Down
6 changes: 5 additions & 1 deletion Sources/OneTBB/tbb/scheduler_common.h
Original file line number Diff line number Diff line change
Expand Up @@ -219,7 +219,11 @@ inline void prolonged_pause_impl() {
}
#endif

inline void prolonged_pause() {
inline
#if __TBB_WAITPKG_INTRINSICS_PRESENT
__TBB_TARGET_ATTRIBUTE("waitpkg")
#endif // __TBB_WAITPKG_INTRINSICS_PRESENT
void prolonged_pause() {
#if __TBB_WAITPKG_INTRINSICS_PRESENT
if (governor::wait_package_enabled()) {
std::uint64_t time_stamp = machine_time_stamp();
Expand Down

0 comments on commit 54b2952

Please sign in to comment.