Thanks to visit codestin.com
Credit goes to github.com

Skip to content

[CUDA] illegal memory write on UnsortedSegmentSum #104361

@kokol16

Description

@kokol16

Issue type

Bug

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 SetToValue

Standalone code to reproduce the issue

import tensorflow as tf
with tf.device('/GPU:0'):
    # A scalar float tensor with value -1e-30.
    data = tf.constant(-1e-30, dtype=tf.float32)
    # A scalar int32 tensor with value -2147483648.
    segment_ids = tf.constant(-2147483648, dtype=tf.int32)

# The third tensor is placed on CPU:0.
with tf.device('/CPU:0'):
    # A scalar int32 tensor with value 2147483647.
    num_segments = tf.constant(2147483647, dtype=tf.int32)

try:
    result = tf.raw_ops.UnsortedSegmentSum(
        data=data,
        segment_ids=segment_ids,
        num_segments=num_segments
    )
    # Evaluate and print the result.
    print("Result:", result.numpy())
except Exception as e:
    print("Error during operation:", e)

Relevant log output

========= Invalid __global__ write of size 4 bytes
=========     at void tensorflow::SetToValue<float, float>(int, T1 *, T2)+0xd0
=========     by thread (480,0,0) in block (46,0,0)
=========     Address 0x7f8077056c80 is out of bounds

Metadata

Metadata

Assignees

Labels

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions