# "Engine buffer is full"

**URL:** <https://forums.developer.nvidia.com/t/engine-buffer-is-full/64401>\
**Category:** TensorRT\
**Created:** [August 23, 2018, 9:46am UTC](https://forums.developer.nvidia.com/t/engine-buffer-is-full/64401 "2018-08-23T09:46:45Z")\
**Posts on this page:** 16\
**Page:** 1

<div class="post-metadata">

**Author:** ![Klamue](https://developer.download.nvidia.com/images/forums/profile-default-devtalk-84.png) [@Klamue](https://forums.developer.nvidia.com/u/Klamue)\
**Post date:** [August 23, 2018, 9:46am UTC](https://forums.developer.nvidia.com/t/engine-buffer-is-full/64401/1 "2018-08-23T09:46:45Z")

</div>

Hello,

I am using the TensorRT-Tensorflow Integration (Sub-Graph Optimization) with TensorRT 3.0.4 and Tensorflow 1.10 on the Tensorflow Object Detection API, which achieves correct results (bounding boxes). However, I have some questions about the TensorRT log output and behavior:

1. 

```auto
2018-08-23 11:35:12.094128: W tensorflow/contrib/tensorrt/convert/trt_optimization_pass.cc:185] TensorRTOptimizer is probably called on funcdef! This optimizer must *NOT* be called on function objects.

```

This happens when executing create\_inference\_graph(). What does this mean and is it relevant?

1. 

```auto
2018-08-23 11:35:33.590131: W tensorflow/contrib/tensorrt/kernels/trt_engine_op.cc:260] Engine buffer is full. buffer limit=1, current entries=1, requested batch=300

```

This happens each time when running the session. Is this an out-of-memory error or what causes it? The following error immediately follows:

```auto
2018-08-23 11:35:33.590161: W tensorflow/contrib/tensorrt/kernels/trt_engine_op.cc:277] Failed to get engine batch, running native segment for my_trt_op_0

```

Does it mean that the TensorRT execution failed and now Tensorflow is executing instead?

1. (might be related to 2) I also noticed that TensorRT does not seem to allocate any GPU-memory when running the session, but does so when creating the inference graph. Is that expected behavior?

Any help is greatly appreciated, thanks in advance!

---

<div class="post-metadata">

**Author:** ![NVES](https://sea2.discourse-cdn.com/nvidia/user_avatar/forums.developer.nvidia.com/nves/32/14043_2.png) [@NVES](https://forums.developer.nvidia.com/u/NVES)\
**Post date:** [August 27, 2018, 6:32pm UTC](https://forums.developer.nvidia.com/t/engine-buffer-is-full/64401/2 "2018-08-27T18:32:13Z")

</div>

Hello, can you provide details on the platforms you are using?

Linux distro and version  
GPU type  
nvidia driver version  
CUDA version  
CUDNN version  
Python version [if using python]  
Tensorflow version  
TensorRT version

---

<div class="post-metadata">

**Author:** ![Klamue](https://developer.download.nvidia.com/images/forums/profile-default-devtalk-84.png) [@Klamue](https://forums.developer.nvidia.com/u/Klamue)\
**Post date:** [August 28, 2018, 8:02am UTC](https://forums.developer.nvidia.com/t/engine-buffer-is-full/64401/3 "2018-08-28T08:02:42Z")

</div>

Linux distro and version CentOS 7.5  
GPU type Quadro M2200  
nvidia driver version 390.77  
CUDA version 9.0  
CUDNN version 7.0.5  
Python version [if using python] 2.7  
Tensorflow version 1.10 (master, built from source, 22 August 2018)  
TensorRT version 3.0.4

---

<div class="post-metadata">

**Author:** ![NVES](https://sea2.discourse-cdn.com/nvidia/user_avatar/forums.developer.nvidia.com/nves/32/14043_2.png) [@NVES](https://forums.developer.nvidia.com/u/NVES)\
**Post date:** [August 28, 2018, 4:11pm UTC](https://forums.developer.nvidia.com/t/engine-buffer-is-full/64401/4 "2018-08-28T16:11:31Z")

</div>

Thank you. Will keep you updated on what we find.

---

<div class="post-metadata">

**Author:** ![NVES](https://sea2.discourse-cdn.com/nvidia/user_avatar/forums.developer.nvidia.com/nves/32/14043_2.png) [@NVES](https://forums.developer.nvidia.com/u/NVES)\
**Post date:** [August 29, 2018, 4:35pm UTC](https://forums.developer.nvidia.com/t/engine-buffer-is-full/64401/5 "2018-08-29T16:35:22Z")

</div>

Yes, looks like tried using TRT but didn’t succeed. Can you post the full log?

---

<div class="post-metadata">

**Author:** ![Klamue](https://developer.download.nvidia.com/images/forums/profile-default-devtalk-84.png) [@Klamue](https://forums.developer.nvidia.com/u/Klamue)\
**Post date:** [August 30, 2018, 12:49pm UTC](https://forums.developer.nvidia.com/t/engine-buffer-is-full/64401/6 "2018-08-30T12:49:54Z")

</div>

Sure, there you go:

```auto
2018-08-30 14:47:31.126811: I tensorflow/core/grappler/devices.cc:51] Number of eligible GPUs (core count >= 8): 1
2018-08-30 14:47:31.128856: I tensorflow/core/grappler/clusters/single_machine.cc:359] Starting new session
2018-08-30 14:47:31.129278: I tensorflow/core/common_runtime/gpu/gpu_device.cc:1485] Adding visible gpu devices: 0
2018-08-30 14:47:31.129300: I tensorflow/core/common_runtime/gpu/gpu_device.cc:966] Device interconnect StreamExecutor with strength 1 edge matrix:
2018-08-30 14:47:31.129310: I tensorflow/core/common_runtime/gpu/gpu_device.cc:972] 0 
2018-08-30 14:47:31.129318: I tensorflow/core/common_runtime/gpu/gpu_device.cc:985] 0: N 
2018-08-30 14:47:31.129455: I tensorflow/core/common_runtime/gpu/gpu_device.cc:1098] Created TensorFlow device (/job:localhost/replica:0/task:0/device:GPU:0 with 2828 MB memory) -> physical GPU (device: 0, name: Quadro M2200, pci bus id: 0000:01:00.0, compute capability: 5.2)
2018-08-30 14:47:34.184799: I tensorflow/contrib/tensorrt/convert/convert_nodes.cc:2951] Segment @scope '', converted to graph
2018-08-30 14:47:34.184834: E tensorflow/contrib/tensorrt/convert/convert_graph.cc:418] Can't find a device placement for the op!
2018-08-30 14:47:39.693597: I tensorflow/contrib/tensorrt/convert/convert_graph.cc:952] Engine my_trt_op_0 creation for segment 0, composed of 85 nodes succeeded.
2018-08-30 14:47:42.076072: W tensorflow/contrib/tensorrt/convert/trt_optimization_pass.cc:185] TensorRTOptimizer is probably called on funcdef! This optimizer must *NOT* be called on function objects.
2018-08-30 14:47:42.224466: W tensorflow/contrib/tensorrt/convert/trt_optimization_pass.cc:185] TensorRTOptimizer is probably called on funcdef! This optimizer must *NOT* be called on function objects.
2018-08-30 14:47:42.257691: I tensorflow/core/grappler/optimizers/meta_optimizer.cc:403] Optimization results for grappler item: tf_graph
2018-08-30 14:47:42.257725: I tensorflow/core/grappler/optimizers/meta_optimizer.cc:405] constant folding: Graph size after: 11435 nodes (-495), 15635 edges (-524), time = 1057.04102ms.
2018-08-30 14:47:42.257735: I tensorflow/core/grappler/optimizers/meta_optimizer.cc:405] layout: Graph size after: 11450 nodes (15), 15653 edges (18), time = 308.294ms.
2018-08-30 14:47:42.257743: I tensorflow/core/grappler/optimizers/meta_optimizer.cc:405] TensorRTOptimizer: Graph size after: 11366 nodes (-84), 15566 edges (-87), time = 6930.48096ms.
2018-08-30 14:47:42.257751: I tensorflow/core/grappler/optimizers/meta_optimizer.cc:405] constant folding: Graph size after: 11363 nodes (-3), 15564 edges (-2), time = 613.757ms.
2018-08-30 14:47:42.257764: I tensorflow/core/grappler/optimizers/meta_optimizer.cc:405] TensorRTOptimizer: Graph size after: 11363 nodes (0), 15564 edges (0), time = 1430.89197ms.
2018-08-30 14:47:42.257775: I tensorflow/core/grappler/optimizers/meta_optimizer.cc:403] Optimization results for grappler item: my_trt_op_0_native_segment
2018-08-30 14:47:42.257787: I tensorflow/core/grappler/optimizers/meta_optimizer.cc:405] constant folding: Graph size after: 86 nodes (0), 88 edges (0), time = 121.162ms.
2018-08-30 14:47:42.257795: I tensorflow/core/grappler/optimizers/meta_optimizer.cc:405] layout: Invalid argument: The graph is already optimized by layout optimizer.
2018-08-30 14:47:42.257806: I tensorflow/core/grappler/optimizers/meta_optimizer.cc:405] TensorRTOptimizer: Graph size after: 86 nodes (0), 88 edges (0), time = 10.492ms.
2018-08-30 14:47:42.257816: I tensorflow/core/grappler/optimizers/meta_optimizer.cc:405] constant folding: Graph size after: 86 nodes (0), 88 edges (0), time = 137.719ms.
2018-08-30 14:47:42.257825: I tensorflow/core/grappler/optimizers/meta_optimizer.cc:405] TensorRTOptimizer: Graph size after: 86 nodes (0), 88 edges (0), time = 12.276ms.
2018-08-30 14:48:37.387138: I tensorflow/core/common_runtime/gpu/gpu_device.cc:1485] Adding visible gpu devices: 0
2018-08-30 14:48:37.387308: I tensorflow/core/common_runtime/gpu/gpu_device.cc:966] Device interconnect StreamExecutor with strength 1 edge matrix:
2018-08-30 14:48:37.387381: I tensorflow/core/common_runtime/gpu/gpu_device.cc:972] 0 
2018-08-30 14:48:37.387470: I tensorflow/core/common_runtime/gpu/gpu_device.cc:985] 0: N 
2018-08-30 14:48:37.387961: I tensorflow/core/common_runtime/gpu/gpu_device.cc:1098] Created TensorFlow device (/job:localhost/replica:0/task:0/device:GPU:0 with 2828 MB memory) -> physical GPU (device: 0, name: Quadro M2200, pci bus id: 0000:01:00.0, compute capability: 5.2)
2018-08-30 14:48:55.002149: W tensorflow/contrib/tensorrt/kernels/trt_engine_op.cc:260] Engine buffer is full. buffer limit=1, current entries=1, requested batch=300
2018-08-30 14:48:55.002175: W tensorflow/contrib/tensorrt/kernels/trt_engine_op.cc:277] Failed to get engine batch, running native segment for my_trt_op_0
2018-08-30 14:48:56.213187: W tensorflow/core/common_runtime/bfc_allocator.cc:215] Allocator (GPU_0_bfc) ran out of memory trying to allocate 2.31GiB. The caller indicates that this is not a failure, but may mean that there could be performance gains if more memory were available.
2018-08-30 14:48:56.332753: W tensorflow/core/common_runtime/bfc_allocator.cc:215] Allocator (GPU_0_bfc) ran out of memory trying to allocate 2.58GiB. The caller indicates that this is not a failure, but may mean that there could be performance gains if more memory were available.
2018-08-30 14:48:56.609630: W tensorflow/core/common_runtime/bfc_allocator.cc:215] Allocator (GPU_0_bfc) ran out of memory trying to allocate 3.57GiB. The caller indicates that this is not a failure, but may mean that there could be performance gains if more memory were available.
2018-08-30 14:48:57.041135: W tensorflow/contrib/tensorrt/kernels/trt_engine_op.cc:260] Engine buffer is full. buffer limit=1, current entries=1, requested batch=300
2018-08-30 14:48:57.041211: W tensorflow/contrib/tensorrt/kernels/trt_engine_op.cc:277] Failed to get engine batch, running native segment for my_trt_op_0
2018-08-30 14:48:57.453425: W tensorflow/contrib/tensorrt/kernels/trt_engine_op.cc:260] Engine buffer is full. buffer limit=1, current entries=1, requested batch=300
2018-08-30 14:48:57.453487: W tensorflow/contrib/tensorrt/kernels/trt_engine_op.cc:277] Failed to get engine batch, running native segment for my_trt_op_0
2018-08-30 14:48:57.858409: W tensorflow/contrib/tensorrt/kernels/trt_engine_op.cc:260] Engine buffer is full. buffer limit=1, current entries=1, requested batch=300
2018-08-30 14:48:57.858510: W tensorflow/contrib/tensorrt/kernels/trt_engine_op.cc:277] Failed to get engine batch, running native segment for my_trt_op_0
2018-08-30 14:48:58.282362: W tensorflow/contrib/tensorrt/kernels/trt_engine_op.cc:260] Engine buffer is full. buffer limit=1, current entries=1, requested batch=300
2018-08-30 14:48:58.282445: W tensorflow/contrib/tensorrt/kernels/trt_engine_op.cc:277] Failed to get engine batch, running native segment for my_trt_op_0
2018-08-30 14:48:58.696690: W tensorflow/contrib/tensorrt/kernels/trt_engine_op.cc:260] Engine buffer is full. buffer limit=1, current entries=1, requested batch=300
2018-08-30 14:48:58.696783: W tensorflow/contrib/tensorrt/kernels/trt_engine_op.cc:277] Failed to get engine batch, running native segment for my_trt_op_0
2018-08-30 14:48:59.120853: W tensorflow/contrib/tensorrt/kernels/trt_engine_op.cc:260] Engine buffer is full. buffer limit=1, current entries=1, requested batch=300
2018-08-30 14:48:59.120941: W tensorflow/contrib/tensorrt/kernels/trt_engine_op.cc:277] Failed to get engine batch, running native segment for my_trt_op_0
2018-08-30 14:48:59.527978: W tensorflow/contrib/tensorrt/kernels/trt_engine_op.cc:260] Engine buffer is full. buffer limit=1, current entries=1, requested batch=300
2018-08-30 14:48:59.528044: W tensorflow/contrib/tensorrt/kernels/trt_engine_op.cc:277] Failed to get engine batch, running native segment for my_trt_op_0
2018-08-30 14:48:59.959494: W tensorflow/contrib/tensorrt/kernels/trt_engine_op.cc:260] Engine buffer is full. buffer limit=1, current entries=1, requested batch=300
2018-08-30 14:48:59.959591: W tensorflow/contrib/tensorrt/kernels/trt_engine_op.cc:277] Failed to get engine batch, running native segment for my_trt_op_0
2018-08-30 14:49:00.388077: W tensorflow/contrib/tensorrt/kernels/trt_engine_op.cc:260] Engine buffer is full. buffer limit=1, current entries=1, requested batch=300
2018-08-30 14:49:00.388151: W tensorflow/contrib/tensorrt/kernels/trt_engine_op.cc:277] Failed to get engine batch, running native segment for my_trt_op_0
2018-08-30 14:49:00.820113: W tensorflow/contrib/tensorrt/kernels/trt_engine_op.cc:260] Engine buffer is full. buffer limit=1, current entries=1, requested batch=300
2018-08-30 14:49:00.820202: W tensorflow/contrib/tensorrt/kernels/trt_engine_op.cc:277] Failed to get engine batch, running native segment for my_trt_op_0
2018-08-30 14:49:01.253252: W tensorflow/contrib/tensorrt/kernels/trt_engine_op.cc:260] Engine buffer is full. buffer limit=1, current entries=1, requested batch=300
2018-08-30 14:49:01.253369: W tensorflow/contrib/tensorrt/kernels/trt_engine_op.cc:277] Failed to get engine batch, running native segment for my_trt_op_0

```

---

<div class="post-metadata">

**Author:** ![NVES](https://sea2.discourse-cdn.com/nvidia/user_avatar/forums.developer.nvidia.com/nves/32/14043_2.png) [@NVES](https://forums.developer.nvidia.com/u/NVES)\
**Post date:** [September 13, 2018, 10:14pm UTC](https://forums.developer.nvidia.com/t/engine-buffer-is-full/64401/7 "2018-09-13T22:14:39Z")

</div>

Hello,

can you please share with us the script/code/dataset sample to reproduce this? It’d help us debug this. If you’d like, you can direct message me.

---

<div class="post-metadata">

**Author:** ![NVES](https://sea2.discourse-cdn.com/nvidia/user_avatar/forums.developer.nvidia.com/nves/32/14043_2.png) [@NVES](https://forums.developer.nvidia.com/u/NVES)\
**Post date:** [September 22, 2018, 2:12am UTC](https://forums.developer.nvidia.com/t/engine-buffer-is-full/64401/8 "2018-09-22T02:12:20Z")

</div>

Hello,

Your conversion batch size is 1, i.e. max\_batch\_size=1

on the other hand execution batch size is 300, i.e. requested batch=300.

Please set max\_batch\_size=300 in conversion and try again.

---

<div class="post-metadata">

**Author:** ![atyshka](https://developer.download.nvidia.com/images/forums/profile-default-devtalk-84.png) [@atyshka](https://forums.developer.nvidia.com/u/atyshka)\
**Post date:** [December 6, 2018, 5:54pm UTC](https://forums.developer.nvidia.com/t/engine-buffer-is-full/64401/9 "2018-12-06T17:54:49Z")

</div>

@NVES I am having the same problem on Jetson Xavier. I converted my frozen weights to trt using this code:

```auto
trt_graph = trt.create_inference_graph(
        input_graph_def=frozen_graph,
        outputs=output_names,
        max_batch_size=1,
        max_workspace_size_bytes=4000000000,
        precision_mode='FP16',
        minimum_segment_size=50
    )

    tf_config = tf.ConfigProto()
    tf_config.gpu_options.allow_growth = True

    tf_sess = tf.Session(config=tf_config)

    tf.import_graph_def(trt_graph, name='')

```

Then when I session.run(), I get this:

```auto
2018-12-06 12:42:18.240586: W tensorflow/contrib/tensorrt/kernels/trt_engine_op.cc:260] Engine buffer is full. buffer limit=1, current entries=1, requested batch=100
2018-12-06 12:42:18.240680: W tensorflow/contrib/tensorrt/kernels/trt_engine_op.cc:277] Failed to get engine batch, running native segment for my_trt_op_1

```

---

<div class="post-metadata">

**Author:** ![Klamue](https://developer.download.nvidia.com/images/forums/profile-default-devtalk-84.png) [@Klamue](https://forums.developer.nvidia.com/u/Klamue)\
**Post date:** [December 7, 2018, 7:00am UTC](https://forums.developer.nvidia.com/t/engine-buffer-is-full/64401/10 "2018-12-07T07:00:15Z")

</div>

I believe you are executing Faster/Mask R-CNN. The problem with it is that the Graph abuses the batch size in the last stage of the algorithm to compute outputs for the 100 boxes from the RPN. Change the parameter which is currently set to 100 in your protobuf config and change it to 99 to see if I am right. I don’t know a simple way around this. Object Detection algorithms, especially Faster RCNN seem to be hard to convert to TRT.

---

<div class="post-metadata">

**Author:** ![atyshka](https://developer.download.nvidia.com/images/forums/profile-default-devtalk-84.png) [@atyshka](https://forums.developer.nvidia.com/u/atyshka)\
**Post date:** [December 7, 2018, 1:23pm UTC](https://forums.developer.nvidia.com/t/engine-buffer-is-full/64401/11 "2018-12-07T13:23:23Z")

</div>

I sure am using Faster rcnn! So I should change that value in the .config to 99 and leave max\_batch\_size at 1? I’ll let you know how it goes

---

<div class="post-metadata">

**Author:** ![atyshka](https://developer.download.nvidia.com/images/forums/profile-default-devtalk-84.png) [@atyshka](https://forums.developer.nvidia.com/u/atyshka)\
**Post date:** [December 7, 2018, 7:45pm UTC](https://forums.developer.nvidia.com/t/engine-buffer-is-full/64401/12 "2018-12-07T19:45:01Z")

</div>

@Klamue I changed the following line in the config:

```
    first_stage_max_proposals: 99 #From 100

```

And I get the same error as before, just with requested\_batch=99:

```auto
2018-12-07 14:35:31.403165: W tensorflow/contrib/tensorrt/kernels/trt_engine_op.cc:260] Engine buffer is full. buffer limit=1, current entries=1, requested batch=99
2018-12-07 14:35:31.403291: W tensorflow/contrib/tensorrt/kernels/trt_engine_op.cc:277] Failed to get engine batch, running native segment for my_trt_op_1

```

Any ideas?

There’s also two other things in the config set to 100 under second\_stage\_post\_processing: max\_detections\_per\_class and max\_total\_detections. Should I set those to 99 too?

One thing I noticed is TensorRT seems to be creating two segments: my\_trt\_op\_0\_native\_segment and my\_trt\_op\_1\_native\_segment. Is it possible that these correlate to the RPN and classification segments respectively? Because if so, then the problem is with the classification and not the RPN since my\_trt\_op\_1\_native\_segment is the one that’s failing.

If you think it would help, I can post the whole config file

---

<div class="post-metadata">

**Author:** ![yichunchen](https://developer.download.nvidia.com/images/forums/profile-default-devtalk-84.png) [@yichunchen](https://forums.developer.nvidia.com/u/yichunchen)\
**Post date:** [March 14, 2019, 2:23am UTC](https://forums.developer.nvidia.com/t/engine-buffer-is-full/64401/13 "2019-03-14T02:23:55Z")

</div>

Hi @atyshka, I am also meeting the same problem. Any update follows up? Have you solved it? Thanks!

---

<div class="post-metadata">

**Author:** ![atyshka](https://developer.download.nvidia.com/images/forums/profile-default-devtalk-84.png) [@atyshka](https://forums.developer.nvidia.com/u/atyshka)\
**Post date:** [March 14, 2019, 2:52am UTC](https://forums.developer.nvidia.com/t/engine-buffer-is-full/64401/14 "2019-03-14T02:52:18Z")

</div>

@yichunchen, unfortunately I have not. This seems to be a known bug with tensorflow and faster rcnn. Let’s hope it’s resolved in tf 2.0

---

<div class="post-metadata">

**Author:** ![alexkjxp7](https://developer.download.nvidia.com/images/forums/profile-default-devtalk-84.png) [@alexkjxp7](https://forums.developer.nvidia.com/u/alexkjxp7)\
**Post date:** [April 25, 2019, 5:29pm UTC](https://forums.developer.nvidia.com/t/engine-buffer-is-full/64401/15 "2019-04-25T17:29:38Z")

</div>

I fixed this problem by setting the batch size to num\_images x 300, for instance if you’re going to process 8 images at a time, set the batch size to 2400.

```auto
num_images = 8
trt_graph = trt.create_inference_graph(
    input_graph_def=tf.get_default_graph().as_graph_def(),
    outputs=output_node,
    max_batch_size=num_images * 300,
    max_workspace_size_bytes=1 << 25,
    precision_mode='FP16', # TRT Engine precision "FP32","FP16" or "INT8"
    minimum_segment_size=50 # minimum number of nodes in an engine
    )

```

On V100 the performance gain for FP16 was about 20%, I’m going to try INT8 next.

---

<div class="post-metadata">

**Author:** ![TomNVIDIA](https://sea2.discourse-cdn.com/nvidia/user_avatar/forums.developer.nvidia.com/tomnvidia/32/14181_2.png) [@TomNVIDIA](https://forums.developer.nvidia.com/u/TomNVIDIA)\
**Post date:** [October 12, 2021, 7:48pm UTC](https://forums.developer.nvidia.com/t/engine-buffer-is-full/64401/16 "2021-10-12T19:48:01Z")

</div>

Closed on October 12, 2021, 7:48pm UTC


