Repository navigation
genReportTable: don't let an image format change empty the gallery - #4465
Conversation
The image gallery collected files with file.endswith(".webp") and derived
the view name with file[:-5], so it silently depended on OpenROAD writing
exactly the extension save_images.tcl asked for.
It doesn't always. gui::Utils::fixImagePath appends .png when Qt has no
writer for the requested format, and the bazel-built GUI has no webp
writer because the qt-bazel prebuilts don't ship Qt's qwebp plugin. Such
a run produces final_clocks.webp.png and friends, matches nothing here,
and writes no report-gallery-*.html at all -- while still reporting
success. That is the failure mode that made The-OpenROAD-Project#4371 hard to see.
Accept .webp and .png, case-insensitively, and strip trailing image
extensions in a loop instead of a fixed five characters. The loop also
collapses the doubled .webp.png back to the intended view name, so a
gallery from an affected binary is correct rather than merely non-empty.
Verified on a synthetic reports/ tree: .webp, .webp.png and .PNG all
resolve to the same view names, where the previous code produced no
gallery for the .webp.png case.
The webp writer itself is being added in
The-OpenROAD-Project/qt_bazel_prebuilts#14; this is the belt-and-braces
half, so the next format change cannot silently empty the gallery again.
Refs: The-OpenROAD-Project#4371
Signed-off-by: SombraSoft <jsombrio@precisioninno.com>
There was a problem hiding this comment.
Code Review
This pull request updates the report table generator to support both .webp and .png image formats, addressing an issue where the GUI silently falls back to .png when a WebP writer is unavailable. It introduces a helper function image_view_name to dynamically strip these extensions. The review feedback suggests simplifying this helper function to avoid duplicate calls to os.path.splitext by using a cleaner loop structure.
| def image_view_name(file): | ||
| view, ext = os.path.splitext(file) | ||
| while ext.lower() in IMAGE_EXTENSIONS: | ||
| file = view | ||
| view, ext = os.path.splitext(file) | ||
| return file |
There was a problem hiding this comment.
The current implementation of image_view_name duplicates the call to os.path.splitext. We can simplify this function by using a while True loop and breaking when the extension is no longer in IMAGE_EXTENSIONS. This avoids code duplication and improves readability.
| def image_view_name(file): | |
| view, ext = os.path.splitext(file) | |
| while ext.lower() in IMAGE_EXTENSIONS: | |
| file = view | |
| view, ext = os.path.splitext(file) | |
| return file | |
| def image_view_name(file): | |
| while True: | |
| base, ext = os.path.splitext(file) | |
| if ext.lower() not in IMAGE_EXTENSIONS: | |
| break | |
| file = base | |
| return file |
🔍 QoR checkMetrics reflect the PR merge build — i.e. what will land on the target branch. Advisory — results are log-only and do not affect build status. The authoritative QoR gate remains the local rules-file check. Commit 62 design(s) checked — 0 with regression(s), 0 without a comparable baseline.
|
Follow-up to #4371, addressing a silent failure found while diagnosing it.
Problem
flow/util/genReportTable.py:337collected gallery images withfile.endswith(".webp")and derived the view name withfile[:-5]. That hard-codes the assumption that OpenROAD writes exactly the extensionsave_images.tclasked for.It doesn't always.
gui::Utils::fixImagePathappends.pngwhen Qt has no writer for the requested format, and a Bazel-built GUI has no webp writer at all (theqt-bazelprebuilts don't ship Qt'sqwebpplugin — being fixed in The-OpenROAD-Project/qt_bazel_prebuilts#14). Such a run producesfinal_clocks.webp.png,final_placement.webp.png, … which match nothing here.The result is worse than a broken gallery: no
report-gallery-*.htmlis written at all, and the run still reports success. That's a large part of why #4371 was confusing to chase — the images were being produced, just under names nothing downstream recognised.Change
.webpand.png, case-insensitively..webp.pngback to the intended view name, so a gallery generated from an affected binary is correct, not merely non-empty.No behaviour change for a healthy
.webp-only run.Verification
Synthetic
reports/tree covering all three shapes:final_clocks.webpfinal_clocksfinal_clocks.webp.pngfinal_clocksfinal_placement.PNGfinal_placementRe-ran the real script against that tree with the pre-change version to confirm the middle row: zero
report-gallery-*.htmlfiles produced.Why this and not just switching to .png
WebP is worth keeping — it was roughly 2.2× smaller than PNG on the same clock tree image in my measurements (8.4 KB vs 19 KB), which matters across a full CI matrix. The real fix is giving the Bazel build a webp writer. This change is the belt-and-braces half, so that the next image format change can't silently empty the gallery again.
Note that
images[design][platform][view]is keyed on the stripped view name, so if a directory somehow held bothfinal_clocks.webpandfinal_clocks.pngthe lateros.walkentry would win. That seemed not worth guarding — it can't arise from a single flow run, and either file is a valid image for that view.