Skip to content

Add failed-stage data, run and stage reports, a journal and constraint helpers to the Python Session - #2875

Open
ganeshgore wants to merge 7 commits into
gg_python_pip_cifrom
gg_agent_api
Open

ganeshgore wants to merge 7 commits into
gg_python_pip_cifrom
gg_agent_api

Conversation

@ganeshgore

@ganeshgore ganeshgore commented Nov 13, 2026 •

Copy link
Copy Markdown
Collaborator

Stacked on #2872 (base gg_python_pip_ci). It adds what a program needs to follow a flow, decide what to run next and say what went wrong: failed-stage data, two reports of the session, a journal and constraint helpers.

The queries about the design that an earlier version of this PR added (device, find, block_info, net_info, congestion hotspots, clock paths) are no longer part of it: they move, with the queries of #2859, to a separate project built on top of OpenFPGA.

What it adds

Why a stage failed

  • OpenfpgaError.diagnostics / .errors: the failures of a command as typed objects (kind, message, file, line, hint, data), with a list of kinds in the docs. Error n: that lands in the middle of a line (stdout is buffered, stderr is not) is found too.
  • A stage that fails without a VPR error (the router finds no legal routing, the circuit does not fit) keeps its data. report_session has failed {stage, message}, and the commands that need the stage say because it failed (...) (diagnostic stage_failed). The next stage command starts from fresh data.

Reports of the session (each has a schema, a section in session_report_commands.rst, a Session method with typed results, and tests against what VPR wrote)

  • report_run: what each stage did (packing, placement cost, routing iterations, wirelength and critical path, time of each stage, the failure if any)
  • report_stage: the options that tune each stage, with the stages that a change drops

Session

  • Session(journal=dir) writes the commands that changed the flow as replay.py and replay.openfpga; Session.replay(path) runs them again. Commands that only answer are left out; the list is Session.READ_ONLY_COMMANDS, which a subclass can extend with its own.
  • set_option, read_vpr_constraints, read_sdc, set_route_chan_width, clear_constraints return a Change with the stages that were dropped.
  • New shell command reset_app_option (an option whose default is empty cannot be set back with set_app_option).
  • The seed sweep example task (seed_sweep_example_script.py) moved here from Add JSON answers for the reports of the shell, report_app_option --json and --changed #2859; it reads the critical path of each run from report_run.

Fixes found on the way

  • A VPR constraints file stayed in force after it was taken away, because the floorplan of the previous run was not cleared when the data of VPR is released.

Tests

openfpga_flow/tasks/python_binding_tests, and the C++ tests of the session, JSON writer and glob matching. New C++ tests cover the failure record and the stage logs of the session. Results are checked against the files and logs that VPR writes.

Notes for review

  • The commits can be read one by one: diagnostics, the failed stages, the journal, the run report, the helpers, report_stage, then the example.
  • A failed route keeps its data until the stage runs again or an option changes; a route that stops with an exception is still dropped.
  • RemoteSession has no journal yet.

@ganeshgore
ganeshgore added this pull request to stack #2834 November 13, 2026 06:16
@ganeshgore
ganeshgore marked this pull request as ready for review November 13, 2026 06:32
@ganeshgore
ganeshgore removed this pull request from stack #2834 November 20, 2026 05:30
@ganeshgore
ganeshgore added this pull request to stack #2890 November 20, 2026 05:30
@ganeshgore ganeshgore changed the title Add queries, failed-stage data, a journal and constraint helpers to the Python Session Add failed-stage data, run and stage reports, a journal and constraint helpers to the Python Session Nov 28, 2026
OpenfpgaError.diagnostics lists what went wrong: the kind of each failure,
the file and line that it names, a hint on what to try, and the facts that
the message contains (the channel width that did not route, the layouts
that are valid). The kinds do not change with the wording of a message.
Failures of a worker have diagnostics too.

The Python code of the module is moved from openfpga/src to
openfpga/python, next to the README of the package.
The task basic_tests/python_shell/seed_sweep packs routing_test once, then
places and routes it with several values of place.seed in one shell. The
critical path and the wirelength of each run are read with report_run,
and all runs are written to seed_sweep.json. The best seed is run again,
must give the same results, and gets the bitstream.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant