| 25 | namespace { |
| 26 | |
| 27 | TEST(PoolAllocatorTest, ZeroSizeBuffers) { |
| 28 | se::Platform* platform = |
| 29 | se::MultiPlatformManager::PlatformWithName("cuda").ValueOrDie(); |
| 30 | PoolAllocator pool( |
| 31 | 2 /*pool_size_limit*/, false /*auto_resize*/, |
| 32 | new GpuHostAllocator( |
| 33 | platform->GetExecutor(se::StreamExecutorConfig(/*ordinal=*/0)) |
| 34 | .ValueOrDie(), |
| 35 | 0 /*numa_node*/, {}, {}), |
| 36 | new NoopRounder, "pool"); |
| 37 | |
| 38 | EXPECT_EQ(nullptr, pool.AllocateRaw(4 /*alignment*/, 0 /*num_bytes*/)); |
| 39 | pool.DeallocateRaw(nullptr); // Should not crash. |
| 40 | EXPECT_EQ(0, pool.get_from_pool_count()); |
| 41 | EXPECT_EQ(0, pool.put_count()); |
| 42 | EXPECT_EQ(0, pool.allocated_count()); |
| 43 | EXPECT_EQ(0, pool.evicted_count()); |
| 44 | } |
| 45 | |
| 46 | TEST(PoolAllocatorTest, ZeroSizePool) { |
| 47 | se::Platform* platform = |
nothing calls this directly
no test coverage detected