Closed rachitnigam closed 11 months ago
Two things that came up during the meeting:
Marking this as available! Let's build an MVP that can support connection with flopoco
which is kind of the perfect use case for this. In building it, I suspect we'll find lots of pain points and places to refine the design.
Filament now has all the features required to model ADLs as parameterized generators. The next step is to build tools that enable us to quickly connect together tools and enable optimization flows. There are a couple of relevant efforts here:
332: Integrating HLS and Filament modules
118: A Module system for Filament
At a high-level, I want to enable the following:
gen
to parse the names and parameters for the modules and generate a manifest to call various external tools.Next up, I want to build a tool called
opt
that can use results from synthesis or estimation flows and modulate the knobs of the generator tools to optimize the design while guaranteeing. This modulation should not affect the final designs because the wrappers should be timing abstract.Together, these tools will make Filament's ADL integration story very clear: transparent integration and powerful optimization.
Language-level Representation
First, we need to figure out how to represent modules that need to be generated from some tool. I think the simplest thing to do here is define something like the
extern
block where users provide shims for modules and have them be generated from the external tool:The above command will use the tool named
aetherling
to generate the modulesConv2D
andSharpen
. We can use this module like any otherextern
module in Filament:For the purposed of the Filament compiler, there is no difference between a
generate
block and anextern
block; they both declare modules that are not Filament source files.Tool Interface
To figure out how to use a particular tool, we need a couple of pieces of information about it:
Note that all of this information is already present in the above
generate
block! The big insight here is that the language-level construct actually already has a lot of the information needed to interface with the tool. However, a couple of pieces of information is missing:Conv2D[10]
need to be transformed toConv2D_10
?All of this information is defined in a TOML file:
And we slightly modify the
generate
definition to point to this tool declaration:Now we have a complete tool interface in our hands!
Generation Manifest
To invoke the tool, we parse the uses of the modules and generate the following manifest file:
The program uses the
Conv2D
module twice andSharpen
once with the given parameters. Given this information, thegen
tool can invoke the various tools and generate the modules. The result will be one or more files Verilog files and corresponding Filament shim files:There is a couple of things going on here:
aetherling_conv2d_10.sv
andaetherling_conv2d_20.sv
define the generated modules.Conv2D
that matches on the value of parameters and instantiates the appropriate module automatically.Once we have all these generated modules, we can go ahead and link them to the original Filament program and compile it as usual.