Skip to content

fix(tf): find external protobuf for TensorFlow 2.21 - #5986

Open
njzjz-bot wants to merge 2 commits into
deepmodeling:masterfrom
njzjz-bot:fix/tf21-external-protobuf
Open

fix(tf): find external protobuf for TensorFlow 2.21#5986
njzjz-bot wants to merge 2 commits into
deepmodeling:masterfrom
njzjz-bot:fix/tf21-external-protobuf

Conversation

@njzjz-bot

@njzjz-bot njzjz-bot commented Aug 22, 2026

Copy link
Copy Markdown
Contributor

Summary

Adapt the conda-forge TensorFlow 2.21 external-Protobuf fix for upstream use.

  • Find the external Protobuf package when TensorFlow does not expose protobuf as a direct runtime dependency.
  • Preserve an exact protobuf library discovered from the TensorFlow runtime dependencies.
  • Use that library installation prefix to guide the header lookup, then restore any caller-provided Protobuf root.

Validation

  • Focused CMake configure: preserved a versioned runtime-discovered protobuf library even when a different protobuf prefix was globally searchable.
  • Focused CMake configure: found protobuf normally when the TensorFlow runtime dependency scan produced no protobuf library.
  • cmake-format check passed for source/cmake/Findtensorflow.cmake.
  • ruff check . passed.
  • ruff format . left 1913 files unchanged.

Repository CI does not exercise the external-header branch because its pip TensorFlow packages bundle google/protobuf/type.pb.h. The focused CMake configurations above validate the changed lookup behavior directly.

Coding agent: Codex
Codex version: codex-cli 0.149.0
Model: gpt-5.6-sol
Reasoning effort: xhigh

Backport conda-forge/deepmd-kit-feedstock patch 0001 at d02138263b0b30629fe28c68c8bcecc2b8644513.

Agent: ChatGPT
Model: GPT-5.6 Sol
@njzjz
njzjz requested a review from wanghan-iapcm August 22, 2026 19:19
@njzjz
njzjz marked this pull request as ready for review August 22, 2026 19:19
Copilot AI lite review requested due to automatic review settings August 22, 2026 19:19

Copilot AI 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.

Copilot was unable to review this pull request because the user who requested the review has reached their quota limit.

@dosubot dosubot Bot added the bug label Aug 22, 2026
@coderabbitai

coderabbitai Bot commented Aug 22, 2026

Copy link
Copy Markdown
Contributor

Review Change Stack

No actionable comments were generated in the recent review. 🎉

ℹ️ Recent review info
⚙️ Run configuration

Configuration used: Repository UI

Review profile: CHILL

Plan: Pro Plus

Run ID: cd6918f7-87ee-4254-b10a-1373e0d51f25

📥 Commits

Reviewing files that changed from the base of the PR and between 2093090 and 72f40f4.

📒 Files selected for processing (1)
  • source/cmake/Findtensorflow.cmake

Included review availability: Your plan provides up to 8 included reviews per hour; 7 remain after this review.


📝 Walkthrough

Walkthrough

The TensorFlow CMake module now preserves the runtime-discovered Protobuf library, uses its installation prefix for temporary package discovery, restores the original Protobuf_ROOT, and assigns the discovered Protobuf include and library variables.

Changes

TensorFlow discovery

Layer / File(s) Summary
Require Protobuf package resolution
source/cmake/Findtensorflow.cmake
When TensorFlow provides a runtime Protobuf library, the module temporarily sets Protobuf_ROOT from its installation prefix. It requires Protobuf discovery, restores the previous root value, and assigns TensorFlow’s Protobuf variables from Protobuf_INCLUDE_DIRS and Protobuf_LIBRARIES.

Estimated code review effort: 2 (Simple) | ~10 minutes

Merge Risk: ⚪ Minimal · up to 72f40

This localized build-dependency discovery change improves TensorFlow 2.21 protobuf handling without introducing a supported merge-blocking risk; no actionable merge-blocking risk remains after normal checks and review.

🚥 Pre-merge checks | ✅ 5
✅ Passed checks (5 passed)
Check name Status Explanation
Docstring Coverage ✅ Passed No functions found in the changed files to evaluate docstring coverage. Skipping docstring coverage check. Docstring coverage is scoped to functions touched by this diff. Analyzed 0 functions across 0 files. (1 skipped: 1 unsupported.)
Linked Issues check ✅ Passed Check skipped because no linked issues were found for this pull request.
Out of Scope Changes check ✅ Passed Check skipped because no linked issues were found for this pull request.
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Title check ✅ Passed The title clearly identifies the TensorFlow 2.21 Protobuf discovery fix, which matches the main change.
✨ Finishing Touches
🧪 Generate unit tests (beta)
  • Create PR with unit tests

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

Comment @coderabbitai help to get the list of available commands.

@codecov

codecov Bot commented Aug 22, 2026

Copy link
Copy Markdown

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 78.84%. Comparing base (8cfd46e) to head (72f40f4).

Additional details and impacted files
@@            Coverage Diff             @@
##           master    #5986      +/-   ##
==========================================
- Coverage   79.10%   78.84%   -0.26%     
==========================================
  Files        1105     1105              
  Lines      130981   130981              
  Branches     4771     4765       -6     
==========================================
- Hits       103609   103272     -337     
- Misses      25686    26025     +339     
+ Partials     1686     1684       -2     

☔ View full report in Codecov by Harness.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.
  • 📦 JS Bundle Analysis: Save yourself from yourself by tracking and limiting bundle sizes in JS merges.

@wanghan-iapcm wanghan-iapcm left a comment

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

Non-blocking. The fix is sound for the environment it came from, and I confirmed the backport is byte-identical to the feedstock patch. Two notes and one fact about coverage.

Worth stating plainly: no CI job executes these lines. The branch is only entered when google/protobuf/type.pb.h is absent from the TensorFlow tree, and CI installs TensorFlow from pip wheels, which bundle that header (checked on a local pip TensorFlow: .../tensorflow/include/google/protobuf/type.pb.h is present, and it is exactly the sentinel find_path looks for at line 224). So the green checks on this PR say nothing about the change, and "Full build is left to upstream CI" does not hold for this path, because this repository's CI does not cover it. That is not a reason to block -- there is no reasonable unit test for a find-module branch like this, and adding a conda-forge-TensorFlow build job is far more than this PR should carry -- but it is worth being explicit that the change ships unexercised.

Comment thread source/cmake/Findtensorflow.cmake Outdated
Comment thread source/cmake/Findtensorflow.cmake Outdated
Keep an ldd-discovered protobuf library pinned while using its installation prefix to guide FindProtobuf. Fall back to the normal external package search when TensorFlow exposes no protobuf runtime dependency.

Coding-Agent: Codex
Codex-Version: codex-cli 0.149.0
Model: gpt-5.6-sol
Reasoning-Effort: xhigh
@njzjz
njzjz requested review from wanghan-iapcm and a lite review from Copilot August 23, 2026 16:15

Copilot AI 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.

Copilot was unable to review this pull request because the user who requested the review has reached their quota limit.

@njzjz

njzjz commented Aug 23, 2026

Copy link
Copy Markdown
Member

The review summary coverage note is addressed as well: the PR description now explicitly states that repository CI does not execute the external-header branch and removes the previous claim that a full build was left to upstream CI. It documents the focused CMake configurations used to validate both the pinned runtime-library path and the TensorFlow 2.21 fallback path.

The inline threads have been addressed and resolved, and reviews have been re-requested.

Coding agent: Codex
Codex version: codex-cli 0.149.0
Model: gpt-5.6-sol
Reasoning effort: xhigh

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants