Changes in order to make use of the new aoptimised address set in calibration

Change the set type to isize as it is a set of offsets
Change Calibrate two threads to make use of it
This commit is contained in:
GuillaumeDIDIER 2020-07-21 11:27:46 +02:00
parent b815fd34ff
commit ebc304d55a
2 changed files with 19 additions and 9 deletions

View File

@ -664,7 +664,17 @@ fn calibrate_fixed_freq_2_thread_impl<I: Iterator<Item = (usize, usize)>>(
// 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<dyn Iterator<Item = isize>> = 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

View File

@ -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<HashSet<u8>> {
match self {
ComplexAddressing(_functions) => {
let matrix = self.pivot(mask);
let matrix = self.pivot(mask as isize);
let mut result = HashSet::<u8>::new();
result.insert(0);
@ -217,10 +217,10 @@ impl CacheSlicing {
}
}
pub fn kernel_compl_basis(&self, mask: usize) -> Option<HashMap<u8, usize>> {
pub fn kernel_compl_basis(&self, mask: usize) -> Option<HashMap<u8, isize>> {
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<HashMap<u8, usize>> {
pub fn image_antecedent(&self, mask: usize) -> Option<HashMap<u8, isize>> {
match self {
ComplexAddressing(_functions) => {
let matrix = self.pivot(mask);
let matrix = self.pivot(mask as isize);
let mut result = HashMap::<u8, usize>::new();
let mut result = HashMap::<u8, isize>::new();
result.insert(0, 0);
for (slice_u, addr_u) in matrix {