mirror of
https://github.com/cberner/raptorq.git
synced 2024-06-29 18:21:43 +00:00
Add per phase tracking of symbol XOR and MUL ops
This commit is contained in:
parent
3be6c672f4
commit
a7966934dd
37
src/base.rs
37
src/base.rs
@ -202,7 +202,9 @@ pub struct IntermediateSymbolDecoder {
|
||||
L: usize,
|
||||
num_source_symbols: u32,
|
||||
debug_symbol_mul_ops: u32,
|
||||
debug_symbol_add_ops: u32
|
||||
debug_symbol_add_ops: u32,
|
||||
debug_symbol_mul_ops_by_phase: Vec<u32>,
|
||||
debug_symbol_add_ops_by_phase: Vec<u32>
|
||||
}
|
||||
|
||||
impl IntermediateSymbolDecoder {
|
||||
@ -228,7 +230,9 @@ impl IntermediateSymbolDecoder {
|
||||
L: num_intermediate_symbols(num_source_symbols) as usize,
|
||||
num_source_symbols,
|
||||
debug_symbol_mul_ops: 0,
|
||||
debug_symbol_add_ops: 0
|
||||
debug_symbol_add_ops: 0,
|
||||
debug_symbol_mul_ops_by_phase: vec![0; 5],
|
||||
debug_symbol_add_ops_by_phase: vec![0; 5]
|
||||
}
|
||||
}
|
||||
|
||||
@ -446,6 +450,7 @@ impl IntermediateSymbolDecoder {
|
||||
self.first_phase_verify();
|
||||
}
|
||||
|
||||
self.record_symbol_ops(0);
|
||||
return true;
|
||||
}
|
||||
|
||||
@ -497,6 +502,7 @@ impl IntermediateSymbolDecoder {
|
||||
// Perform backwards elimination
|
||||
self.backwards_elimination(temp, temp, size);
|
||||
|
||||
self.record_symbol_ops(1);
|
||||
return true;
|
||||
}
|
||||
|
||||
@ -547,6 +553,8 @@ impl IntermediateSymbolDecoder {
|
||||
}
|
||||
}
|
||||
|
||||
self.record_symbol_ops(2);
|
||||
|
||||
#[cfg(debug_assertions)]
|
||||
self.third_phase_verify_end();
|
||||
}
|
||||
@ -594,6 +602,9 @@ impl IntermediateSymbolDecoder {
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
self.record_symbol_ops(3);
|
||||
|
||||
#[cfg(debug_assertions)]
|
||||
self.fourth_phase_verify();
|
||||
}
|
||||
@ -649,6 +660,9 @@ impl IntermediateSymbolDecoder {
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
self.record_symbol_ops(4);
|
||||
|
||||
#[cfg(debug_assertions)]
|
||||
self.fifth_phase_verify();
|
||||
}
|
||||
@ -670,6 +684,15 @@ impl IntermediateSymbolDecoder {
|
||||
}
|
||||
}
|
||||
|
||||
fn record_symbol_ops(&mut self, phase: usize) {
|
||||
self.debug_symbol_add_ops_by_phase[phase] = self.debug_symbol_add_ops;
|
||||
self.debug_symbol_mul_ops_by_phase[phase] = self.debug_symbol_mul_ops;
|
||||
for i in 0..phase {
|
||||
self.debug_symbol_add_ops_by_phase[phase] -= self.debug_symbol_add_ops_by_phase[i];
|
||||
self.debug_symbol_mul_ops_by_phase[phase] -= self.debug_symbol_mul_ops_by_phase[i];
|
||||
}
|
||||
}
|
||||
|
||||
// Reduces the size x size submatrix, starting at row_offset and col_offset as the upper left
|
||||
// corner, to row echelon form
|
||||
#[inline(never)]
|
||||
@ -732,6 +755,16 @@ impl IntermediateSymbolDecoder {
|
||||
self.debug_symbol_add_ops
|
||||
}
|
||||
|
||||
#[allow(dead_code)]
|
||||
pub fn get_symbol_mul_ops_by_phase(&self) -> Vec<u32> {
|
||||
self.debug_symbol_mul_ops_by_phase.clone()
|
||||
}
|
||||
|
||||
#[allow(dead_code)]
|
||||
pub fn get_symbol_add_ops_by_phase(&self) -> Vec<u32> {
|
||||
self.debug_symbol_add_ops_by_phase.clone()
|
||||
}
|
||||
|
||||
// Helper operations to apply operations to A, also to D
|
||||
fn mul_row(&mut self, i: usize, beta: Octet) {
|
||||
self.debug_symbol_mul_ops += 1;
|
||||
|
@ -60,5 +60,8 @@ fn main() {
|
||||
decoder.get_symbol_mul_ops() as f64 / num_symbols as f64,
|
||||
decoder.get_symbol_add_ops(),
|
||||
decoder.get_symbol_add_ops() as f64 / num_symbols as f64);
|
||||
println!("By phase mul ops: {:?}, add ops: {:?}",
|
||||
decoder.get_symbol_mul_ops_by_phase(),
|
||||
decoder.get_symbol_add_ops_by_phase());
|
||||
}
|
||||
}
|
Loading…
Reference in New Issue
Block a user