Skip to content

Conversation

@tohtana
Copy link
Collaborator

@tohtana tohtana commented Sep 28, 2025

This PR improves state management for DeepCompile in the engine.

Previously, the system relied only on the config flag indicating whether DeepCompile was enabled. However, DeepCompile is actually activated only when compile() is called. This meant that if DeepCompile was enabled in the config but compile() was never called, it could lead to invalid internal states (as shown in #7598).

Since enabled == True should be interpreted as an option that modifies the behavior of compile(), this PR introduces clearer state management:

  • If .compile() is not called, the DeepCompile config has no effect on behavior. A one-time message is shown instead.
  • A new state, DeepCompile activated, is introduced. This represents the condition where DeepCompile is both enabled in the config and .compile() has been called.

@tohtana tohtana requested a review from tjruwase as a code owner September 28, 2025 20:06
@sfc-gh-truwase
Copy link
Collaborator

@tohtana thanks for this PR. So, is the behavior now the following?

  1. No deepspeed.compile() in client code equals eager-mode
  2. deepspeed.compile() in client code with deepcompile==False or missing in ds_config equals torch.compile()
  3. deepspeed.compile() in client code with deepcompile==True equals DeepCompile

@tohtana
Copy link
Collaborator Author

tohtana commented Sep 30, 2025

Hi @sfc-gh-truwase, Yes it is correct.

@tohtana tohtana merged commit e32e817 into deepspeedai:master Oct 1, 2025
10 of 12 checks passed
ryantqiu pushed a commit to snorkel-marlin-repos/DeepSpeed_1460d5a8 that referenced this pull request Oct 1, 2025
ryantqiu added a commit to snorkel-marlin-repos/DeepSpeed_1460d5a8 that referenced this pull request Oct 1, 2025
delock pushed a commit that referenced this pull request Oct 3, 2025
This PR improves state management for DeepCompile in the engine.

Previously, the system relied only on the config flag indicating whether
DeepCompile was enabled. However, DeepCompile is actually activated only
when `compile()` is called. This meant that if DeepCompile was enabled
in the config but `compile()` was never called, it could lead to invalid
internal states (as shown in #7598).

Since `enabled == True` should be interpreted as an option that modifies
the behavior of `compile()`, this PR introduces clearer state
management:
- If .compile() is not called, the DeepCompile config has no effect on
behavior. A one-time message is shown instead.
- A new state, DeepCompile activated, is introduced. This represents the
condition where DeepCompile is both enabled in the config and .compile()
has been called.

---------

Signed-off-by: Masahiro Tanaka <[email protected]>
Co-authored-by: Olatunji Ruwase <[email protected]>
Signed-off-by: Guokai Ma <[email protected]>
mauryaavinash95 pushed a commit to DataStates/DeepSpeed that referenced this pull request Oct 4, 2025
…ai#7603)

This PR improves state management for DeepCompile in the engine.

Previously, the system relied only on the config flag indicating whether
DeepCompile was enabled. However, DeepCompile is actually activated only
when `compile()` is called. This meant that if DeepCompile was enabled
in the config but `compile()` was never called, it could lead to invalid
internal states (as shown in deepspeedai#7598).

Since `enabled == True` should be interpreted as an option that modifies
the behavior of `compile()`, this PR introduces clearer state
management:
- If .compile() is not called, the DeepCompile config has no effect on
behavior. A one-time message is shown instead.
- A new state, DeepCompile activated, is introduced. This represents the
condition where DeepCompile is both enabled in the config and .compile()
has been called.

---------

Signed-off-by: Masahiro Tanaka <[email protected]>
Co-authored-by: Olatunji Ruwase <[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