-
Notifications
You must be signed in to change notification settings - Fork 10
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
chisel refactoring to enable split main <-> test #104
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I feel like it does look cleaner because all test files are collated (collected/aggregated). My only worry is:
- Will it break when I generate new parameters? I left some comments on parts that i think are critical.
- Will it also break @xiaoling-yi 's flow? Haha, make sure to discuss together and meet half-way 😄
hw/chisel/src/test/scala/snax/csr_manager/CsrManagerGenerate.scala
Outdated
Show resolved
Hide resolved
hw/chisel/src/test/scala/snax/csr_manager/CsrManagerGenerate.scala
Outdated
Show resolved
Hide resolved
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
For this file too make sure to add those I mean one of those and test if they generate properly: sbt "runMain snax.streamer.MacStreamerTop "
// streamertop for MAC
object MacStreamerTop extends App {
emitVerilog(
new StreamerTop(
StreamerParams(
temporalAddrGenUnitParams =
MacStreamerParameters.temporalAddrGenUnitParams,
fifoReaderParams = MacStreamerParameters.fifoReaderParams,
fifoWriterParams = MacStreamerParameters.fifoWriterParams,
stationarity = MacStreamerParameters.stationarity,
dataReaderParams = MacStreamerParameters.dataReaderParams,
dataWriterParams = MacStreamerParameters.dataWriterParams
)
),
Array("--target-dir", "generated/streamertop/mac")
)
}
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
See comment above!
Array("--target-dir", "generated/") | ||
) | ||
|
||
} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I vote to put the parameter example for instancing gemm and simd back. We can write some comments in the code to say this example configuration is for which accelerator. Because I think 1) these example configurations are good for people to understand how to configure the streamer for different use cases as the configuration format of the streamer is quite complicated. 2) making sure the streamer still works after any modification for these configurations is essential. 3) These configurations show the streamer's reusability, working for different accelerators.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Alright! As discussed: we like to avoid having code that is not used anywhere. Therefore the example configuration is displayed in the added documentation. The tests for different configurations are run through the automatic generation of scala parameters using the .hjson configuration files! For now this is only ALU but when the other accelerators are added these will be tested as well!
0b6d13d
to
0aabecc
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Overall this PR looks good to me, I just have some small comments. Please kindly check it!
hw/chisel/.gitignore
Outdated
@@ -0,0 +1,5 @@ | |||
generated | |||
project |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Actually, two files in the ./hw/chisel/project
folder is used, which are plugins.sbt
and build.properties
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Aha, yes I missed this, I excluded those two files!
hw/chisel/doc/streamer.md
Outdated
|
||
<p align="center"> | ||
<img src="./docs/microarch.svg" alt=""> | ||
</p> |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This figure is disappeared!
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I re-added it!
hw/chisel/doc/streamer.md
Outdated
| tcdm_req | write | io_data_tcdm_req_0_bits_write | 1| Out| The signal indicates this request is for CSR write or read. | | ||
| tcdm_req | valid | io_data_tcdm_req_0_valid | 1| Out| The signal indicates if this request is valid. | | ||
| tcdm_req | ready | io_data_tcdm_req_0_ready | 1| Int| The signal indicates if the TCDM is ready for this CSR request. | | ||
| | . | . | . | . | There can be a large number of tcdm_req ports depending on the spatial unrolling factors for the data readers and the data writers. tcdm_req ports for readers have lower index number. A detailed mapping for the tcdm_req ports and the data mover ports can be found at `Streamer.scala` line 269-311.| |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The line number is 330-372 now. Or we can delete the line number here.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yes I just deleted it because it might change later
| offset + [0..temporalDim - 1] | temporalLoopBoundCSRs | temporal loop bound for each temporal dimension. | | ||
| offset + temporalDim + [0..temdataMoverNum * temporalDimporalDim - 1] | temporalLoopSrtidesCSRs | temporal loop strides for each temporal dimension and for each data mover. | | ||
| offset + temporalDim + dataMoverNum * temporalDim + [0..spatialDim.sum - 1] | spatialLoopSrtidesCSRs | spatial loop strides for each data mover and for corresponding spatial dimension. The spatial dimension for each data mover can be different. It depends on the accelerator. | | ||
| offset + temporalDim + dataMoverNum * temporalDim + spatialDim.sum + [0..dataMoverNum - 1] | basePtrCSRs | base pointers for each data mover. | |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Add the status CSR here too?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Added!
Array("--target-dir", "generated/") | ||
) | ||
|
||
} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Can we add the modular system verilog generation test back? It is useful for modular generation and tests.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
What is the modular system verilog genration?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I mean the code like this:
emitVerilog( new SpatialAddrGenUnit(SpatialAddrGenUnitParams()), Array("--target-dir", "generated/streamer") )
for testing the system verilog genration for each module.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
We do not want people to use subparts as systemverilog components, right?
The testing of systemverilog generation is done by the top module, the only one that we are going to use. All lower modules are included in this test. Having them separate is duplicated testing, and is confusing as we don't want to generate verilog for the modules separately. Does that make sense?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Ok, I understand your point of view. I am fine to merge this PR.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Ok, thank you!
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I will give the go signal here but I prefer Xiaoling gives the final go signal since she uses this more closely than I do 😄
Otherwise, I am okay with it. Let's just make sure to fill-in the CSR manager docu.
hw/chisel/doc/microarch.svg
Outdated
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Do you think it's better we dump images in our repo? I have images that were dumped in a google drive then sent the link to the gh pages 😅 what do you think?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
A lot of people seem to have a lot of opinions about this but in the end it doesn't seem to matter much 😅 . The only worry about Google Drive links is that if they disappear they are gone forever. Maybe the best way is including it as github user content, I'll change it to that!
hw/chisel/README.md
Outdated
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I'm actually surprised we put the README's in this PR already. For the CSR Manager we do that in a separate PR?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yes, ideally it should've been included previously, but I never noticed. We need it here because the readme replaces some code that wasn't used and thus removed. For the CSR manager we indeed best separate it. Although is there already documentation for this? The streamer readme is just a copy from the old repo
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I made a new issue #106 for this 😄
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thank you!
} | ||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Should the streamer test parameter be in the streamer folder?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yes, this was an error. I fixed it!
Array("--target-dir", "generated/") | ||
) | ||
|
||
} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I mean the code like this:
emitVerilog( new SpatialAddrGenUnit(SpatialAddrGenUnitParams()), Array("--target-dir", "generated/streamer") )
for testing the system verilog genration for each module.
* dnn: Increase error threshold in FA-2 * dnn: Switch to naive FP32 as baseline fails in FlashAttention-2 * target: Re-introduce FlashAttention in CI --------- Co-authored-by: Viviane Potocnik <[email protected]> Co-authored-by: Luca Colagrande <[email protected]>
* light refactoring to enable split main <-> test * enable CI to actually run the Chisel unit tests * remove unused instance parameters * formatting * cleaning up some test params * resolve trailing space * add chisel .gitignore * add verilog generator scripts to test * use TestParameters * move test parameters back to /tests * add streamer documentation * rename documentation file * add chisel readme * add documentation image * update image path * address comments * update streamer.md image * Delete hw/chisel/doc/microarch.svg * move test parameters to correct folder
See here my proposals to be able to split testing and source code without errors.
This includes the following: