未验证 提交 37cb6f32 编写于 作者: Q Qi Li 提交者: GitHub

[ROCm] fix Managed Memory Alloc on HIP, test=develop (#39896)

* [ROCm] fix Managed Memory Alloc on HIP, test=develop

* update, test=develop
上级 783c4aba
...@@ -493,7 +493,8 @@ class AllocatorFacadePrivate { ...@@ -493,7 +493,8 @@ class AllocatorFacadePrivate {
"support allocating managed memory.\n" "support allocating managed memory.\n"
"If you don't actually need to use managed memory, please disable " "If you don't actually need to use managed memory, please disable "
"it with command `export FLAGS_use_cuda_managed_memory=false`.\n" "it with command `export FLAGS_use_cuda_managed_memory=false`.\n"
"Or you must use the gpu device that supports managed memory.")); "Or you must use the gpu device that supports managed memory.",
p.device));
} }
return std::make_shared<CUDAManagedAllocator>(p); return std::make_shared<CUDAManagedAllocator>(p);
} }
......
...@@ -128,6 +128,9 @@ TEST(ManagedMemoryTest, OversubscribeGPUMemoryTest) { ...@@ -128,6 +128,9 @@ TEST(ManagedMemoryTest, OversubscribeGPUMemoryTest) {
} }
TEST(ManagedMemoryTest, OOMExceptionTest) { TEST(ManagedMemoryTest, OOMExceptionTest) {
if (!platform::IsGPUManagedMemorySupported(0)) {
return;
}
EXPECT_THROW(Alloc(platform::CUDAPlace(0), size_t(1) << 60), EXPECT_THROW(Alloc(platform::CUDAPlace(0), size_t(1) << 60),
memory::allocation::BadAlloc); memory::allocation::BadAlloc);
} }
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册