MCPcopy Create free account
hub / github.com/DeepRec-AI/DeepRec / TEST

Function TEST

tensorflow/core/common_runtime/gpu/gpu_debug_allocator_test.cc:38–62  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

36namespace {
37
38TEST(GPUDebugAllocatorTest, OverwriteDetection_None) {
39 const PlatformGpuId platform_gpu_id(0);
40 GPUMemAllocator* sub_allocator = new GPUMemAllocator(
41 GpuIdUtil::ExecutorForPlatformGpuId(platform_gpu_id).ValueOrDie(),
42 platform_gpu_id, false /*use_unified_memory*/, {}, {});
43 GPUDebugAllocator a(new GPUBFCAllocator(sub_allocator, 1 << 30, ""),
44 platform_gpu_id);
45 auto stream_exec =
46 GpuIdUtil::ExecutorForPlatformGpuId(platform_gpu_id).ValueOrDie();
47
48 for (int s : {8}) {
49 std::vector<int64> cpu_array(s);
50 memset(&cpu_array[0], 0, cpu_array.size() * sizeof(int64));
51 int64* gpu_array =
52 TypedAllocator::Allocate<int64>(&a, cpu_array.size(), {});
53 se::DeviceMemory<int64> gpu_array_ptr{se::DeviceMemoryBase{gpu_array}};
54 ASSERT_TRUE(stream_exec->SynchronousMemcpy(&gpu_array_ptr, &cpu_array[0],
55 s * sizeof(int64)));
56 EXPECT_TRUE(a.CheckHeader(gpu_array));
57 EXPECT_TRUE(a.CheckFooter(gpu_array));
58
59 // Confirm no error on free.
60 a.DeallocateRaw(gpu_array);
61 }
62}
63
64TEST(GPUDebugAllocatorTest, OverwriteDetection_Header) {
65 for (int s : {8, 211}) {

Callers

nothing calls this directly

Calls 10

EXPECT_DEATHFunction · 0.85
isfiniteClass · 0.85
CheckHeaderMethod · 0.80
CheckFooterMethod · 0.80
sizeMethod · 0.45
SynchronousMemcpyMethod · 0.45
DeallocateRawMethod · 0.45
TracksAllocationSizesMethod · 0.45
RequestedSizeMethod · 0.45
AllocatedSizeMethod · 0.45

Tested by

no test coverage detected