@@ -359,7 +359,7 @@ bool PCM::isHWTMAL1Supported() const
359
359
void PCM::readCPUMicrocodeLevel ()
360
360
{
361
361
if (MSR.empty ()) return ;
362
- const int ref_core = 0 ;
362
+ const int32 ref_core = socketRefCore[ 0 ] ;
363
363
TemporalThreadAffinity affinity (ref_core);
364
364
if (affinity.supported () && isCoreOnline (ref_core))
365
365
{ // see "Update Signature and Verification" and "Determining the Signature"
@@ -1110,7 +1110,22 @@ bool PCM::discoverSystemTopology()
1110
1110
};
1111
1111
std::unordered_map<int , domain> topologyDomainMap;
1112
1112
{
1113
- TemporalThreadAffinity aff0 (0 );
1113
+ const int32 maxTopoDomainAff = 1 <<16 ;
1114
+ int32 topoDomainAff = -1 ;
1115
+
1116
+ for (int32 core = 0 ; core < maxTopoDomainAff; ++core)
1117
+ {
1118
+ try {
1119
+ TemporalThreadAffinity _ (core);
1120
+ topoDomainAff = core;
1121
+ }
1122
+ catch (...)
1123
+ {
1124
+ }
1125
+ if (topoDomainAff != -1 ) break ;
1126
+ }
1127
+
1128
+ TemporalThreadAffinity _ (topoDomainAff);
1114
1129
1115
1130
if (initCoreMasks (smtMaskWidth, coreMaskWidth, l2CacheMaskShift, l3CacheMaskShift) == false )
1116
1131
{
@@ -4637,7 +4652,7 @@ uint64 RDTSC();
4637
4652
4638
4653
void PCM::computeNominalFrequency ()
4639
4654
{
4640
- const int ref_core = 0 ;
4655
+ const int32 ref_core = socketRefCore[ 0 ] ;
4641
4656
const uint64 before = getInvariantTSC_Fast (ref_core);
4642
4657
MySleepMs (100 );
4643
4658
const uint64 after = getInvariantTSC_Fast (ref_core);
@@ -4809,11 +4824,11 @@ void PCM::computeQPISpeedBeckton(int core_nr)
4809
4824
MSR[core_nr]->read (R_MSR_PMON_CTR0, &startFlits);
4810
4825
4811
4826
const uint64 timerGranularity = 1000000ULL ; // mks
4812
- uint64 startTSC = getTickCount (timerGranularity, (uint32) core_nr);
4827
+ uint64 startTSC = getTickCount (timerGranularity, core_nr);
4813
4828
uint64 endTSC;
4814
4829
do
4815
4830
{
4816
- endTSC = getTickCount (timerGranularity, (uint32) core_nr);
4831
+ endTSC = getTickCount (timerGranularity, core_nr);
4817
4832
} while (endTSC - startTSC < 200000ULL ); // spin for 200 ms
4818
4833
4819
4834
uint64 endFlits = 0 ;
@@ -5401,8 +5416,9 @@ int convertUnknownToInt(size_t size, char* value)
5401
5416
#endif
5402
5417
5403
5418
5404
- uint64 PCM::getTickCount (uint64 multiplier, uint32 core)
5419
+ uint64 PCM::getTickCount (uint64 multiplier, int32 core)
5405
5420
{
5421
+ if (core == -1 ) core = socketRefCore[0 ];
5406
5422
return (multiplier * getInvariantTSC_Fast (core)) / getNominalFrequency ();
5407
5423
}
5408
5424
0 commit comments