[*] i swore i replaced this with a tpause before
[*] ...and the docs arent clear on whether or not this clock value is relative or absolute
This commit is contained in:
parent
316fb3f6b2
commit
8e1c74a5df
@ -117,7 +117,7 @@ namespace Aurora::Threading
|
|||||||
#if (defined(AURORA_ARCH_X64) || defined(AURORA_ARCH_X86))
|
#if (defined(AURORA_ARCH_X64) || defined(AURORA_ARCH_X86))
|
||||||
if (AuThreadPrimitives::ThrdCfg::gIsIntelAlderLakeOrGreater)
|
if (AuThreadPrimitives::ThrdCfg::gIsIntelAlderLakeOrGreater)
|
||||||
{
|
{
|
||||||
_tpause(0, 10000);
|
_tpause(0, __rdtsc() + 10000);
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
#endif
|
#endif
|
||||||
@ -168,7 +168,7 @@ namespace Aurora::Threading
|
|||||||
#if (defined(AURORA_ARCH_X64) || defined(AURORA_ARCH_X86))
|
#if (defined(AURORA_ARCH_X64) || defined(AURORA_ARCH_X86))
|
||||||
if (AuThreadPrimitives::ThrdCfg::gIsIntelAlderLakeOrGreater)
|
if (AuThreadPrimitives::ThrdCfg::gIsIntelAlderLakeOrGreater)
|
||||||
{
|
{
|
||||||
_tpause(0, 1000);
|
_tpause(0, __rdtsc() + 1000);
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
#endif
|
#endif
|
||||||
|
@ -103,6 +103,19 @@ namespace Aurora::Threading::Primitives
|
|||||||
inline AuUInt32 gUseFutexRWLock {};
|
inline AuUInt32 gUseFutexRWLock {};
|
||||||
inline AuUInt32 gPreferFutexEvent {};
|
inline AuUInt32 gPreferFutexEvent {};
|
||||||
|
|
||||||
|
static constexpr AuUInt32 kMWAITXUseTSC = (1 << 1);
|
||||||
|
static constexpr AuUInt32 kMWAITXAllowInterrupts = (1 << 0);
|
||||||
|
static constexpr AuUInt32 kMWAITXFaultGP0 = (1 << 31);
|
||||||
|
static constexpr AuUInt32 kMWAITXWaitOnStore = 0;
|
||||||
|
static constexpr AuUInt32 kMWAITXWaitOnStoreTimed = kMWAITXWaitOnStore | kMWAITXUseTSC;
|
||||||
|
|
||||||
|
struct Blocky
|
||||||
|
{
|
||||||
|
SMTAtomic_t a;
|
||||||
|
};
|
||||||
|
|
||||||
|
inline const AuAlignTo<16, Blocky> kMassiveBlock;
|
||||||
|
|
||||||
void InitAdaptiveThreshold();
|
void InitAdaptiveThreshold();
|
||||||
void InitAdaptiveThresholdFirstTime();
|
void InitAdaptiveThresholdFirstTime();
|
||||||
void InitCfg();
|
void InitCfg();
|
||||||
@ -227,7 +240,20 @@ namespace Aurora::Threading::Primitives
|
|||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
_umwait(1, __rdtsc() + uCount);
|
_tpause(0, __rdtsc() + uCount);
|
||||||
|
bRet = callback();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
else if (ThrdCfg::gIsZen3OrGreater)
|
||||||
|
{
|
||||||
|
if (callback())
|
||||||
|
{
|
||||||
|
bRet = true;
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
_mm_monitorx(&kMassiveBlock, 0, 0);
|
||||||
|
_mm_mwaitx(kMWAITXUseTSC, 0, uCount);
|
||||||
bRet = callback();
|
bRet = callback();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -461,7 +487,7 @@ namespace Aurora::Threading::Primitives
|
|||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
_mm_mwaitx(2, 0, uCount);
|
_mm_mwaitx(kMWAITXWaitOnStoreTimed, 0, uCount);
|
||||||
bRet = callback();
|
bRet = callback();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user