Fix some issues in CUDACachingAllocator (#59819)
Summary: Pull Request resolved: https://github.com/pytorch/pytorch/pull/59819
Test Plan: Sandcastle
Reviewed By: ngimel
Differential Revision: D29034650
fbshipit-source-id: 7e9689fc1ae121432e9421fa4a9ae00f7f78caca