Skip to content

Commit

Permalink
docs/crates cleanup (#1062)
Browse files Browse the repository at this point in the history
* docs/crates cleanup

* Apply suggestions from code review

* chore: another warning

* chore: spacing

* chore: mv

* chore: link benchmarks

* chore: update

---------

Co-authored-by: Jonathan Wang <[email protected]>
  • Loading branch information
zlangley and jonathanpwang authored Dec 16, 2024
1 parent 5b98791 commit 930dd54
Show file tree
Hide file tree
Showing 5 changed files with 90 additions and 256 deletions.
3 changes: 2 additions & 1 deletion docs/crates/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,8 @@

Code-level guides to the crates in the repository.

- [`openvm-stark-backend`](./stark.md): Proof system backend
- `openvm-circuit`
- [VM Architecture and Chips](./vm.md)
- [VM Extensions](./vm-extensions.md)
- `openvm-benchmarks`
- [Running Benchmarks](./benchmarks.md)
14 changes: 5 additions & 9 deletions docs/crates/benchmarks.md
Original file line number Diff line number Diff line change
Expand Up @@ -3,19 +3,15 @@
To run benchmarks, install python3 and run (from root of repo):

```bash
python ci/scripts/bench.py <name>
python ci/scripts/bench.py <name> --instance_type <string> --memory_allocator <mimalloc | jemalloc>
```

where `<name>` is a benchmark implemented as a rust binary (located in `src/bin` in a crate). Current benchmark options are:

- `verify_fibair`
- `fibonacci`
- `regex`
in the `benchmarks` crate.
The benchmark outputs a JSON of metrics. You can process this into markdown with:
where `<name>` is a benchmark implemented as a rust binary (located in `src/bin` in the `openvm-benchmarks` crate).
For local benchmarking, the `--instance_type` flag can take an arbitrary string.
The benchmark outputs a JSON of metrics. You can process this into markdown with:

```bash
python ci/scripts/metric_unify/main.py <path to json>
python ci/scripts/metric_unify/main.py <path to json> --aggregation-json ci/scripts/metric_unify/aggregation.json <path to metric json>
```

Currently the processing is done automatically at the end of `bench.py`. The script automatically detects if you have a previously saved metric file for the same benchmark and includes the diff report in the output.
Expand Down
145 changes: 0 additions & 145 deletions docs/crates/stark.md

This file was deleted.

17 changes: 4 additions & 13 deletions docs/crates/vm-extensions.md
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,8 @@ pub trait VmExtension<F: PrimeField32> {
}
```

The `VmExtensionTrait` is a way to specify how to construct a collection of chips and all assign opcodes to be handled by them. This data is collected into a `VmInventory` struct, which is returned.
The `VmExtension` trait is a way to specify how to construct a collection of chips and all assign opcodes to be handled
by them. This data is collected into a `VmInventory` struct, which is returned.

To handle previous chip dependencies necessary for chip construction and also automatic bus index management, we provide a `VmInventoryBuilder` api.

Expand Down Expand Up @@ -123,7 +124,7 @@ The macro will also make two big enums: one that is an enum of the `Ext*::Execut

The macro will then generate a `create_chip_complex` function.

For that we need to understand what `VmChipComplex` is: it replaces the role of the previous `VmChipSet` and consists of:
For that we need to understand what `VmChipComplex` consists of:

- System chips
- `VmInventory`
Expand Down Expand Up @@ -152,19 +153,9 @@ function. What this does in words:

For each extension's inventory generation, the `VmInventoryBuilder` is provided with a view of all current chips already inside the running chip complex. This means the inventory generation process is sequential in the order the extensions are specified, and each extension has borrow access to all chips constructed by any extension before it.

### `VirtualMachine`

The top level structs of `VirtualMachine`, `VmExecutor`, `SegmentExecutor` remain almost entirely the same, but now has `VmConfig` as a generic:

```rust
pub struct VirtualMachine<SC: StarkGenericConfig, E, VC>;
```

TODO: discuss usage

## Examples

The `extensions/` folder contains extensions implementing all non-system functionality via several extensions. For example, the `Rv32I`, `Rv32M`, and `Rv32Io` extensions implement `VmExtension<F>` in [`openvm-rv32im-circuit`](../../extensions/rv32im/circuit/) and correspond to the RISC-V 32-bit base and multiplication instruction sets and an extension for IO, respectively.
The [`extensions/`](../../extensions/) folder contains extensions implementing all non-system functionality via custom extensions. For example, the `Rv32I`, `Rv32M`, and `Rv32Io` extensions implement `VmExtension<F>` in [`openvm-rv32im-circuit`](../../extensions/rv32im/circuit/) and correspond to the RISC-V 32-bit base and multiplication instruction sets and an extension for IO, respectively.

# Design Choices

Expand Down
Loading

0 comments on commit 930dd54

Please sign in to comment.