diff --git a/cache_utils/src/calibration.rs b/cache_utils/src/calibration.rs index d5cf45a..e71149f 100644 --- a/cache_utils/src/calibration.rs +++ b/cache_utils/src/calibration.rs @@ -664,7 +664,17 @@ fn calibrate_fixed_freq_2_thread_impl>( // do the calibration let mut calibrate_result_vec = Vec::new(); - for i in (0..len).step_by(increment) { + let image_antecedent = match slicing { + Some(s) => s.image_antecedent(len as usize - 1), + None => None, + }; + + let offsets: Box> = match image_antecedent { + Some(ima) => Box::new(ima.into_iter().map(|(_k, v)| v)), + None => Box::new((0..len as isize).step_by(increment)), + }; + + for i in offsets { let pointer = unsafe { p.offset(i) }; helper_thread_params .address diff --git a/cache_utils/src/complex_addressing.rs b/cache_utils/src/complex_addressing.rs index bd22968..6def28d 100644 --- a/cache_utils/src/complex_addressing.rs +++ b/cache_utils/src/complex_addressing.rs @@ -135,7 +135,7 @@ impl CacheSlicing { // Only works for Complex Addressing rn // May work in the future for simple. - fn pivot(&self, mask: usize) -> Vec<(u8, usize)> { + fn pivot(&self, mask: isize) -> Vec<(u8, isize)> { match self { ComplexAddressing(functions) => { let mut matrix = Vec::new(); @@ -144,7 +144,7 @@ impl CacheSlicing { let mut hashspace = 0; while i != 0 { if i & mask != 0 { - let h = self.hash(i).unwrap(); + let h = self.hash(i as usize).unwrap(); hashspace |= h; matrix.push((h, i)); @@ -199,7 +199,7 @@ impl CacheSlicing { pub fn image(&self, mask: usize) -> Option> { match self { ComplexAddressing(_functions) => { - let matrix = self.pivot(mask); + let matrix = self.pivot(mask as isize); let mut result = HashSet::::new(); result.insert(0); @@ -217,10 +217,10 @@ impl CacheSlicing { } } - pub fn kernel_compl_basis(&self, mask: usize) -> Option> { + pub fn kernel_compl_basis(&self, mask: usize) -> Option> { match self { ComplexAddressing(_functions) => { - let matrix = self.pivot(mask); + let matrix = self.pivot(mask as isize); let mut result = HashMap::new(); for (slice, addr) in matrix { if slice != 0 { @@ -233,12 +233,12 @@ impl CacheSlicing { _ => None, } } - pub fn image_antecedent(&self, mask: usize) -> Option> { + pub fn image_antecedent(&self, mask: usize) -> Option> { match self { ComplexAddressing(_functions) => { - let matrix = self.pivot(mask); + let matrix = self.pivot(mask as isize); - let mut result = HashMap::::new(); + let mut result = HashMap::::new(); result.insert(0, 0); for (slice_u, addr_u) in matrix {