From a4e617021dfd07b1d18f13a07fb419aa5286c393 Mon Sep 17 00:00:00 2001 From: GuillaumeDIDIER Date: Wed, 15 Jul 2020 10:15:19 +0200 Subject: [PATCH] Add extra fence to ensure proper oredring in the same thread case --- cache_utils/src/calibration.rs | 2 ++ 1 file changed, 2 insertions(+) diff --git a/cache_utils/src/calibration.rs b/cache_utils/src/calibration.rs index 809901a..8d98fa4 100644 --- a/cache_utils/src/calibration.rs +++ b/cache_utils/src/calibration.rs @@ -674,10 +674,12 @@ fn calibrate_fixed_freq_2_thread_impl>( let mut hist = vec![0; hist_params.bucket_number]; for _ in 0..hist_params.iterations { unsafe { (op.prepare)(pointer) }; + unsafe { arch_x86::_mm_mfence() }; // Test with this ? let _time = unsafe { (op.op)(pointer) }; } for _ in 0..hist_params.iterations { unsafe { (op.prepare)(pointer) }; + unsafe { arch_x86::_mm_mfence() }; // Test with this ? let time = unsafe { (op.op)(pointer) }; let bucket = min(hist_params.bucket_number - 1, to_bucket(time)); hist[bucket] += 1;