Skip to content

Conversation

@hertschuh
Copy link
Collaborator

The jax.experimental.layout.Layout argument is renamed from _tiling to tiling.

Copy link
Contributor

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

Choose a reason for hiding this comment

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

Summary of Changes

Hello @hertschuh, I'm Gemini Code Assist1! I'm currently reviewing this pull request and will post my feedback shortly. In the meantime, here's a summary to help you and other reviewers quickly get up to speed!

This pull request addresses a breaking change in JAX 0.7.1 by updating how the jax.experimental.layout.Layout class is instantiated. The core change involves adapting to a renamed argument, ensuring that the codebase remains functional and compatible with both newer and older versions of the JAX library.

Highlights

  • JAX API Compatibility: Updated the usage of jax.experimental.layout.Layout to account for the _tiling argument being renamed to tiling in JAX version 0.7.1.
  • Backward Compatibility: Implemented version-aware logic using jax.__version_info__ to dynamically select between the tiling (for JAX 0.7.1+) and _tiling (for older JAX versions) arguments, ensuring the code remains compatible across different JAX environments.
  • Code Refinement: Introduced a local layout variable to encapsulate the version-dependent LayoutClass instantiation, improving readability and maintainability in both the main implementation and its test utility.
Using Gemini Code Assist

The full guide for Gemini Code Assist can be found on our documentation page, here are some quick tips.

Invoking Gemini

You can request assistance from Gemini at any point in your pull request via creating an issue comment (i.e. comment on the pull request page) using either /gemini <command> or @gemini-code-assist <command>. Below is a summary of the supported commands.

Feature Command Description
Code Review /gemini review Performs a code review for the current pull request in its current state.
Pull Request Summary /gemini summary Provides a summary of the current pull request in its current state.
Comment @gemini-code-assist Responds in comments when explicitly tagged, both in issue comments and review comments.
Help /gemini help Displays a list of available commands.

Customization

To customize Gemini Code Assist for GitHub experience, repository maintainers can create a configuration file and/or provide a custom code review style guide (such as PEP-8 for Python) by creating and adding files to a .gemini/ folder in the base of the repository. Detailed instructions can be found here.

Limitations & Feedback

Gemini Code Assist may make mistakes. Please leave feedback on any instances where its feedback is incorrect or counter productive. You can react with 👍 and 👎 on @gemini-code-assist comments or fill out our survey to provide feedback.

You can also get AI-powered code generation, chat, as well as code reviews directly in the IDE at no cost with the Gemini Code Assist IDE Extension.

Footnotes

  1. Review the Privacy Notices, Generative AI Prohibited Use Policy, Terms of Service, and learn how to configure Gemini Code Assist in GitHub here. Gemini can make mistakes, so double check it and use code with caution.

Copy link
Contributor

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

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 addresses a breaking change in JAX version 0.7.1 by renaming the _tiling argument to tiling for jax.experimental.layout.Layout. The changes are applied to both the main implementation and the corresponding test file. My feedback focuses on improving code maintainability by reducing duplication in the newly added conditional logic. I've suggested refactoring the LayoutClass instantiation to avoid repeating common arguments, which should make the code cleaner and easier to maintain.

Comment on lines 224 to 228
layout = (
LayoutClass(major_to_minor=(0, 1), tiling=((8,),))
if jax.__version_info__ >= (0, 7, 1)
else LayoutClass(major_to_minor=(0, 1), _tiling=((8,),)) # type: ignore
)
Copy link
Contributor

Choose a reason for hiding this comment

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

medium

To improve maintainability and reduce code duplication, you can factor out the common arguments for LayoutClass into a dictionary. This makes the conditional logic cleaner and avoids repeating arguments.

common_kwargs = {"major_to_minor": (0, 1)}
layout = (
    LayoutClass(**common_kwargs, tiling=((8,),))
    if jax.__version_info__ >= (0, 7, 1)
    else LayoutClass(**common_kwargs, _tiling=((8,),))  # type: ignore

Comment on lines 49 to 53
layout = (
LayoutClass(major_to_minor=(0, 1), tiling=((8,),))
if jax.__version_info__ >= (0, 7, 1)
else LayoutClass(major_to_minor=(0, 1), _tiling=((8,),)) # type: ignore
)
Copy link
Contributor

Choose a reason for hiding this comment

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

medium

To improve maintainability and reduce code duplication, you can factor out the common arguments for LayoutClass into a dictionary. This makes the conditional logic cleaner and avoids repeating arguments.

common_kwargs = {"major_to_minor": (0, 1)}
layout = (
    LayoutClass(**common_kwargs, tiling=((8,),))
    if jax.__version_info__ >= (0, 7, 1)
    else LayoutClass(**common_kwargs, _tiling=((8,),))  # type: ignore

Copy link
Collaborator

@abheesht17 abheesht17 left a comment

Choose a reason for hiding this comment

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

Thanks!

The `jax.experimental.layout.Layout` argument is renamed from `_tiling` to `tiling`.
@hertschuh hertschuh merged commit 73331a6 into keras-team:main Jul 25, 2025
5 checks passed
@hertschuh hertschuh deleted the layout_tiling branch July 25, 2025 18:51
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.

2 participants