[PyTorch] Add user_metadata display to memory visualizer#165939
[PyTorch] Add user_metadata display to memory visualizer#165939sraikund16 wants to merge 1 commit intopytorch:mainfrom
Conversation
Summary: Enhanced the PyTorch CUDA memory visualizer to display user_metadata alongside stack frames when inspecting allocations. The user_metadata field is now shown in all views (Allocator State History, Active Memory Timeline, etc.) with consistent formatting. The implementation handles both string and object metadata types, displaying strings directly and objects as key-value pairs.
Test Plan:
1. Generate a memory snapshot with user_metadata:
```python
import torch
torch.cuda.memory._record_memory_history(enabled=True)
# Add allocations with user_metadata
x = torch.randn(1000, 1000, device='cuda')
torch.cuda.memory._dump_snapshot("snapshot.pickle")
```
2. Open the memory visualizer in a browser
3. Load the snapshot file
4. Verify user_metadata appears
5. Test with both string metadata ("testing") and object metadata ({"key": "value"})
6. Verify formatting shows "User Metadata:\n <value>" for strings
{F1982860439}
Differential Revision: D85095152
🔗 Helpful Links🧪 See artifacts and rendered test results at hud.pytorch.org/pr/165939
Note: Links to docs will display an error until the docs builds have been completed. ✅ No FailuresAs of commit b59a31a with merge base 1891239 ( This comment was automatically generated by Dr. CI and updates every 15 minutes. |
|
@sraikund16 has exported this pull request. If you are a Meta employee, you can view the originating Diff in D85095152. |
|
Thanks! Can you add a screenshot to the output? (I guess |
It is in the diff D85095152. Didn't post it here since I tested on a real workload. |
|
@pytorchbot merge |
Merge startedYour change will be merged once all checks pass (ETA 0-4 Hours). Learn more about merging in the wiki. Questions? Feedback? Please reach out to the PyTorch DevX Team |
) Summary: Enhanced the PyTorch CUDA memory visualizer to display user_metadata alongside stack frames when inspecting allocations. The user_metadata field is now shown in all views (Allocator State History, Active Memory Timeline, etc.) with consistent formatting. The implementation handles both string and object metadata types, displaying strings directly and objects as key-value pairs. Test Plan: 1. Generate a memory snapshot with user_metadata 2. Open the memory visualizer in a browser 3. Load the snapshot file 4. Verify user_metadata appears 5. Test with both string metadata ("testing") and object metadata ({"key": "value"}) 6. Verify formatting shows "User Metadata:\n <value>" for strings {F1982860439} Differential Revision: D85095152 Pull Request resolved: pytorch#165939 Approved by: https://github.com/yushangdi
Summary: Enhanced the PyTorch CUDA memory visualizer to display user_metadata alongside stack frames when inspecting allocations. The user_metadata field is now shown in all views (Allocator State History, Active Memory Timeline, etc.) with consistent formatting. The implementation handles both string and object metadata types, displaying strings directly and objects as key-value pairs.
Test Plan:
{F1982860439}
Differential Revision: D85095152