Introduce workload markings
This commit is contained in:
@@ -26,10 +26,10 @@ pub extern "C" fn main() {
|
||||
let matrix = SMatrix::<F16x1, ROWS, COLUMNS>::zeros();
|
||||
let input_vector = SVector::<F16x1, COLUMNS>::zeros();
|
||||
|
||||
for _ in 0..10 {
|
||||
pim_os::m5op::exit(0);
|
||||
let output_vector = matrix * input_vector;
|
||||
core::hint::black_box(output_vector);
|
||||
}
|
||||
pim_os::m5op::exit(0);
|
||||
|
||||
writeln!(Uart0, "Done").unwrap();
|
||||
}
|
||||
|
||||
@@ -15,10 +15,10 @@ pub extern "C" fn main() {
|
||||
let matrix = SMatrix::<F16x1, ROWS, COLUMNS>::zeros();
|
||||
let mut input_vector = SVector::<F16x1, COLUMNS>::zeros();
|
||||
|
||||
for _ in 0..5 {
|
||||
pim_os::m5op::exit(0);
|
||||
input_vector = matrix * input_vector;
|
||||
core::hint::black_box(input_vector);
|
||||
}
|
||||
pim_os::m5op::exit(0);
|
||||
|
||||
writeln!(Uart0, "Done").unwrap();
|
||||
}
|
||||
|
||||
@@ -26,11 +26,11 @@ pub extern "C" fn main() {
|
||||
let b = SVector::<F16x1, ROWS>::zeros();
|
||||
let s = F16x1::zero();
|
||||
|
||||
for _ in 0..10 {
|
||||
pim_os::m5op::exit(0);
|
||||
let a_s = a * s;
|
||||
let c = a_s.component_mul(&b);
|
||||
core::hint::black_box(c);
|
||||
}
|
||||
pim_os::m5op::exit(0);
|
||||
|
||||
writeln!(Uart0, "Done").unwrap();
|
||||
}
|
||||
|
||||
@@ -24,10 +24,10 @@ pub extern "C" fn main() {
|
||||
let a = SVector::<F16x1, ROWS>::zeros();
|
||||
let b = SVector::<F16x1, ROWS>::zeros();
|
||||
|
||||
for _ in 0..10 {
|
||||
pim_os::m5op::exit(0);
|
||||
let c = a + b;
|
||||
core::hint::black_box(c);
|
||||
}
|
||||
pim_os::m5op::exit(0);
|
||||
|
||||
writeln!(Uart0, "Done").unwrap();
|
||||
}
|
||||
|
||||
@@ -24,10 +24,10 @@ pub extern "C" fn main() {
|
||||
let a = SVector::<F16x1, ROWS>::zeros();
|
||||
let b = SVector::<F16x1, ROWS>::zeros();
|
||||
|
||||
for _ in 0..10 {
|
||||
pim_os::m5op::exit(0);
|
||||
let c = a.component_mul(&b);
|
||||
core::hint::black_box(c);
|
||||
}
|
||||
pim_os::m5op::exit(0);
|
||||
|
||||
writeln!(Uart0, "Done").unwrap();
|
||||
}
|
||||
|
||||
@@ -67,12 +67,14 @@ pub extern "C" fn main() {
|
||||
{
|
||||
pim::state::set_bank_mode(BankMode::PimAllBank);
|
||||
|
||||
pim_os::m5op::exit(0);
|
||||
gemv::execute(
|
||||
pim_matrix.as_ref(),
|
||||
interleaved_input_vector.as_ref(),
|
||||
output_partial_sum_vector.as_mut(),
|
||||
dummy.as_ref(),
|
||||
);
|
||||
pim_os::m5op::exit(0);
|
||||
|
||||
pim::state::set_bank_mode(BankMode::SingleBank);
|
||||
}
|
||||
|
||||
@@ -38,9 +38,7 @@ pub extern "C" fn main() {
|
||||
|
||||
let dummy = Box::new(0);
|
||||
|
||||
for _ in 0..5 {
|
||||
let interleaved_input_vector =
|
||||
Box::new(interleaved_array::Vector::from(input_vector.clone()));
|
||||
let interleaved_input_vector = Box::new(interleaved_array::Vector::from(input_vector.clone()));
|
||||
|
||||
// Verify everything is correctly initialized before PIM operation
|
||||
barrier::dsb(barrier::SY);
|
||||
@@ -67,6 +65,6 @@ pub extern "C" fn main() {
|
||||
});
|
||||
|
||||
core::hint::black_box(output_vector);
|
||||
}
|
||||
|
||||
writeln!(Uart0, "Done").unwrap();
|
||||
}
|
||||
|
||||
@@ -19,17 +19,17 @@ use pim_os::{
|
||||
};
|
||||
|
||||
#[cfg(feature = "X1")]
|
||||
const ROWS: usize = 128;
|
||||
|
||||
#[cfg(feature = "X2")]
|
||||
const ROWS: usize = 256;
|
||||
|
||||
#[cfg(feature = "X3")]
|
||||
#[cfg(feature = "X2")]
|
||||
const ROWS: usize = 512;
|
||||
|
||||
#[cfg(feature = "X4")]
|
||||
#[cfg(feature = "X3")]
|
||||
const ROWS: usize = 1024;
|
||||
|
||||
#[cfg(feature = "X4")]
|
||||
const ROWS: usize = 2048;
|
||||
|
||||
const ELEMENTS_PER_BANK: usize = 16;
|
||||
const BANKS: usize = 16;
|
||||
const BLOCKS: usize = ROWS / (ELEMENTS_PER_BANK * BANKS);
|
||||
@@ -73,6 +73,7 @@ pub extern "C" fn main() {
|
||||
{
|
||||
pim::state::set_bank_mode(BankMode::PimAllBank);
|
||||
|
||||
pim_os::m5op::exit(0);
|
||||
haxpy::execute::<ROWS, BLOCKS>(
|
||||
&a.0,
|
||||
&b.0,
|
||||
@@ -80,6 +81,7 @@ pub extern "C" fn main() {
|
||||
&mut c.0,
|
||||
dummy.as_ref(),
|
||||
);
|
||||
pim_os::m5op::exit(0);
|
||||
|
||||
pim::state::set_bank_mode(BankMode::SingleBank);
|
||||
}
|
||||
|
||||
@@ -67,7 +67,9 @@ pub extern "C" fn main() {
|
||||
{
|
||||
pim::state::set_bank_mode(BankMode::PimAllBank);
|
||||
|
||||
pim_os::m5op::exit(0);
|
||||
vadd::execute::<ROWS, BLOCKS>(&a.0, &b.0, &mut c.0, dummy.as_ref());
|
||||
pim_os::m5op::exit(0);
|
||||
|
||||
pim::state::set_bank_mode(BankMode::SingleBank);
|
||||
}
|
||||
|
||||
@@ -67,7 +67,9 @@ pub extern "C" fn main() {
|
||||
{
|
||||
pim::state::set_bank_mode(BankMode::PimAllBank);
|
||||
|
||||
pim_os::m5op::exit(0);
|
||||
vmul::execute::<ROWS, BLOCKS>(&a.0, &b.0, &mut c.0, dummy.as_ref());
|
||||
pim_os::m5op::exit(0);
|
||||
|
||||
pim::state::set_bank_mode(BankMode::SingleBank);
|
||||
}
|
||||
|
||||
@@ -13,13 +13,13 @@ pub const KERNEL_X1: Kernel = Kernel([
|
||||
},
|
||||
Instruction::MAD {
|
||||
src0: File::Bank,
|
||||
src1: File::GrfA { index: 0 },
|
||||
src2: File::SrfA { index: 0 },
|
||||
dst: File::GrfB { index: 0 },
|
||||
src1: File::SrfA { index: 0 },
|
||||
src2: File::GrfA { index: 0 },
|
||||
dst: File::GrfA { index: 0 },
|
||||
aam: false,
|
||||
},
|
||||
Instruction::FILL {
|
||||
src: File::GrfB { index: 0 },
|
||||
src: File::GrfA { index: 0 },
|
||||
dst: File::Bank,
|
||||
},
|
||||
Instruction::EXIT,
|
||||
@@ -67,24 +67,24 @@ pub const KERNEL_X2: Kernel = Kernel([
|
||||
},
|
||||
Instruction::MAD {
|
||||
src0: File::Bank,
|
||||
src1: File::GrfA { index: 0 },
|
||||
src2: File::SrfA { index: 0 },
|
||||
dst: File::GrfB { index: 0 },
|
||||
src1: File::SrfA { index: 0 },
|
||||
src2: File::GrfA { index: 0 },
|
||||
dst: File::GrfA { index: 0 },
|
||||
aam: false,
|
||||
},
|
||||
Instruction::MAD {
|
||||
src0: File::Bank,
|
||||
src1: File::GrfA { index: 1 },
|
||||
src2: File::SrfA { index: 1 },
|
||||
dst: File::GrfB { index: 1 },
|
||||
src1: File::SrfA { index: 1 },
|
||||
src2: File::GrfA { index: 1 },
|
||||
dst: File::GrfA { index: 1 },
|
||||
aam: false,
|
||||
},
|
||||
Instruction::FILL {
|
||||
src: File::GrfB { index: 0 },
|
||||
src: File::GrfA { index: 0 },
|
||||
dst: File::Bank,
|
||||
},
|
||||
Instruction::FILL {
|
||||
src: File::GrfB { index: 1 },
|
||||
src: File::GrfA { index: 1 },
|
||||
dst: File::Bank,
|
||||
},
|
||||
Instruction::EXIT,
|
||||
@@ -137,46 +137,46 @@ pub const KERNEL_X3: Kernel = Kernel([
|
||||
},
|
||||
Instruction::MAD {
|
||||
src0: File::Bank,
|
||||
src1: File::GrfA { index: 0 },
|
||||
src2: File::SrfA { index: 0 },
|
||||
dst: File::GrfB { index: 0 },
|
||||
src1: File::SrfA { index: 0 },
|
||||
src2: File::GrfA { index: 0 },
|
||||
dst: File::GrfA { index: 0 },
|
||||
aam: false,
|
||||
},
|
||||
Instruction::MAD {
|
||||
src0: File::Bank,
|
||||
src1: File::GrfA { index: 1 },
|
||||
src2: File::SrfA { index: 1 },
|
||||
dst: File::GrfB { index: 1 },
|
||||
src1: File::SrfA { index: 1 },
|
||||
src2: File::GrfA { index: 1 },
|
||||
dst: File::GrfA { index: 1 },
|
||||
aam: false,
|
||||
},
|
||||
Instruction::MAD {
|
||||
src0: File::Bank,
|
||||
src1: File::GrfA { index: 2 },
|
||||
src2: File::SrfA { index: 2 },
|
||||
dst: File::GrfB { index: 2 },
|
||||
src1: File::SrfA { index: 2 },
|
||||
src2: File::GrfA { index: 2 },
|
||||
dst: File::GrfA { index: 2 },
|
||||
aam: false,
|
||||
},
|
||||
Instruction::MAD {
|
||||
src0: File::Bank,
|
||||
src1: File::GrfA { index: 3 },
|
||||
src2: File::SrfA { index: 3 },
|
||||
dst: File::GrfB { index: 3 },
|
||||
src1: File::SrfA { index: 3 },
|
||||
src2: File::GrfA { index: 3 },
|
||||
dst: File::GrfA { index: 3 },
|
||||
aam: false,
|
||||
},
|
||||
Instruction::FILL {
|
||||
src: File::GrfB { index: 0 },
|
||||
src: File::GrfA { index: 0 },
|
||||
dst: File::Bank,
|
||||
},
|
||||
Instruction::FILL {
|
||||
src: File::GrfB { index: 1 },
|
||||
src: File::GrfA { index: 1 },
|
||||
dst: File::Bank,
|
||||
},
|
||||
Instruction::FILL {
|
||||
src: File::GrfB { index: 2 },
|
||||
src: File::GrfA { index: 2 },
|
||||
dst: File::Bank,
|
||||
},
|
||||
Instruction::FILL {
|
||||
src: File::GrfB { index: 3 },
|
||||
src: File::GrfA { index: 3 },
|
||||
dst: File::Bank,
|
||||
},
|
||||
Instruction::EXIT,
|
||||
@@ -239,90 +239,90 @@ pub const KERNEL_X4: Kernel = Kernel([
|
||||
},
|
||||
Instruction::MAD {
|
||||
src0: File::Bank,
|
||||
src1: File::GrfA { index: 0 },
|
||||
src2: File::SrfA { index: 0 },
|
||||
dst: File::GrfB { index: 0 },
|
||||
src1: File::SrfA { index: 0 },
|
||||
src2: File::GrfA { index: 0 },
|
||||
dst: File::GrfA { index: 0 },
|
||||
aam: false,
|
||||
},
|
||||
Instruction::MAD {
|
||||
src0: File::Bank,
|
||||
src1: File::GrfA { index: 1 },
|
||||
src2: File::SrfA { index: 1 },
|
||||
dst: File::GrfB { index: 1 },
|
||||
src1: File::SrfA { index: 1 },
|
||||
src2: File::GrfA { index: 1 },
|
||||
dst: File::GrfA { index: 1 },
|
||||
aam: false,
|
||||
},
|
||||
Instruction::MAD {
|
||||
src0: File::Bank,
|
||||
src1: File::GrfA { index: 2 },
|
||||
src2: File::SrfA { index: 2 },
|
||||
dst: File::GrfB { index: 2 },
|
||||
src1: File::SrfA { index: 2 },
|
||||
src2: File::GrfA { index: 2 },
|
||||
dst: File::GrfA { index: 2 },
|
||||
aam: false,
|
||||
},
|
||||
Instruction::MAD {
|
||||
src0: File::Bank,
|
||||
src1: File::GrfA { index: 3 },
|
||||
src2: File::SrfA { index: 3 },
|
||||
dst: File::GrfB { index: 3 },
|
||||
src1: File::SrfA { index: 3 },
|
||||
src2: File::GrfA { index: 3 },
|
||||
dst: File::GrfA { index: 3 },
|
||||
aam: false,
|
||||
},
|
||||
Instruction::MAD {
|
||||
src0: File::Bank,
|
||||
src1: File::GrfA { index: 4 },
|
||||
src2: File::SrfA { index: 4 },
|
||||
dst: File::GrfB { index: 4 },
|
||||
src1: File::SrfA { index: 4 },
|
||||
src2: File::GrfA { index: 4 },
|
||||
dst: File::GrfA { index: 4 },
|
||||
aam: false,
|
||||
},
|
||||
Instruction::MAD {
|
||||
src0: File::Bank,
|
||||
src1: File::GrfA { index: 5 },
|
||||
src2: File::SrfA { index: 5 },
|
||||
dst: File::GrfB { index: 5 },
|
||||
src1: File::SrfA { index: 5 },
|
||||
src2: File::GrfA { index: 5 },
|
||||
dst: File::GrfA { index: 5 },
|
||||
aam: false,
|
||||
},
|
||||
Instruction::MAD {
|
||||
src0: File::Bank,
|
||||
src1: File::GrfA { index: 6 },
|
||||
src2: File::SrfA { index: 6 },
|
||||
dst: File::GrfB { index: 6 },
|
||||
src1: File::SrfA { index: 6 },
|
||||
src2: File::GrfA { index: 6 },
|
||||
dst: File::GrfA { index: 6 },
|
||||
aam: false,
|
||||
},
|
||||
Instruction::MAD {
|
||||
src0: File::Bank,
|
||||
src1: File::GrfA { index: 7 },
|
||||
src2: File::SrfA { index: 7 },
|
||||
dst: File::GrfB { index: 7 },
|
||||
src1: File::SrfA { index: 7 },
|
||||
src2: File::GrfA { index: 7 },
|
||||
dst: File::GrfA { index: 7 },
|
||||
aam: false,
|
||||
},
|
||||
Instruction::FILL {
|
||||
src: File::GrfB { index: 0 },
|
||||
src: File::GrfA { index: 0 },
|
||||
dst: File::Bank,
|
||||
},
|
||||
Instruction::FILL {
|
||||
src: File::GrfB { index: 1 },
|
||||
src: File::GrfA { index: 1 },
|
||||
dst: File::Bank,
|
||||
},
|
||||
Instruction::FILL {
|
||||
src: File::GrfB { index: 2 },
|
||||
src: File::GrfA { index: 2 },
|
||||
dst: File::Bank,
|
||||
},
|
||||
Instruction::FILL {
|
||||
src: File::GrfB { index: 3 },
|
||||
src: File::GrfA { index: 3 },
|
||||
dst: File::Bank,
|
||||
},
|
||||
Instruction::FILL {
|
||||
src: File::GrfB { index: 4 },
|
||||
src: File::GrfA { index: 4 },
|
||||
dst: File::Bank,
|
||||
},
|
||||
Instruction::FILL {
|
||||
src: File::GrfB { index: 5 },
|
||||
src: File::GrfA { index: 5 },
|
||||
dst: File::Bank,
|
||||
},
|
||||
Instruction::FILL {
|
||||
src: File::GrfB { index: 6 },
|
||||
src: File::GrfA { index: 6 },
|
||||
dst: File::Bank,
|
||||
},
|
||||
Instruction::FILL {
|
||||
src: File::GrfB { index: 7 },
|
||||
src: File::GrfA { index: 7 },
|
||||
dst: File::Bank,
|
||||
},
|
||||
Instruction::EXIT,
|
||||
|
||||
@@ -24,7 +24,7 @@ pub extern "C" fn entry() -> ! {
|
||||
|
||||
unsafe { main() }
|
||||
|
||||
m5op::exit();
|
||||
m5op::exit(0);
|
||||
|
||||
loop {
|
||||
compiler_fence(Ordering::SeqCst);
|
||||
|
||||
@@ -3,24 +3,24 @@ use core::arch::global_asm;
|
||||
global_asm!(include_str!("m5op.s"));
|
||||
|
||||
extern "C" {
|
||||
fn m5_exit();
|
||||
fn m5_reset_stats();
|
||||
fn m5_dump_stats();
|
||||
fn m5_dump_reset_stats();
|
||||
fn m5_exit(delay_ns: u64);
|
||||
fn m5_reset_stats(delay_ns: u64, period_ns: u64);
|
||||
fn m5_dump_stats(delay_ns: u64, period_ns: u64);
|
||||
fn m5_dump_reset_stats(delay_ns: u64, period_ns: u64);
|
||||
}
|
||||
|
||||
pub fn exit() {
|
||||
unsafe { m5_exit() }
|
||||
pub fn exit(delay_ns: u64) {
|
||||
unsafe { m5_exit(delay_ns) }
|
||||
}
|
||||
|
||||
pub fn reset_stats() {
|
||||
unsafe { m5_reset_stats() }
|
||||
pub fn reset_stats(delay_ns: u64, period_ns: u64) {
|
||||
unsafe { m5_reset_stats(delay_ns, period_ns) }
|
||||
}
|
||||
|
||||
pub fn dump_stats() {
|
||||
unsafe { m5_dump_stats() }
|
||||
pub fn dump_stats(delay_ns: u64, period_ns: u64) {
|
||||
unsafe { m5_dump_stats(delay_ns, period_ns) }
|
||||
}
|
||||
|
||||
pub fn dump_reset_stats() {
|
||||
unsafe { m5_dump_reset_stats() }
|
||||
pub fn dump_reset_stats(delay_ns: u64, period_ns: u64) {
|
||||
unsafe { m5_dump_reset_stats(delay_ns, period_ns) }
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user