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

Function RunTest

tensorflow/compiler/tf2tensorrt/utils/trt_allocator_test.cc:23–43  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

21namespace tensorrt {
22
23bool RunTest(const uint64_t alignment, const uint64_t size,
24 const intptr_t orig_ptr_val, const uint64_t orig_space) {
25 void* const orig_ptr = reinterpret_cast<void*>(orig_ptr_val);
26 void* ptr = orig_ptr;
27 uint64_t space = orig_space;
28 void* result = Align(alignment, size, ptr, space);
29 if (result == nullptr) {
30 EXPECT_EQ(orig_ptr, ptr);
31 EXPECT_EQ(orig_space, space);
32 return false;
33 } else {
34 EXPECT_EQ(result, ptr);
35 const intptr_t ptr_val = reinterpret_cast<intptr_t>(ptr);
36 EXPECT_EQ(0, ptr_val % alignment);
37 EXPECT_GE(ptr_val, orig_ptr_val);
38 EXPECT_GE(space, size);
39 EXPECT_LE(space, orig_space);
40 EXPECT_EQ(ptr_val + space, orig_ptr_val + orig_space);
41 return true;
42 }
43}
44
45TEST(TRTAllocatorTest, Align) {
46 for (const uint64_t space :

Callers 7

TESTFunction · 0.70
XLA_TEST_FFunction · 0.50
RunTestMethod · 0.50
XLA_TEST_FFunction · 0.50
RunTestMethod · 0.50
XLA_TEST_FFunction · 0.50
TEST_FFunction · 0.50

Calls 1

AlignFunction · 0.85

Tested by

no test coverage detected