Skip to content

Conversation

@njzjz
Copy link
Member

@njzjz njzjz commented Jun 26, 2025

jaxlib.xla_extension has been removed in recent versions of JAX.

Summary by CodeRabbit

  • Refactor
    • Improved exception handling by updating error type checks and removing an unnecessary dependency.

`jaxlib.xla_extension` has been removed in the recent jax versions.

Signed-off-by: Jinzhe Zeng <jinzhe.zeng@rutgers.edu>
Copilot AI review requested due to automatic review settings June 26, 2025 13:11
Copy link
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

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

Pull Request Overview

This PR updates OOM error detection by removing the dependency on the removed jaxlib.xla_extension.XlaRuntimeError type.

  • Replace jaxlib.xla_extension.XlaRuntimeError with built-in RuntimeError
  • Retain existing ValueError check for RESOURCE_EXHAUSTED messages

@coderabbitai
Copy link
Contributor

coderabbitai bot commented Jun 26, 2025

📝 Walkthrough

Walkthrough

The code removes the import of the jaxlib module and updates the exception type checking in the is_oom_error method, replacing jaxlib.xla_extension.XlaRuntimeError with the more general RuntimeError. No changes were made to function signatures or public APIs.

Changes

File Change Summary
deepmd/jax/utils/auto_batch_size.py Removed jaxlib import; updated exception type check in is_oom_error to use RuntimeError.

Sequence Diagram(s)

sequenceDiagram
    participant Caller
    participant auto_batch_size.py

    Caller->>auto_batch_size.py: Call is_oom_error(e)
    auto_batch_size.py->>auto_batch_size.py: Check if e is (RuntimeError, ValueError)
    auto_batch_size.py->>auto_batch_size.py: Check if "RESOURCE_EXHAUSTED:" in str(e)
    auto_batch_size.py-->>Caller: Return True/False
Loading

Warning

There were issues while running some tools. Please review the errors and either fix the tool's configuration or disable the tool if it's a critical failure.

🔧 Pylint (3.3.7)
deepmd/jax/utils/auto_batch_size.py

No files to lint: exiting.


📜 Recent review details

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

📥 Commits

Reviewing files that changed from the base of the PR and between 205f924 and 7d99912.

📒 Files selected for processing (1)
  • deepmd/jax/utils/auto_batch_size.py (1 hunks)
🧰 Additional context used
🧠 Learnings (2)
📓 Common learnings
Learnt from: njzjz
PR: deepmodeling/deepmd-kit#4258
File: deepmd/jax/utils/neighbor_stat.py:98-101
Timestamp: 2024-10-26T02:09:01.365Z
Learning: The function `to_jax_array` in `deepmd/jax/common.py` can handle `None` values, so it's safe to pass `None` to it without additional checks.
Learnt from: njzjz
PR: deepmodeling/deepmd-kit#4284
File: deepmd/jax/__init__.py:8-8
Timestamp: 2024-10-30T20:08:12.531Z
Learning: In the DeepMD project, entry points like `deepmd.jax` may be registered in external projects, so their absence in the local configuration files is acceptable.
deepmd/jax/utils/auto_batch_size.py (6)
Learnt from: njzjz
PR: deepmodeling/deepmd-kit#4002
File: deepmd/dpmodel/model/model.py:106-106
Timestamp: 2024-10-08T15:32:11.479Z
Learning: The `get_class_by_type` method in `deepmd/utils/plugin.py` includes error handling for unsupported model types by raising a `RuntimeError` and providing a "Did you mean" message if there are close matches.
Learnt from: njzjz
PR: deepmodeling/deepmd-kit#4002
File: deepmd/dpmodel/model/model.py:106-106
Timestamp: 2024-07-22T21:18:12.787Z
Learning: The `get_class_by_type` method in `deepmd/utils/plugin.py` includes error handling for unsupported model types by raising a `RuntimeError` and providing a "Did you mean" message if there are close matches.
Learnt from: njzjz
PR: deepmodeling/deepmd-kit#4002
File: deepmd/pt/model/model/__init__.py:209-209
Timestamp: 2024-07-22T21:19:07.962Z
Learning: The `get_class_by_type` method in `deepmd/utils/plugin.py` includes error handling that raises a `RuntimeError` if the class type is unknown, along with a "Did you mean" suggestion.
Learnt from: njzjz
PR: deepmodeling/deepmd-kit#4002
File: deepmd/pt/model/model/__init__.py:209-209
Timestamp: 2024-10-08T15:32:11.479Z
Learning: The `get_class_by_type` method in `deepmd/utils/plugin.py` includes error handling that raises a `RuntimeError` if the class type is unknown, along with a "Did you mean" suggestion.
Learnt from: njzjz
PR: deepmodeling/deepmd-kit#4284
File: deepmd/jax/__init__.py:8-8
Timestamp: 2024-10-30T20:08:12.531Z
Learning: In the DeepMD project, entry points like `deepmd.jax` may be registered in external projects, so their absence in the local configuration files is acceptable.
Learnt from: njzjz
PR: deepmodeling/deepmd-kit#4258
File: deepmd/jax/utils/neighbor_stat.py:98-101
Timestamp: 2024-10-26T02:09:01.365Z
Learning: The function `to_jax_array` in `deepmd/jax/common.py` can handle `None` values, so it's safe to pass `None` to it without additional checks.
⏰ Context from checks skipped due to timeout of 90000ms (24)
  • GitHub Check: Build C++ (cuda120, cuda)
  • GitHub Check: Build C++ (rocm, rocm)
  • GitHub Check: Build C++ (cuda, cuda)
  • GitHub Check: Build C++ (clang, clang)
  • GitHub Check: Build C++ (cpu, cpu)
  • GitHub Check: Build C library (2.14, >=2.5.0rc0,<2.15, libdeepmd_c_cu11.tar.gz)
  • GitHub Check: Build C library (2.18, libdeepmd_c.tar.gz)
  • GitHub Check: Analyze (python)
  • GitHub Check: Analyze (c-cpp)
  • GitHub Check: Test C++ (true)
  • GitHub Check: Test C++ (false)
  • GitHub Check: Test Python (4, 3.12)
  • GitHub Check: Test Python (6, 3.9)
  • GitHub Check: Test Python (5, 3.12)
  • GitHub Check: Test Python (6, 3.12)
  • GitHub Check: Test Python (1, 3.9)
  • GitHub Check: Test Python (2, 3.12)
  • GitHub Check: Test Python (4, 3.9)
  • GitHub Check: Test Python (5, 3.9)
  • GitHub Check: Test Python (2, 3.9)
  • GitHub Check: Test Python (3, 3.12)
  • GitHub Check: Test Python (3, 3.9)
  • GitHub Check: Test Python (1, 3.12)
  • GitHub Check: Build wheels for cp311-win_amd64
✨ 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.

@njzjz njzjz closed this Jun 27, 2025
@njzjz njzjz reopened this Jun 27, 2025
@codecov
Copy link

codecov bot commented Jun 27, 2025

Codecov Report

❌ Patch coverage is 0% with 1 line in your changes missing coverage. Please review.
✅ Project coverage is 84.57%. Comparing base (205f924) to head (7d99912).
⚠️ Report is 78 commits behind head on devel.

Files with missing lines Patch % Lines
deepmd/jax/utils/auto_batch_size.py 0.00% 1 Missing ⚠️
Additional details and impacted files
@@            Coverage Diff             @@
##            devel    #4824      +/-   ##
==========================================
- Coverage   84.57%   84.57%   -0.01%     
==========================================
  Files         699      699              
  Lines       68039    68038       -1     
  Branches     3541     3543       +2     
==========================================
- Hits        57542    57541       -1     
  Misses       9363     9363              
  Partials     1134     1134              

☔ View full report in Codecov by Sentry.
📢 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.

@njzjz njzjz requested a review from wanghan-iapcm June 27, 2025 14:12
@njzjz njzjz added this pull request to the merge queue Jun 27, 2025
Merged via the queue into deepmodeling:devel with commit f8f01cb Jun 27, 2025
94 of 105 checks passed
@njzjz njzjz deleted the fix-jaxlib.xla_extension branch June 27, 2025 20:29
ChiahsinChu pushed a commit to ChiahsinChu/deepmd-kit that referenced this pull request Dec 17, 2025
`jaxlib.xla_extension` has been removed in recent versions of JAX.

<!-- This is an auto-generated comment: release notes by coderabbit.ai
-->

## Summary by CodeRabbit

* **Refactor**
* Improved exception handling by updating error type checks and removing
an unnecessary dependency.

<!-- end of auto-generated comment: release notes by coderabbit.ai -->

---------

Signed-off-by: Jinzhe Zeng <jinzhe.zeng@rutgers.edu>
Co-authored-by: pre-commit-ci[bot] <66853113+pre-commit-ci[bot]@users.noreply.github.com>
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.

2 participants