From 2fde10d9148d2dae9dc168ccd647de7f3cafea6b Mon Sep 17 00:00:00 2001 From: Jeff Daily Date: Wed, 22 Oct 2025 03:46:20 +0000 Subject: [PATCH] [ROCm] fix test_allocator_backend (#166035) Fixes #165872. Forward fix PR #165298. hipify was causing some symbols to be replaced. Pull Request resolved: https://github.com/pytorch/pytorch/pull/166035 Approved by: https://github.com/jeffdaily Co-authored-by: Jeff Daily --- c10/cuda/CUDACachingAllocator.cpp | 5 ++++- c10/cuda/CUDAMallocAsyncAllocator.cpp | 4 +++- 2 files changed, 7 insertions(+), 2 deletions(-) diff --git a/c10/cuda/CUDACachingAllocator.cpp b/c10/cuda/CUDACachingAllocator.cpp index 45d2bc3ff64..091e580f958 100644 --- a/c10/cuda/CUDACachingAllocator.cpp +++ b/c10/cuda/CUDACachingAllocator.cpp @@ -4469,7 +4469,10 @@ struct BackendStaticInitializer { if (key == "backend") { tokenizer.checkToken(++i, ":"); i++; // Move to the value after the colon - if (tokenizer[i] == "cudaMallocAsync" + // break up token to trick hipify + if (tokenizer[i] == + "c" + "udaMallocAsync" #ifdef USE_ROCM // convenience for ROCm users to allow either CUDA or HIP env var || tokenizer[i] == "hipMallocAsync" diff --git a/c10/cuda/CUDAMallocAsyncAllocator.cpp b/c10/cuda/CUDAMallocAsyncAllocator.cpp index 6d6b8a56d29..93bce51f1b9 100644 --- a/c10/cuda/CUDAMallocAsyncAllocator.cpp +++ b/c10/cuda/CUDAMallocAsyncAllocator.cpp @@ -913,7 +913,9 @@ struct CudaMallocAsyncAllocator : public CUDAAllocator { } } std::string name() override { - return "cudaMallocAsync"; + // break up token to trick hipify + return "c" + "udaMallocAsync"; } void copy_data(void* dest, const void* src, std::size_t count) const final { C10_CUDA_CHECK(