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

Queues: binary heap #2074

Merged
merged 51 commits into from
Jun 3, 2024
Merged

Queues: binary heap #2074

merged 51 commits into from
Jun 3, 2024

Conversation

anshumanmohan
Copy link
Contributor

@anshumanmohan anshumanmohan commented May 29, 2024

This PR makes progress towards #2067. I have started implementing a binary heap. It just has the push function. It does not yet implement our universal queue interface, has not been tested very rigorously, and does not have documentation.

Importantly, it just accepts and stores 64-bit values, ordering them by those values' magnitudes. Eventually we'll want to accept a 32-bit value and a 32-bit rank, and push the (value, rank) tuple ordered by the magnitude of the rank.

I'm hoping to leave those tasks for my amazing BURE undergrads!

@anshumanmohan anshumanmohan changed the base branch from main to sharing-bug May 29, 2024 21:00
@anshumanmohan anshumanmohan mentioned this pull request May 29, 2024
10 tasks
Base automatically changed from sharing-bug to main May 30, 2024 12:23
@anshumanmohan anshumanmohan enabled auto-merge (squash) June 3, 2024 19:40
@anshumanmohan anshumanmohan merged commit 4c21a1a into main Jun 3, 2024
18 checks passed
@anshumanmohan anshumanmohan deleted the binary-heap branch June 3, 2024 19:55
ethanuppal added a commit that referenced this pull request Jun 6, 2024
* [fud2] Rhai Plugins (#2078)

* initial implementation of rhai based plugin system

* cleanup EmitSetup trait situation + appease clippy

* fix tests by emitting everything to an intermediate buffer first

* use thread_local + once_cell::Lazy to avoid constructing the engine over and over

* remove unused import

* DriverBuilder::find_state + define plugins in fud2.toml

* try building more complicated plugins

* unused annotation for add_file

* nicer errors for rhai

* remove unused imports

* clean reporting code slightly

* create a new emitter for each rhai function

* RhaiEmitter::with to simplifies buffering + unbuffering the emitter

* separate plugins.rs into multiple files + rename things

* fix lib.rs

* error reporting for setup_refs

* small string change

* change Into to From

* [fud2] Make plugins optional (#2082)

Very minor fix: #2078 added plugins, controlled by a `plugins` key in
`fud2.toml`. However, it inadvertently made this option required, i.e.,
fud2 would crash if this option was not present. Now it's optional! So
we just silently proceed with no plugins if none are configured.

* Queues: binary heap (#2074)

* Some sketching

* Quick fixed to make it generate

* Tuplify

* Untuplify

* Tidy

* Stash

* More component-based approach

* Swap group

* Checking in aspirational yx file

* Thrashing. Need comb components

* Baby data file

* Attempt at CombComponent in ast

* Attempt to add comb comp to builder

* Test comb groups with tuplify

* Testing for comb comp

* Stray assert

* Fix slice helper, use correctly

* Stray change from merge

* Use HI instead of 1

* Smaller, tidier, py file

* Two values

* Smaller queue

* Add rudimentary cmp component

* Add three elements, no swaps

* Make cmp a comb component

* Trying to actually run algorithm. Wrong

* Little tinkering

* Parent, child indices

* Comb mem all over

* Aha. Just find_parent is wrong

* Minimize issue

* Move to seq mem

* fix

* Working thanks to #2071

* Tidy some helpers

* Move to mem of length 15

* Bubbling up works, insert works

* Simplify interface

* One more push that does not trigger a swap

* Put back the well-formedness pass I had removed

* Simplify parent-finding routine

* Tinkering

* Update runt.toml

* Tidy docstring

---------

Co-authored-by: Caleb <[email protected]>
Co-authored-by: calebmkim <[email protected]>

* [fud2] Refactor plugin script loading (#2083)

* [fud2] Make plugins optional

Very minor fix: #2078 added plugins, controlled by a `plugins` key in
`fud2.toml`. However, it inadvertently made this option required, i.e.,
fud2 would crash if this option was not present. Now it's optional! So
we just silently proceed with no plugins if none are configured.

* Fix a doc typo

* Start refactoring plugin loading

* Start refactoring builder functions

* Refactor the rest of the functions

* Gather up a `register` function

* Use a fresh engine for each plugin??

Maybe this is wasteful, but it simplifies things a lot.

* Run one script at a time

* Refector script contexts

* Refactor runner struct

* Further beef up the runner

* Further simplify interface

* Fix a borrow that lasts too long

* Fix a method name

Clippy was thrown for a loop because of the `to_*` name.

* Move plugin loading to DriverBuilder?

Now the top-level thing is in the builder itself... no need for an extra
trait? Not sure this is a good idea.

* [Profiling] Sample values at clock falling edges and accommodate single-enable control blocks/par arms (#2081)

* [WIP] Saving scratch work. Most likely want to switch to VCDVCD streaming like Kevin's example

* Very rough first pass at sampling FSM values

* Some cleanup

* Add start and end times for each group

* Small bug fix

* Add documentation

* Get TDCC to emit different information for parallel arms that only have one group

* Finagle with documentation

* [WIP] Setting up signal ID mapping from signal names

* [WIP] Read single value groups. Need to fix the FSMs

* Add FSM entry for "END"

* Fixed up most of fsm0 (language-tutorial-iterate) profiling.

* Emit JSON when the control only consists of one group

* Remove resolved TODO

* Documentation and struct name changes

* Fix bug where FSM values of main's startup time didn't get profiled

* Rename tools/vcd-parsing to tools/profiler

* Fix up documentation

* Pass Reorder Option (#2075)

* reorder pass options

* interp bug

* clippy

* clippy again

* some more erros

* redo this

* Fix multiple paths doc link (#2094)

* Fix a link to Python source code (#2095)

* [fud2] Unique fud2 directories and version gating `ninja --quiet` (#2092)

* attempt to create a unique directory for each fud2 execution

* version checking for --quiet

* trigger CI again

* Use a stable directory name when `--keep`

* Remove an unnecessary `into`

Now that we are cloning the working directory anyway.

* Factor out ninja_supports_quiet

---------

Co-authored-by: Adrian Sampson <[email protected]>

* [fud2] Migrate operations into Rhai (#2084)

* [fud2] Make plugins optional

Very minor fix: #2078 added plugins, controlled by a `plugins` key in
`fud2.toml`. However, it inadvertently made this option required, i.e.,
fud2 would crash if this option was not present. Now it's optional! So
we just silently proceed with no plugins if none are configured.

* Fix a doc typo

* Start refactoring plugin loading

* Start refactoring builder functions

* Refactor the rest of the functions

* Gather up a `register` function

* Use a fresh engine for each plugin??

Maybe this is wasteful, but it simplifies things a lot.

* Run one script at a time

* Refector script contexts

* Refactor runner struct

* Further beef up the runner

* Further simplify interface

* Fix a borrow that lasts too long

* Fix a method name

Clippy was thrown for a loop because of the `to_*` name.

* Move plugin loading to DriverBuilder?

Now the top-level thing is in the builder itself... no need for an extra
trait? Not sure this is a good idea.

* translate a bulk of operations into rhai

* use single engine to module resolution caching, enabling imports

* switched all plugins to use import system

* include plugins in debug build

* we can now load scripts embedded in the binary

* if a module fails once, don't retry it

* sort states and operations in list mode

* migrate entirely to plugins

* gate migration behind a feature

* move sorting to when we run files

* rename plugins to scripts internally

* refactored to have more things live in the resolver

* rename plugins/ to scripts/

---------

Co-authored-by: Adrian Sampson <[email protected]>

* Improve some `from_ast` errors (#2102)

* fix a missing papercut test

* slightly improved handlig of ast errors

* formatting

* Revert "fix a missing papercut test"

This reverts commit c155487.

* Initial calyx-pass

* Update calyx-pass

* Update README.md

* Add image to README

* Implement custom scroll buffer

* Update formatting

* Update formatting (take 2)

* Make clippy happy

* Make clippy happy (take 2)

* Make clippy happy (take 3)

* Better error message for when calyx executable isn't found

* Fix pass application errors

Calyx IR is not deserializable so I worked around that

---------

Co-authored-by: Samuel Thomas <[email protected]>
Co-authored-by: Adrian Sampson <[email protected]>
Co-authored-by: Anshuman Mohan <[email protected]>
Co-authored-by: Caleb <[email protected]>
Co-authored-by: calebmkim <[email protected]>
Co-authored-by: Ayaka Yorihiro <[email protected]>
Co-authored-by: Nathaniel Navarro <[email protected]>
Co-authored-by: Adrian Sampson <[email protected]>
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.

2 participants