Fix memory layout
This commit is contained in:
@@ -1,4 +1,7 @@
|
||||
use crate::pim::{continuous_array::Matrix, interleaved_array, operation::PimOperand, vector};
|
||||
use crate::pim::{
|
||||
continuous_array::Matrix, interleaved_array, operation::PimOperand, vector::F16x16,
|
||||
};
|
||||
use nalgebra::SVector;
|
||||
use pim_isa::{File, Instruction, Kernel};
|
||||
|
||||
pub const KERNEL: Kernel = Kernel([
|
||||
@@ -45,17 +48,6 @@ pub const KERNEL: Kernel = Kernel([
|
||||
offset: -1,
|
||||
count: 7,
|
||||
},
|
||||
Instruction::MAC {
|
||||
src0: File::Bank,
|
||||
src1: File::GrfA { index: 0 },
|
||||
src2: File::GrfB { index: 0 },
|
||||
dst: File::GrfB { index: 0 },
|
||||
aam: true,
|
||||
},
|
||||
Instruction::JUMP {
|
||||
offset: -1,
|
||||
count: 7,
|
||||
},
|
||||
Instruction::FILL {
|
||||
src: File::GrfB { index: 0 },
|
||||
dst: File::Bank,
|
||||
@@ -79,42 +71,22 @@ pub const KERNEL: Kernel = Kernel([
|
||||
Instruction::NOP,
|
||||
Instruction::NOP,
|
||||
Instruction::NOP,
|
||||
Instruction::NOP,
|
||||
Instruction::NOP,
|
||||
]);
|
||||
|
||||
pub fn execute<const R: usize, const C: usize>(
|
||||
matrix: &Matrix<R, C>,
|
||||
input_vector: &interleaved_array::Vector<C>,
|
||||
output_partial_sum_vector: &mut Matrix<R, { vector::ELEMENT_COUNT }>,
|
||||
output_partial_sum_vector: &mut SVector<F16x16, R>,
|
||||
dummy: &impl PimOperand,
|
||||
) where
|
||||
[(); C / vector::ELEMENT_COUNT]:,
|
||||
{
|
||||
) {
|
||||
for block in input_vector.0.as_slice().iter() {
|
||||
block.execute_read();
|
||||
}
|
||||
|
||||
for matrix_column in matrix
|
||||
.0
|
||||
.fixed_rows::<1>(0)
|
||||
.fixed_columns_with_step::<{ C / vector::ELEMENT_COUNT }>(0, vector::ELEMENT_COUNT - 1)
|
||||
.iter()
|
||||
{
|
||||
use core::fmt::Write;
|
||||
writeln!(
|
||||
crate::uart::Uart0,
|
||||
"{:?}",
|
||||
core::ptr::addr_of!(*matrix_column)
|
||||
);
|
||||
matrix_column.execute_read();
|
||||
}
|
||||
|
||||
for matrix_column in matrix
|
||||
.0
|
||||
.fixed_rows::<1>(0)
|
||||
.fixed_columns_with_step::<{ C / vector::ELEMENT_COUNT }>(4, vector::ELEMENT_COUNT - 1)
|
||||
.iter()
|
||||
{
|
||||
matrix_column.execute_read();
|
||||
for column_block in matrix.0.fixed_rows::<1>(0).iter() {
|
||||
column_block.execute_read();
|
||||
}
|
||||
|
||||
output_partial_sum_vector.execute_write();
|
||||
|
||||
Reference in New Issue
Block a user