Skip to content

Add addtional config to import xla flags directly to compile()#3570

Open
NuojCheng wants to merge 1 commit intomainfrom
chengnuojin-compile-flags
Open

Add addtional config to import xla flags directly to compile()#3570
NuojCheng wants to merge 1 commit intomainfrom
chengnuojin-compile-flags

Conversation

@NuojCheng
Copy link
Copy Markdown
Collaborator

@NuojCheng NuojCheng commented Apr 3, 2026

Description

Add an additional flag compile_xla_flags to import libtpu flags for internal compilation usage.

Tests

  • Cloud: Successfully compile https://paste.googleplex.com/5468268715442176, which means this flag works for cloud as well.
  • G3: Patch cl/895369658 and run bash experimental/users/chengnuojin/maxtext-compile/deepseek3-671b/ds-pp8-ep8-fsdp128.sh . The compilation succeed (otherwise got vmem oom error if flags are not imported properly)

Checklist

Before submitting this PR, please make sure (put X in square brackets):

  • I have performed a self-review of my code. For an optional AI review, add the gemini-review label.
  • I have necessary comments in my code, particularly in hard-to-understand areas.
  • I have run end-to-end tests tests and provided workload links above if applicable.
  • I have made or will make corresponding changes to the doc if needed, including adding new documentation pages to the relevant Table of Contents (toctree directive) as explained in our documentation.

@codecov
Copy link
Copy Markdown

codecov bot commented Apr 3, 2026

Codecov Report

❌ Patch coverage is 26.31579% with 14 lines in your changes missing coverage. Please review.

Files with missing lines Patch % Lines
src/maxtext/utils/max_utils.py 17.64% 13 Missing and 1 partial ⚠️

📢 Thoughts on this report? Let us know!

Copy link
Copy Markdown
Collaborator

@gobbleturk gobbleturk left a comment

Choose a reason for hiding this comment

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

I think this only supports OSS usage (which is kind of already supported since you can export these before running train_compile). Have you tested this internally - I don't think this will work

@NuojCheng NuojCheng force-pushed the chengnuojin-compile-flags branch from 0d2ca8a to 58918e8 Compare April 6, 2026 16:17
@NuojCheng NuojCheng requested a review from gobbleturk April 6, 2026 17:44
# internal_compile allows bypassing open-source topology name mappings when using internal topologies directly via get_topology_desc.
internal_compile: False
internal_compile_num_devices: -1 # You must specify the number of devices when using internal_compile.
internal_compile_libtpu_flags: "" # Compiler options for internal compilation only
Copy link
Copy Markdown
Collaborator

@gobbleturk gobbleturk Apr 6, 2026

Choose a reason for hiding this comment

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

note there is no libtpu internally, libtpu is only used in cloud/OSS environments.

I also think this should work for both internal and OSS? Does it not work for OSS? If it works for both, we could call this compile_xla_flags

Copy link
Copy Markdown
Collaborator Author

Choose a reason for hiding this comment

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

renaming done

@NuojCheng NuojCheng force-pushed the chengnuojin-compile-flags branch from 58918e8 to dcf2450 Compare April 6, 2026 18:40
@NuojCheng NuojCheng force-pushed the chengnuojin-compile-flags branch from dcf2450 to 9ce6019 Compare April 6, 2026 18:46
# internal_compile allows bypassing open-source topology name mappings when using internal topologies directly via get_topology_desc.
internal_compile: False
internal_compile_num_devices: -1 # You must specify the number of devices when using internal_compile.
compile_xla_flags: "" # Compiler options for compilation only
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.

can you show an example value here to help users format correctly?

Copy link
Copy Markdown
Collaborator Author

Choose a reason for hiding this comment

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

added

@NuojCheng NuojCheng force-pushed the chengnuojin-compile-flags branch from 9ce6019 to 78c0122 Compare April 6, 2026 19:17
@NuojCheng NuojCheng changed the title Add addtional config to import libtpu flags Add addtional config to import xla flags directly to compile() Apr 6, 2026
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