add pimsim-nn simulator
This commit is contained in:
3
.gitmodules
vendored
3
.gitmodules
vendored
@@ -1,3 +1,6 @@
|
|||||||
[submodule "onnx-mlir"]
|
[submodule "onnx-mlir"]
|
||||||
path = onnx-mlir
|
path = onnx-mlir
|
||||||
url = https://github.com/onnx/onnx-mlir.git
|
url = https://github.com/onnx/onnx-mlir.git
|
||||||
|
[submodule "backend-simulators/pim/pimsim-nn"]
|
||||||
|
path = backend-simulators/pim/pimsim-nn
|
||||||
|
url = https://github.com/wangxy-2000/pimsim-nn.git
|
||||||
|
|||||||
@@ -20,11 +20,11 @@ where
|
|||||||
let mut cpu = CPU::new(0);
|
let mut cpu = CPU::new(0);
|
||||||
cpu.reserve_crossbar(1, 1024 * size_of::<f32>(), 1024);
|
cpu.reserve_crossbar(1, 1024 * size_of::<f32>(), 1024);
|
||||||
let (memory, crossbars) = cpu.host().get_memory_crossbar();
|
let (memory, crossbars) = cpu.host().get_memory_crossbar();
|
||||||
let matrix = simple_read(Path::new("./tests/B.txt")) ;
|
let matrix = simple_read(Path::new("B.txt")) ;
|
||||||
|
|
||||||
|
|
||||||
crossbars.get_mut(0).unwrap().execute_store( &matrix).unwrap();
|
crossbars.get_mut(0).unwrap().execute_store( &matrix).unwrap();
|
||||||
let vector = simple_read(Path::new("./tests/A.txt"));
|
let vector = simple_read(Path::new("A.txt"));
|
||||||
memory.execute_store(0, &vector).unwrap();
|
memory.execute_store(0, &vector).unwrap();
|
||||||
|
|
||||||
let mut inst_builder = InstructionsBuilder::new();
|
let mut inst_builder = InstructionsBuilder::new();
|
||||||
@@ -57,7 +57,7 @@ where
|
|||||||
.cpu_mut()
|
.cpu_mut()
|
||||||
.host()
|
.host()
|
||||||
.load::<f32>(1024 * size_of::<f32>(), 1024*size_of::<f32>()).unwrap()[0].iter().zip(
|
.load::<f32>(1024 * size_of::<f32>(), 1024*size_of::<f32>()).unwrap()[0].iter().zip(
|
||||||
simple_read(Path::new("./tests/X.txt")) ).all(|(&a,b) : (&f32, f32)| {a-b < 0.001}),
|
simple_read(Path::new("X.txt")) ).all(|(&a,b) : (&f32, f32)| {a-b < 0.001}),
|
||||||
"Wrong result for {}",
|
"Wrong result for {}",
|
||||||
err
|
err
|
||||||
);
|
);
|
||||||
@@ -43,7 +43,7 @@ fn collect_json_from_subfolders<P: AsRef<Path>>(root: P) -> Result<Vec<(Value, V
|
|||||||
|
|
||||||
#[test]
|
#[test]
|
||||||
fn json_folder_tester() {
|
fn json_folder_tester() {
|
||||||
let examples = collect_json_from_subfolders("./tests/data").unwrap();
|
let examples = collect_json_from_subfolders("data").unwrap();
|
||||||
for example in examples {
|
for example in examples {
|
||||||
let (config, cores) = example;
|
let (config, cores) = example;
|
||||||
json_to_executor::json_to_executor(config, cores.iter()).execute();
|
json_to_executor::json_to_executor(config, cores.iter()).execute();
|
||||||
1
backend-simulators/pim/pimsim-nn
Submodule
1
backend-simulators/pim/pimsim-nn
Submodule
Submodule backend-simulators/pim/pimsim-nn added at 3e3442b663
Reference in New Issue
Block a user