Skip to content

Commit 5644f73

Browse files
Revert "[OpenMP] Add support for Intel's umonitor/umwait"
This reverts commit 9cfad5f.
1 parent 0c101c9 commit 5644f73

14 files changed

+172
-542
lines changed

Diff for: openmp/runtime/src/i18n/en_US.txt

-2
Original file line numberDiff line numberDiff line change
@@ -417,8 +417,6 @@ AffUsingHwloc "%1$s: Affinity capable, using hwloc."
417417
AffIgnoringHwloc "%1$s: Ignoring hwloc mechanism."
418418
AffHwlocErrorOccurred "%1$s: Hwloc failed in %2$s. Relying on internal affinity mechanisms."
419419
EnvSerialWarn "%1$s must be set prior to OpenMP runtime library initialization; ignored."
420-
EnvMwaitWarn "You have enabled the use of umonitor/umwait. If the CPU doesn't have that enabled "
421-
"you'll get an illegal instruction exception."
422420
EnvVarDeprecated "%1$s variable deprecated, please use %2$s instead."
423421
RedMethodNotSupported "KMP_FORCE_REDUCTION: %1$s method is not supported; using critical."
424422
AffHWSubsetNoHWLOC "KMP_HW_SUBSET ignored: unsupported item requested for non-HWLOC topology method (KMP_TOPOLOGY_METHOD)"

Diff for: openmp/runtime/src/kmp.h

+34-145
Original file line numberDiff line numberDiff line change
@@ -255,10 +255,6 @@ typedef union kmp_team kmp_team_p;
255255
typedef union kmp_info kmp_info_p;
256256
typedef union kmp_root kmp_root_p;
257257

258-
template <bool C = false, bool S = true> class kmp_flag_32;
259-
template <bool C = false, bool S = true> class kmp_flag_64;
260-
class kmp_flag_oncore;
261-
262258
#ifdef __cplusplus
263259
extern "C" {
264260
#endif
@@ -1322,96 +1318,6 @@ static inline void __kmp_x86_pause(void) { _mm_pause(); }
13221318
} \
13231319
}
13241320

1325-
// User-level Monitor/Mwait
1326-
#if KMP_HAVE_UMWAIT
1327-
// We always try for UMWAIT first
1328-
#if (KMP_COMPILER_ICC && __INTEL_COMPILER >= 1300) || \
1329-
(KMP_COMPILER_MSVC && _MSC_VER >= 1700) || \
1330-
(KMP_COMPILER_CLANG && (KMP_MSVC_COMPAT || __MINGW32__)) || \
1331-
(KMP_COMPILER_GCC && __MINGW32__)
1332-
#if KMP_OS_UNIX
1333-
#include <immintrin.h>
1334-
#else
1335-
#include <intrin.h>
1336-
#endif // KMP_OS_UNIX
1337-
#else
1338-
#define USE_MWAIT_ASM \
1339-
KMP_OS_UNIX && (!KMP_COMPILER_ICC || __INTEL_COMPILER < 1900)
1340-
#endif // KMP_COMPILER_ICC etc.
1341-
#if KMP_OS_UNIX && 0 // "waitpkg" not recognized yet
1342-
__attribute__((target("waitpkg")))
1343-
#endif
1344-
static inline int
1345-
__kmp_tpause(uint32_t hint, uint64_t counter) {
1346-
#if (USE_MWAIT_ASM)
1347-
uint32_t timeHi = uint32_t(counter >> 32);
1348-
uint32_t timeLo = uint32_t(counter & 0xffffffff);
1349-
char flag;
1350-
__asm__ volatile("#tpause\n.byte 0x66, 0x0F, 0xAE, 0xF1\n"
1351-
"setb %0"
1352-
: "=r"(flag)
1353-
: "a"(timeLo), "d"(timeHi), "c"(hint)
1354-
:);
1355-
return flag;
1356-
#else
1357-
return _tpause(hint, counter);
1358-
#endif
1359-
}
1360-
#if KMP_OS_UNIX && 0 // "waitpkg" not recognized on our build machine
1361-
__attribute__((target("waitpkg")))
1362-
#endif
1363-
static inline void
1364-
__kmp_umonitor(void *cacheline) {
1365-
#if (USE_MWAIT_ASM)
1366-
__asm__ volatile("# umonitor\n.byte 0xF3, 0x0F, 0xAE, 0x01 "
1367-
:
1368-
: "a"(cacheline)
1369-
:);
1370-
#else
1371-
_umonitor(cacheline);
1372-
#endif
1373-
}
1374-
#if KMP_OS_UNIX && 0 // "waitpkg" not recognized on our build machine
1375-
__attribute__((target("waitpkg")))
1376-
#endif
1377-
static inline int
1378-
__kmp_umwait(uint32_t hint, uint64_t counter) {
1379-
#if (USE_MWAIT_ASM)
1380-
uint32_t timeHi = uint32_t(counter >> 32);
1381-
uint32_t timeLo = uint32_t(counter & 0xffffffff);
1382-
char flag;
1383-
__asm__ volatile("#umwait\n.byte 0xF2, 0x0F, 0xAE, 0xF1\n"
1384-
"setb %0"
1385-
: "=r"(flag)
1386-
: "a"(timeLo), "d"(timeHi), "c"(hint)
1387-
:);
1388-
return flag;
1389-
#else
1390-
return _umwait(hint, counter);
1391-
#endif
1392-
}
1393-
#elif KMP_HAVE_MWAIT
1394-
#if KMP_OS_UNIX
1395-
#include <pmmintrin.h>
1396-
#else
1397-
#include <intrin.h>
1398-
#endif
1399-
#if KMP_OS_UNIX
1400-
__attribute__((target("sse3")))
1401-
#endif
1402-
static inline void
1403-
__kmp_mm_monitor(void *cacheline, unsigned extensions, unsigned hints) {
1404-
_mm_monitor(cacheline, extensions, hints);
1405-
}
1406-
#if KMP_OS_UNIX
1407-
__attribute__((target("sse3")))
1408-
#endif
1409-
static inline void
1410-
__kmp_mm_mwait(unsigned extensions, unsigned hints) {
1411-
_mm_mwait(extensions, hints);
1412-
}
1413-
#endif // KMP_HAVE_UMWAIT
1414-
14151321
/* ------------------------------------------------------------------------ */
14161322
/* Support datatypes for the orphaned construct nesting checks. */
14171323
/* ------------------------------------------------------------------------ */
@@ -3188,13 +3094,6 @@ static inline void __kmp_assert_valid_gtid(kmp_int32 gtid) {
31883094
KMP_FATAL(ThreadIdentInvalid);
31893095
}
31903096

3191-
#if KMP_HAVE_MWAIT || KMP_HAVE_UMWAIT
3192-
extern int __kmp_user_level_mwait; // TRUE or FALSE; from KMP_USER_LEVEL_MWAIT
3193-
extern int __kmp_umwait_enabled; // Runtime check if user-level mwait enabled
3194-
extern int __kmp_mwait_enabled; // Runtime check if ring3 mwait is enabled
3195-
extern int __kmp_mwait_hints; // Hints to pass in to mwait
3196-
#endif
3197-
31983097
/* ------------------------------------------------------------------------- */
31993098

32003099
extern kmp_global_t __kmp_global; /* global status */
@@ -3396,14 +3295,17 @@ extern kmp_uint32 __kmp_wait_4(kmp_uint32 volatile *spinner, kmp_uint32 checker,
33963295
extern void __kmp_wait_4_ptr(void *spinner, kmp_uint32 checker,
33973296
kmp_uint32 (*pred)(void *, kmp_uint32), void *obj);
33983297

3399-
extern void __kmp_wait_64(kmp_info_t *this_thr, kmp_flag_64<> *flag,
3298+
class kmp_flag_32;
3299+
class kmp_flag_64;
3300+
class kmp_flag_oncore;
3301+
extern void __kmp_wait_64(kmp_info_t *this_thr, kmp_flag_64 *flag,
34003302
int final_spin
34013303
#if USE_ITT_BUILD
34023304
,
34033305
void *itt_sync_obj
34043306
#endif
34053307
);
3406-
extern void __kmp_release_64(kmp_flag_64<> *flag);
3308+
extern void __kmp_release_64(kmp_flag_64 *flag);
34073309

34083310
extern void __kmp_infinite_loop(void);
34093311

@@ -3501,6 +3403,13 @@ extern int __kmp_try_suspend_mx(kmp_info_t *th);
35013403
extern void __kmp_lock_suspend_mx(kmp_info_t *th);
35023404
extern void __kmp_unlock_suspend_mx(kmp_info_t *th);
35033405

3406+
extern void __kmp_suspend_32(int th_gtid, kmp_flag_32 *flag);
3407+
extern void __kmp_suspend_64(int th_gtid, kmp_flag_64 *flag);
3408+
extern void __kmp_suspend_oncore(int th_gtid, kmp_flag_oncore *flag);
3409+
extern void __kmp_resume_32(int target_gtid, kmp_flag_32 *flag);
3410+
extern void __kmp_resume_64(int target_gtid, kmp_flag_64 *flag);
3411+
extern void __kmp_resume_oncore(int target_gtid, kmp_flag_oncore *flag);
3412+
35043413
extern void __kmp_elapsed(double *);
35053414
extern void __kmp_elapsed_tick(double *);
35063415

@@ -3625,6 +3534,28 @@ extern kmp_event_t *__kmpc_task_allow_completion_event(ident_t *loc_ref,
36253534
kmp_task_t *task);
36263535
extern void __kmp_fulfill_event(kmp_event_t *event);
36273536

3537+
int __kmp_execute_tasks_32(kmp_info_t *thread, kmp_int32 gtid,
3538+
kmp_flag_32 *flag, int final_spin,
3539+
int *thread_finished,
3540+
#if USE_ITT_BUILD
3541+
void *itt_sync_obj,
3542+
#endif /* USE_ITT_BUILD */
3543+
kmp_int32 is_constrained);
3544+
int __kmp_execute_tasks_64(kmp_info_t *thread, kmp_int32 gtid,
3545+
kmp_flag_64 *flag, int final_spin,
3546+
int *thread_finished,
3547+
#if USE_ITT_BUILD
3548+
void *itt_sync_obj,
3549+
#endif /* USE_ITT_BUILD */
3550+
kmp_int32 is_constrained);
3551+
int __kmp_execute_tasks_oncore(kmp_info_t *thread, kmp_int32 gtid,
3552+
kmp_flag_oncore *flag, int final_spin,
3553+
int *thread_finished,
3554+
#if USE_ITT_BUILD
3555+
void *itt_sync_obj,
3556+
#endif /* USE_ITT_BUILD */
3557+
kmp_int32 is_constrained);
3558+
36283559
extern void __kmp_free_task_team(kmp_info_t *thread,
36293560
kmp_task_team_t *task_team);
36303561
extern void __kmp_reap_task_teams(void);
@@ -3988,46 +3919,4 @@ extern void __kmp_omp_display_env(int verbose);
39883919
}
39893920
#endif
39903921

3991-
template <bool C, bool S>
3992-
extern void __kmp_suspend_32(int th_gtid, kmp_flag_32<C, S> *flag);
3993-
template <bool C, bool S>
3994-
extern void __kmp_suspend_64(int th_gtid, kmp_flag_64<C, S> *flag);
3995-
extern void __kmp_suspend_oncore(int th_gtid, kmp_flag_oncore *flag);
3996-
template <bool C, bool S>
3997-
#if KMP_HAVE_MWAIT || KMP_HAVE_UMWAIT
3998-
extern void __kmp_mwait_32(int th_gtid, kmp_flag_32<C, S> *flag);
3999-
template <bool C, bool S>
4000-
extern void __kmp_mwait_64(int th_gtid, kmp_flag_64<C, S> *flag);
4001-
extern void __kmp_mwait_oncore(int th_gtid, kmp_flag_oncore *flag);
4002-
template <bool C, bool S>
4003-
#endif
4004-
extern void __kmp_resume_32(int target_gtid, kmp_flag_32<C, S> *flag);
4005-
template <bool C, bool S>
4006-
extern void __kmp_resume_64(int target_gtid, kmp_flag_64<C, S> *flag);
4007-
extern void __kmp_resume_oncore(int target_gtid, kmp_flag_oncore *flag);
4008-
4009-
template <bool C, bool S>
4010-
int __kmp_execute_tasks_32(kmp_info_t *thread, kmp_int32 gtid,
4011-
kmp_flag_32<C, S> *flag, int final_spin,
4012-
int *thread_finished,
4013-
#if USE_ITT_BUILD
4014-
void *itt_sync_obj,
4015-
#endif /* USE_ITT_BUILD */
4016-
kmp_int32 is_constrained);
4017-
template <bool C, bool S>
4018-
int __kmp_execute_tasks_64(kmp_info_t *thread, kmp_int32 gtid,
4019-
kmp_flag_64<C, S> *flag, int final_spin,
4020-
int *thread_finished,
4021-
#if USE_ITT_BUILD
4022-
void *itt_sync_obj,
4023-
#endif /* USE_ITT_BUILD */
4024-
kmp_int32 is_constrained);
4025-
int __kmp_execute_tasks_oncore(kmp_info_t *thread, kmp_int32 gtid,
4026-
kmp_flag_oncore *flag, int final_spin,
4027-
int *thread_finished,
4028-
#if USE_ITT_BUILD
4029-
void *itt_sync_obj,
4030-
#endif /* USE_ITT_BUILD */
4031-
kmp_int32 is_constrained);
4032-
40333922
#endif /* KMP_H */

0 commit comments

Comments
 (0)