Skip to content

genReportTable: don't let an image format change empty the gallery - #4465

Merged
maliberty merged 1 commit into
The-OpenROAD-Project:masterfrom
The-OpenROAD-Project-staging:harden-report-gallery-image-extensions
Aug 24, 2026
Merged

maliberty merged 1 commit into
The-OpenROAD-Project:masterfrom
The-OpenROAD-Project-staging:harden-report-gallery-image-extensions

Conversation

@openroad-ci

Copy link
Copy Markdown
Member

Follow-up to #4371, addressing a silent failure found while diagnosing it.

Problem

flow/util/genReportTable.py:337 collected gallery images with file.endswith(".webp") and derived the view name with file[:-5]. That hard-codes the assumption that OpenROAD writes 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 a Bazel-built GUI has no webp writer at all (the qt-bazel prebuilts don't ship Qt's qwebp plugin — being fixed in The-OpenROAD-Project/qt_bazel_prebuilts#14). Such a run produces final_clocks.webp.png, final_placement.webp.png, … which match nothing here.

The result is worse than a broken gallery: no report-gallery-*.html is 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

  • Accept .webp and .png, case-insensitively.
  • Derive the view name by stripping trailing image extensions in a loop rather than a fixed five characters. The loop also collapses the doubled .webp.png back 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:

file on disk view name in gallery before after
final_clocks.webp final_clocks yes yes
final_clocks.webp.png final_clocks no gallery written at all yes
final_placement.PNG final_placement no yes

Re-ran the real script against that tree with the pre-change version to confirm the middle row: zero report-gallery-*.html files 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 both final_clocks.webp and final_clocks.png the later os.walk entry 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.

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>

@gemini-code-assist gemini-code-assist Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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.

Comment on lines +338 to +343
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

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

medium

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.

Suggested change
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

@maliberty
maliberty enabled auto-merge August 24, 2026 17:45
@openroad-ci

Copy link
Copy Markdown
Member Author

🔍 QoR check

Metrics 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 d739485 · Jenkins build #1 · Baseline: build

62 design(s) checked — 0 with regression(s), 0 without a comparable baseline.
Design Variant Verdict local vs inline passed / failed / missing
asap7/aes base ✅ pass ✅ MATCH 25 / 0 / 0
asap7/aes-block base ✅ pass ✅ MATCH 25 / 0 / 0
asap7/aes-mbff base ✅ pass ✅ MATCH 25 / 0 / 0
asap7/aes_lvt base ✅ pass ✅ MATCH 25 / 0 / 0
asap7/cva6 base ✅ pass ✅ MATCH 12 / 0 / 0
asap7/ethmac base ✅ pass ✅ MATCH 25 / 0 / 0
asap7/ethmac_lvt base ✅ pass ✅ MATCH 25 / 0 / 0
asap7/gcd base ✅ pass ✅ MATCH 25 / 0 / 0
asap7/gcd-ccs base ✅ pass ✅ MATCH 25 / 0 / 0
asap7/ibex base ✅ pass ✅ MATCH 25 / 0 / 0
asap7/jpeg base ✅ pass ✅ MATCH 25 / 0 / 0
asap7/jpeg_lvt base ✅ pass ✅ MATCH 25 / 0 / 0
asap7/mock-alu base ✅ pass ✅ MATCH 25 / 0 / 0
asap7/mock-cpu base ✅ pass ✅ MATCH 25 / 0 / 0
asap7/riscv32i base ✅ pass ✅ MATCH 25 / 0 / 0
asap7/riscv32i-mock-sram base ✅ pass ✅ MATCH 25 / 0 / 0
asap7/swerv_wrapper base ✅ pass ✅ MATCH 25 / 0 / 0
asap7/uart base ✅ pass ✅ MATCH 25 / 0 / 0
gf180/aes base ✅ pass ✅ MATCH 25 / 0 / 0
gf180/aes-hybrid base ✅ pass ✅ MATCH 25 / 0 / 0
gf180/ibex base ✅ pass ✅ MATCH 25 / 0 / 0
gf180/jpeg base ✅ pass ✅ MATCH 25 / 0 / 0
gf180/riscv32i base ✅ pass ✅ MATCH 25 / 0 / 0
gf180/uart-blocks base ✅ pass ✅ MATCH 25 / 0 / 0
gt2n/aes base ✅ pass ✅ MATCH 25 / 0 / 0
gt2n/gcd base ✅ pass ✅ MATCH 25 / 0 / 0
gt2n/jpeg base ✅ pass ✅ MATCH 25 / 0 / 0
ihp-sg13g2/aes base ✅ pass ✅ MATCH 25 / 0 / 0
ihp-sg13g2/gcd base ✅ pass ✅ MATCH 25 / 0 / 0
ihp-sg13g2/i2c-gpio-expander base ✅ pass ✅ MATCH 25 / 0 / 0
ihp-sg13g2/ibex base ✅ pass ✅ MATCH 25 / 0 / 0
ihp-sg13g2/jpeg base ✅ pass ✅ MATCH 25 / 0 / 0
ihp-sg13g2/riscv32i base ✅ pass ✅ MATCH 25 / 0 / 0
ihp-sg13g2/spi base ✅ pass ✅ MATCH 25 / 0 / 0
nangate45/aes base ✅ pass ✅ MATCH 25 / 0 / 0
nangate45/ariane133 base ✅ pass ✅ MATCH 25 / 0 / 0
nangate45/ariane136 base ✅ pass ✅ MATCH 25 / 0 / 0
nangate45/black_parrot base ✅ pass ✅ MATCH 25 / 0 / 0
nangate45/bp_be_top base ✅ pass ✅ MATCH 25 / 0 / 0
nangate45/bp_fe_top base ✅ pass ✅ MATCH 25 / 0 / 0
nangate45/bp_multi_top base ✅ pass ✅ MATCH 25 / 0 / 0
nangate45/cva6 base ✅ pass ✅ MATCH 25 / 0 / 0
nangate45/dynamic_node base ✅ pass ✅ MATCH 25 / 0 / 0
nangate45/gcd base ✅ pass ✅ MATCH 25 / 0 / 0
nangate45/ibex base ✅ pass ✅ MATCH 25 / 0 / 0
nangate45/jpeg base ✅ pass ✅ MATCH 25 / 0 / 0
nangate45/mempool_group base ✅ pass ✅ MATCH 12 / 0 / 0
nangate45/swerv base ✅ pass ✅ MATCH 25 / 0 / 0
nangate45/swerv_wrapper base ✅ pass ✅ MATCH 25 / 0 / 0
nangate45/tinyRocket base ✅ pass ✅ MATCH 25 / 0 / 0
sky130hd/aes base ✅ pass ✅ MATCH 25 / 0 / 0
sky130hd/chameleon base ✅ pass ✅ MATCH 25 / 0 / 0
sky130hd/gcd base ✅ pass ✅ MATCH 25 / 0 / 0
sky130hd/ibex base ✅ pass ✅ MATCH 25 / 0 / 0
sky130hd/jpeg base ✅ pass ✅ MATCH 25 / 0 / 0
sky130hd/microwatt base ✅ pass ✅ MATCH 25 / 0 / 0
sky130hd/riscv32i base ✅ pass ✅ MATCH 25 / 0 / 0
sky130hs/aes base ✅ pass ✅ MATCH 25 / 0 / 0
sky130hs/gcd base ✅ pass ✅ MATCH 25 / 0 / 0
sky130hs/ibex base ✅ pass ✅ MATCH 25 / 0 / 0
sky130hs/jpeg base ✅ pass ✅ MATCH 25 / 0 / 0
sky130hs/riscv32i base ✅ pass ✅ MATCH 25 / 0 / 0

@maliberty
maliberty merged commit 7386fff into The-OpenROAD-Project:master Aug 24, 2026
8 of 9 checks passed
@maliberty
maliberty deleted the harden-report-gallery-image-extensions branch August 24, 2026 18:37
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants