Skip to content

Conversation

@gmagogsfm
Copy link
Contributor

@gmagogsfm gmagogsfm commented Nov 4, 2025

Update inductor_partition_rule_context to try the new torch._inductor.config API first, falling back to the deprecated _custom_should_partition_fns API for compatibility with older torch versions. This prepares the codebase for future torch releases that remove the old API.

This fixes test failures:

  • compile/piecewise/test_multiple_graphs.py::test_multi_graph_piecewise_compile[True]
  • compile/piecewise/test_simple.py::test_simple_inductor_graph_partition
  • compile/piecewise/test_toy_llama.py::test_toy_llama[inductor-True]
  • compile/piecewise/test_full_cudagraph.py

Signed off by: Yanan Cao gmagogsfm@gmail.com

…artition op API

Summary:
Update inductor_partition_rule_context to try the new torch._inductor.config API
first, falling back to the deprecated _custom_should_partition_fns API for
compatibility with older torch versions. This prepares the codebase for future
torch releases that remove the old API.

Signed off by: Yanan Cao <gmagogsfm@gmail.com>

Signed-off-by: Yanan Cao <gmagogsfm@gmail.com>
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 updates inductor_partition_rule_context to support a new API in torch._inductor.config while maintaining backward compatibility with the old API. The change is well-structured, using a try...except block to handle different torch versions. My main feedback is to refactor the implementation to reduce code duplication, which will improve maintainability.

@gmagogsfm
Copy link
Contributor Author

@zou3519 @ProExpertProg Please review, thanks.

@ProExpertProg
Copy link
Collaborator

Cc @BoyuanFeng

@BoyuanFeng
Copy link
Contributor

Thanks for the PR! We have something similar in #27702

@gmagogsfm
Copy link
Contributor Author

gmagogsfm commented Nov 4, 2025

This is a dupe of #27702, closing

@gmagogsfm gmagogsfm closed this Nov 4, 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.

3 participants