Skip to content

A check fail can be triggered in LSTMBlockCell #58270

Closed

Description

@shijy16
Click to expand!

Issue Type

Bug

Source

binary

Tensorflow Version

tf 2.9 and 2.12.0-dev20221018

Custom Code

No

OS Platform and Distribution

Linux Ubuntu 20.04

Mobile device

No response

Python version

3.8

Bazel version

No response

GCC/Compiler version

No response

CUDA/cuDNN version

CUDA 11.5

GPU model and memory

No response

Current Behaviour?

A crash due to check fail can be trigerred.

Standalone code to reproduce the issue

import os
os.environ['TF_ENABLE_ONEDNN_OPTS'] = '0'
import tensorflow as tf
import numpy as np
print(tf.__version__)
for _ in range(20):
    try:
        forget_bias = 112.66590343649887
        cell_clip = 67.12389445926587
        use_peephole = False
        x = tf.saturate_cast(tf.random.uniform([2, 16], minval=0, maxval=64, dtype=tf.int64), dtype=tf.half)
        cs_prev = tf.saturate_cast(tf.random.uniform([2, 0], minval=0, maxval=64, dtype=tf.int64), dtype=tf.half)
        h_prev = tf.saturate_cast(tf.random.uniform([2, 0], minval=0, maxval=64, dtype=tf.int64), dtype=tf.half)
        w = tf.saturate_cast(tf.random.uniform([16, 0], minval=0, maxval=64, dtype=tf.int64), dtype=tf.half)
        wci = tf.saturate_cast(tf.random.uniform([5], minval=0, maxval=64, dtype=tf.int64), dtype=tf.half)
        wcf = tf.saturate_cast(tf.random.uniform([16], minval=0, maxval=64, dtype=tf.int64), dtype=tf.half)
        wco = tf.saturate_cast(tf.random.uniform([13], minval=0, maxval=64, dtype=tf.int64), dtype=tf.half)
        b = tf.saturate_cast(tf.random.uniform([0], minval=0, maxval=64, dtype=tf.int64), dtype=tf.half)
        res = tf.raw_ops.LSTMBlockCell(
            forget_bias=forget_bias,
            cell_clip=cell_clip,
            use_peephole=use_peephole,
            x=x,
            cs_prev=cs_prev,
            h_prev=h_prev,
            w=w,
            wci=wci,
            wcf=wcf,
            wco=wco,
            b=b,
        )
    except:
        pass

Relevant log output

F tensorflow/core/kernels/rnn/lstm_ops_gpu.cu.cc:277] Non-OK-status: GpuLaunchKernel( lstm_gates<T, false, gate_layout>, grid_dim_2d, block_dim_2d, 0, cu_stream, gates.data(), b.data(), cs_prev.data(), wci.data(), wcf.data(), wco.data(), o.data(), h.data(), ci.data(), cs.data(), co.data(), i.data(), f.data(), forget_bias, cell_clip, batch_size, cell_size) status: INTERNAL: invalid configuration argument
Aborted (core dumped)

Activity

  1. bhack commented on Oct 25, 2022

    @bhack
    Contributor

    Same as the other issues. Can you try the same with the high level API?

  2. self-assigned this
    on Oct 26, 2022
  3. tiruk007 commented on Oct 26, 2022

    @tiruk007
    Contributor

    @sushreebarsa
    I was able to reproduce the issue on Colab using TF 2.10 GPU and it works fine inTF 2.10 CPU. Could you please find attached gists GPU and CPU for reference.

    Thank you!

  4. sachinprasadhs commented on Dec 9, 2022

    @sachinprasadhs
    Contributor

    tf.raw_ops are basically designed to be consumed by downstream library users, not end users.
    Usually, these APIs are less strict in terms of validation etc which is fine since only library writers are supposed to use these symbols.
    If available, please prefer high level API for general use case scenarios.
    Refer this RFC for more details. Thanks!

  5. added
    stat:awaiting response
    on Dec 9, 2022
  6. mihaimaruseac commented on Dec 9, 2022

    @mihaimaruseac
    Contributor

    While these are internal APIs, the check failure could lead to denial of service. In the past this used to be considered a vulnerability, but since the impact is bounded and preventable, now the policy is for these to be files as issues and resolved whenever someone from community wants to pick them up (they're very good first issues). Please don't auto-close these!

  7. removed
    stat:awaiting response
    on Dec 9, 2022
  8. added
    good first issue
    on Dec 9, 2022
  9. 21 remaining items

  10. SahilJain8 commented on Mar 5, 2023

    @SahilJain8

    Hello good greetings my name is Sahil and would love to contribute to Tensorflow could anyone help me with it 😊😊

  11. CrazyShenanigan commented on Mar 12, 2023

    @CrazyShenanigan

    The issue can be resolved by disabling the use of oneDNN optimizations in TensorFlow by setting the environment variable "TF_ENABLE_ONEDNN_OPTS" to 0 before importing TensorFlow. (see below code)
    os.environ['TF_ENABLE_ONEDNN_OPTS'] = '0'

    Explanation:
    The provided code generates random values for inputs to the LSTMBlockCell operation and runs it in a loop for 20 iterations. The LSTMBlockCell operation implements the long short-term memory (LSTM) algorithm, which is a type of recurrent neural network commonly used for sequence processing tasks. The inputs to the LSTMBlockCell operation include the current input values, the previous cell state and output values, and the weights and biases of the LSTM cell.

  12. CrazyShenanigan commented on Mar 12, 2023

    @CrazyShenanigan

    The issue can be resolved by disabling the use of oneDNN optimizations in TensorFlow by setting the environment variable "TF_ENABLE_ONEDNN_OPTS" to 0 before importing TensorFlow. (see below code) os.environ['TF_ENABLE_ONEDNN_OPTS'] = '0'

    Explanation: The provided code generates random values for inputs to the LSTMBlockCell operation and runs it in a loop for 20 iterations. The LSTMBlockCell operation implements the long short-term memory (LSTM) algorithm, which is a type of recurrent neural network commonly used for sequence processing tasks. The inputs to the LSTMBlockCell operation include the current input values, the previous cell state and output values, and the weights and biases of the LSTM cell.

    assign this issue to me

  13. CrazyShenanigan commented on Mar 12, 2023

    @CrazyShenanigan

    The issue can be resolved by disabling the use of oneDNN optimizations in TensorFlow by setting the environment variable "TF_ENABLE_ONEDNN_OPTS" to 0 before importing TensorFlow. (see below code) os.environ['TF_ENABLE_ONEDNN_OPTS'] = '0'
    Explanation: The provided code generates random values for inputs to the LSTMBlockCell operation and runs it in a loop for 20 iterations. The LSTMBlockCell operation implements the long short-term memory (LSTM) algorithm, which is a type of recurrent neural network commonly used for sequence processing tasks. The inputs to the LSTMBlockCell operation include the current input values, the previous cell state and output values, and the weights and biases of the LSTM cell.

    assign this issue to me

    import os
    os.environ['TF_ENABLE_ONEDNN_OPTS'] = '0'
    import tensorflow as tf
    import numpy as np

    Set random values for inputs

    forget_bias = 112.66590343649887
    cell_clip = 67.12389445926587
    use_peephole = False
    x = tf.saturate_cast(tf.random.uniform([2, 16], minval=0, maxval=64, dtype=tf.int64), dtype=tf.half)
    cs_prev = tf.saturate_cast(tf.random.uniform([2, 0], minval=0, maxval=64, dtype=tf.int64), dtype=tf.half)
    h_prev = tf.saturate_cast(tf.random.uniform([2, 0], minval=0, maxval=64, dtype=tf.int64), dtype=tf.half)
    w = tf.saturate_cast(tf.random.uniform([16, 0], minval=0, maxval=64, dtype=tf.int64), dtype=tf.half)
    wci = tf.saturate_cast(tf.random.uniform([5], minval=0, maxval=64, dtype=tf.int64), dtype=tf.half)
    wcf = tf.saturate_cast(tf.random.uniform([16], minval=0, maxval=64, dtype=tf.int64), dtype=tf.half)
    wco = tf.saturate_cast(tf.random.uniform([13], minval=0, maxval=64, dtype=tf.int64), dtype=tf.half)
    b = tf.saturate_cast(tf.random.uniform([0], minval=0, maxval=64, dtype=tf.int64), dtype=tf.half)

    Run LSTMBlockCell operation in a loop for 20 iterations

    for _ in range(20):
    try:
    res = tf.raw_ops.LSTMBlockCell(
    forget_bias=forget_bias,
    cell_clip=cell_clip,
    use_peephole=use_peephole,
    x=x,
    cs_prev=cs_prev,
    h_prev=h_prev,
    w=w,
    wci=wci,
    wcf=wcf,
    wco=wco,
    b=b,
    )
    except:
    pass

    This will be the corrected code for this issue.

  14. pranjalisr commented on Mar 16, 2023

    @pranjalisr

    @shijy16 is this issue still open? I would like provide solution for the same.

  15. sachinprasadhs commented on Mar 16, 2023

    @sachinprasadhs
    Contributor

    @pranjalsrv123 , Feel free to open a PR for this issue. Thanks!

  16. varunk47 commented on Mar 17, 2023

    @varunk47

    I can contribute if its still not solved

  17. anuth212 commented on Mar 29, 2023

    @anuth212

    I will also work on this issue.

  18. surajraoo commented on Apr 4, 2023

    @surajraoo

    I will also work on this issue

  19. google-ml-butler commented on Apr 4, 2023

    @google-ml-butler

    Are you satisfied with the resolution of your issue?
    Yes
    No

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

Labels

good first issuetype:bug

Type

No type

Projects

No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions