Repository navigation
Add typed application options, generated from VPR, with set_app_option and report_app_option - #2840
Open
ganeshgore wants to merge 4 commits into
Open
ganeshgore wants to merge 4 commits into
ganeshgore wants to merge 4 commits into
Conversation
ganeshgore
force-pushed
the
gg_app_options
branch
from
October 27, 2026 15:20
a343575 to
484f004
Compare
ganeshgore
force-pushed
the
gg_app_options
branch
from
November 5, 2026 04:01
f41bb67 to
c0b6c62
Compare
ganeshgore
force-pushed
the
gg_app_options
branch
from
November 5, 2026 05:18
c0b6c62 to
4ec9238
Compare
ganeshgore
force-pushed
the
gg_app_options
branch
from
November 10, 2026 06:59
4ec9238 to
3cb8d8d
Compare
tangxifan
force-pushed
the
gg_app_options
branch
from
November 12, 2026 05:43
3cb8d8d to
0697156
Compare
ganeshgore
force-pushed
the
gg_app_options
branch
from
November 20, 2026 05:14
0697156 to
ddb6627
Compare
ganeshgore
force-pushed
the
gg_app_options
branch
2 times, most recently
from
November 27, 2026 04:45
4e3133d to
fb55321
Compare
ganeshgore
force-pushed
the
gg_app_options
branch
from
December 1, 2026 03:42
fb55321 to
937994d
Compare
ganeshgore
force-pushed
the
gg_app_options
branch
from
December 2, 2026 05:23
937994d to
1a64f2e
Compare
The engines of the flow (clustering, placement, routing, analysis) take many parameters. Keep them in a table of typed options that is owned by the OpenFpgaSession, can be set between the stages, and can be inspected. - AppOptionValue: a string, int, float, bool or selection, with a help message. A selection lists the values it accepts and the enumeration they stand for - AppOptions: a flat map from group.option (e.g., place.seed) to the value, with the default of every option. It can be copied and listed, and an option can be reset - The values are read from text according to the type, and a value that is not valid is refused with a message naming the option and the type, and the choices for a selection. The option keeps its value - 206 options in 11 groups, taken from the VPR options of the version vendored here. Selections carry the VPR enumerations - set_app_option --name <option> --value <value> and report_app_option [--name <option>]. An invalid set is a fatal error - The options are kept when the session is reset - Add unit tests (ctest) and tests of the commands from Python
The hand-written table of options did not follow VPR: against the vendored VTR, 33 of its defaults were not the ones of VPR, and some selections used values that VPR rejects (e.g., gnd for the unconnected outputs of the post-synthesis netlist, or spellings of the analytical placement solvers). VPR reads its options with read_options(), which also infers defaults from the options that were specified. Give the application options to read_options() as a command line, as a user would type them, so that the setup is the one VPR builds. Only the options that differ from their default are given. - Add openfpga_flow/scripts/generate_vpr_option_mapping.py. It reads read_options.h and read_options.cpp, and writes vpr_option_table.cpp: for each option its group, name, type, help, flag, the values a selection accepts (from the parsers of VPR) and a function reading its value from t_options. It fails when a field of t_options has neither an option nor a reason to be left out - The defaults are read from VPR when the options are created. Only the options of OpenFPGA (build_fabric.*) are written by hand - Add vpr_args_from_app_options() and read_vpr_options() - The architecture and the circuit are the positional arguments of VPR. The files VPR names after the circuit stay empty - Remove the hand-written selection maps and the static table - Add unit tests: every field of t_options is accounted for, every option reaches the right field of VPR with its value, the defaults are the ones of VPR, the command line follows the rules of VPR, and the setup VPR shows for an architecture and a circuit is the same from the options and from a command line. Add a ctest that the generated file is up to date
Every application option belongs to a stage of the flow, taken from its group, with a few exceptions among the filename options. Setting an option to a new value, or resetting it, drops the results of that stage and of the stages that depend on it, and keeps the earlier ones and the other branch of the stage tree. Setting the value an option already has changes nothing. The session sets and resets the options, so that nothing can change one without invalidating the stages.
tangxifan
force-pushed
the
gg_app_options
branch
from
December 2, 2026 21:59
1a64f2e to
310aa35
Compare
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
The engines of the flow (clustering, placement, routing, analysis) take many parameters. This adds a table of typed options that the
OpenFpgaSessionowns, that can be set between the stages, and that can be inspected. The options of VPR are generated from VPR's own sources, so their names, types, help, accepted values and defaults follow the version of VPR in use. Setting an option makes the stage it tunes out of date. Nothing in the flow reads the options yet, so behavior is unchanged.Changes
AppOptionValueis a string, int, float, bool or selection, with a help message. A selection lists the values it accepts and the VPR enumeration each stands for.AppOptionsis a flat map fromgroup.option(for exampleplace.seed) to the value, with the default of every option. It can be copied, listed and reset.true/false/on/off/yes/no/1/0for bool, and only the listed values for a selection.The options of VPR are generated by
openfpga_flow/scripts/generate_vpr_option_mapping.pyfromread_options.handread_options.cpp:filename,general,atom,cluster,aplace,place,tplace,router,trouter,analysis,powerandcrr. The groups are VPR's own argument groups.t_options.t_optionsare left out, each with a recorded reason: stage switches, graphics, NoC, run control, verbosity, formats, and options VPR infers. The script fails when a field has neither an option nor a reason.build_fabric.reorder_incoming_edgesandbuild_fabric.sort_gsb_chan_node_in_edges.The options reach VPR as a command line for
read_options(), as a user would type it (vpr_args_from_app_options(),read_vpr_options()).read_options()infers defaults from the options that were specified, so this gives the setup VPR itself would build. Only options that differ from their default are given; the architecture and circuit are the positional arguments.Two new commands:
set_app_option --name <option> --value <value>report_app_option [--name <option>]An invalid
set_app_optionis a fatal error, so a mistyped option in a script does not go unnoticed. Both commands are documented inbasic_commands.rst.OpenFpgaSessionowns the options, and they are kept when the session is reset.Every option belongs to a stage of the flow, taken from its group (
filename,general,atom: device;cluster: packing;aplace,place,tplace: placement;crr,router,trouter: routing;analysis,power: analysis;build_fabric: repacking). A fewfilenameoptions and theappack_*options have the stage of the file or of the packer they concern, and the earlier stage is taken when in doubt.place.seedafter routing keeps the packing and forces placement and routing to run again, and a change toanalysis.*does not touch the repacking.OpenFpgaSession::set_app_option,reset_app_option,reset_app_options), so nothing can change an option without invalidating the stages.libopenfpgashellis untouched and does not depend on VPR.Testing
ctestruns three tests for this:test_app_options(13 cases): the table, parsing by type, refused values, error messages, reset, copies, ownership by the session.test_vpr_app_options(9 cases):t_optionsis accounted for;vpr_option_table_up_to_datefails when the generated file is out of date.test_app_option_stages(10 cases): every option has a stage, the stage of each group and of the exceptions,place.seedafter routing keeps the packing and drops placement and what follows, routing options drop both branches, analysis options keep the repacking, build_fabric options keep the analysis, options of stages not reached change nothing, and an unchanged or refused value keeps the stages. Planted bugs caught: no invalidation, invalidation on an unchanged value, a wrong stage for a group, and dropping everything instead of the dependent stages.trueinstead ofon, defaults sent as well, and a derived file option no longer left empty.Notes
python3 openfpga_flow/scripts/generate_vpr_option_mapping.pyand review the result. The generated file isopenfpga/src/base/vpr_option_table.cpp.place.seedorrouter.max_router_iterationschange can only be tested once the stage commands exist.