From defd5ccbf2f9230f58c0034101154582ed386892 Mon Sep 17 00:00:00 2001 From: martyall Date: Thu, 2 Jan 2025 08:30:25 -0800 Subject: [PATCH] danny pr review comments --- README.md | 2 ++ o1vm/meta_test.json | 37 ----------------------------------- o1vm/src/elf_loader.rs | 4 ++-- o1vm/tests/test_elf_loader.rs | 2 +- o1vm/tests/test_riscv_elf.rs | 18 ++++++++--------- 5 files changed, 14 insertions(+), 49 deletions(-) delete mode 100644 o1vm/meta_test.json diff --git a/README.md b/README.md index 68f0191f5f..8f6b42bb21 100644 --- a/README.md +++ b/README.md @@ -88,6 +88,8 @@ You can visualize the documentation by opening the file `target/doc/index.html`. This workflow runs benchmarks when a pull request is labeled with "benchmark." It sets up the Rust and OCaml environments, installs necessary tools, and executes cargo criterion benchmarks on the kimchi crate. The benchmark results are then posted as a comment on the pull request for review. - [Deploy Specifications & Docs to GitHub Pages](.github/workflows/gh-page.yml). When CI passes on master, the documentation built from the rust code will be available by this [link](https://o1-labs.github.io/proof-systems/rustdoc) and the book will be available by this [link](https://o1-labs.github.io/proof-systems). +- [MIPS Build and Package](.github/workflows/mips-build.yml) + This workflow runs the assembler and linker on the programs from the OpenMips test suite, and provides a link where you can download the artifacts (recommended if you don't have / can't install the required MIPS tooling). This workflow also runs the o1vm ELF parser on the artifacts to check that our parsing is working. Currently it is run via manual trigger only -- you can find the trigger in the [GitHub actions tab](https://github.com/o1-labs/proof-systems/actions/workflows/mips-build.yml) and the link to the artifacts will appear in logs of the `Upload Artifacts` stage. ## Nix for Dependencies (WIP) diff --git a/o1vm/meta_test.json b/o1vm/meta_test.json deleted file mode 100644 index ab21ff5093..0000000000 --- a/o1vm/meta_test.json +++ /dev/null @@ -1,37 +0,0 @@ -{ - "symbols": [ - { - "name": "go.go", - "start": 0, - "size": 0 - }, - { - "name": "internal/cpu.processOptions", - "start": 69632, - "size": 1872 - }, - { - "name": "runtime.text", - "start": 69632, - "size": 0 - }, - { - "name": "runtime/internal/atomic.(*Uint8).Load", - "start": 71504, - "size": 28 - }, - { - "name": "runtime/internal/atomic.(*Uint8).Store", - "start": 71532, - "size": 28 - }, - { - "name": "runtime/internal/atomic.(*Uint8).And", - "start": 71560, - "size": 88 - }, - { - "name": "runtime/internal/atomic.(*Uint8).Or", - "start": 71648, - "size": 72 - }]} \ No newline at end of file diff --git a/o1vm/src/elf_loader.rs b/o1vm/src/elf_loader.rs index 89e698f2ff..b2e0e1009f 100644 --- a/o1vm/src/elf_loader.rs +++ b/o1vm/src/elf_loader.rs @@ -9,7 +9,7 @@ use std::{collections::HashMap, path::Path}; pub enum Architecture { Mips, - RiscV, + RiscV32, } pub fn make_state(file: ElfBytes) -> Result { @@ -157,7 +157,7 @@ pub fn parse_elf(arch: Architecture, path: &Path) -> Result { assert_eq!(file.ehdr.e_machine, 8); make_state(file) } - Architecture::RiscV => { + Architecture::RiscV32 => { let file = ElfBytes::::minimal_parse(slice).expect("Open ELF file failed."); assert_eq!(file.ehdr.e_machine, 243); diff --git a/o1vm/tests/test_elf_loader.rs b/o1vm/tests/test_elf_loader.rs index 695ea48f78..b248f8e79a 100644 --- a/o1vm/tests/test_elf_loader.rs +++ b/o1vm/tests/test_elf_loader.rs @@ -9,7 +9,7 @@ fn test_correctly_parsing_elf() { let path = curr_dir.join(std::path::PathBuf::from( "resources/programs/riscv32im/bin/fibonacci", )); - let state = o1vm::elf_loader::parse_elf(Architecture::RiscV, &path).unwrap(); + let state = o1vm::elf_loader::parse_elf(Architecture::RiscV32, &path).unwrap(); // This is the output we get by running objdump -d fibonacci assert_eq!(state.pc, 69932); diff --git a/o1vm/tests/test_riscv_elf.rs b/o1vm/tests/test_riscv_elf.rs index f95857462e..120cf6ebd1 100644 --- a/o1vm/tests/test_riscv_elf.rs +++ b/o1vm/tests/test_riscv_elf.rs @@ -15,7 +15,7 @@ fn test_registers_indexed_by_alias() { let path = curr_dir.join(std::path::PathBuf::from( "resources/programs/riscv32im/bin/sll", )); - let state = o1vm::elf_loader::parse_elf(Architecture::RiscV, &path).unwrap(); + let state = o1vm::elf_loader::parse_elf(Architecture::RiscV32, &path).unwrap(); let witness = Env::::create(PAGE_SIZE.try_into().unwrap(), state); assert_eq!(witness.registers[Ip], 65652); @@ -46,7 +46,7 @@ fn test_no_action() { let path = curr_dir.join(std::path::PathBuf::from( "resources/programs/riscv32im/bin/no-action", )); - let state = o1vm::elf_loader::parse_elf(Architecture::RiscV, &path).unwrap(); + let state = o1vm::elf_loader::parse_elf(Architecture::RiscV32, &path).unwrap(); let mut witness = Env::::create(PAGE_SIZE.try_into().unwrap(), state); // This is the output we get by running objdump -d no-action assert_eq!(witness.registers.current_instruction_pointer, 69844); @@ -75,7 +75,7 @@ fn test_fibonacci_7() { let path = curr_dir.join(std::path::PathBuf::from( "resources/programs/riscv32im/bin/fibonacci-7", )); - let state = o1vm::elf_loader::parse_elf(Architecture::RiscV, &path).unwrap(); + let state = o1vm::elf_loader::parse_elf(Architecture::RiscV32, &path).unwrap(); let mut witness = Env::::create(PAGE_SIZE.try_into().unwrap(), state); // This is the output we get by running objdump -d fibonacci-7 assert_eq!(witness.registers.current_instruction_pointer, 69932); @@ -97,7 +97,7 @@ fn test_sll() { let path = curr_dir.join(std::path::PathBuf::from( "resources/programs/riscv32im/bin/sll", )); - let state = o1vm::elf_loader::parse_elf(Architecture::RiscV, &path).unwrap(); + let state = o1vm::elf_loader::parse_elf(Architecture::RiscV32, &path).unwrap(); let mut witness = Env::::create(PAGE_SIZE.try_into().unwrap(), state); while !witness.halt { @@ -114,7 +114,7 @@ fn test_addi() { let path = curr_dir.join(std::path::PathBuf::from( "resources/programs/riscv32im/bin/addi", )); - let state = o1vm::elf_loader::parse_elf(Architecture::RiscV, &path).unwrap(); + let state = o1vm::elf_loader::parse_elf(Architecture::RiscV32, &path).unwrap(); let mut witness = Env::::create(PAGE_SIZE.try_into().unwrap(), state); while !witness.halt { @@ -130,7 +130,7 @@ fn test_add_1() { let path = curr_dir.join(std::path::PathBuf::from( "resources/programs/riscv32im/bin/add_1", )); - let state = o1vm::elf_loader::parse_elf(Architecture::RiscV, &path).unwrap(); + let state = o1vm::elf_loader::parse_elf(Architecture::RiscV32, &path).unwrap(); let mut witness = Env::::create(PAGE_SIZE.try_into().unwrap(), state); while !witness.halt { @@ -146,7 +146,7 @@ fn test_add_2() { let path = curr_dir.join(std::path::PathBuf::from( "resources/programs/riscv32im/bin/add_2", )); - let state = o1vm::elf_loader::parse_elf(Architecture::RiscV, &path).unwrap(); + let state = o1vm::elf_loader::parse_elf(Architecture::RiscV32, &path).unwrap(); let mut witness = Env::::create(PAGE_SIZE.try_into().unwrap(), state); while !witness.halt { @@ -168,7 +168,7 @@ fn test_add_overflow() { let path = curr_dir.join(std::path::PathBuf::from( "resources/programs/riscv32im/bin/add_overflow", )); - let state = o1vm::elf_loader::parse_elf(Architecture::RiscV, &path).unwrap(); + let state = o1vm::elf_loader::parse_elf(Architecture::RiscV32, &path).unwrap(); let mut witness = Env::::create(PAGE_SIZE.try_into().unwrap(), state); while !witness.halt { @@ -188,7 +188,7 @@ fn test_addi_negative() { let path = curr_dir.join(std::path::PathBuf::from( "resources/programs/riscv32im/bin/addi_negative", )); - let state = o1vm::elf_loader::parse_elf(Architecture::RiscV, &path).unwrap(); + let state = o1vm::elf_loader::parse_elf(Architecture::RiscV32, &path).unwrap(); let mut witness = Env::::create(PAGE_SIZE.try_into().unwrap(), state); while !witness.halt {