Skip to content

Conversation

@PankhudiJ17
Copy link

@PankhudiJ17 PankhudiJ17 commented May 26, 2025

This pull request addresses build issues encountered on Power architecture with GCC-11, specifically related to the following components: pg_bitutils.c (PostgreSQL), m4, and BoringSSL. The fixes ensure better compatibility and successful compilation on Power systems using GCC-11.

Summary of Changes

  1. Power Architecture Support – PostgreSQL Patch

A patch has been added to resolve a build error in pg_bitutils.c encountered specifically on Power architecture.
Patch location: //ml_metadata/third_party:postgresql.patch

  1. GCC-11 Compatibility Fix – m4 Patch
    Resolved the following compilation error in c-stack.c when building m4 with GCC-11:
    error:
    missing binary operator before token "(" #elif HAVE_LIBSIGSEGV && SIGSTKSZ < 16384

Upstream patch taken from Debian sources:
https://launchpad.net/ubuntu/+archive/primary/+sourcefiles/m4/1.4.18-5ubuntu1/m4_1.4.18-5ubuntu1.debian.tar.xz
Patch location: ml_metadata/third_party:zetasql.patch

  1. Boringssl Update for GCC-11
    A build error was encountered with the previous version of BoringSSL on Power architecture using GCC-11.
    The issue was resolved by upgrading the boringssl version.
    Update location: WORKSPACE file

  2. Test Case Fix for Abseil (absl)
    Patch location: ml_metadata/metadata_store/metadata_store.py

Purpose of this PR:
These changes are necessary to ensure successful builds of ml_metadata on Power architecture with GCC-11. They improve cross-platform compatibility and ensure smoother CI/CD integration for platforms using newer compilers.

Summary by CodeRabbit

  • Chores
    • Updated dependency versions and integrity checks for improved reliability.
    • Applied a patch to enhance compatibility with certain CPU architectures.
    • Suppressed specific compiler warnings in the Red Hat-based server build.
    • Improved initialization of configuration flags for testing environments.

@tarilabs
Copy link
Member

tarilabs commented Jun 5, 2025

/ok-to-test

Copy link
Member

@tarilabs tarilabs left a comment

Choose a reason for hiding this comment

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

As mentioned offline, in MR we're not using PgSQL mainly due to this limitation:
google#194

We provided a (potential) solution upstream with
google#195

but was never curated for more than a year now.

More in general, we're moving away from MLMD with:
kubeflow/model-registry#865

So in conclusion in MR team we're not using PgSQL<->MLMD and we're moving away from MLMD going fwd.

This PR looks to me mainly focus on PgSQL and other dependency upgrades which in general
/lgtm
also based on the test results documentation provided offline.

I can't advise on the CI failures and which need actual resolution.

Hope this helps!

@alhad-deshpande
Copy link

Hi @tarilabs
Thanks for the review, This PR mainly enables building ml-metdata on Power with GCC-11.

We checked the CI failure and the reason behind looks like it failed to download zetasql repo.
ERROR: An error occurred during the fetch of repository 'com_google_zetasql':

When we checked on cloned repo from opendatahub-io/ml-metadata and triggered CI build by pushing to a new branch, there the build gone ahead and it got built successfully.
https://github.com/Sunidhi-Gaonkar1/ml-metadata/actions/runs/15460242271/job/43519900281

Can you please re-trigger once this build?

@tarilabs
Copy link
Member

tarilabs commented Jun 5, 2025

retriggered as reqeusted

@alhad-deshpande
Copy link

@tarilabs
We checked this and found that the ZetaSQL commit Id is getting changed in CI pipeline for UBI 9.3 at https://github.com/opendatahub-io/ml-metadata/blob/master/ml_metadata/tools/docker_server/Dockerfile.redhat#L36.

Hence, we are checking now what all patches are necessary for new commit Id "f764f4e986ac1516ab5ae95e6d6ce2f4416cc6ff" which is getting used. Will push changes with the fix once done.

@alhad-deshpande
Copy link

@tarilabs
Fixed the build issues for zetasql version f764f4e986ac1516ab5ae95e6d6ce2f4416cc6ff which is used for UBI 9.3.

Can you please trigger build now?

@tarilabs
Copy link
Member

tarilabs commented Jun 6, 2025

retriggered as requested.

@alhad-deshpande
Copy link

@tarilabs
The build is successful. Can you please approve/merge this PR?

@tarilabs
Copy link
Member

I'd appreciate an additional reviewer, I've given my LGTM already with #19 (review) but according to process someone else should Approve it. I will eventually be happy to merge it for you.

@alhad-deshpande
Copy link

@tarilabs
Can you please share the list of reviewers who can help?

@tarilabs
Copy link
Member

@opendatahub-io/data-science-pipelines-maintainers please approve.

I'd appreciate an additional reviewer, I've given my LGTM already with #19 (review) but according to process someone else should Approve it. I will eventually be happy to merge it for you.

@tsambari2
Copy link

Can someone help to approve and merge the PR?

@mprahl
Copy link

mprahl commented Jun 26, 2025

@opendatahub-io/data-science-pipelines-maintainers please approve.

I'd appreciate an additional reviewer, I've given my LGTM already with #19 (review) but according to process someone else should Approve it. I will eventually be happy to merge it for you.

I don't think anyone on the team has C++ knowledge that could provide a good review. We don't have any objections with the objective of the PR.

@tsambari2
Copy link

@tarilabs , @mprahl , what next? we need this PR merged for adding Power support. Any inputs on how to proceed?

@tarilabs
Copy link
Member

@tsambari2 reach out internally to ODH admins and ask one of them to merge this PR, since no-one involved has C++ expertise to vouch for this Approval+Merge.

@grdryn
Copy link
Member

grdryn commented Jul 11, 2025

@coderabbitai full review

@coderabbitai
Copy link

coderabbitai bot commented Jul 11, 2025

✅ Actions performed

Full review triggered.

@coderabbitai
Copy link

coderabbitai bot commented Jul 11, 2025

Walkthrough

The updates introduce a patch for the PostgreSQL dependency to improve compatibility with PowerPC architectures, update the BoringSSL dependency to a new version, and suppress specific compiler warnings in the Red Hat Docker build. Additionally, the Abseil flags system is initialized in the Python metadata store module for testing purposes.

Changes

File(s) Change Summary
WORKSPACE Added PostgreSQL patch; updated BoringSSL version, checksum, and URL.
ml_metadata/third_party/postgresql.patch Patch adds PowerPC-specific guards to CPU feature detection code in PostgreSQL.
ml_metadata/metadata_store/metadata_store.py Imports Abseil flags and initializes with pytest argument.
ml_metadata/tools/docker_server/Dockerfile.redhat Adds --copt="-Wno-maybe-uninitialized" to suppress uninitialized variable warnings during build.

Poem

In the garden of code where dependencies grow,
A patch for the penguins, BoringSSL on the go!
Docker builds hush their warnings away,
Flags wave for pytest at the break of day.
🐇✨
Hopping along, the code’s now more robust—
Let’s celebrate these changes, in rabbits we trust!

✨ Finishing Touches
  • 📝 Generate Docstrings

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share
🪧 Tips

Chat

There are 3 ways to chat with CodeRabbit:

  • Review comments: Directly reply to a review comment made by CodeRabbit. Example:
    • I pushed a fix in commit <commit_id>, please review it.
    • Explain this complex logic.
    • Open a follow-up GitHub issue for this discussion.
  • Files and specific lines of code (under the "Files changed" tab): Tag @coderabbitai in a new review comment at the desired location with your query. Examples:
    • @coderabbitai explain this code block.
    • @coderabbitai modularize this function.
  • PR comments: Tag @coderabbitai in a new PR comment to ask questions about the PR branch. For the best results, please provide a very specific query, as very limited context is provided in this mode. Examples:
    • @coderabbitai gather interesting stats about this repository and render them as a table. Additionally, render a pie chart showing the language distribution in the codebase.
    • @coderabbitai read src/utils.ts and explain its main purpose.
    • @coderabbitai read the files in the src/scheduler package and generate a class diagram using mermaid and a README in the markdown format.
    • @coderabbitai help me debug CodeRabbit configuration file.

Support

Need help? Create a ticket on our support page for assistance with any issues or questions.

Note: Be mindful of the bot's finite context window. It's strongly recommended to break down tasks such as reading entire modules into smaller chunks. For a focused discussion, use review comments to chat about specific files and their changes, instead of using the PR comments.

CodeRabbit Commands (Invoked using PR comments)

  • @coderabbitai pause to pause the reviews on a PR.
  • @coderabbitai resume to resume the paused reviews.
  • @coderabbitai review to trigger an incremental review. This is useful when automatic reviews are disabled for the repository.
  • @coderabbitai full review to do a full review from scratch and review all the files again.
  • @coderabbitai summary to regenerate the summary of the PR.
  • @coderabbitai generate docstrings to generate docstrings for this PR.
  • @coderabbitai generate sequence diagram to generate a sequence diagram of the changes in this PR.
  • @coderabbitai resolve resolve all the CodeRabbit review comments.
  • @coderabbitai configuration to show the current CodeRabbit configuration for the repository.
  • @coderabbitai help to get help.

Other keywords and placeholders

  • Add @coderabbitai ignore anywhere in the PR description to prevent this PR from being reviewed.
  • Add @coderabbitai summary to generate the high-level summary at a specific location in the PR description.
  • Add @coderabbitai anywhere in the PR title to generate the title automatically.

CodeRabbit Configuration File (.coderabbit.yaml)

  • You can programmatically configure CodeRabbit by adding a .coderabbit.yaml file to the root of your repository.
  • Please see the configuration documentation for more information.
  • If your editor has YAML language server enabled, you can add the path at the top of this file to enable auto-completion and validation: # yaml-language-server: $schema=https://coderabbit.ai/integrations/schema.v2.json

Documentation and Community

  • Visit our Documentation for detailed information on how to use CodeRabbit.
  • Join our Discord Community to get help, request features, and share feedback.
  • Follow us on X/Twitter for updates and announcements.

Copy link

@coderabbitai coderabbitai bot left a comment

Choose a reason for hiding this comment

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

Actionable comments posted: 1

📜 Review details

Configuration used: CodeRabbit UI
Review profile: CHILL
Plan: Pro

📥 Commits

Reviewing files that changed from the base of the PR and between 38b99b0 and 08aa81c.

📒 Files selected for processing (4)
  • WORKSPACE (2 hunks)
  • ml_metadata/metadata_store/metadata_store.py (1 hunks)
  • ml_metadata/third_party/postgresql.patch (1 hunks)
  • ml_metadata/tools/docker_server/Dockerfile.redhat (1 hunks)
🔇 Additional comments (4)
ml_metadata/tools/docker_server/Dockerfile.redhat (1)

40-40: Compiler warning suppression added for GCC-11 compatibility.

The addition of --copt="-Wno-maybe-uninitialized" suppresses warnings about potentially uninitialized variables, which aligns with the PR's goal of supporting GCC-11 builds.

While suppressing warnings is generally not ideal, this appears to be a targeted fix for GCC-11 compatibility issues. The change is well-isolated to the build process and doesn't affect runtime behavior.

Please verify that this flag is specifically needed for GCC-11 compatibility and consider adding a comment explaining why this suppression is necessary:

  # "-std=c++17" is needed in order to build with ZetaSQL.
+ # "-Wno-maybe-uninitialized" is needed for GCC-11 compatibility on Power architecture.
  RUN bazel build -c opt --action_env=PATH \
    --define=grpc_no_ares=true \
    --copt="-Wno-maybe-uninitialized" \
ml_metadata/third_party/postgresql.patch (1)

1-38: Well-structured patch for PowerPC compatibility.

The patch correctly addresses PowerPC architecture compatibility issues by:

  1. Proper architecture detection: Uses comprehensive PowerPC macros (__ppc__, __PPC__, __ppc64__, __PPC64__)
  2. Safe fallback: Returns false for pg_popcount_available() on PowerPC, preventing use of unsupported CPU instructions
  3. Targeted approach: Only wraps the problematic CPU feature detection code without affecting other functionality
  4. Standard patch format: Follows proper diff conventions and is easy to review

The patch effectively prevents compilation and runtime issues on PowerPC systems by excluding unsupported CPUID instructions and headers. This is a clean, targeted solution that maintains compatibility across different architectures.

WORKSPACE (2)

11-11: PostgreSQL patch integration looks correct.

The patch reference correctly points to the PostgreSQL patch file reviewed earlier, which addresses PowerPC architecture compatibility issues.

The integration properly follows Bazel's dependency management conventions and aligns with the PR's goal of supporting Power architecture builds.


56-57: BoringSSL SHA256 checksum verified

I’ve confirmed that the SHA256 for commit 648cbaf033401b7fe7acdce02f275b06a88aab5c matches the value in WORKSPACE. This update—intended to improve GCC-11 and Power architecture compatibility—is good to merge.

• File: WORKSPACE (lines 56–57, 59)
• Verified SHA256: 579cb415458e9f3642da0a39a72f79fdfe6dc9c1713b3a823f1e276681b9703e

Comment on lines +20 to +21
from absl import flags
flags.FLAGS(['pytest'])
Copy link

Choose a reason for hiding this comment

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

🛠️ Refactor suggestion

Consider moving flags initialization to a more appropriate location.

Initializing absl flags at module import time with a hardcoded argument can cause issues:

  1. Side effects during import: Module-level initialization can interfere with other parts of the application that might need different flag configurations
  2. Hardcoded argument: The 'pytest' argument may not be appropriate for all use cases of this module
  3. Potential conflicts: This could conflict with other flag initialization elsewhere in the codebase

Consider these alternatives:

  • Move the flags initialization to a dedicated initialization function
  • Use a conditional check to only initialize when running tests
  • Initialize flags in the test setup rather than in the main module
-from absl import flags
-flags.FLAGS(['pytest'])
+from absl import flags
+
+def _initialize_flags_for_testing():
+    """Initialize flags for testing purposes."""
+    if not flags.FLAGS.is_parsed():
+        flags.FLAGS(['pytest'])

Then call this function in test setup or conditionally based on runtime context.

📝 Committable suggestion

‼️ IMPORTANT
Carefully review the code before committing. Ensure that it accurately replaces the highlighted code, contains no missing lines, and has no issues with indentation. Thoroughly test & benchmark the code to ensure it meets the requirements.

Suggested change
from absl import flags
flags.FLAGS(['pytest'])
from absl import flags
def _initialize_flags_for_testing():
"""Initialize flags for testing purposes."""
if not flags.FLAGS.is_parsed():
flags.FLAGS(['pytest'])
🤖 Prompt for AI Agents
In ml_metadata/metadata_store/metadata_store.py around lines 20 to 21, the absl
flags are being initialized at module import time with a hardcoded argument
'pytest', which can cause side effects and conflicts. Remove the
flags.FLAGS(['pytest']) call from the module level and instead create a
dedicated initialization function for flags. Call this function conditionally
during test setup or runtime context where needed, avoiding hardcoded arguments
and preventing side effects during normal module imports.

@tarilabs
Copy link
Member

proceeding to merge. thanks @grdryn didn't realize you could trigger coderabbit this way 🙏

@tarilabs tarilabs merged commit 8da742e into opendatahub-io:master Jul 11, 2025
1 of 2 checks passed
grdryn pushed a commit to grdryn/ml-metadata that referenced this pull request Aug 5, 2025
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.

6 participants