Repository navigation
Enable memory snapshot for generic devices - #2228
Conversation
| class MemoryProfiler: | ||
| def __init__(self, step_num: int, freq: int): | ||
| torch.cuda.memory._record_memory_history( | ||
| self.device_module = torch.get_device_module() |
There was a problem hiding this comment.
|
test failed |
|
I found device_module typing was incorrect, so I fixed that and the relevant typing overrides. |
| # PP computation ======================================================== | ||
| _hook_coordinator.enable_coordination(num_layers=min_num_layers) | ||
| main_stream = torch.accelerator.current_stream(device_module) | ||
| main_stream = torch.accelerator.current_stream(device_type) |
There was a problem hiding this comment.
nit: this change is not absolutely necessary? https://docs.pytorch.org/docs/stable/generated/torch.accelerator.current_stream.html
OK to change though
There was a problem hiding this comment.
After fixing the typing for device_module, using it here throws a pyre typing error.
current_stream accepts a device type, which can be torch.device | str | int | None (from types.py ).
It looks like torch.cuda or torch.xpu can convert to one of these types, but it's definitely not the intended design, and we should use the correct device_type since we already have it.
Pytorch recently added `_record_memory_history` for Intel XPU. This PR makes the memory snapshot device-generic. @pkourdis @githubsgi
Pytorch recently added `_record_memory_history` for Intel XPU. This PR makes the memory snapshot device-generic. @pkourdis @githubsgi
Pytorch recently added `_record_memory_history` for Intel XPU. This PR makes the memory snapshot device-generic. @pkourdis @githubsgi
Pytorch recently added `_record_memory_history` for Intel XPU. This PR makes the memory snapshot device-generic. @pkourdis @githubsgi
Pytorch recently added
_record_memory_historyfor Intel XPU. This PR makes the memory snapshot device-generic.@pkourdis @githubsgi