-
Notifications
You must be signed in to change notification settings - Fork 49
Update documentation #1254
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Open
DiegoCivi
wants to merge
42
commits into
main
Choose a base branch
from
update-documentation
base: main
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
Open
Update documentation #1254
Changes from 13 commits
Commits
Show all changes
42 commits
Select commit
Hold shift + click to select a range
a282628
Add some docs. Fix some issues.
azteca1998 6b8f6d0
More docs.
azteca1998 03bce62
Minor changes
DiegoCivi 655d438
More minor changes
DiegoCivi 5fc6372
Refactor on src layout
DiegoCivi b6ada90
Update examples on overview.md
DiegoCivi 6cd39dd
Minor changes on overview.md example
DiegoCivi f36784d
Minor change
DiegoCivi 107ee68
Remove wrong enum explanation
DiegoCivi b2cfadb
Fix merge mistake
DiegoCivi a465209
Remove JitValue references
DiegoCivi 34e5c6a
Apply comments
DiegoCivi 722ea69
Remove outdated link
DiegoCivi 5b18317
Change cairo-native-run example file
DiegoCivi 5ef2c42
Update runtime info
DiegoCivi 49f3d6a
Update tools help message
DiegoCivi c42454d
Undo changes on compile.rs
DiegoCivi 8002c24
Update example on overview.md
DiegoCivi cac4d34
Add AotContractExecutor
DiegoCivi 2d9365f
Merge branch 'main' into update-documentation
FrancoGiachetta 4a78d2b
Merge branch 'main' into update-documentation
DiegoCivi 88b8c87
Update sierra-emu references
DiegoCivi 56b4723
Merge branch 'update-documentation' of github.com:lambdaclass/cairo_n…
DiegoCivi b755bab
API usage refactor
DiegoCivi 580521a
Refactor of project layout
DiegoCivi da5c08d
Add tool info
DiegoCivi 286c666
Merge branch 'main' into update-documentation
DiegoCivi ee28e90
Refactor of runtime explanation
DiegoCivi 2822583
Minor changes
DiegoCivi 717935e
Update docs/overview.md
DiegoCivi 663b5c5
Update docs/execution_walkthrough.md
DiegoCivi da4c780
Update docs/execution_walkthrough.md
DiegoCivi ffb66ad
Merge branch 'main' into update-documentation
DiegoCivi a6858ab
Refactor of starknet-native-compile description
DiegoCivi 567fc74
cairo -> sierra
DiegoCivi 753f850
Update docs/compilation_walkthrough.md
DiegoCivi 82022da
Update docs/compilation_walkthrough.md
DiegoCivi ab53ab1
Update docs/compilation_walkthrough.md
DiegoCivi aea8b7e
Update docs/compilation_walkthrough.md
DiegoCivi 76a7235
Minor changes
DiegoCivi 3e9307d
Merge branch 'main' into update-documentation
DiegoCivi dc471bb
Merge branch 'main' into update-documentation
DiegoCivi File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -23,7 +23,6 @@ to machine code via MLIR and LLVM. | |
|
|
||
| - [Getting Started](#getting-started) | ||
| - [Included Tools](#included-tools) | ||
| - [Scripts](#scripts) | ||
| - [cairo-native-compile](#cairo-native-compile) | ||
| - [cairo-native-dump](#cairo-native-dump) | ||
| - [cairo-native-run](#cairo-native-run) | ||
|
|
@@ -46,6 +45,7 @@ use. This can be done by adding `cairo-native = "0.5.0-rc.6"` to your Cargo.toml | |
| ## Getting Started | ||
|
|
||
| ### Dependencies | ||
|
|
||
| - Linux or macOS (aarch64 included) only for now | ||
| - LLVM 19 with MLIR: On debian you can use [apt.llvm.org](https://apt.llvm.org/), | ||
| on macOS you can use brew | ||
|
|
@@ -54,6 +54,7 @@ use. This can be done by adding `cairo-native = "0.5.0-rc.6"` to your Cargo.toml | |
| - Git | ||
|
|
||
| ### Setup | ||
|
|
||
| > This step applies to all operating systems. | ||
|
|
||
| Run the following make target to install the dependencies (**both Linux and macOS**): | ||
|
|
@@ -63,6 +64,7 @@ make deps | |
| ``` | ||
|
|
||
| #### Linux | ||
|
|
||
| Since Linux distributions change widely, you need to install LLVM 19 via your | ||
| package manager, compile it or check if the current release has a Linux binary. | ||
|
|
||
|
|
@@ -125,6 +127,7 @@ source env.sh | |
| ``` | ||
|
|
||
| #### MacOS | ||
|
|
||
| The makefile `deps` target (which you should have ran before) installs LLVM 19 | ||
| with brew for you, afterwards you need to execute the `env.sh` script to setup | ||
| the needed environment variables. | ||
|
|
@@ -134,13 +137,14 @@ source env.sh | |
| ``` | ||
|
|
||
| ### Make targets: | ||
|
|
||
| Running `make` by itself will check whether the required LLVM installation and | ||
| corelib is found, and then list available targets. | ||
|
|
||
| ```bash | ||
| % make | ||
| LLVM is correctly set at /opt/homebrew/opt/llvm. | ||
| ./scripts/check-corelib-version.sh 2.12.0-dev.0 | ||
| ./scripts/check-corelib-version.sh 2.12.0-dev.1 | ||
| Usage: | ||
| deps: Installs the necesary dependencies. | ||
| build: Builds the cairo-native library and binaries in release mode. | ||
|
|
@@ -154,19 +158,19 @@ Usage: | |
| doc-open: Builds and opens documentation in browser. | ||
| bench: Runs the hyperfine benchmark script. | ||
| bench-ci: Runs the criterion benchmarks for CI. | ||
| install: Invokes cargo to install the cairo-native tools. | ||
| install: Invokes cargo to install cairo-native tools. | ||
| clean: Cleans the built artifacts. | ||
| stress-test Runs a command which runs stress tests. | ||
| stress-plot Plots the results of the stress test command. | ||
| stress-clean Clean the cache of AOT compiled code of the stress test command. | ||
| ``` | ||
|
|
||
| ## Included Tools | ||
|
|
||
| Aside from the compilation and execution engine library, Cairo Native includes | ||
| a few command-line tools to aid development, and some useful scripts. | ||
|
|
||
| These are: | ||
| - The contents of the `/scripts/` folder | ||
| These are the contents of the `/src/bin` folder | ||
| - `cairo-native-compile` | ||
| - `cairo-native-dump` | ||
| - `cairo-native-run` | ||
|
|
@@ -176,6 +180,7 @@ These are: | |
| - `scarb-native-test` | ||
|
|
||
| ### `cairo-native-compile` | ||
|
|
||
| ```bash | ||
| Compiles a Cairo project outputting the generated MLIR and the shared library. | ||
| Exits with 1 if the compilation or run fails, otherwise 0. | ||
|
|
@@ -197,6 +202,7 @@ Options: | |
| ``` | ||
|
|
||
| ### `cairo-native-dump` | ||
|
|
||
| ```bash | ||
| Usage: cairo-native-dump [OPTIONS] <INPUT> | ||
|
|
||
|
|
@@ -210,10 +216,11 @@ Options: | |
| ``` | ||
|
|
||
| ### `cairo-native-run` | ||
|
|
||
| This tool allows to run programs using the JIT engine, like the `cairo-run` | ||
| tool, the parameters can only be felt values. | ||
|
|
||
| Example: `echo '1' | cairo-native-run 'program.cairo' 'program::program::main' --inputs - --outputs -` | ||
| Example: `cairo-native-run --available-gas 5000 './programs/program.cairo'` | ||
|
||
|
|
||
| ```bash | ||
| Exits with 1 if the compilation or run fails, otherwise 0. | ||
|
|
@@ -234,6 +241,7 @@ Options: | |
| ``` | ||
|
|
||
| ### `cairo-native-test` | ||
|
|
||
| This tool mimics the `cairo-test` | ||
| [tool](https://github.com/starkware-libs/cairo/tree/main/crates/cairo-lang-test-runner) | ||
| and is identical to it in interface, the only feature it doesn't have is the profiler. | ||
|
|
@@ -275,6 +283,7 @@ cairo-native-test ./cairo-tests/ | |
| This will run all the tests (functions marked with the `#[test]` attribute). | ||
|
|
||
| ### `cairo-native-stress` | ||
|
|
||
| This tool runs a stress test on Cairo Native. | ||
|
|
||
| ```bash | ||
|
|
@@ -315,6 +324,7 @@ make stress-clean | |
| ``` | ||
|
|
||
| ### `scarb-native-dump` | ||
|
|
||
| This tool mimics the `scarb build` [command](https://github.com/software-mansion/scarb/tree/main/extensions/scarb-cairo-test). | ||
| You can download it on our [releases](https://github.com/lambdaclass/cairo_native/releases) page. | ||
|
|
||
|
|
@@ -323,6 +333,7 @@ behave like `scarb build`, leaving the MLIR files under the `target/` folder | |
| besides the generated JSON sierra files. | ||
|
|
||
| ### `scarb-native-test` | ||
|
|
||
| This tool mimics the `scarb test` [command](https://github.com/software-mansion/scarb/tree/main/extensions/scarb-cairo-test). | ||
| You can download it on our [releases](https://github.com/lambdaclass/cairo_native/releases) page. | ||
|
|
||
|
|
@@ -348,6 +359,7 @@ Options: | |
| ## Benchmarking | ||
|
|
||
| ### Requirements | ||
|
|
||
| - [hyperfine](https://github.com/sharkdp/hyperfine): `cargo install hyperfine` | ||
| - [cairo 2.12.0-dev.0](https://github.com/starkware-libs/cairo) | ||
| - Cairo Corelibs | ||
|
|
||
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Uh oh!
There was an error while loading. Please reload this page.