Add extra fence to ensure proper oredring in the same thread case

This commit is contained in:
GuillaumeDIDIER 2020-07-15 10:15:19 +02:00
parent 4db469ae0b
commit a4e617021d

View File

@ -674,10 +674,12 @@ fn calibrate_fixed_freq_2_thread_impl<I: Iterator<Item = (usize, usize)>>(
let mut hist = vec![0; hist_params.bucket_number]; let mut hist = vec![0; hist_params.bucket_number];
for _ in 0..hist_params.iterations { for _ in 0..hist_params.iterations {
unsafe { (op.prepare)(pointer) }; unsafe { (op.prepare)(pointer) };
unsafe { arch_x86::_mm_mfence() }; // Test with this ?
let _time = unsafe { (op.op)(pointer) }; let _time = unsafe { (op.op)(pointer) };
} }
for _ in 0..hist_params.iterations { for _ in 0..hist_params.iterations {
unsafe { (op.prepare)(pointer) }; unsafe { (op.prepare)(pointer) };
unsafe { arch_x86::_mm_mfence() }; // Test with this ?
let time = unsafe { (op.op)(pointer) }; let time = unsafe { (op.op)(pointer) };
let bucket = min(hist_params.bucket_number - 1, to_bucket(time)); let bucket = min(hist_params.bucket_number - 1, to_bucket(time));
hist[bucket] += 1; hist[bucket] += 1;