You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
[CUDA] illegal memory write on PopulationCount #104077
Have you reproduced the bug with TensorFlow Nightly?
No
Source
source
TensorFlow version
tf 2.20
Custom code
Yes
OS platform and distribution
Ubuntu 22.04
Mobile device
No response
Python version
3.10
Bazel version
No response
GCC/compiler version
No response
CUDA/cuDNN version
CUDA 12.5.1, cuDNN 9.2.1
GPU model and memory
No response
Current behavior?
Compute-Sanitizer reports an out of bounds Write on PopulationCountKernel
Standalone code to reproduce the issue
# PopulationCountOp
import tensorflow as tf
x = tf.constant(1, shape=[2147483647], dtype=tf.int8)
tf.raw_ops.PopulationCount(x=x)
Relevant log output
========= Invalid __global__ write of size 1 bytes
========= at void tensorflow::functor::PopulationCountKernel<signed char>(int, const T1 *, unsigned char *)+0x140
========= by thread (416,0,0) in block (31,0,0)
========= Address 0x7ef7470403a0 is out of bounds
========= and is 929 bytes after the nearest allocation at 0x7ef1d4000000 of size 23404478464 bytes
Hi @kokol16 ,
Apologies for the delay, I tried reproducing your code with TensorFlow 2.20.0 on GPU, and I am also seeing a failure when using the very large shape value 2147483647. On my setup, it results in a CUDA illegal memory access error:
InternalError: CUDA error: Could not synchronize CUDA stream: CUDA_ERROR_ILLEGAL_ADDRESS: an illegal memory access was encountered
When I reduce the shape to a smaller value, the PopulationCount op works normally. So the behavior matches what you observed the extremely large tensor size is causing the kernel to access memory out of bounds.
I am attaching a Colab gist for reference.
Hope this helps, and thank you again for reporting this.
Activity
Venkat6871 commentedon Nov 24, 2025
Hi @kokol16 ,
Apologies for the delay, I tried reproducing your code with TensorFlow 2.20.0 on GPU, and I am also seeing a failure when using the very large shape value
2147483647.On my setup, it results in a CUDA illegal memory access error:When I reduce the shape to a smaller value, the
PopulationCountop works normally. So the behavior matches what you observed the extremely large tensor size is causing the kernel to access memory out of bounds.I am attaching a Colab gist for reference.
Hope this helps, and thank you again for reporting this.
github-actions commentedon Dec 2, 2025
This issue is stale because it has been open for 7 days with no activity. It will be closed if no further activity occurs. Thank you.
github-actions commentedon Dec 9, 2025
This issue was closed because it has been inactive for 7 days since being marked as stale. Please reopen if you'd like to work on this further.
google-ml-butler commentedon Dec 9, 2025
Are you satisfied with the resolution of your issue?
Yes
No