# Cuda kernel function after codegen compile failed

**URL:** <https://discuss.tvm.apache.org/t/cuda-kernel-function-after-codegen-compile-failed/7582>\
**Category:** Troubleshooting\
**Created:** [August 11, 2020, 12:51pm UTC](https://discuss.tvm.apache.org/t/cuda-kernel-function-after-codegen-compile-failed/7582 "2020-08-11T12:51:48Z")\
**Posts on this page:** 2\
**Page:** 1

<div class="post-metadata">

**Author:** ![sleepwalker2017](https://discuss.tvm.apache.org/letter_avatar_proxy/v4/letter/s/5e9695/32.png) [@sleepwalker2017](https://discuss.tvm.apache.org/u/sleepwalker2017)\
**Post date:** [August 11, 2020, 12:51pm UTC](https://discuss.tvm.apache.org/t/cuda-kernel-function-after-codegen-compile-failed/7582/1 "2020-08-11T12:51:48Z")

</div>

> /tmp/tmps94u7qu7/my\_kernel.cu(6908): Error: Formal parameter space overflowed (4544 bytes required, max 4096 bytes allowed) in function fused\_reshape\_gather\_nd\_reshape\_floor\_mod\_less\_zeros\_like\_where\_reshape\_gather\_n\_17367594856123799618\_\_kernel0

this fused function has 576 params and seems each param requires 8 bytes, and the total bytes required exceeds the limited 4096.

NVIDIA suggests that we should pass a struct to avoid passing too many params. I’m not familiar with the codegen process, could this be fixed easily?

---

<div class="post-metadata">

**Author:** ![sleepwalker2017](https://discuss.tvm.apache.org/letter_avatar_proxy/v4/letter/s/5e9695/32.png) [@sleepwalker2017](https://discuss.tvm.apache.org/u/sleepwalker2017)\
**Post date:** [August 12, 2020, 2:59am UTC](https://discuss.tvm.apache.org/t/cuda-kernel-function-after-codegen-compile-failed/7582/2 "2020-08-12T02:59:01Z")

</div>

I can give an example that can reproduce this error .

```
import tensorflow as tf
def create_split():
graph = tf.Graph()
with graph.as_default():
    branches = []
    a = tf.placeholder(shape=(1,600), dtype=tf.int64)
    a = tf.split(a, 600, axis=1)
    for i in range(600):
        x = tf.less(a[i], i)
        branches.append(x)
    y = tf.concat(branches, axis=0, name='y')
return graph.as_graph_def()

def load_pb(filename):
with tf.gfile.FastGFile(filename, 'rb') as f:
    graph_def = tf.GraphDef()
    graph_def.ParseFromString(f.read())
return graph_def

def save_pb(graph_def, filename):
with tf.gfile.FastGFile(filename, 'wb') as f:
    f.write(graph_def.SerializeToString())

#graph_def = create_branches()
graph_def = create_split()
save_pb(graph_def, 'example.pb')
```
