-
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
sw: Add minimal runtime and toolchain file for generic llvm compilation #57
Conversation
@rgantonio I need a newer version of the container to run these tests. |
OMG I just saw this now haha wait haha |
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.
Got some questions of course!
Hmm I wonder how to do the /rtl
part without copy-pasting hmmm.
target/snitch_cluster/sw/Makefile
Outdated
@@ -30,5 +32,5 @@ apps: $(RUNTIME) math $(SNAX_MAC) $(SNAX_GEMM) | |||
tests: $(RUNTIME) math $(SNAX_MAC) $(SNAX_GEMM) | |||
$(MAKE) -C $@ $(TARGET) | |||
|
|||
runtime/rtl runtime/banshee math $(SNAX_MAC) $(SNAX_GEMM): | |||
runtime/rtl runtime/banshee runtime/rtl-generic math $(SNAX_MAC) $(SNAX_GEMM): |
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.
Are there dependencies between runtime/rtl
and runtime/rtl-generic
?
Maybe we can just do the same $(RUNTIME)
for this part.
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.
@rgantonio, no there are none. Actually now that I'm thinking of this, I would actually prefer it if we could change the other targets on this line also to be snax/mac
and snax/gemm
instead, in that way it is nice and explicit what is being built, but if the name changes then you get a lot of place to change it....
I don't know what the best solution is hahah. Let me know if you still like me to change it
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.
@JosseVanDelm let's change it to the snax/mac
and the snax/gemm
version. In the latest Snitch Cluster they used it this way :)
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.
@JosseVanDelm maybe change the $(SNAX_MAC)
and $(SNAX_GEMM)
as well? So it's uniform? Just an idea haha although it's just a minor thing...
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 know you are not a fan of file duplication haha I wonder if we can actually break the run-yaml tests down separately.
For example, maybe we have:
run-fp.yaml
that actually runs all the fp builds onlyrun-basic.yaml
tests things likeatomics.elf
,barrier.elf
,dma_simple.elf
and so on.run-snax-mac.yaml
only tests thesnax-mac
stuff
Then in the ci
we can always call multiple run.py
tests for the different tests. 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.
@rgantonio I was looking at ways to include yaml files into one, but actually just calling run multiple times makes much more sense, will look into 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.
@JosseVanDelm I was also looking if there was a conditional statement way of doing it in yaml haha but it's not elegant I think. I mean there is but it looked odd...
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.
@rgantonio I've split up the tests and it seems to work now 😄, while also being about 100 lines less!
7d4a16f
to
bd733e4
Compare
@JosseVanDelm since this is WIP, I will ask permission to add/remove stuff just to kick the CI haha |
@JosseVanDelm I fixed the docker thing :) tomorrow I will do the docker build PR for automatic builds. |
This reverts commit 03ba20b.
Also appears to be disabled upstream
Not sure if it works with the newest version
These tests require 9 cores (1 data mover + 8 compute)
Some tests require multiple cores to be present
3908f36
to
016e202
Compare
This might just be the ugliest fix ever, but it seems to work
@rgantonio I went from 391 to 340 lines with the last commit, it's the ugliest way to include the rtl thing, but it works |
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 is super nice!
I can't notice anything wrong, but I'm not super familiar with the codebase.
It might be useful to include the PR documentation and support matrix to the documentation for future reference. If we add custom support for something in a specific combination of toolchain-runtime, we can keep track of this nicely.
Also the support matrix in a following format looks more clear to me:
Runtime | rtl | rtl-generic | |
---|---|---|---|
Toolchain | llvm-snitch | llvm-generic | |
LLVM Version | 12 ❌ | 12 ❌ | 17 ✔️ |
Custom Instructions | ✔️ | ✔️ | ❌ |
OpenMP Support | ✔️ | ❌ | ❌ |
SSR Support | ✔️ | ❌ | ❌ |
Data Mover Support | ✔️ | ❌ | ❌ |
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.
BYUTIPUL with the current. And maybe also consider some of the comments I made? 😄
Very minor things. I think the testing in CI to build 1 hardware but just change the SW builds should be better so it reduces build time 😄
./run.py --simulator verilator \ | ||
sw/runtime.yaml sw/snitch-cluster-runtime.yaml sw/custom-fp.yaml \ | ||
sw/standard-fp.yaml sw/openmp.yaml sw/snitch-cluster-openmp.yaml \ | ||
sw/blas.yaml sw/dnn.yaml -j | ||
|
||
|
||
############################################## |
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.
Label to SNAX Cluster w/ Verilator? hehe I think I forgot to change this too.
make -C target/snitch_cluster sw \ | ||
SELECT_RUNTIME=rtl-generic \ | ||
SELECT_TOOLCHAIN=llvm-generic | ||
- name: Run Tests | ||
working-directory: target/snitch_cluster | ||
run: |- | ||
./run.py --simulator verilator \ | ||
sw/runtime.yaml sw/standard-fp.yaml sw/snax-gemm-run.yaml -j |
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.
Of course, same as above haha
target/snitch_cluster/sw/Makefile
Outdated
@@ -30,5 +32,5 @@ apps: $(RUNTIME) math $(SNAX_MAC) $(SNAX_GEMM) | |||
tests: $(RUNTIME) math $(SNAX_MAC) $(SNAX_GEMM) | |||
$(MAKE) -C $@ $(TARGET) | |||
|
|||
runtime/rtl runtime/banshee math $(SNAX_MAC) $(SNAX_GEMM): | |||
runtime/rtl runtime/banshee runtime/rtl-generic math $(SNAX_MAC) $(SNAX_GEMM): |
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.
@JosseVanDelm maybe change the $(SNAX_MAC)
and $(SNAX_GEMM)
as well? So it's uniform? Just an idea haha although it's just a minor thing...
@JosseVanDelm push? |
…on (#57) * Add rtl-generic runtime which compiles with generic llvm * Add generic llvm toolchain and generic toolchain setting * Add LLVM generic toolchain installation to chisel dockerfile * Make makefile work with rtl-generic and clang-12 * Add zfh option and generic llvm examples * Move toolchain selection to toolchain.mk * Make yaml-lint happy * Add back removed files from rtl-generic runtime for clarity * Make lint-yaml even happier * Hardcode an oopsie in toolchain.mk to make old toolchain work * Add tests with generic runtime to CI * Revert "Add LLVM generic toolchain installation to chisel dockerfile" This reverts commit 03ba20b. * Add separate test files * Disable interrupt test Also appears to be disabled upstream * Clean up DNN tests * Hardcode version of clang runtime to be 12.0.1 Not sure if it works with the newest version * Move snitch_cluster specific tests to separate file These tests require 9 cores (1 data mover + 8 compute) * Split openmp tests into snitch-cluster specific ones Some tests require multiple cores to be present * Add right test invocations to snitch-runtime specific ones * Add multiple tests to single runner * Fix -j argument in test runner * Add snitch-specific parts to test build * Reduce rtl runtime code duplication This might just be the ugliest fix ever, but it seems to work * Fix comment in CI workflow * Make makefile more uniform
Add generic LLVM support
This adds an opt-in option for two things that are closely related:
can be invoked with
make sw SELECT_RUNTIME=rtl-generic
can be invoked with
make sw SELECT_RUNTIME=rtl-generic SELECT_TOOLCHAIN=llvm-generic
This combination yields a new "support matrix":
What I had to do to make this happen:
/target/snitch_cluster/sw/runtime/rtl-generic
, this is largely the same as/target/snitch_cluster/sw/runtime/rtl
, but disables a few imports that mostly require custom builtins, that are not known to generic LLVM. Onlysnrt.c
andsnrt.h
are adapted. I've kept the comments to make clear what disappeared. Other files literally include theirrtl
counterparts.if(n)eq
statements that switch onSELECT_RUNTIME
andSELECT_TOOLCHAIN
parameters, to disable the build of certain programs.make sw SELECT_TOOLCHAIN=llvm-generic SELECT_RUNTIME=rtl-generic
In more detail, functionality we lose by going to generic LLVM
Note that we are giving up certain functionality here:
I'm not sure how these relate to the dma instructions, because those seem to work just fine.
Zfhmin
,Zfh
). This means that many of the computational kernels in the blas and dnn folders don't work anymore, since they contain inline assembly that needs to be known by the compiler.For non-relocatable instructions it should be fine to replace these with hardcoded
.word
directives inside the assembly.To do's
Refactor run.yaml to have one for the generic runtimeThere are now three different files for the above, suggestions welcome!refactor generic runtime to not copy-paste all files?I don't know how to do this, currently all files within rtl-generic folder are just copy pasted from the rtl folder.Edit license headerslooks fine