Replies: 6 comments 10 replies
-
I am absolutely with you on The data serialization and deserialization from the interpreter is also a real nasty block of code that I wrote once and have generally tried to avoid messing with at all costs, in part because it's not a standalone thing: https://github.com/calyxir/calyx/blob/main/fud/fud/stages/interpreter.py#L270 So I can totally see having things like datagen as their own mini-tool or script set within the repo but we then have to contend with making sure those pieces are available or bundling a bunch of binaries. That, as I think you've pointed out is a cost of moving away from the monolith. I am however interested as to whether using Ninja can make things like caching results easy/free? The data conversion for large programs like LeNet took a non-trivial amount of time and it could be really useful to not have to rerun that since the data-files don't change that often, but building a caching system into fud always seemed like a step too far.
I also wonder how hard/possible it is to emulate the behavior of taking control of |
Beta Was this translation helpful? Give feedback.
-
@sampsyo über cool! I'm a particularly big fan of the
@EclecticGriffin fud grew out of the need to make it easy for people to "run" Calyx programs. This means that you should be able to provide a Calyx file, a data file, and get an output. Other things have been slowly added on top of it, but fundamentally, it is a tool for running Calyx programs. As we develop things like the AXI interface and the FIRRTL backend, what it means to run a Calyx program is changing. It is not enough to have a standard interface for all programs and we'll need to develop a clearer sense of what we're building. The other project management-y thing here is what is the development, migration, and maintenance story for this new tool? |
Beta Was this translation helpful? Give feedback.
-
One prompt to discuss the scope of this tool: we should differentiate between "project build tool" and "file build tool". Something like Edalize seems like a project build tool to me: each project requires specific configuration and edalizes manages the building of the whole set of dependencies. A "file build tool" (which is the misnomer I'm using for Now, the cool thing with |
Beta Was this translation helpful? Give feedback.
-
I'd like to propose some immediate next steps for adoption/migration:
At this point, fud2 would exist alongside OG fud, and we'd have a clear picture of the work required to fully migrate, but OG fud would not yet be deprecated. Hopefully, we can get a little more experience with using and extending fud2 that will clarify what to prioritize. At some later date, we will make the longer-term plan for actually going about the replacement. What do folks think about this short-term plan? Even if you just want to say "sounds fine with me", I would appreciate the validation of knowing y'all don't see any obviously bad ideas with this modest next step. 😃 With apologies for @'ing you, some people I can imagine might have opinions about this stuff would include: @ayakayorihiro @EclecticGriffin @rachitnigam @anshumanmohan (non-exclusively; as ever, I'd love to hear from you even if you're not mentioned here (P.S., as a bonus: fud2 now has Cider stages, so you can do |
Beta Was this translation helpful? Give feedback.
-
One little topic that I would've been excited to discuss if I wasn't going to fall asleep in the next 10 minutes: using Filament
|
Beta Was this translation helpful? Give feedback.
-
On the generator front, I want to bubble-up FuseSoC's approach. You can specify generators using shell scripts: And then parameterize the generation on a per-target basis: https://github.com/olofk/corescore/blob/master/corescore.core#L352 |
Beta Was this translation helpful? Give feedback.
-
fud is an important part of the Calyx ecosystem. What it lacks in research novelty it makes up in sheer utility.
Despite its centrality, fud has some problems. Some of these are baked in and would be pretty hard to change at this point:
verilog.data
config option that is sometimes shared by other stages and sometimes not).I am seeking comments on a proof-of-concept prototype successor to fud I hacked together that addresses all of those problems. It's pretty far from a complete replacement; it is just mature enough to demonstrate that such a replacement might be feasible. I want to show off the design and what is working so far, while at the same time emphasizing that literally everything is up for debate.
Here's a demo of some of the stuff that's currently supported:
The first few seconds are the most interesting; only watch to the end if you like waiting for EDA toolchains!
Design Approach
fud is a compiler driver, in the same sense that
clang
andgcc
are compiler drivers. The interesting thing about fud is that it's an extensible, generic compiler driver: it has a generic way to register different states of a program and the ways to transform between them, and the generic machinery wires all that stuff up according to what you have and what you want.I've thought for a long time about taking another whack at this "generic compiler driver" notion while baking in some of the lessons we've learned over the last several years (see above). This always seemed like a pretty heavy lift, however, primarily because of the basic machinery for executing commands—and doing this in parallel, and doing it incrementally. Even though fud is a compiler driver and not a full-fledged build system, all this started to seem uncomfortably like reimplementing a build system.
The idea that came to me a few weeks ago was that we could reuse an existing build tool to do that hard part: running commands, buffering their output, deciding when to re-run them, etc. Then fud itself could focus on the planning part, i.e., deciding which commands to run. Namely, there exists a popular tool with exactly this intent (just running jobs, while delegating the plan of what to execute): Ninja.
So that's the approach. There are two crates:
ninja.build
file, and invokesninja
.Quick User Manual
You need a configuration file, at
~/.config/fud2.toml
. Start with something like this:The
data
path goes tofud2/data
within the fake repo.calyx.base
goes to your Calyx checkout. That's enough to get started.You'll also need to install Ninja, which you can do from most package managers.
Here's what works in the current prototype:
fud2 <file> -o <file>
: Do the thing.-o <file>
with--to <state>
to print to stdout.<file>
with--from <state>
to read from stdin.--set <key>=<value>
to override configuration options (or-s
for short). For example,-s sim.data=<path>
to specify the data file for simulation.--keep
if you want to keep the intermediate files, which enables incremental compilation. You can find the intermediate files in a directory.fud2
inside the working directory. Without--keep
, this gets automatically deleted after execution finishes.There are a few alternative modes you can try too:
--mode gen
: Just generate the.fud2/build.ninja
file but don't actually build anything. You can then typeninja -C .fud2
to run the build.--mode emit
: Just print out the Ninja file. If you like, you can always dofud2 [...] --mode emit > build.ninja && ninja
to make fud2 work more like a "normal" build system.--mode plan
: Show a simple listing of the plan fud2 found for you (the sequence of operators it wants to run).--mode dot
: Produce a GraphViz visualization of the selected plan, as a path through all available states. See below for an example.What Is Lost
Here are some good things about OG fud that are not really possible in fud2 without a very different design:
dlopen
or whatever, but I'm just not sure it's worth it. (This cost is just because of switching from Python to Rust.)readmemh
or whatever. fud2 does not build in stuff like this. In fact, the current PoC ships with a little Python script that just invokes OG fud's machinery to do this!Status of the Proof of Concept
Here are some things missing from the PoC that probably wouldn't be that hard to implement:
fud config
).fud check
).Discussion Questions
I will claim a meeting slot to talk more about this. But even in the mean time, I am curious what people think about this approach!
Thanks for taking a look!! Please post any and all questions; I am sure I left lots of details out.
Beta Was this translation helpful? Give feedback.
All reactions