Skip to content
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

main marge #2355

Merged
merged 25 commits into from
Nov 19, 2024
Merged

main marge #2355

merged 25 commits into from
Nov 19, 2024

Conversation

parthsarkar17
Copy link
Contributor

No description provided.

ayakayorihiro and others added 25 commits October 29, 2024 18:42
…#2314)

*Note: This PR is still a draft because I have some questions about the
changes I made here that I wanted to ask about. Once those concerns are
resolved I will turn this into a full PR.*
## This PR contains:
- `fud2/scripts/profiler.rhai`: fud2 support for the profiler. I added a
new state `flamegraph` (the `svg` file containing the flame graph) and a
new operation called `profiler`, which takes a Calyx file and produces
the profiled flame graph.
- Updates to existing profiling scripts to read instrumented cell
signals and allow toggling between profiling optimized and non-optimized
Calyx programs.
- Updated fud2 tests to reflect new state and operation.

## Usage

First, clone https://github.com/brendangregg/FlameGraph and edit the
`fud2` configuration file to specify the location of `flamegraph.pl`:
ex)
```
[flamegraph]
script = "/home/ayaka/projects/FlameGraph/flamegraph.pl"
```

To obtain a flame graph from a Calyx program, specify the output as a
`svg` file.
ex) 
```
fud2 tests/correctness/while.futil -o while.svg -s sim.data=tests/correctness/while.futil
```
will produce the below flame graph.

![image](https://github.com/user-attachments/assets/b257ecb6-9f45-49b7-9555-f68e3212403e)

To obtain a flame graph for the non-compiler-optimized version of the
Calyx program, add `-s passes=no-opt`:
ex)
```
fud2 tests/correctness/while.futil -o flame.svg -s sim.data=tests/correctness/while.futil.data -s passes=no-opt
```
…ogging (#2319)

Sorry for the larger PR here, a bunch of stuff ended up getting all
tangled together.

This PR adds:
- a check for undefined guards after convergence. This is currently
disabled by default as the changes to `@control` mean that this will
basically never be relevant for normal programs.
- redoes internal error handling to make proper error messages more
enforceable by the type system
- Adds a configuration struct for runtime checks/behaviors
- Adds optional debug logging via `--debug-logging` which prints out the
assignments that fire and the results they propagate alongside the
implicit zero assignments. Might be useful for some people under some
circumstances?
- Adjust the `@control` port process to match that used by the compiler.
Consequently for most programs we simulate, every port is `@control`.
This means some error cases are no longer errors and also reintroduces
transient conflicts on some programs.
- As a spot fix to the transient conflicts, when detected we will now
check if the guard for the first assignment still evaluates to true and
if not we take the later assignment and continue onward, otherwise an
error is raised. In all likelihood this won't mitigate every instance of
the transient conflict problem but seems to address it for our current
programs.
This reduces the size of BitVecValue from 32 bytes to 24 bytes.
…#2323)

A quick patch for the `fud2` flow which makes it possible to run without
supplying a `sim.data` value which would otherwise block things. This
hopefully makes testing small programs more straightforward as it no
longer requires generating an empty data file or using direct
invocations of the tools.
Extract floating-point support for `fud` from
#1928
Add a `calyx.lib_path` argument for the `fud2` stage.
This PR removes ops from `lib.rs` which are duplicated in Rhai scripts.
Changes from #2266 since author has not responded. Fixes #2253.
Removes all the old btor code that is no longer used.
Quick set of renaming to reduce the confusion with the `flags` stuff
which should make it clear where things belong
Adding `jq` stage to `fud2` but I've been having trouble getting the
stage to print out the value from the command. It seems like the `jq ...
> $out` call gobbles up the output. Not sure if I'm making a mistake.

Any thoughts @EclecticGriffin @ekiwi or @sampsyo?
Fixes #2336. Currently running into the same problem as
#2335 (comment)

@ekiwi how did you fix it on the Rust side?
Moving all tests in the root `runt.toml` to use `fud2`.
Sorry, I overlooked Rachit's comment on the previous PR.
This PR adds a documentation page for the `calyx-pass-explorer` tool,
serving as a gentle introduction to its usage as well as an overview of
its code.

- I've added `mdbook-callouts` as a way to get Obsidian-style quote
blocks. Specifically, I'm using this for the `[!TIP]` environment. I can
remove this if we don't want another dependency.
- I did some unrelated things (to `docs/contributors.md`,
`docs/github.md`, and `docs/intro.md`) that I can move into another PR
if that would be better.
This allows us to remove most uses of `jq` in the tests.
I did some silly hacking late last week that might get us marginally
closer to unifying all the data marshaling under a single tool.

This adds the ability to specify a `--to dat` (or one of the aliases)
and an output directory which will generate the hex encoded files that
verilator/icarus expect. There are some minor differences with the dat
files generated by the python flow. Mainly, the python flow truncates
leading zeroes in the encoding while I've elected to retain them in the
interest of keeping things simple. Python generates:
```
4B
53
21
5D
1E
5E
2B
B
3C
60
```
while the data-converter generates
```
0000004B
00000053
00000021
0000005D
0000001E
0000005E
0000002B
0000000B
0000003C
00000060
```

This also adds the ability to deserialize this style of data dump but is
slightly brittle at the moment since it expect the following:
- the data header is exactly that used by the tool and is cbor encoded
in a file named `header`. The python currently json encodes things in a
file named `shape`
- the input data includes all leading zeroes

Both these assumptions can probably be relaxed in the future in the
interest of robustness
Creates a new `BaseSimulator` object that can be used independently of
`Simulator`. Also, things are cloneable now. The rationale is we can now
write a model checker using cider by cloning cider contexts at forks.
Configured various files and edited the parser to print out nodes in the
format we talked about.
Biggest function implemented was string_path in **program_counter.rs**
I spent some more time hacking on this instead of spending my time in a
more productive way. This does the following:
- switch the `dat` deserializing from custom matching stuff to a proper
`nom` parser that accounts for comments and leading `0x` tags.
- `dat` files can now parse values with leading zeroes truncated (though
we continue to generate `dat` files with the leading zeroes included)
- Output `dat` files will be generated by default as `MEMNAME.dat`
though this can be customized with `-e` flag. I.e. `-e out` will
generate `MEMNAME.out`
- Similarly, when reading in a `dat` directory, the tool will look for
`MEMNAME.dat` which can be retargeted via `-e` flag.
- The tool will also infer the `--to json` target when given a directory
as input
@parthsarkar17 parthsarkar17 merged commit 4fa792d into explicit-fsm-compilation Nov 19, 2024
16 of 18 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

10 participants