Skip to content

Conversation

@deepcharm
Copy link
Contributor

@deepcharm deepcharm commented Jun 16, 2025

Dynamo breaks graphs because currently compile is disabled for a number of functions such as iter_params and record_module.

The above functions compile successfully for at least PyTorch version 2.7.0.

We enable the compilation based on the user PyTorch version using a new compiler.enable(min_version=None) decorator.
This should avoid the corresponding graph breaks and improve the performance.

Copy link
Contributor

@tohtana tohtana left a comment

Choose a reason for hiding this comment

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

Hi @deepcharm,
Thank you for the improvement. I confirmed that this works with the latest PyTorch (v2.7).
I think it is good to merge this PR now, but I remember that the compiler of the older version threw an error. I'm not sure which version fixed it. We might need to turn on/off compiling this function depending on the PyTorch version.

@deepcharm
Copy link
Contributor Author

Hi @deepcharm, Thank you for the improvement. I confirmed that this works with the latest PyTorch (v2.7). I think it is good to merge this PR now, but I remember that the compiler of the older version threw an error. I'm not sure which version fixed it. We might need to turn on/off compiling this function depending on the PyTorch version.

hi @tohtana, thanks for pointing this out - let me try to find the failing compiler version and then turn on/off that respectively.

@loadams
Copy link
Collaborator

loadams commented Jun 23, 2025

@deepcharm - is this ready to be merged?

@deepcharm
Copy link
Contributor Author

deepcharm commented Jun 25, 2025

@deepcharm - is this ready to be merged?

Hi @loadams, @tohtana
I've added PyTorch version dependent compiler.enable decorator to ensure backward compatibility with older releases (< 2.7). Also enabled compilation for iter_params.

Kindly review, thanks.

Signed-off-by: Max Kovalenko <[email protected]>
This reverts commit 11612773b3d68aa5b8d72bad1de4b1714ea1193a.

Signed-off-by: Max Kovalenko <[email protected]>
Dynamo breaks the graph because currently compile is disabled for record_module.

Re-enabling the compile should avoid the graph break and improve the performance.

Signed-off-by: Max Kovalenko <[email protected]>
@deepcharm deepcharm changed the title Avoid graph break by enabling compile of record module Enable torch version dependent compilation of record_module and iter_params Jun 25, 2025
@tohtana tohtana merged commit 8ace4da into deepspeedai:master Jul 7, 2025
10 checks passed
lpnpcs pushed a commit to lpnpcs/DeepSpeed that referenced this pull request Jul 30, 2025
…params (deepspeedai#7362)

Dynamo breaks graphs because currently compile is disabled for a number
of functions such as `iter_params` and `record_module`.

The above functions compile successfully for at least PyTorch version
2.7.0.

We enable the compilation based on the user PyTorch version using a new
`compiler.enable(min_version=None)` decorator.
This should avoid the corresponding graph breaks and improve the
performance.

---------

Signed-off-by: Max Kovalenko <[email protected]>
Co-authored-by: Masahiro Tanaka <[email protected]>
Co-authored-by: Logan Adams <[email protected]>
mauryaavinash95 pushed a commit to DataStates/DeepSpeed that referenced this pull request Oct 4, 2025
…params (deepspeedai#7362)

Dynamo breaks graphs because currently compile is disabled for a number
of functions such as `iter_params` and `record_module`.

The above functions compile successfully for at least PyTorch version
2.7.0.

We enable the compilation based on the user PyTorch version using a new
`compiler.enable(min_version=None)` decorator.
This should avoid the corresponding graph breaks and improve the
performance.

---------

Signed-off-by: Max Kovalenko <[email protected]>
Co-authored-by: Masahiro Tanaka <[email protected]>
Co-authored-by: Logan Adams <[email protected]>
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