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

Compile sync without sync reg #1415

Merged
merged 20 commits into from
Apr 29, 2023
Merged

Compile sync without sync reg #1415

merged 20 commits into from
Apr 29, 2023

Conversation

paili0628
Copy link
Contributor

@paili0628 paili0628 commented Apr 21, 2023

Fixed the pass compile-sync-without-sync-reg
The original problem was simply that the clear group did not have a done condition, if I ran validate sooner, this could be immediately discovered.
Compiles @sync without use of std_sync_reg
Upon encountering @sync, it first instantiates a std_reg(1) for each thread(bar) and a std_reg(1) for each barrier (s)
It then continuously assigns the value of (s.in) to 1'd1 guarded by the
expression that all values of bar for threads under the barrier are
set to 1'd1
Then it replaces the @sync control operator with

seq {
     barrier;
     clear;
 }

barrier simply sets the value of bar to 1'd1 and then waits for s.out to be up
clear resets the value of bar to 1'd0 for reuse of barrier
Using this method, each thread only incurs 3 cycles of latency overhead for the barrier, and we theoretically won't have a limit for number of threads under one barrier

@rachitnigam
Copy link
Contributor

Seems like this PR still has conflicts with master branch. Can you fix them and let me know afterwards? The diff is currently too big and I'm assuming that's because the branch hasn't been merged with master yet.

@paili0628 paili0628 linked an issue Apr 22, 2023 that may be closed by this pull request
@paili0628
Copy link
Contributor Author

@rachitnigam fixed merging conflict. Please take a look.

Copy link
Contributor

@rachitnigam rachitnigam left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Couple of thoughts on reorganizing some code. High-level suggestions:

  1. Make BarrierMap a newtype and define methods on it instead of doing the trait trick
  2. One of the big pitches for this was to support multiple threads (more than 2), so let's make sure that this PR can actually do that

I think this will make a cool case study of the paper but we need to make sure that the baseline implementation is good enough for a reasonable comparison.

@rachitnigam
Copy link
Contributor

Changes look good! Looks like two tests are failing because #1422 improved the cycle count. Merge at your discretion! Great job! We should make this the default compile-sync pass in the pipeline and deprecate the old one once you're convinced it works for general programs

@paili0628 paili0628 merged commit e074e83 into master Apr 29, 2023
@paili0628 paili0628 deleted the compile-sync-with-fsm branch April 29, 2023 00:38
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.

Support sync without std_sync_reg
3 participants