Revert "Refactor caching device allocator utils (#130923)"

This reverts commit c45ca8092dddf718563a1a754de798ad25eae1ee.

Reverted https://github.com/pytorch/pytorch/pull/130923 on behalf of https://github.com/ZainRizvi due to Sorry but this appears to be causing internal tests to fail with errors like `error: no type named 'DeviceStats' in namespace 'xxx::xxx:xxxAllocator'; did you mean 'DeviceStatus'?` ([comment](https://github.com/pytorch/pytorch/pull/130923#issuecomment-2315730155))
This commit is contained in:
PyTorch MergeBot
2024-08-28 15:56:08 +00:00
parent d52aff3e73
commit 2c88a923a7
7 changed files with 190 additions and 198 deletions

View File

@ -554,10 +554,10 @@ PyObject* THCPModule_memoryStats(PyObject* _unused, PyObject* arg) {
TORCH_CHECK(THPUtils_checkLong(arg), "invalid argument to memory_allocated");
const auto device_index = THPUtils_unpackDeviceIndex(arg);
using c10::CachingDeviceAllocator::DeviceStats;
using c10::CachingDeviceAllocator::Stat;
using c10::CachingDeviceAllocator::StatArray;
using c10::CachingDeviceAllocator::StatType;
using c10::cuda::CUDACachingAllocator::DeviceStats;
using c10::cuda::CUDACachingAllocator::Stat;
using c10::cuda::CUDACachingAllocator::StatArray;
using c10::cuda::CUDACachingAllocator::StatType;
const auto statToDict = [](const Stat& stat) {
py::dict dict;