[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 <jeff.daily@amd.com>
This commit is contained in:
Jeff Daily 2025-10-22 03:46:20 +00:00 committed by PyTorch MergeBot
parent 0a93295da0
commit 2fde10d914
2 changed files with 7 additions and 2 deletions

View File

@ -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"

View File

@ -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(