# Elementwise\_kernel low efficiency when input size is small?

**URL:** <https://discuss.pytorch.org/t/elementwise-kernel-low-efficiency-when-input-size-is-small/188140>\
**Category:** torch.compile\
**Created:** [September 12, 2023, 6:31am UTC](https://discuss.pytorch.org/t/elementwise-kernel-low-efficiency-when-input-size-is-small/188140 "2023-09-12T06:31:13Z")\
**Posts on this page:** 1\
**Page:** 1

<div class="post-metadata">

**Author:** ![tianyma](https://discuss.pytorch.org/user_avatar/discuss.pytorch.org/tianyma/32/61882_2.png) [@tianyma](https://discuss.pytorch.org/u/tianyma)\
**Post date:** [September 12, 2023, 6:31am UTC](https://discuss.pytorch.org/t/elementwise-kernel-low-efficiency-when-input-size-is-small/188140/1 "2023-09-12T06:31:13Z")

</div>

Hi, I am profiling my torch code using NVIDIA nsight-cli tool, and the experiment is on GPU V100. I found that **elementwise\_kernel** is the most time-consuming. I found the actual reason is that the **elementwise\_kernel** uses few cuda threads, for example, a two vector’s multiplication calls the **elementwise\_kernel** , and the size of each vector is 500 in FP32, but the profiling result is that **elementwise\_kernel** actually uses 128 threads, rather than 500 threads.

So my question is why does the **elementwise\_kernel** use such few CUDA threads? Is it because the input size is too small?

 ![image](https://discuss.pytorch.org/uploads/default/original/3X/9/8/9805476ac8828cd8a134ba0e100d64574598afe2.png)
