aboutsummaryrefslogtreecommitdiffhomepage
path: root/tensorflow/contrib/tensorrt
diff options
context:
space:
mode:
authorGravatar Guangda Lai <31743510+aaroey@users.noreply.github.com>2018-09-20 10:01:59 -0700
committerGravatar Guangda Lai <31743510+aaroey@users.noreply.github.com>2018-09-20 10:01:59 -0700
commit72e085ca1701e275acec381885b519fa6b06522c (patch)
tree1af70edb732ebd4c6d7ec71925126e30ffb8a23a /tensorflow/contrib/tensorrt
parent13fac9da3820d0dda504eac43a0bd59876742262 (diff)
Add comments about why we use uint64_t type for alignment.
Diffstat (limited to 'tensorflow/contrib/tensorrt')
-rw-r--r--tensorflow/contrib/tensorrt/resources/trt_allocator.cc4
1 files changed, 4 insertions, 0 deletions
diff --git a/tensorflow/contrib/tensorrt/resources/trt_allocator.cc b/tensorflow/contrib/tensorrt/resources/trt_allocator.cc
index f6b4b4dcab..a9425864dd 100644
--- a/tensorflow/contrib/tensorrt/resources/trt_allocator.cc
+++ b/tensorflow/contrib/tensorrt/resources/trt_allocator.cc
@@ -27,6 +27,10 @@ namespace tensorflow {
namespace tensorrt {
// std::align is not supported, so this method mimic its behavior.
+//
+// NOTE(aaroey): according to the TensorRT API,
+// nvinfer1::IGpuAllocator::allocate() uses uint64_t type for size and alignment
+// parameters, so here we use the same type to make it compatible.
void* Align(uint64_t alignment, uint64_t size, void*& ptr, uint64_t& space) {
QCHECK_GT(alignment, 0ul) << "alignment must be greater than 0.";
QCHECK_EQ(0, alignment & (alignment - 1)) << "Alignment must be power of 2.";