fix(engine): resolve inference workspace attribute lookup - #8288
Open
nathon-lee wants to merge 1 commit into
Open
fix(engine): resolve inference workspace attribute lookup#8288nathon-lee wants to merge 1 commit into
nathon-lee wants to merge 1 commit into
Conversation
Signed-off-by: nathon-lee <leejianwoo@gmail.com>
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: 49dc3e9372
ℹ️ About Codex in GitHub
Codex has been enabled to automatically review pull requests in this repo. Reviews are triggered when you
- Open a pull request for review
- Mark a draft as ready
- Comment "@codex review".
If Codex has suggestions, it will comment; otherwise it will react with 👍.
When you sign up for Codex through ChatGPT, Codex can also answer questions or update the PR, like "@codex address that feedback".
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Description
Fix recursive attribute lookup in
DeepSpeedEngine.__getattr__.WorkspaceOpinherits fromtorch.nn.Module, so assigning it toDeepSpeedHybridEngine.workspaceregisters it in the engine's_modulesmapping. The existing
DeepSpeedEngine.__getattr__implementation did notdelegate to
torch.nn.Module.__getattr__before forwarding missing attributesto the wrapped model.
When HybridEngine was configured with:
the first call to
retake_inference_cache()attempted to accessself.workspace. The registered submodule was not resolved correctly, and thefollowing logic recursively invoked
DeepSpeedEngine.__getattr__:This eventually failed with:
The updated implementation first uses the parent
torch.nn.Moduleattributeresolver. It delegates to the wrapped model only when the attribute is not an
engine parameter, buffer, or registered submodule.
Changes
torch.nn.Module.__getattr__.AttributeErrorbehavior for missing attributes.Testing
Unit tests
Result:
The warnings only reported that explicit expected Torch and CUDA versions were
not provided to the test runner.
HybridEngine integration validation
The fix was also validated through the real HybridEngine
release_inference_cache=Truepath using the OPSD profiling benchmark relatedto #8197.
Test environment:
facebook/opt-6.7bcuda:0CUDA_LAUNCH_BLOCKING=1Before this fix, the first rollout failed in
retake_inference_cache()with a recursive__getattr__traceback.After this fix, the benchmark completed successfully and produced:
The corresponding cache-retaining baseline was:
For this workload, the complete cache release/retake lifecycle increased mean
rollout latency by approximately 132.98 ms, or 2.56%, and reduced aggregate
throughput by approximately 2.50%.
These measurements are included as integration validation rather than a
cross-hardware performance claim.
Scope
This PR fixes engine attribute lookup and restores the HybridEngine inference
workspace release/retake path.
It does not:
Related to #8197.