#include #include #include #include #include #include #include "torch_npu/csrc/core/npu/NPUCachingAllocator.h" extern "C" { using c10_npu::NPUCachingAllocator::DeviceStats; static bool useflag = false; static std::atomic alloc_count{0}; static std::atomic free_count{0}; void* my_malloc(ssize_t size, int device, aclrtStream stream) { void *ptr; aclrtMallocAlign32(&ptr, size, aclrtMemMallocPolicy::ACL_MEM_MALLOC_HUGE_FIRST); std::cout<<"alloc ptr = "<